Android-malware-hack
Sometimes life just gets in the way of things we love doing. Case in point, me and hacking my Nexus phones. Even though in my Ausdroid Bio it states that I have my “finger on the pulse of all things ‘moddable'” I have not had the time, nor the inclination to modify my phone in any way for quite a while. Lately though, since the arrival of Nougat to my Nexus 6P I’ve found myself missing a lot of the features that Google thinks we do not need (such as the advanced power button functions — ie. reboot, hot reboot etc). After flashing a custom ROM at 11pm the other night I encountered an issue that I had totally forgotten about.

Personally I blame Google (tongue in cheek people). All this security (DM-verity and the like) has made it increasingly difficult for those of us who do like to hack their phones. There was once a time where you could easily hack you phone and restore it at a moments notice to a previous state — all hacking advice here Ausdroid is preceded by the advice to perform a nandroid (what it was originally known as but the term is used less often these days) backup through your custom recovery.

For a while now if you backed up your phone before performing some form of modification, and you did so while you had any form of lockscreen security enabled, it would lock you out of the phone upon restoring that backup. I often want to test out a new mod (well, when I have time) and the easy way to do it is to perform a nandroid backup, flash the new mod, test it out and then if you don’t like it restore the backup. If you performed the backup with lockscreen security enabled then no code will let you into the phone upon rebooting this restored backup. After running into this issue the other night followed by a lot of Googling there is a relatively easy fix.

To get back into your phone you will need to reboot back into your recovery and perform the following steps:

  1. Tap on Advanced from the main menu
  2. Open File Manager
  3. Navigate to the /data/system folder
  4. Find and delete the files named:
    • gatekeeper.password.key
    • gatekeeper.pattern.key
    • locksettings.db
    • locksettings.db-shm
    • locksettings.db-wal
  • Reboot system
  • Upon rebooting your phone will have no lockscreen security. Head into security settings and setup your security. It does not lose your previously saved fingerprints if you add a new one here either. It just needs you to set one up to get the new lockscreen pattern/code. From here your phone will function as it did before performing your nandroid backup.

    I hope you never need this advice but if you do I hope it helps you and saves you many hours and lots of stress.

      4 Comments
      newest
      oldest
      Inline Feedbacks
      View all comments

      Urrm… Silly question. What’s the point of having the lock screen code if you can bypass it by rebooting into recovery?

      one of the insecurities of rooting your device. you could always pop a password on TWRP…

      Probably a silly question, but can I use this method to remove locks Creek security for a phone that I can’t remember the pattern, or a phone that isn’t mine? Ie my mum’s phone where she forgot the pass code or an old phone I found lying in my draw with a pass code I’ve forgotten?

      If you have a custom recovery on the phone… If you don’t, the process of flashing one will usually wipe user data anyway