Loading packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +7 −10 Original line number Diff line number Diff line Loading @@ -59,8 +59,6 @@ import android.graphics.Color; import android.graphics.Insets; import android.graphics.Rect; import android.graphics.Region; import android.hardware.biometrics.SensorLocationInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.os.Bundle; import android.os.Handler; import android.os.PowerManager; Loading Loading @@ -224,8 +222,6 @@ import com.android.systemui.util.Utils; import com.android.systemui.util.time.SystemClock; import com.android.wm.shell.animation.FlingAnimationUtils; import kotlin.Unit; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; Loading @@ -236,6 +232,8 @@ import java.util.function.Consumer; import javax.inject.Inject; import javax.inject.Provider; import kotlin.Unit; import kotlinx.coroutines.CoroutineDispatcher; @CentralSurfacesComponent.CentralSurfacesScope Loading Loading @@ -410,7 +408,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private int mDisplayRightInset = 0; // in pixels private int mDisplayLeftInset = 0; // in pixels private final KeyguardClockPositionAlgorithm @VisibleForTesting KeyguardClockPositionAlgorithm mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm(); private final KeyguardClockPositionAlgorithm.Result Loading Loading @@ -1493,11 +1492,9 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump ? 1.0f : mInterpolatedDarkAmount; float udfpsAodTopLocation = -1f; if (mUpdateMonitor.isUdfpsEnrolled() && mAuthController.getUdfpsProps().size() > 0) { FingerprintSensorPropertiesInternal props = mAuthController.getUdfpsProps().get(0); final SensorLocationInternal location = props.getLocation(); udfpsAodTopLocation = location.sensorLocationY - location.sensorRadius - mUdfpsMaxYBurnInOffset; if (mUpdateMonitor.isUdfpsEnrolled() && mAuthController.getUdfpsLocation() != null) { udfpsAodTopLocation = mAuthController.getUdfpsLocation().y - mAuthController.getUdfpsRadius() - mUdfpsMaxYBurnInOffset; } mClockPositionAlgorithm.setup( Loading packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock protected ActivityStarter mActivityStarter; @Mock protected KeyguardFaceAuthInteractor mKeyguardFaceAuthInteractor; protected final int mMaxUdfpsBurnInOffsetY = 5; protected KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor; protected KeyguardInteractor mKeyguardInteractor; protected NotificationPanelViewController.TouchHandler mTouchHandler; Loading Loading @@ -365,6 +366,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { when(mResources.getDisplayMetrics()).thenReturn(mDisplayMetrics); mDisplayMetrics.density = 100; when(mResources.getBoolean(R.bool.config_enableNotificationShadeDrag)).thenReturn(true); when(mResources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_y)) .thenReturn(mMaxUdfpsBurnInOffsetY); when(mResources.getDimensionPixelSize(R.dimen.notifications_top_padding_split_shade)) .thenReturn(NOTIFICATION_SCRIM_TOP_PADDING_IN_SPLIT_SHADE); when(mResources.getDimensionPixelSize(R.dimen.notification_panel_margin_horizontal)) Loading packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +40 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; Loading @@ -44,6 +45,7 @@ import static org.mockito.Mockito.when; import android.animation.Animator; import android.animation.ValueAnimator; import android.graphics.Point; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.MotionEvent; Loading @@ -61,6 +63,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener; import com.android.systemui.statusbar.notification.stack.AmbientState; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; import com.android.systemui.statusbar.phone.KeyguardClockPositionAlgorithm; import org.junit.Before; import org.junit.Ignore; Loading Loading @@ -250,6 +253,43 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo assertThat(mStatusBarStateController.getDozeAmount()).isEqualTo(1f); } @Test public void testOnDozeAmountChanged_positionClockAndNotificationsUsesUdfpsLocation() { // GIVEN UDFPS is enrolled and we're on the keyguard final Point udfpsLocationCenter = new Point(0, 100); final float udfpsRadius = 10f; when(mUpdateMonitor.isUdfpsEnrolled()).thenReturn(true); when(mAuthController.getUdfpsLocation()).thenReturn(udfpsLocationCenter); when(mAuthController.getUdfpsRadius()).thenReturn(udfpsRadius); mNotificationPanelViewController.getStatusBarStateListener().onStateChanged(KEYGUARD); // WHEN the doze amount changes mNotificationPanelViewController.mClockPositionAlgorithm = mock( KeyguardClockPositionAlgorithm.class); mNotificationPanelViewController.getStatusBarStateListener().onDozeAmountChanged(1f, 1f); // THEN the clock positions accounts for the UDFPS location & its worst case burn in final float udfpsTop = udfpsLocationCenter.y - udfpsRadius - mMaxUdfpsBurnInOffsetY; verify(mNotificationPanelViewController.mClockPositionAlgorithm).setup( anyInt(), anyFloat(), anyInt(), anyInt(), anyInt(), /* darkAmount */ eq(1f), anyFloat(), anyBoolean(), anyInt(), anyFloat(), anyInt(), anyBoolean(), /* udfpsTop */ eq(udfpsTop), anyFloat(), anyBoolean() ); } @Test public void testSetExpandedHeight() { mNotificationPanelViewController.setExpandedHeight(200); Loading Loading
packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +7 −10 Original line number Diff line number Diff line Loading @@ -59,8 +59,6 @@ import android.graphics.Color; import android.graphics.Insets; import android.graphics.Rect; import android.graphics.Region; import android.hardware.biometrics.SensorLocationInternal; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.os.Bundle; import android.os.Handler; import android.os.PowerManager; Loading Loading @@ -224,8 +222,6 @@ import com.android.systemui.util.Utils; import com.android.systemui.util.time.SystemClock; import com.android.wm.shell.animation.FlingAnimationUtils; import kotlin.Unit; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; Loading @@ -236,6 +232,8 @@ import java.util.function.Consumer; import javax.inject.Inject; import javax.inject.Provider; import kotlin.Unit; import kotlinx.coroutines.CoroutineDispatcher; @CentralSurfacesComponent.CentralSurfacesScope Loading Loading @@ -410,7 +408,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private int mDisplayRightInset = 0; // in pixels private int mDisplayLeftInset = 0; // in pixels private final KeyguardClockPositionAlgorithm @VisibleForTesting KeyguardClockPositionAlgorithm mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm(); private final KeyguardClockPositionAlgorithm.Result Loading Loading @@ -1493,11 +1492,9 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump ? 1.0f : mInterpolatedDarkAmount; float udfpsAodTopLocation = -1f; if (mUpdateMonitor.isUdfpsEnrolled() && mAuthController.getUdfpsProps().size() > 0) { FingerprintSensorPropertiesInternal props = mAuthController.getUdfpsProps().get(0); final SensorLocationInternal location = props.getLocation(); udfpsAodTopLocation = location.sensorLocationY - location.sensorRadius - mUdfpsMaxYBurnInOffset; if (mUpdateMonitor.isUdfpsEnrolled() && mAuthController.getUdfpsLocation() != null) { udfpsAodTopLocation = mAuthController.getUdfpsLocation().y - mAuthController.getUdfpsRadius() - mUdfpsMaxYBurnInOffset; } mClockPositionAlgorithm.setup( Loading
packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +3 −0 Original line number Diff line number Diff line Loading @@ -305,6 +305,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock protected ActivityStarter mActivityStarter; @Mock protected KeyguardFaceAuthInteractor mKeyguardFaceAuthInteractor; protected final int mMaxUdfpsBurnInOffsetY = 5; protected KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor; protected KeyguardInteractor mKeyguardInteractor; protected NotificationPanelViewController.TouchHandler mTouchHandler; Loading Loading @@ -365,6 +366,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { when(mResources.getDisplayMetrics()).thenReturn(mDisplayMetrics); mDisplayMetrics.density = 100; when(mResources.getBoolean(R.bool.config_enableNotificationShadeDrag)).thenReturn(true); when(mResources.getDimensionPixelSize(R.dimen.udfps_burn_in_offset_y)) .thenReturn(mMaxUdfpsBurnInOffsetY); when(mResources.getDimensionPixelSize(R.dimen.notifications_top_padding_split_shade)) .thenReturn(NOTIFICATION_SCRIM_TOP_PADDING_IN_SPLIT_SHADE); when(mResources.getDimensionPixelSize(R.dimen.notification_panel_margin_horizontal)) Loading
packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +40 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyFloat; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; Loading @@ -44,6 +45,7 @@ import static org.mockito.Mockito.when; import android.animation.Animator; import android.animation.ValueAnimator; import android.graphics.Point; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.MotionEvent; Loading @@ -61,6 +63,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableView; import com.android.systemui.statusbar.notification.row.ExpandableView.OnHeightChangedListener; import com.android.systemui.statusbar.notification.stack.AmbientState; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; import com.android.systemui.statusbar.phone.KeyguardClockPositionAlgorithm; import org.junit.Before; import org.junit.Ignore; Loading Loading @@ -250,6 +253,43 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo assertThat(mStatusBarStateController.getDozeAmount()).isEqualTo(1f); } @Test public void testOnDozeAmountChanged_positionClockAndNotificationsUsesUdfpsLocation() { // GIVEN UDFPS is enrolled and we're on the keyguard final Point udfpsLocationCenter = new Point(0, 100); final float udfpsRadius = 10f; when(mUpdateMonitor.isUdfpsEnrolled()).thenReturn(true); when(mAuthController.getUdfpsLocation()).thenReturn(udfpsLocationCenter); when(mAuthController.getUdfpsRadius()).thenReturn(udfpsRadius); mNotificationPanelViewController.getStatusBarStateListener().onStateChanged(KEYGUARD); // WHEN the doze amount changes mNotificationPanelViewController.mClockPositionAlgorithm = mock( KeyguardClockPositionAlgorithm.class); mNotificationPanelViewController.getStatusBarStateListener().onDozeAmountChanged(1f, 1f); // THEN the clock positions accounts for the UDFPS location & its worst case burn in final float udfpsTop = udfpsLocationCenter.y - udfpsRadius - mMaxUdfpsBurnInOffsetY; verify(mNotificationPanelViewController.mClockPositionAlgorithm).setup( anyInt(), anyFloat(), anyInt(), anyInt(), anyInt(), /* darkAmount */ eq(1f), anyFloat(), anyBoolean(), anyInt(), anyFloat(), anyInt(), anyBoolean(), /* udfpsTop */ eq(udfpsTop), anyFloat(), anyBoolean() ); } @Test public void testSetExpandedHeight() { mNotificationPanelViewController.setExpandedHeight(200); Loading