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

Commit da069d7f authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Show locked padlock if sim card is locked

Otherwise, lock icon would show as unlocked because it's only tracking
the device state and the device might not have a password (like during
provisioning.)

Fixes: 131134059
Test: remove password, add locked sim, reboot
Change-Id: Ic2d31600020282ee3e908a275c3138ff68c887d3
parent d7314d7a
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.view.accessibility.AccessibilityNodeInfo;
import androidx.annotation.Nullable;

import com.android.internal.graphics.ColorUtils;
import com.android.internal.telephony.IccCardConstants;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.R;
@@ -75,6 +76,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
    private boolean mScreenOn;
    private boolean mLastScreenOn;
    private boolean mIsFaceUnlockState;
    private boolean mSimLocked;
    private int mDensity;
    private boolean mPulsing;
    private boolean mDozing;
@@ -116,6 +118,14 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
                    update();
                }

                @Override
                public void onSimStateChanged(int subId, int slotId,
                        IccCardConstants.State simState) {
                    boolean oldSimLocked = mSimLocked;
                    mSimLocked = mKeyguardUpdateMonitor.isSimPinSecure();
                    update(oldSimLocked != mSimLocked);
                }

                @Override
                public void onKeyguardVisibilityChanged(boolean showing) {
                    update();
@@ -158,6 +168,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
        mConfigurationController.addCallback(this);
        mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
        mUnlockMethodCache.addListener(this);
        mSimLocked = mKeyguardUpdateMonitor.isSimPinSecure();
        if (mDockManager != null) {
            mDockManager.addListener(mDockEventListener);
        }
@@ -362,7 +373,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
        KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
        if (mTransientBiometricsError) {
            return STATE_BIOMETRICS_ERROR;
        } else if (mUnlockMethodCache.canSkipBouncer()) {
        } else if (mUnlockMethodCache.canSkipBouncer() && !mSimLocked) {
            return STATE_LOCK_OPEN;
        } else if (updateMonitor.isFaceDetectionRunning()) {
            return STATE_SCANNING_FACE;