Context: I forgot my unlock pattern, so I used TWRP and ADB to move gatekeeper.password.key and gatekeeper.pattern.key to /sdcard, so now I am able to use my phone again :-)

Problem: I want to set a new pattern, but whenever I go to Settings>Security and press Screen lock, it crashes:

enter image description here

How to solve the problem?

I restarted, cleared all apps cache, wiped the cache partition from TWRP, booted in safe mode, always crash. I am afraid that if I move the files back the situation will get even worse, or at best it will ask me for the pattern that I still can't remember.

Android 7.1.2 LineageOS

  • The "Mega Post" in our locked-out tag-wiki mentions how to correctly reset the pattern. AFAIR this also involved updating the settings database. If you missed that step, the "state" is "out of sync" (settings assumes there must be a file which it then doesn't find) – at least that could be the case here. Have you cross-checked that?
    – Izzy
    Jul 27, 2018 at 6:38
  • 1
    @izzy: I was not aware of that page, thanks! Actually just right now I have managed to fix the situation, I write an answer immediately about it :-) Jul 27, 2018 at 6:49
  • Easy fix would probably have been to also delete the locksettings.db* files from the same place where you removed the .key files (see my second comment on your answer). :)
    – Izzy
    Jul 27, 2018 at 9:01

1 Answer 1

  1. In a web browser (on any device), log into Gmail with the account you used when setting up your phone.
  2. Go to https://myaccount.google.com/intro/find-your-phone
  3. Press "Lock your phone"
  4. Enter "abcd"
  5. Your phone's screen is now locked. Unlock it with "abcd"
  6. You can now change your screen lock.

enter image description here

  • Ah, congrats! Maybe I should include that in my "cover-all" answer (or link here from it). Though this approach only works if you have a Google account associated with the device (and not e.g. run "Google-free"). Would have been interesting if switching to a pin or password lock on device would work as well (maybe with some ADB trick, as with the settings app you didn't get that far before it crashed), so Google-free devices would be covered as well. Ah, here we go.
    – Izzy
    Jul 27, 2018 at 8:43
  • PS: Updated my "general answer" linking to yours, and adding a few more hints. Doing that I discovered why you failed with your first approach: you forgot to also delete the locksettings.db* files. So the Settings app saw them, evaluated them, decided you have a pattern lock set – and then crashed accessing the *.key files. I'd consider that a bug, the developer not having caught the exception or checked whether the files exist and are readable.
    – Izzy
    Jul 27, 2018 at 9:00
  • Are those Gatekeeper files only used in verifying the password? Or are they also used in deriving the key that decrypts the device encryption key?
    – Melab
    Aug 24, 2019 at 3:41

You must log in to answer this question.

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