I'm running Android 11 on a Pixel 5.

I know about the locksettings --set-pattern ... shell command, but that command only seems to work in a 3x3 pattern space. For example, if the pattern is to start at the upper left and in a clockwise direction to touch each corner of a 3x3 lock-pattern square, I can set that pattern lock as follows (because the pattern dots are numbered 1 through 9) ...

locksettings --set-pattern 1397

However, my ROM also offers the option of 4x4, 5x5, and 6x6 pattern spaces (dots numbered 1 through 16 for 4x4, and 1 through 25 for 5x5, and 1 through 36 for 6x6). If I want to do the same clockwise traversal to the corners in a 4x4 pattern space, the numbers would be 1, 4, 16, 13. However, I don't know a way to specify these 4 numeric values to the locksettings --set-pattern ... command.

Is there any way to use locksettings --set-pattern ... in a 4x4, 5x5, or 6x6 pattern space?

If not, is there any way to run some other shell command(s) under Android 11 to set a lock pattern in a 4x4, 5x5, or 6x6 pattern space?

Thank you very much in advance.

  • 1
    not sure I got the question blog.alxu.ca/unlocking-large-pattern-encryption-in-twrp.html
    – alecxs
    Jan 7, 2023 at 17:32
  • 1
    @alecxs that looks like a possible answer, though it seems only for TWRP.
    – Andrew T.
    Jan 8, 2023 at 3:32
  • 1
    On the other hand, looks like AOSP hardcoded the pattern only for 3x3, so for custom implementation, it needs to be checked with the ROM maker whether they also support/modify this part or not.
    – Andrew T.
    Jan 8, 2023 at 3:33
  • Yes, and thank you, @AndrewT. I want this to run via adb for a running ROM, not for TWRP. And my ROM (crDroid) supports 4x4, 5x5, and 6x6 in addition to 3x3, but the "locksettings" utility that comes with my ROM only seems to support 3x3. So, I'll check with the crDroid developers about this.
    – HippoMan
    Jan 8, 2023 at 5:17
  • @alecxs - OK, so does this mean that I can use this method via ADB in a running ROM to set the lock pattern, in place of using "locksettings set-pattern"? If so, I just need to figure out how to somehow build the method as a stand-alone executable which can then be installed on my device.
    – HippoMan
    Jan 8, 2023 at 14:53


You must log in to answer this question.

Browse other questions tagged .