So I'm trying on copying the Android 11 screen lock password to another same device our customer does not want to set the password one by one
and I find out a resolution: copying files
However it only works in the scenario if the device password is not been set.
while copying the file below to the device without a password after rebooting the device the screen lock will show up and the password is as expected**
Unfortunately, it will not work if the device's password has been set; the screen lock will still show up but the password was not as expected
What did I miss here? Does anyone know?
the code below what I am trying to do is to copy
1.locksettings.db
an SQLite database containing the lock screen settings
2.copy /data/system_de/0/spblob/*
In order to unlock a real user, you need to know a synthetic password. However it's encrypted by the Keystore, so you need the real password to unlock the Keystore first
for example
.00000000000.handle: return value of gatekeeper first enroll by synthetic password derived password
handle.pwd: the second gatekeeper enroll by real password with a fake user ID (e.g. user_id + 10000).
handle.secdis: Actually a random number. Used to encrypt the synthetic password.
handle.spblob: encrypted synthetic password
3. copy /data/misc/keystore/user_0/
keystore key. Used for encrypting synthetic passwords.
cp -rf /storage/self/primary/export/configuration/Settings/lock* /data/system/
chown system:system /data/system/locksettings.db
chmod 660 /data/system/locksettings.db
rm -rf /data/system_de/0/spblob
mkdir /data/system_de/0/spblob/
chown system:system /data/system_de/0/spblob
rm -rf /data/misc/keystore/user_0
mkdir /data/misc/keystore/user_0/
chown keystore:keystore /data/misc/keystore/user_0
cp -rf /storage/self/primary/export/configuration/data/spblob/* /data/system_de/0/spblob/
chown system:system /data/system_de/0/spblob/*
chmod 600 /data/system_de/0/spblob/*
cp -rf /storage/self/primary/export/configuration/data/keystore/* /data/misc/keystore/user_0/
chown keystore:keystore /data/misc/keystore/user_0/*
chmod 600 /data/misc/keystore/user_0/*
For additional question:
Yes those command above need to run under root acces ,however because it is a customize os so we make those command run under a system service and fix some sepolicy avc error so the customer do not have root acces for sure and we can run those command even under an unroot device