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

Commit 000884e8 authored by Chandru S's avatar Chandru S Committed by Android (Google) Code Review
Browse files

Merge "Stop relying on the local cache in KeyguardUpdateMonitor to determine...

Merge "Stop relying on the local cache in KeyguardUpdateMonitor to determine whether user storage is locked." into main
parents 9839809a 11c5b789
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -25,6 +25,16 @@ flag {
   }
}

flag {
   name: "user_encrypted_source"
   namespace: "systemui"
   description: "Get rid of the local cache and rely on UserManager.isUserUnlocked directly to determine whether user CE storage is encrypted."
   bug: "333656491"
   metadata {
        purpose: PURPOSE_BUGFIX
   }
}

flag {
   name: "modes_ui_dialog_paging"
   namespace: "systemui"
+10 −2
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ import com.android.settingslib.WirelessUtils;
import com.android.settingslib.fuelgauge.BatteryStatus;
import com.android.systemui.CoreStartable;
import com.android.systemui.Dumpable;
import com.android.systemui.Flags;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.biometrics.FingerprintInteractiveToAuthProvider;
import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor;
@@ -473,6 +474,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        }
    }

    @Deprecated
    private final SparseBooleanArray mUserIsUnlocked = new SparseBooleanArray();
    private final SparseBooleanArray mUserHasTrust = new SparseBooleanArray();
    private final SparseBooleanArray mUserTrustIsManaged = new SparseBooleanArray();
@@ -2688,8 +2690,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
     * @see Intent#ACTION_USER_UNLOCKED
     */
    public boolean isUserUnlocked(int userId) {
        if (Flags.userEncryptedSource()) {
            boolean userStorageUnlocked = mUserManager.isUserUnlocked(userId);
            mLogger.logUserStorageUnlocked(userId, userStorageUnlocked);
            return userStorageUnlocked;
        } else {
            return mUserIsUnlocked.get(userId);
        }
    }

    /**
     * Called whenever passive authentication is requested or aborted by a sensor.
@@ -4213,7 +4221,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        pw.println("    strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
        pw.println("ActiveUnlockRunning="
                + mTrustManager.isActiveUnlockRunning(mSelectedUserInteractor.getSelectedUserId()));
        pw.println("userUnlockedCache[userid=" + userId + "]=" + isUserUnlocked(userId));
        pw.println("userUnlockedCache[userid=" + userId + "]=" + mUserIsUnlocked.get(userId));
        pw.println("actualUserUnlocked[userid=" + userId + "]="
                + mUserManager.isUserUnlocked(userId));
        new DumpsysTableLogger(
+3 −3
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ constructor(

    fun logUpdateLockScreenUserLockedMsg(
        userId: Int,
        userUnlocked: Boolean,
        userStorageUnlocked: Boolean,
        encryptedOrLockdown: Boolean,
    ) {
        buffer.log(
@@ -124,12 +124,12 @@ constructor(
            LogLevel.DEBUG,
            {
                int1 = userId
                bool1 = userUnlocked
                bool1 = userStorageUnlocked
                bool2 = encryptedOrLockdown
            },
            {
                "updateLockScreenUserLockedMsg userId=$int1 " +
                    "userUnlocked:$bool1 encryptedOrLockdown:$bool2"
                    "userStorageUnlocked:$bool1 encryptedOrLockdown:$bool2"
            }
        )
    }
+12 −0
Original line number Diff line number Diff line
@@ -582,6 +582,18 @@ constructor(@KeyguardUpdateMonitorLog private val logBuffer: LogBuffer) {
        logBuffer.log(TAG, DEBUG, { int1 = userId }, { "userUnlocked userId: $int1" })
    }

    fun logUserStorageUnlocked(userId: Int, result: Boolean) {
        logBuffer.log(
            TAG,
            DEBUG,
            {
                int1 = userId
                bool1 = result
            },
            { "Invoked UserManager#isUserUnlocked $int1, result: $bool1" },
        )
    }

    fun logUserStopped(userId: Int, isUnlocked: Boolean) {
        logBuffer.log(
            TAG,
+4 −3
Original line number Diff line number Diff line
@@ -619,10 +619,11 @@ public class KeyguardIndicationController {
    }

    private void updateLockScreenUserLockedMsg(int userId) {
        boolean userUnlocked = mKeyguardUpdateMonitor.isUserUnlocked(userId);
        boolean userStorageUnlocked = mKeyguardUpdateMonitor.isUserUnlocked(userId);
        boolean encryptedOrLockdown = mKeyguardUpdateMonitor.isEncryptedOrLockdown(userId);
        mKeyguardLogger.logUpdateLockScreenUserLockedMsg(userId, userUnlocked, encryptedOrLockdown);
        if (!userUnlocked || encryptedOrLockdown) {
        mKeyguardLogger.logUpdateLockScreenUserLockedMsg(userId, userStorageUnlocked,
                encryptedOrLockdown);
        if (!userStorageUnlocked || encryptedOrLockdown) {
            mRotateTextViewController.updateIndication(
                    INDICATION_TYPE_USER_LOCKED,
                    new KeyguardIndication.Builder()