[G4 General] romverse:
Hi all, first post here. I would like to thank all the community of xda for their work and try to give back a little bit with this how to! ;)

Introduction

When setting a screen lock pattern / pin / password and making it a requirement to boot the phone, that becomes both the power on decryption method and screen lock unlock method.

With Android Marshmallow I was able to use a strong encryption password for my phone on boot / power on while having a simpler pin for screen lock usage using an application called SnooperStopper. As a bonus that application does failed screen lock monitoring and forces a shutdown of the phone after a configurable number of failed attempts.

On Android Nougat however I was not able to use SnooperStopper, since it would fail to detect root (SuperSU, Magisk or Lineage OS built in root support), neither using Cryptfs Password which SnooperStopper is based on and had the same root detection problem. Also tried issuing the cryptfs commands directly in a shell but broke the encryption on the phone and failed to boot.

I changed the perspective and instead of trying to change the encryption password after setting a simple screen lock pin, I would set a strong screen lock password which also updates the power on password and later change the screen lock only. This method worked, so below is a guide on how to do it. :cool:

How to

How to use a separate screen lock / boot encryption password.

Background

For this method I used Freedom OS customized stock rom on a LG G4 H815, rooted with Magisk.

IMPORTANT: Before starting make sure to make a backup of your files!

Step 1:

Set the phone to unencrypted state. Either format /data partition using TWRP or decrypt the phone to preserve data.

Step 2:

(optional, since you may already be running on the ROM you want to keep)

Install Freedom OS customized stock ROM.

Step 3:

Setup you desired screen lock method, for example a PIN.

Step 4:

Backup screen lock files. Enable USB debugging on your device, connect your phone to your computer and issue the following commands from a terminal:

The following command uses Magisk su path. If you are using another root method see below:

[COLOR="Indigo"]adb shell
mkdir /sdcard/pinlock
/sbin/su -c "/system/bin/sh -"
cp /data/system/device_policies.xml /sdcard/pinlock/
cp /data/system/gatekeeper* /sdcard/pinlock/
cp /data/system/locksettings* /sdcard/pinlock/
exit
exit[/COLOR]

For other root method, replace line 3 with:

[COLOR="Indigo"]/system/xbin/su -c "/system/bin/sh -"[/COLOR]

These are the files that get copied for PIN screen lock.

[COLOR="indigo"]/data/system/device_policies.xml
/data/system/gatekeeper.password.key
/data/system/gatekeeper.pattern.key
/data/system/locksettings.db
/data/system/locksettings.db-shm
/data/system/locksettings.db-wal[/COLOR]

Step 5:

Setup a strong screen lock password, the one you would like to use as a power decryption on password.

Step 6:

Encrypt phone. Go to Settings / General / Security / Encryption / Encrypt phone.

Step 7:

Reboot and go to setting to require password to start phone. Go to Settings / General / Security / Encryption / Secure start-up.

Step 8:

Restart the phone to verify that you are required to type in your password to boot and that it works.

Step 9:

Restore screen lock files by issuing the following commands from a terminal.

The following command uses Magisk su path. If you are using another root method see below:

[COLOR="indigo"]adb shell
/sbin/su -c "/system/bin/sh -"
cp /sdcard/pinlock/* /data/system/[/COLOR]

For other root method, replace line 2 with:

[COLOR="indigo"]/system/xbin/su -c "/system/bin/sh -"[/COLOR]

Step 10:

Final step. Reboot your phone! You will need to use the strong password to boot up but when unlock your screen you will be prompted for the simpler PIN or the unlock method selected.

This worked for me on a customized Nougat stock ROM, a strong boot password and a PIN screen unlock. Post your setup if it worked for you using a different combination. The principle should work on stock, customized stock and custom roms.

References

Freedom ROM

https://xdaforums.com/g4/development/h815-freedom-rom-t3630056

Magisk root

https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

Snooper Stopper

https://f-droid.org/packages/cz.eutopia.snooperstopper/

Cryptfs Password

https://f-droid.org/packages/org.nick.cryptfs.passwdmanager/