Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +4 −1 Original line number Diff line number Diff line Loading @@ -1830,7 +1830,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { return shouldListen; } private boolean shouldListenForFace() { /** * If face auth is allows to scan on this exact moment. */ public boolean shouldListenForFace() { final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep; final int user = getCurrentUser(); final int strongAuth = mStrongAuthTracker.getStrongAuthForUser(user); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +28 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.Region; import android.hardware.biometrics.BiometricSourceType; import android.os.PowerManager; import android.os.SystemClock; import android.provider.DeviceConfig; Loading @@ -62,6 +63,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.keyguard.KeyguardClockSwitch; import com.android.keyguard.KeyguardStatusView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.DejankUtils; import com.android.systemui.Dependency; import com.android.systemui.Interpolators; Loading Loading @@ -172,6 +174,25 @@ public class NotificationPanelView extends PanelView implements R.id.keyguard_hun_animator_start_tag); private static final AnimationProperties KEYGUARD_HUN_PROPERTIES = new AnimationProperties().setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD); @VisibleForTesting final KeyguardUpdateMonitorCallback mKeyguardUpdateCallback = new KeyguardUpdateMonitorCallback() { @Override public void onBiometricRunningStateChanged(boolean running, BiometricSourceType biometricSourceType) { boolean keyguardOrShadeLocked = mBarState == StatusBarState.KEYGUARD || mBarState == StatusBarState.SHADE_LOCKED; if (!running && mFirstBypassAttempt && keyguardOrShadeLocked && !mDozing) { mFirstBypassAttempt = false; animateKeyguardStatusBarIn(StackStateAnimator.ANIMATION_DURATION_STANDARD); } } @Override public void onFinishedGoingToSleep(int why) { mFirstBypassAttempt = mKeyguardBypassController.getBypassEnabled(); } }; private final InjectionInflationController mInjectionInflationController; private final PowerManager mPowerManager; Loading Loading @@ -392,6 +413,7 @@ public class NotificationPanelView extends PanelView implements private boolean mShowingKeyguardHeadsUp; private boolean mAllowExpandForSmallExpansion; private Runnable mExpandAfterLayoutRunnable; private boolean mFirstBypassAttempt; private PluginManager mPluginManager; private FrameLayout mPluginFrame; Loading Loading @@ -427,6 +449,7 @@ public class NotificationPanelView extends PanelView implements mThemeResId = context.getThemeResId(); mKeyguardBypassController = bypassController; mUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class); mFirstBypassAttempt = mKeyguardBypassController.getBypassEnabled(); dynamicPrivacyController.addListener(this); mBottomAreaShadeAlphaAnimator = ValueAnimator.ofFloat(1f, 0); Loading Loading @@ -519,6 +542,7 @@ public class NotificationPanelView extends PanelView implements Dependency.get(StatusBarStateController.class).addCallback(this); Dependency.get(ZenModeController.class).addCallback(this); Dependency.get(ConfigurationController.class).addCallback(this); mUpdateMonitor.registerCallback(mKeyguardUpdateCallback); // Theme might have changed between inflating this view and attaching it to the window, so // force a call to onThemeChanged onThemeChanged(); Loading @@ -531,6 +555,7 @@ public class NotificationPanelView extends PanelView implements Dependency.get(StatusBarStateController.class).removeCallback(this); Dependency.get(ZenModeController.class).removeCallback(this); Dependency.get(ConfigurationController.class).removeCallback(this); mUpdateMonitor.removeCallback(mKeyguardUpdateCallback); } @Override Loading Loading @@ -2366,7 +2391,9 @@ public class NotificationPanelView extends PanelView implements * mKeyguardStatusBarAnimateAlpha; newAlpha *= 1.0f - mKeyguardHeadsUpShowingAmount; mKeyguardStatusBar.setAlpha(newAlpha); mKeyguardStatusBar.setVisibility(newAlpha != 0f && !mDozing ? VISIBLE : INVISIBLE); boolean hideForBypass = mFirstBypassAttempt && mUpdateMonitor.shouldListenForFace(); mKeyguardStatusBar.setVisibility(newAlpha != 0f && !mDozing && !hideForBypass ? VISIBLE : INVISIBLE); } private void updateKeyguardBottomAreaAlpha() { Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +27 −7 Original line number Diff line number Diff line Loading @@ -21,19 +21,23 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.StatusBarManager; import android.hardware.biometrics.BiometricSourceType; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import androidx.test.filters.SmallTest; import com.android.keyguard.KeyguardStatusView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SystemUIFactory; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.FalsingManager; Loading @@ -51,7 +55,6 @@ import com.android.systemui.statusbar.notification.stack.NotificationRoundnessMa import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.InjectionInflationController; import org.junit.Before; Loading Loading @@ -101,7 +104,11 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Mock private KeyguardAffordanceHelper mAffordanceHelper; @Mock private KeyguardUpdateMonitor mUpdateMonitor; @Mock private FalsingManager mFalsingManager; @Mock private KeyguardBypassController mKeyguardBypassController; private NotificationPanelView mNotificationPanelView; @Before Loading @@ -112,22 +119,21 @@ public class NotificationPanelViewTest extends SysuiTestCase { when(mHeadsUpCallback.getContext()).thenReturn(mContext); mDependency.injectTestDependency(StatusBarStateController.class, mStatusBarStateController); mDependency.injectTestDependency(KeyguardUpdateMonitor.class, mUpdateMonitor); mDependency.injectMockDependency(ShadeController.class); mDependency.injectMockDependency(NotificationLockscreenUserManager.class); mDependency.injectMockDependency(ConfigurationController.class); mDependency.injectMockDependency(ZenModeController.class); KeyguardBypassController bypassController = new KeyguardBypassController(mContext, mock(TunerService.class), mStatusBarStateController, mock(NotificationLockscreenUserManager.class)); NotificationWakeUpCoordinator coordinator = new NotificationWakeUpCoordinator(mContext, mock(HeadsUpManagerPhone.class), new StatusBarStateControllerImpl(), bypassController); mKeyguardBypassController); PulseExpansionHandler expansionHandler = new PulseExpansionHandler(mContext, coordinator, bypassController, mHeadsUpManager, mock(NotificationRoundnessManager.class)); mKeyguardBypassController, mHeadsUpManager, mock(NotificationRoundnessManager.class)); mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler, bypassController); mKeyguardBypassController); mNotificationPanelView.setHeadsUpManager(mHeadsUpManager); mNotificationPanelView.setBar(mPanelBar); Loading Loading @@ -187,6 +193,20 @@ public class NotificationPanelViewTest extends SysuiTestCase { assertThat(mNotificationPanelView.isTrackingBlocked()).isFalse(); } @Test public void testKeyguardStatusBarVisibility_hiddenForBypass() { when(mUpdateMonitor.shouldListenForFace()).thenReturn(true); mNotificationPanelView.mKeyguardUpdateCallback.onBiometricRunningStateChanged(true, BiometricSourceType.FACE); verify(mKeyguardStatusBar, never()).setVisibility(View.VISIBLE); when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); mNotificationPanelView.mKeyguardUpdateCallback.onFinishedGoingToSleep(0); mNotificationPanelView.mKeyguardUpdateCallback.onBiometricRunningStateChanged(true, BiometricSourceType.FACE); verify(mKeyguardStatusBar, never()).setVisibility(View.VISIBLE); } private class TestableNotificationPanelView extends NotificationPanelView { TestableNotificationPanelView(NotificationWakeUpCoordinator coordinator, PulseExpansionHandler expansionHandler, Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +4 −1 Original line number Diff line number Diff line Loading @@ -1830,7 +1830,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { return shouldListen; } private boolean shouldListenForFace() { /** * If face auth is allows to scan on this exact moment. */ public boolean shouldListenForFace() { final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep; final int user = getCurrentUser(); final int strongAuth = mStrongAuthTracker.getStrongAuthForUser(user); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +28 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.Region; import android.hardware.biometrics.BiometricSourceType; import android.os.PowerManager; import android.os.SystemClock; import android.provider.DeviceConfig; Loading @@ -62,6 +63,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.keyguard.KeyguardClockSwitch; import com.android.keyguard.KeyguardStatusView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.DejankUtils; import com.android.systemui.Dependency; import com.android.systemui.Interpolators; Loading Loading @@ -172,6 +174,25 @@ public class NotificationPanelView extends PanelView implements R.id.keyguard_hun_animator_start_tag); private static final AnimationProperties KEYGUARD_HUN_PROPERTIES = new AnimationProperties().setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD); @VisibleForTesting final KeyguardUpdateMonitorCallback mKeyguardUpdateCallback = new KeyguardUpdateMonitorCallback() { @Override public void onBiometricRunningStateChanged(boolean running, BiometricSourceType biometricSourceType) { boolean keyguardOrShadeLocked = mBarState == StatusBarState.KEYGUARD || mBarState == StatusBarState.SHADE_LOCKED; if (!running && mFirstBypassAttempt && keyguardOrShadeLocked && !mDozing) { mFirstBypassAttempt = false; animateKeyguardStatusBarIn(StackStateAnimator.ANIMATION_DURATION_STANDARD); } } @Override public void onFinishedGoingToSleep(int why) { mFirstBypassAttempt = mKeyguardBypassController.getBypassEnabled(); } }; private final InjectionInflationController mInjectionInflationController; private final PowerManager mPowerManager; Loading Loading @@ -392,6 +413,7 @@ public class NotificationPanelView extends PanelView implements private boolean mShowingKeyguardHeadsUp; private boolean mAllowExpandForSmallExpansion; private Runnable mExpandAfterLayoutRunnable; private boolean mFirstBypassAttempt; private PluginManager mPluginManager; private FrameLayout mPluginFrame; Loading Loading @@ -427,6 +449,7 @@ public class NotificationPanelView extends PanelView implements mThemeResId = context.getThemeResId(); mKeyguardBypassController = bypassController; mUpdateMonitor = Dependency.get(KeyguardUpdateMonitor.class); mFirstBypassAttempt = mKeyguardBypassController.getBypassEnabled(); dynamicPrivacyController.addListener(this); mBottomAreaShadeAlphaAnimator = ValueAnimator.ofFloat(1f, 0); Loading Loading @@ -519,6 +542,7 @@ public class NotificationPanelView extends PanelView implements Dependency.get(StatusBarStateController.class).addCallback(this); Dependency.get(ZenModeController.class).addCallback(this); Dependency.get(ConfigurationController.class).addCallback(this); mUpdateMonitor.registerCallback(mKeyguardUpdateCallback); // Theme might have changed between inflating this view and attaching it to the window, so // force a call to onThemeChanged onThemeChanged(); Loading @@ -531,6 +555,7 @@ public class NotificationPanelView extends PanelView implements Dependency.get(StatusBarStateController.class).removeCallback(this); Dependency.get(ZenModeController.class).removeCallback(this); Dependency.get(ConfigurationController.class).removeCallback(this); mUpdateMonitor.removeCallback(mKeyguardUpdateCallback); } @Override Loading Loading @@ -2366,7 +2391,9 @@ public class NotificationPanelView extends PanelView implements * mKeyguardStatusBarAnimateAlpha; newAlpha *= 1.0f - mKeyguardHeadsUpShowingAmount; mKeyguardStatusBar.setAlpha(newAlpha); mKeyguardStatusBar.setVisibility(newAlpha != 0f && !mDozing ? VISIBLE : INVISIBLE); boolean hideForBypass = mFirstBypassAttempt && mUpdateMonitor.shouldListenForFace(); mKeyguardStatusBar.setVisibility(newAlpha != 0f && !mDozing && !hideForBypass ? VISIBLE : INVISIBLE); } private void updateKeyguardBottomAreaAlpha() { Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +27 −7 Original line number Diff line number Diff line Loading @@ -21,19 +21,23 @@ import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.app.StatusBarManager; import android.hardware.biometrics.BiometricSourceType; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import androidx.test.filters.SmallTest; import com.android.keyguard.KeyguardStatusView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SystemUIFactory; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.FalsingManager; Loading @@ -51,7 +55,6 @@ import com.android.systemui.statusbar.notification.stack.NotificationRoundnessMa import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.tuner.TunerService; import com.android.systemui.util.InjectionInflationController; import org.junit.Before; Loading Loading @@ -101,7 +104,11 @@ public class NotificationPanelViewTest extends SysuiTestCase { @Mock private KeyguardAffordanceHelper mAffordanceHelper; @Mock private KeyguardUpdateMonitor mUpdateMonitor; @Mock private FalsingManager mFalsingManager; @Mock private KeyguardBypassController mKeyguardBypassController; private NotificationPanelView mNotificationPanelView; @Before Loading @@ -112,22 +119,21 @@ public class NotificationPanelViewTest extends SysuiTestCase { when(mHeadsUpCallback.getContext()).thenReturn(mContext); mDependency.injectTestDependency(StatusBarStateController.class, mStatusBarStateController); mDependency.injectTestDependency(KeyguardUpdateMonitor.class, mUpdateMonitor); mDependency.injectMockDependency(ShadeController.class); mDependency.injectMockDependency(NotificationLockscreenUserManager.class); mDependency.injectMockDependency(ConfigurationController.class); mDependency.injectMockDependency(ZenModeController.class); KeyguardBypassController bypassController = new KeyguardBypassController(mContext, mock(TunerService.class), mStatusBarStateController, mock(NotificationLockscreenUserManager.class)); NotificationWakeUpCoordinator coordinator = new NotificationWakeUpCoordinator(mContext, mock(HeadsUpManagerPhone.class), new StatusBarStateControllerImpl(), bypassController); mKeyguardBypassController); PulseExpansionHandler expansionHandler = new PulseExpansionHandler(mContext, coordinator, bypassController, mHeadsUpManager, mock(NotificationRoundnessManager.class)); mKeyguardBypassController, mHeadsUpManager, mock(NotificationRoundnessManager.class)); mNotificationPanelView = new TestableNotificationPanelView(coordinator, expansionHandler, bypassController); mKeyguardBypassController); mNotificationPanelView.setHeadsUpManager(mHeadsUpManager); mNotificationPanelView.setBar(mPanelBar); Loading Loading @@ -187,6 +193,20 @@ public class NotificationPanelViewTest extends SysuiTestCase { assertThat(mNotificationPanelView.isTrackingBlocked()).isFalse(); } @Test public void testKeyguardStatusBarVisibility_hiddenForBypass() { when(mUpdateMonitor.shouldListenForFace()).thenReturn(true); mNotificationPanelView.mKeyguardUpdateCallback.onBiometricRunningStateChanged(true, BiometricSourceType.FACE); verify(mKeyguardStatusBar, never()).setVisibility(View.VISIBLE); when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); mNotificationPanelView.mKeyguardUpdateCallback.onFinishedGoingToSleep(0); mNotificationPanelView.mKeyguardUpdateCallback.onBiometricRunningStateChanged(true, BiometricSourceType.FACE); verify(mKeyguardStatusBar, never()).setVisibility(View.VISIBLE); } private class TestableNotificationPanelView extends NotificationPanelView { TestableNotificationPanelView(NotificationWakeUpCoordinator coordinator, PulseExpansionHandler expansionHandler, Loading