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

Commit 4b543d30 authored by Curtis Belmonte's avatar Curtis Belmonte Committed by Automerger Merge Worker
Browse files

Merge "Don't re-trigger face auth from notification shade" into rvc-dev am:...

Merge "Don't re-trigger face auth from notification shade" into rvc-dev am: 3940a995 am: 918f98eb am: 213a3fd6 am: 7e554798

Change-Id: I0293fabf32c89fc9d7cb84c573b84ef807601fdf
parents a18d4c76 7e554798
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -94,8 +94,10 @@ import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.util.Assert;
import com.android.systemui.util.RingerModeTracker;
@@ -219,6 +221,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab

    private final Context mContext;
    private final boolean mIsPrimaryUser;
    private final StatusBarStateController mStatusBarStateController;
    HashMap<Integer, SimData> mSimDatas = new HashMap<>();
    HashMap<Integer, ServiceState> mServiceStates = new HashMap<Integer, ServiceState>();

@@ -1521,7 +1524,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            BroadcastDispatcher broadcastDispatcher,
            DumpManager dumpManager,
            RingerModeTracker ringerModeTracker,
            @Background Executor backgroundExecutor) {
            @Background Executor backgroundExecutor,
            StatusBarStateController statusBarStateController) {
        mContext = context;
        mSubscriptionManager = SubscriptionManager.from(context);
        mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
@@ -1529,6 +1533,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        mBackgroundExecutor = backgroundExecutor;
        mBroadcastDispatcher = broadcastDispatcher;
        mRingerModeTracker = ringerModeTracker;
        mStatusBarStateController = statusBarStateController;
        dumpManager.registerDumpable(getClass().getName(), this);

        mHandler = new Handler(mainLooper) {
@@ -1855,8 +1860,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        boolean shouldListenForFace = shouldListenForFace();
        if (mFaceRunningState == BIOMETRIC_STATE_RUNNING && !shouldListenForFace) {
            stopListeningForFace();
        } else if (mFaceRunningState != BIOMETRIC_STATE_RUNNING
                && shouldListenForFace) {
        } else if (mFaceRunningState != BIOMETRIC_STATE_RUNNING && shouldListenForFace) {
            startListeningForFace();
        }
    }
@@ -1894,7 +1898,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
     * If face auth is allows to scan on this exact moment.
     */
    public boolean shouldListenForFace() {
        final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep;
        final boolean statusBarShadeLocked =
                mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED;
        final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep
                && !statusBarShadeLocked;
        final int user = getCurrentUser();
        final int strongAuth = mStrongAuthTracker.getStrongAuthForUser(user);
        final boolean isLockDown =
+15 −1
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ import com.android.keyguard.KeyguardUpdateMonitor.BiometricAuthenticated;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.util.RingerModeTracker;

@@ -141,6 +143,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
    private RingerModeTracker mRingerModeTracker;
    @Mock
    private LiveData<Integer> mRingerModeLiveData;
    @Mock
    private StatusBarStateController mStatusBarStateController;
    // Direct executor
    private Executor mBackgroundExecutor = Runnable::run;
    private TestableLooper mTestableLooper;
@@ -417,6 +421,16 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        verify(mFaceManager).authenticate(any(), any(), anyInt(), any(), any(), anyInt());
    }

    @Test
    public void skipsAuthentication_whenStatusBarShadeLocked() {
        when(mStatusBarStateController.getState()).thenReturn(StatusBarState.SHADE_LOCKED);

        mKeyguardUpdateMonitor.dispatchStartedWakingUp();
        mTestableLooper.processAllMessages();
        mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
        verify(mFaceManager, never()).authenticate(any(), any(), anyInt(), any(), any(), anyInt());
    }

    @Test
    public void skipsAuthentication_whenEncryptedKeyguard() {
        when(mStrongAuthTracker.getStrongAuthForUser(anyInt())).thenReturn(
@@ -715,7 +729,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
            super(context,
                    TestableLooper.get(KeyguardUpdateMonitorTest.this).getLooper(),
                    mBroadcastDispatcher, mDumpManager,
                    mRingerModeTracker, mBackgroundExecutor);
                    mRingerModeTracker, mBackgroundExecutor, mStatusBarStateController);
            mStrongAuthTracker = KeyguardUpdateMonitorTest.this.mStrongAuthTracker;
        }