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

Commit a451cc24 authored by AnilKumar Chimata's avatar AnilKumar Chimata Committed by Bruno Martins
Browse files

frameworks: base: Port password retention feature

Port password retention feature for HW FDE.

This patch also include these changes:
   - Fix clearing of retained password
   - keyguard: Fix password doesnot sanitize after verification
   - LockSettings: fix the get password issue during boot up
   - frameworks/base: Fix pattern update issue

CRs-Fixed: 2210986
Change-Id: I2def56b14c10229b72feccd1c97b281cad65f282
parent ce92cdfa
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -80,4 +80,6 @@ interface ILockSettings {
            in byte[] recoveryKeyBlob,
            in List<WrappedApplicationKey> applicationKeys);
    void closeSession(in String sessionId);
    void sanitizePassword();
    String getPassword();
}
+11 −0
Original line number Diff line number Diff line
@@ -737,6 +737,17 @@ public class LockPatternUtils {
        onAfterChangingPassword(userId);
    }

    /**
     * clears stored password.
     */
    public void sanitizePassword() {
        try {
            getLockSettings().sanitizePassword();
        } catch (RemoteException re) {
            Log.e(TAG, "Couldn't sanitize password" + re);
        }
    }

    private void updateCryptoUserInfo(int userId) {
        if (userId != UserHandle.USER_SYSTEM) {
            return;
+1 −0
Original line number Diff line number Diff line
@@ -187,6 +187,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
            boolean isValidPassword) {
        boolean dismissKeyguard = KeyguardUpdateMonitor.getCurrentUser() == userId;
        if (matched) {
            mLockPatternUtils.sanitizePassword();
            mCallback.reportUnlockAttempt(userId, true, 0);
            if (dismissKeyguard) {
                mDismissing = true;
+1 −0
Original line number Diff line number Diff line
@@ -315,6 +315,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
                boolean isValidPattern) {
            boolean dismissKeyguard = KeyguardUpdateMonitor.getCurrentUser() == userId;
            if (matched) {
                mLockPatternUtils.sanitizePassword();
                mCallback.reportUnlockAttempt(userId, true, 0);
                if (dismissKeyguard) {
                    mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct);
+16 −1
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ import com.android.internal.util.Preconditions;
import com.android.internal.widget.LockPatternUtils;
import com.android.server.pm.PackageManagerService;
import com.android.server.storage.AppFuseBridge;
import com.android.internal.widget.ILockSettings;

import libcore.io.IoUtils;
import libcore.util.EmptyArray;
@@ -2309,8 +2310,22 @@ class StorageManagerService extends IStorageManager.Stub
            Slog.i(TAG, "changing encryption password...");
        }

        ILockSettings lockSettings = ILockSettings.Stub.asInterface(
                        ServiceManager.getService("lock_settings"));
        String currentPassword="default_password";
        try {
            mVold.fdeChangePassword(type, password);
            currentPassword = lockSettings.getPassword();
        } catch (Exception e) {
            Slog.wtf(TAG, "Couldn't get password" + e);
        }

        try {
            mVold.fdeChangePassword(type, currentPassword, password);
            try {
                lockSettings.sanitizePassword();
            } catch (Exception e) {
                Slog.wtf(TAG, "Couldn't sanitize password" + e);
            }
            return 0;
        } catch (Exception e) {
            Slog.wtf(TAG, e);
Loading