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

Commit dfd866da authored by Robin Lee's avatar Robin Lee
Browse files

Allow devices without SECURE_LOCK to *clear* PINs

Otherwise upgrade devices get stuck and can't possibly recover.

Bug: 165634310
Change-Id: Iff3115ae734cdfdba09939915f00c1ce02fe6272
parent 1fb18b74
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -680,7 +680,7 @@ public class LockPatternUtils {
     */
    public boolean setLockCredential(@NonNull LockscreenCredential newCredential,
            @NonNull LockscreenCredential savedCredential, int userHandle) {
        if (!hasSecureLockScreen()) {
        if (!hasSecureLockScreen() && newCredential.getType() != CREDENTIAL_TYPE_NONE) {
            throw new UnsupportedOperationException(
                    "This operation requires the lock screen feature.");
        }
@@ -775,7 +775,7 @@ public class LockPatternUtils {

    /** Update the encryption password if it is enabled **/
    private void updateEncryptionPassword(final int type, final byte[] password) {
        if (!hasSecureLockScreen()) {
        if (!hasSecureLockScreen() && password != null && password.length != 0) {
            throw new UnsupportedOperationException(
                    "This operation requires the lock screen feature.");
        }
@@ -1575,7 +1575,7 @@ public class LockPatternUtils {
     */
    public boolean setLockCredentialWithToken(@NonNull LockscreenCredential credential,
            long tokenHandle, byte[] token, int userHandle) {
        if (!hasSecureLockScreen()) {
        if (!hasSecureLockScreen() && credential.getType() != CREDENTIAL_TYPE_NONE) {
            throw new UnsupportedOperationException(
                    "This operation requires the lock screen feature.");
        }
+7 −3
Original line number Diff line number Diff line
@@ -1090,7 +1090,9 @@ public class LockSettingsService extends ILockSettings.Stub {
    public void setSeparateProfileChallengeEnabled(int userId, boolean enabled,
            LockscreenCredential managedUserPassword) {
        checkWritePermission(userId);
        if (!mHasSecureLockScreen) {
        if (!mHasSecureLockScreen
                && managedUserPassword != null
                && managedUserPassword.getType() != CREDENTIAL_TYPE_NONE) {
            throw new UnsupportedOperationException(
                    "This operation requires secure lock screen feature.");
        }
@@ -1560,7 +1562,8 @@ public class LockSettingsService extends ILockSettings.Stub {
    public boolean setLockCredential(LockscreenCredential credential,
            LockscreenCredential savedCredential, int userId) {

        if (!mHasSecureLockScreen) {
        if (!mHasSecureLockScreen
                && credential != null && credential.getType() != CREDENTIAL_TYPE_NONE) {
            throw new UnsupportedOperationException(
                    "This operation requires secure lock screen feature");
        }
@@ -3423,7 +3426,8 @@ public class LockSettingsService extends ILockSettings.Stub {
        @Override
        public boolean setLockCredentialWithToken(LockscreenCredential credential, long tokenHandle,
                byte[] token, int userId) {
            if (!mHasSecureLockScreen) {
        if (!mHasSecureLockScreen
                && credential != null && credential.getType() != CREDENTIAL_TYPE_NONE) {
                throw new UnsupportedOperationException(
                        "This operation requires secure lock screen feature.");
            }