Loading packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java +8 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.systemui.R; import com.android.systemui.SystemUIApplication; import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.dock.DockManager; import com.android.systemui.statusbar.phone.BiometricUnlockController; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.util.AsyncSensorManager; import com.android.systemui.util.wakelock.DelayedWakeLock; Loading Loading @@ -70,7 +71,7 @@ public class DozeFactory { new DozeScreenState(wrappedService, handler, params, wakeLock), createDozeScreenBrightness(context, wrappedService, sensorManager, host, params, handler), new DozeWallpaperState(context), new DozeWallpaperState(context, getBiometricUnlockController(dozeService)), new DozeDockHandler(context, machine, host, config, handler, dockManager) }); Loading Loading @@ -107,4 +108,10 @@ public class DozeFactory { final SystemUIApplication app = (SystemUIApplication) appCandidate; return app.getComponent(DozeHost.class); } public static BiometricUnlockController getBiometricUnlockController(DozeService service) { Application appCandidate = service.getApplication(); final SystemUIApplication app = (SystemUIApplication) appCandidate; return app.getComponent(BiometricUnlockController.class); } } packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java +10 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.phone.BiometricUnlockController; import com.android.systemui.statusbar.phone.DozeParameters; import java.io.PrintWriter; Loading @@ -38,18 +39,22 @@ public class DozeWallpaperState implements DozeMachine.Part { private final IWallpaperManager mWallpaperManagerService; private final DozeParameters mDozeParameters; private final BiometricUnlockController mBiometricUnlockController; private boolean mIsAmbientMode; public DozeWallpaperState(Context context) { public DozeWallpaperState(Context context, BiometricUnlockController biometricUnlockController) { this(IWallpaperManager.Stub.asInterface( ServiceManager.getService(Context.WALLPAPER_SERVICE)), biometricUnlockController, DozeParameters.getInstance(context)); } @VisibleForTesting DozeWallpaperState(IWallpaperManager wallpaperManagerService, DozeParameters parameters) { BiometricUnlockController biometricUnlockController, DozeParameters parameters) { mWallpaperManagerService = wallpaperManagerService; mBiometricUnlockController = biometricUnlockController; mDozeParameters = parameters; } Loading @@ -76,7 +81,9 @@ public class DozeWallpaperState implements DozeMachine.Part { } else { boolean wakingUpFromPulse = oldState == DozeMachine.State.DOZE_PULSING && newState == DozeMachine.State.FINISH; animated = !mDozeParameters.getDisplayNeedsBlanking() || wakingUpFromPulse; boolean fastDisplay = !mDozeParameters.getDisplayNeedsBlanking(); animated = (fastDisplay && !mBiometricUnlockController.unlockedByWakeAndUnlock()) || wakingUpFromPulse; } if (isAmbientMode != mIsAmbientMode) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +13 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { private BiometricSourceType mPendingAuthenticatedBioSourceType = null; private boolean mPendingShowBouncer; private boolean mHasScreenTurnedOnSinceAuthenticating; private boolean mFadedAwayAfterWakeAndUnlock; private final TunerService.Tunable mFaceDismissedKeyguardTunable = new TunerService.Tunable() { @Override Loading Loading @@ -360,6 +361,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { @Override public void onStartedGoingToSleep(int why) { resetMode(); mFadedAwayAfterWakeAndUnlock = false; mPendingAuthenticatedUserId = -1; mPendingAuthenticatedBioSourceType = null; } Loading Loading @@ -454,6 +456,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { } public void finishKeyguardFadingAway() { if (isWakeAndUnlock()) { mFadedAwayAfterWakeAndUnlock = true; } resetMode(); } Loading Loading @@ -503,6 +508,14 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { || mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM; } /** * Successful authentication with fingerprint, face, or iris that wakes up the device. * This will return {@code true} even after the keyguard fades away. */ public boolean unlockedByWakeAndUnlock() { return isWakeAndUnlock() || mFadedAwayAfterWakeAndUnlock; } /** * Successful authentication with fingerprint, face, or iris when the screen was either * on or off. Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -1213,6 +1213,7 @@ public class StatusBar extends SystemUI implements DemoMode, mDozeScrimController, keyguardViewMediator, mScrimController, this, UnlockMethodCache.getInstance(mContext), new Handler(), mKeyguardUpdateMonitor, Dependency.get(TunerService.class)); putComponent(BiometricUnlockController.class, mBiometricUnlockController); mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this, getBouncerContainer(), mNotificationPanel, mBiometricUnlockController, mStatusBarWindow.findViewById(R.id.lock_icon_container)); Loading packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java +19 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.doze; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading @@ -29,6 +30,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.phone.BiometricUnlockController; import com.android.systemui.statusbar.phone.DozeParameters; import org.junit.Before; Loading @@ -44,12 +46,14 @@ public class DozeWallpaperStateTest extends SysuiTestCase { private DozeWallpaperState mDozeWallpaperState; @Mock IWallpaperManager mIWallpaperManager; @Mock BiometricUnlockController mBiometricUnlockController; @Mock DozeParameters mDozeParameters; @Before public void setUp() { MockitoAnnotations.initMocks(this); mDozeWallpaperState = new DozeWallpaperState(mIWallpaperManager, mDozeParameters); mDozeWallpaperState = new DozeWallpaperState(mIWallpaperManager, mBiometricUnlockController, mDozeParameters); } @Test Loading Loading @@ -101,6 +105,20 @@ public class DozeWallpaperStateTest extends SysuiTestCase { verify(mIWallpaperManager).setInAmbientMode(eq(false), eq(0L)); } @Test public void testDoesNotAnimate_whenWakeAndUnlock() throws RemoteException { // Pre-conditions when(mDozeParameters.getAlwaysOn()).thenReturn(true); when(mBiometricUnlockController.unlockedByWakeAndUnlock()).thenReturn(true); mDozeWallpaperState.transitionTo(DozeMachine.State.UNINITIALIZED, DozeMachine.State.DOZE_AOD); clearInvocations(mIWallpaperManager); mDozeWallpaperState.transitionTo(DozeMachine.State.DOZE_AOD, DozeMachine.State.FINISH); verify(mIWallpaperManager).setInAmbientMode(eq(false), eq(0L)); } @Test public void testTransitionTo_requestPulseIsAmbientMode() throws RemoteException { mDozeWallpaperState.transitionTo(DozeMachine.State.DOZE, Loading Loading
packages/SystemUI/src/com/android/systemui/doze/DozeFactory.java +8 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import com.android.systemui.R; import com.android.systemui.SystemUIApplication; import com.android.systemui.classifier.FalsingManagerFactory; import com.android.systemui.dock.DockManager; import com.android.systemui.statusbar.phone.BiometricUnlockController; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.util.AsyncSensorManager; import com.android.systemui.util.wakelock.DelayedWakeLock; Loading Loading @@ -70,7 +71,7 @@ public class DozeFactory { new DozeScreenState(wrappedService, handler, params, wakeLock), createDozeScreenBrightness(context, wrappedService, sensorManager, host, params, handler), new DozeWallpaperState(context), new DozeWallpaperState(context, getBiometricUnlockController(dozeService)), new DozeDockHandler(context, machine, host, config, handler, dockManager) }); Loading Loading @@ -107,4 +108,10 @@ public class DozeFactory { final SystemUIApplication app = (SystemUIApplication) appCandidate; return app.getComponent(DozeHost.class); } public static BiometricUnlockController getBiometricUnlockController(DozeService service) { Application appCandidate = service.getApplication(); final SystemUIApplication app = (SystemUIApplication) appCandidate; return app.getComponent(BiometricUnlockController.class); } }
packages/SystemUI/src/com/android/systemui/doze/DozeWallpaperState.java +10 −3 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.phone.BiometricUnlockController; import com.android.systemui.statusbar.phone.DozeParameters; import java.io.PrintWriter; Loading @@ -38,18 +39,22 @@ public class DozeWallpaperState implements DozeMachine.Part { private final IWallpaperManager mWallpaperManagerService; private final DozeParameters mDozeParameters; private final BiometricUnlockController mBiometricUnlockController; private boolean mIsAmbientMode; public DozeWallpaperState(Context context) { public DozeWallpaperState(Context context, BiometricUnlockController biometricUnlockController) { this(IWallpaperManager.Stub.asInterface( ServiceManager.getService(Context.WALLPAPER_SERVICE)), biometricUnlockController, DozeParameters.getInstance(context)); } @VisibleForTesting DozeWallpaperState(IWallpaperManager wallpaperManagerService, DozeParameters parameters) { BiometricUnlockController biometricUnlockController, DozeParameters parameters) { mWallpaperManagerService = wallpaperManagerService; mBiometricUnlockController = biometricUnlockController; mDozeParameters = parameters; } Loading @@ -76,7 +81,9 @@ public class DozeWallpaperState implements DozeMachine.Part { } else { boolean wakingUpFromPulse = oldState == DozeMachine.State.DOZE_PULSING && newState == DozeMachine.State.FINISH; animated = !mDozeParameters.getDisplayNeedsBlanking() || wakingUpFromPulse; boolean fastDisplay = !mDozeParameters.getDisplayNeedsBlanking(); animated = (fastDisplay && !mBiometricUnlockController.unlockedByWakeAndUnlock()) || wakingUpFromPulse; } if (isAmbientMode != mIsAmbientMode) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +13 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { private BiometricSourceType mPendingAuthenticatedBioSourceType = null; private boolean mPendingShowBouncer; private boolean mHasScreenTurnedOnSinceAuthenticating; private boolean mFadedAwayAfterWakeAndUnlock; private final TunerService.Tunable mFaceDismissedKeyguardTunable = new TunerService.Tunable() { @Override Loading Loading @@ -360,6 +361,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { @Override public void onStartedGoingToSleep(int why) { resetMode(); mFadedAwayAfterWakeAndUnlock = false; mPendingAuthenticatedUserId = -1; mPendingAuthenticatedBioSourceType = null; } Loading Loading @@ -454,6 +456,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { } public void finishKeyguardFadingAway() { if (isWakeAndUnlock()) { mFadedAwayAfterWakeAndUnlock = true; } resetMode(); } Loading Loading @@ -503,6 +508,14 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback { || mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM; } /** * Successful authentication with fingerprint, face, or iris that wakes up the device. * This will return {@code true} even after the keyguard fades away. */ public boolean unlockedByWakeAndUnlock() { return isWakeAndUnlock() || mFadedAwayAfterWakeAndUnlock; } /** * Successful authentication with fingerprint, face, or iris when the screen was either * on or off. Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +1 −0 Original line number Diff line number Diff line Loading @@ -1213,6 +1213,7 @@ public class StatusBar extends SystemUI implements DemoMode, mDozeScrimController, keyguardViewMediator, mScrimController, this, UnlockMethodCache.getInstance(mContext), new Handler(), mKeyguardUpdateMonitor, Dependency.get(TunerService.class)); putComponent(BiometricUnlockController.class, mBiometricUnlockController); mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this, getBouncerContainer(), mNotificationPanel, mBiometricUnlockController, mStatusBarWindow.findViewById(R.id.lock_icon_container)); Loading
packages/SystemUI/tests/src/com/android/systemui/doze/DozeWallpaperStateTest.java +19 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.doze; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading @@ -29,6 +30,7 @@ import androidx.test.filters.SmallTest; import com.android.systemui.SysuiTestCase; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.phone.BiometricUnlockController; import com.android.systemui.statusbar.phone.DozeParameters; import org.junit.Before; Loading @@ -44,12 +46,14 @@ public class DozeWallpaperStateTest extends SysuiTestCase { private DozeWallpaperState mDozeWallpaperState; @Mock IWallpaperManager mIWallpaperManager; @Mock BiometricUnlockController mBiometricUnlockController; @Mock DozeParameters mDozeParameters; @Before public void setUp() { MockitoAnnotations.initMocks(this); mDozeWallpaperState = new DozeWallpaperState(mIWallpaperManager, mDozeParameters); mDozeWallpaperState = new DozeWallpaperState(mIWallpaperManager, mBiometricUnlockController, mDozeParameters); } @Test Loading Loading @@ -101,6 +105,20 @@ public class DozeWallpaperStateTest extends SysuiTestCase { verify(mIWallpaperManager).setInAmbientMode(eq(false), eq(0L)); } @Test public void testDoesNotAnimate_whenWakeAndUnlock() throws RemoteException { // Pre-conditions when(mDozeParameters.getAlwaysOn()).thenReturn(true); when(mBiometricUnlockController.unlockedByWakeAndUnlock()).thenReturn(true); mDozeWallpaperState.transitionTo(DozeMachine.State.UNINITIALIZED, DozeMachine.State.DOZE_AOD); clearInvocations(mIWallpaperManager); mDozeWallpaperState.transitionTo(DozeMachine.State.DOZE_AOD, DozeMachine.State.FINISH); verify(mIWallpaperManager).setInAmbientMode(eq(false), eq(0L)); } @Test public void testTransitionTo_requestPulseIsAmbientMode() throws RemoteException { mDozeWallpaperState.transitionTo(DozeMachine.State.DOZE, Loading