Merge "Don't re-trigger face auth from notification shade" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3940a99593
@@ -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 =
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user