I'm working on source code of Lollipop. It seems the type lock (if users have to enter a password/SIMM or a pattern) is stored in a database, /data/system/locksettings.db. This database is located in /data but /data is encrypted before the user types the password. So I think it may be stored in another place.

In CryptKeeperConfirm.java, there is this comment:

  /* WARNING - nasty hack!
               Settings for the lock screen are not available to the crypto
               screen (CryptKeeper) at boot. We duplicate the ones that
               CryptKeeper needs to the crypto key/value store when they are
               modified (see LockPatternUtils).
               However, prior to encryption, the crypto key/value store is not
               persisted across reboots, thus modified settings are lost to
               In order to make sure CryptKeeper had the correct settings after
               first encrypting, we thus need to rewrite them, which ensures the
               crypto key/value store is up to date. On encryption, this store
               is then persisted, and the settings will be there on future

That leads me to believe that the settings for lock screen (including type lock) are stored in 2 places. Does anyone know what other places lock screen settings and type lock may be stored?

  • In the same directory or if there is multi-user setup, go to /data/system/users/USER_ID/ look for .key, such as password.key, gesture.key files. They are the keepers of secret. See source. Also, /data already is decrypted once you reaches the lock screen. – Firelord Dec 19 '15 at 10:28
  • @Firelord Thanks for your comment, but i'm talking about type lock and not password or pattern. I edited my question. I know passwords can be stored in data even if its encrypted because the system will encrypt the password entered by user at lock screen then compare it with the encrypted password. But how the system know what lock screen it should propose to users if data are encrypted and user have to enter is password/pattern to decrypt them ? – Gabriel D Dec 21 '15 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.