Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 688af6c5 authored by Paul Lawrence's avatar Paul Lawrence
Browse files

DOn't save encryption settings when not encrypted

If this setting is saved when unencrypted, it will apply after encryption
and cause the user to get the wrong default in the 'Require pattern to start
device' dialog.

Bug: 21105662
Change-Id: Ibd2918abb6af27e20dc03a1a10f4cad1033bc575
parent 8d0cf8bc
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -1097,9 +1097,12 @@ public class LockPatternUtils {
            Log.w(TAG, "Only device owner may call setCredentialRequiredForDecrypt()");
            Log.w(TAG, "Only device owner may call setCredentialRequiredForDecrypt()");
            return;
            return;
        }
        }

        if (isDeviceEncryptionEnabled()){
            Settings.Global.putInt(mContext.getContentResolver(),
            Settings.Global.putInt(mContext.getContentResolver(),
               Settings.Global.REQUIRE_PASSWORD_TO_DECRYPT, required ? 1 : 0);
               Settings.Global.REQUIRE_PASSWORD_TO_DECRYPT, required ? 1 : 0);
        }
        }
    }


    private boolean isDoNotAskCredentialsOnBootSet() {
    private boolean isDoNotAskCredentialsOnBootSet() {
        return mDevicePolicyManager.getDoNotAskCredentialsOnBoot();
        return mDevicePolicyManager.getDoNotAskCredentialsOnBoot();