Loading packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +2 −3 Original line number Diff line number Diff line Loading @@ -188,7 +188,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme protected void onViewAttached() { updateIsUdfpsEnrolled(); updateConfiguration(); updateLockIconLocation(); updateKeyguardShowing(); mUserUnlockedWithBiometric = false; Loading Loading @@ -347,6 +346,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme R.string.accessibility_unlock_button); mLockedLabel = mView.getContext() .getResources().getString(R.string.accessibility_lock_icon); updateLockIconLocation(); } private void updateLockIconLocation() { Loading Loading @@ -691,7 +691,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mExecutor.execute(() -> { updateIsUdfpsEnrolled(); updateConfiguration(); updateLockIconLocation(); }); } Loading @@ -708,7 +707,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @Override public void onUdfpsLocationChanged() { updateLockIconLocation(); updateUdfpsConfig(); } }; Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/LockIconViewControllerTest.java +36 −3 Original line number Diff line number Diff line Loading @@ -135,8 +135,7 @@ public class LockIconViewControllerTest extends SysuiTestCase { .startMocking(); MockitoAnnotations.initMocks(this); when(mLockIconView.getResources()).thenReturn(mResources); when(mLockIconView.getContext()).thenReturn(mContext); setupLockIconViewMocks(); when(mContext.getResources()).thenReturn(mResources); when(mContext.getSystemService(WindowManager.class)).thenReturn(mWindowManager); Rect windowBounds = new Rect(0, 0, 800, 1200); Loading Loading @@ -206,13 +205,14 @@ public class LockIconViewControllerTest extends SysuiTestCase { } @Test public void testUpdateFingerprintLocationOnAuthenticatorsRegistered() { public void testUpdateLockIconLocationOnAuthenticatorsRegistered() { // GIVEN fp sensor location is not available pre-init when(mKeyguardUpdateMonitor.isUdfpsSupported()).thenReturn(false); when(mAuthController.getFingerprintSensorLocation()).thenReturn(null); mLockIconViewController.init(); captureAttachListener(); mAttachListener.onViewAttachedToWindow(mLockIconView); resetLockIconView(); // reset any method call counts for when we verify method calls later // GIVEN fp sensor location is available post-attached captureAuthControllerCallback(); Loading @@ -227,6 +227,29 @@ public class LockIconViewControllerTest extends SysuiTestCase { eq(PADDING)); } @Test public void testUpdateLockIconLocationOnUdfpsLocationChanged() { // GIVEN fp sensor location is not available pre-init when(mKeyguardUpdateMonitor.isUdfpsSupported()).thenReturn(false); when(mAuthController.getFingerprintSensorLocation()).thenReturn(null); mLockIconViewController.init(); captureAttachListener(); mAttachListener.onViewAttachedToWindow(mLockIconView); resetLockIconView(); // reset any method call counts for when we verify method calls later // GIVEN fp sensor location is available post-attached captureAuthControllerCallback(); Pair<Float, PointF> udfps = setupUdfps(); // WHEN udfps location changes mAuthControllerCallback.onUdfpsLocationChanged(); mDelayableExecutor.runAllReady(); // THEN lock icon view location is updated with the same coordinates as auth controller vals verify(mLockIconView).setCenterLocation(eq(udfps.second), eq(udfps.first), eq(PADDING)); } @Test public void testLockIconViewBackgroundEnabledWhenUdfpsIsSupported() { // GIVEN Udpfs sensor location is available Loading Loading @@ -440,4 +463,14 @@ public class LockIconViewControllerTest extends SysuiTestCase { mKeyguardUpdateMonitorCallbackCaptor.capture()); mKeyguardUpdateMonitorCallback = mKeyguardUpdateMonitorCallbackCaptor.getValue(); } private void setupLockIconViewMocks() { when(mLockIconView.getResources()).thenReturn(mResources); when(mLockIconView.getContext()).thenReturn(mContext); } private void resetLockIconView() { reset(mLockIconView); setupLockIconViewMocks(); } } Loading
packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +2 −3 Original line number Diff line number Diff line Loading @@ -188,7 +188,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme protected void onViewAttached() { updateIsUdfpsEnrolled(); updateConfiguration(); updateLockIconLocation(); updateKeyguardShowing(); mUserUnlockedWithBiometric = false; Loading Loading @@ -347,6 +346,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme R.string.accessibility_unlock_button); mLockedLabel = mView.getContext() .getResources().getString(R.string.accessibility_lock_icon); updateLockIconLocation(); } private void updateLockIconLocation() { Loading Loading @@ -691,7 +691,6 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mExecutor.execute(() -> { updateIsUdfpsEnrolled(); updateConfiguration(); updateLockIconLocation(); }); } Loading @@ -708,7 +707,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @Override public void onUdfpsLocationChanged() { updateLockIconLocation(); updateUdfpsConfig(); } }; Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/LockIconViewControllerTest.java +36 −3 Original line number Diff line number Diff line Loading @@ -135,8 +135,7 @@ public class LockIconViewControllerTest extends SysuiTestCase { .startMocking(); MockitoAnnotations.initMocks(this); when(mLockIconView.getResources()).thenReturn(mResources); when(mLockIconView.getContext()).thenReturn(mContext); setupLockIconViewMocks(); when(mContext.getResources()).thenReturn(mResources); when(mContext.getSystemService(WindowManager.class)).thenReturn(mWindowManager); Rect windowBounds = new Rect(0, 0, 800, 1200); Loading Loading @@ -206,13 +205,14 @@ public class LockIconViewControllerTest extends SysuiTestCase { } @Test public void testUpdateFingerprintLocationOnAuthenticatorsRegistered() { public void testUpdateLockIconLocationOnAuthenticatorsRegistered() { // GIVEN fp sensor location is not available pre-init when(mKeyguardUpdateMonitor.isUdfpsSupported()).thenReturn(false); when(mAuthController.getFingerprintSensorLocation()).thenReturn(null); mLockIconViewController.init(); captureAttachListener(); mAttachListener.onViewAttachedToWindow(mLockIconView); resetLockIconView(); // reset any method call counts for when we verify method calls later // GIVEN fp sensor location is available post-attached captureAuthControllerCallback(); Loading @@ -227,6 +227,29 @@ public class LockIconViewControllerTest extends SysuiTestCase { eq(PADDING)); } @Test public void testUpdateLockIconLocationOnUdfpsLocationChanged() { // GIVEN fp sensor location is not available pre-init when(mKeyguardUpdateMonitor.isUdfpsSupported()).thenReturn(false); when(mAuthController.getFingerprintSensorLocation()).thenReturn(null); mLockIconViewController.init(); captureAttachListener(); mAttachListener.onViewAttachedToWindow(mLockIconView); resetLockIconView(); // reset any method call counts for when we verify method calls later // GIVEN fp sensor location is available post-attached captureAuthControllerCallback(); Pair<Float, PointF> udfps = setupUdfps(); // WHEN udfps location changes mAuthControllerCallback.onUdfpsLocationChanged(); mDelayableExecutor.runAllReady(); // THEN lock icon view location is updated with the same coordinates as auth controller vals verify(mLockIconView).setCenterLocation(eq(udfps.second), eq(udfps.first), eq(PADDING)); } @Test public void testLockIconViewBackgroundEnabledWhenUdfpsIsSupported() { // GIVEN Udpfs sensor location is available Loading Loading @@ -440,4 +463,14 @@ public class LockIconViewControllerTest extends SysuiTestCase { mKeyguardUpdateMonitorCallbackCaptor.capture()); mKeyguardUpdateMonitorCallback = mKeyguardUpdateMonitorCallbackCaptor.getValue(); } private void setupLockIconViewMocks() { when(mLockIconView.getResources()).thenReturn(mResources); when(mLockIconView.getContext()).thenReturn(mContext); } private void resetLockIconView() { reset(mLockIconView); setupLockIconViewMocks(); } }