diff options
| author | 2024-02-01 22:42:56 +0000 | |
|---|---|---|
| committer | 2024-02-15 15:58:34 +0000 | |
| commit | 99b8fd73bf95dacb4157694204444e87a8b42f11 (patch) | |
| tree | 0524df22011e2ef07893d80eb7625e76571b2282 | |
| parent | 10c4811d1a6eaa9018c2539f17b7a9eef10115df (diff) | |
NPVC should uses the top of the DeviceEntryIcon to calc space for notifs
This handles when device_entry_udfps_refactor is enabled and the nssl
migration is not enabled.
Test: atest NotificationPanelViewControllerTest
Flag: ACONFIG com.android.systemui.device_entry_udfps_refactor DEVELOPMENT
Fixes: 323404505
Change-Id: Iaf0831851f498bec9716d85b7da2c4fc7b83e31e
3 files changed, 37 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 9a03393be979..9acab4e56d58 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -122,6 +122,7 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.DisplayId; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInteractor; +import com.android.systemui.deviceentry.shared.DeviceEntryUdfpsRefactor; import com.android.systemui.doze.DozeLog; import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpsysTableLogger; @@ -1826,7 +1827,14 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump /** Returns space between top of lock icon and bottom of NotificationStackScrollLayout. */ private float getLockIconPadding() { float lockIconPadding = 0f; - if (mLockIconViewController.getTop() != 0f) { + if (DeviceEntryUdfpsRefactor.isEnabled()) { + View deviceEntryIconView = mKeyguardViewConfigurator.getKeyguardRootView() + .findViewById(R.id.device_entry_icon_view); + if (deviceEntryIconView != null) { + lockIconPadding = mNotificationStackScrollLayoutController.getBottom() + - deviceEntryIconView.getTop(); + } + } else if (mLockIconViewController.getTop() != 0f) { lockIconPadding = mNotificationStackScrollLayoutController.getBottom() - mLockIconViewController.getTop(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 44b897447759..78d9475b878a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -103,6 +103,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractorFactory; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; import com.android.systemui.keyguard.domain.interactor.NaturalScrollingSettingObserver; +import com.android.systemui.keyguard.ui.view.KeyguardRootView; import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingLockscreenHostedTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingTransitionViewModel; @@ -280,6 +281,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock protected UiEventLogger mUiEventLogger; @Mock protected LockIconViewController mLockIconViewController; @Mock protected KeyguardViewConfigurator mKeyguardViewConfigurator; + @Mock protected KeyguardRootView mKeyguardRootView; + @Mock protected View mKeyguardRootViewChild; @Mock protected KeyguardMediaController mKeyguardMediaController; @Mock protected NavigationModeController mNavigationModeController; @Mock protected NavigationBarController mNavigationBarController; @@ -389,6 +392,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mSetFlagsRule.disableFlags(com.android.systemui.Flags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR); mSetFlagsRule.disableFlags(com.android.systemui.Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT); + mSetFlagsRule.disableFlags(com.android.systemui.Flags.FLAG_DEVICE_ENTRY_UDFPS_REFACTOR); mMainDispatcher = getMainDispatcher(); KeyguardInteractorFactory.WithDependencies keyguardInteractorDeps = @@ -835,6 +839,10 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { when(mNotificationStackScrollLayoutController.getBottom()).thenReturn(stackBottom); when(mLockIconViewController.getTop()).thenReturn((float) (stackBottom - lockIconPadding)); + when(mKeyguardRootViewChild.getTop()).thenReturn((int) (stackBottom - lockIconPadding)); + when(mKeyguardRootView.findViewById(anyInt())).thenReturn(mKeyguardRootViewChild); + when(mKeyguardViewConfigurator.getKeyguardRootView()).thenReturn(mKeyguardRootView); + when(mResources.getDimensionPixelSize(R.dimen.keyguard_indication_bottom_padding)) .thenReturn(indicationPadding); mNotificationPanelViewController.loadDimens(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java index 059053c58e39..d24fe1b16ef9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java @@ -203,6 +203,10 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo when(mNotificationStackScrollLayoutController.getShelfHeight()).thenReturn(5); assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) .isEqualTo(5); + + mSetFlagsRule.enableFlags(com.android.systemui.Flags.FLAG_DEVICE_ENTRY_UDFPS_REFACTOR); + assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) + .isEqualTo(5); } @Test @@ -216,6 +220,10 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo when(mNotificationStackScrollLayoutController.getShelfHeight()).thenReturn(5); assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) .isEqualTo(0); + + mSetFlagsRule.enableFlags(com.android.systemui.Flags.FLAG_DEVICE_ENTRY_UDFPS_REFACTOR); + assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) + .isEqualTo(0); } @Test @@ -229,6 +237,10 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo when(mNotificationStackScrollLayoutController.getShelfHeight()).thenReturn(5); assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) .isEqualTo(0); + + mSetFlagsRule.enableFlags(com.android.systemui.Flags.FLAG_DEVICE_ENTRY_UDFPS_REFACTOR); + assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) + .isEqualTo(0); } @Test @@ -242,6 +254,10 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo when(mNotificationStackScrollLayoutController.getShelfHeight()).thenReturn(5); assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) .isEqualTo(2); + + mSetFlagsRule.enableFlags(com.android.systemui.Flags.FLAG_DEVICE_ENTRY_UDFPS_REFACTOR); + assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) + .isEqualTo(2); } @Test @@ -255,6 +271,10 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo when(mNotificationStackScrollLayoutController.getShelfHeight()).thenReturn(5); assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) .isEqualTo(0); + + mSetFlagsRule.enableFlags(com.android.systemui.Flags.FLAG_DEVICE_ENTRY_UDFPS_REFACTOR); + assertThat(mNotificationPanelViewController.getVerticalSpaceForLockscreenShelf()) + .isEqualTo(0); } @Test |