2

I just encrypted my Moto X (Gen 1) (KitKat 4.4.4) using the default encryption option from the Settings > Security menu. After the encryption process finished, it asks me, "Type password to decrypt storage". Only there's one problem: it never asked me for a password.

It seems I'm not the only one who experienced this. I've tried my Google password like 3 times, and, like that other poor soul, I haven't been able to find a way to map my pattern-lock to a PIN, which might be what Android used for the encryption.

For the mappings, I have tried a standard phone dial pad:

1 2 3
4 5 6
7 8 9

and a standard keyboard numpad:

7 8 9
4 5 6
1 2 3

and a wild guess based on how a developer might do it:

0 1 2
3 4 5
6 7 8

Presumably, though not necessarily, Android stores that pattern as a string or number somehow. Given a certain unlock pattern, how do I find the string or number that represents that pattern?


To the moderators: I'm fine deleting this question if it's not on-topic. I think the question would have been on-topic if the answer fixed my problem. I'm not sure how you guys see that.

2 Answers 2

2

I downloaded the Android source and found the answer. The wild guess turns out to be right. This is the mapping:

0 1 2
3 4 5
6 7 8

If your pattern is from top-left to top-right (0->1->2) then down to bottom-right (2->5->8), the string version of the password is "01258".

The source for this comes from LockPatternUtils in package com.android.internal.widget:

/**
 * Serialize a pattern.
 * @param pattern The pattern.
 * @return The pattern in string form.
 */
public static String patternToString(List<LockPatternView.Cell> pattern) {
    if (pattern == null) {
        return "";
    }
    final int patternSize = pattern.size();

    byte[] res = new byte[patternSize];
    for (int i = 0; i < patternSize; i++) {
        LockPatternView.Cell cell = pattern.get(i);
        res[i] = (byte) (cell.getRow() * 3 + cell.getColumn());
    }
    return new String(res);
}

where the rows and columns are both {0,1,2}.

However, as I said in my question, I tried this mapping with my pattern, and it doesn't work to unlock my encryption. This turned out to be a dead end, but I hope this answer is helpful to others with a similar problem. (Note again that the other person who had this problem also tried to find the pattern-lock to PIN mapping, but the answer wasn't out there.)

1
  • Good info, thanx +1, if you get the right answer please edit your answer for the rest of us struggling with this issue.
    – HasH_BrowN
    Commented Oct 2, 2014 at 16:31
1

I realize this thread is really old, but I actually used this info to much success! This is the correct grid to translate 3x3 pattern locks into a pin:

1 2 3
4 5 6
7 8 9

This work on my Oneplus 3 running Resurrection Remix 6.0.1. Long story short, I enabled decrypt password on boot, but upon restarting it gave me the password option. This grid worked like a charm!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .