diff options
| author | 2022-05-23 15:02:17 +0000 | |
|---|---|---|
| committer | 2022-05-23 15:02:17 +0000 | |
| commit | 2274df1efbe32febaaad1a6c34a9dfea4ee6fc13 (patch) | |
| tree | 58008de1ee8481637f3969dc03fb618bd7be5f4e | |
| parent | 0559661c13528919c9391aa936abdf409525943d (diff) | |
| parent | 209f3c92b8e3880a3a3ace0024ce77835c8127cb (diff) | |
Merge "Offset bounds by card top padding to align lockscreen/launcher smartspaces." into tm-dev
4 files changed, 24 insertions, 0 deletions
diff --git a/packages/SystemUI/plugin/bcsmartspace/src/com/android/systemui/plugins/BcSmartspaceDataPlugin.java b/packages/SystemUI/plugin/bcsmartspace/src/com/android/systemui/plugins/BcSmartspaceDataPlugin.java index f492c069ac7e..3cf76456de91 100644 --- a/packages/SystemUI/plugin/bcsmartspace/src/com/android/systemui/plugins/BcSmartspaceDataPlugin.java +++ b/packages/SystemUI/plugin/bcsmartspace/src/com/android/systemui/plugins/BcSmartspaceDataPlugin.java @@ -134,6 +134,12 @@ public interface BcSmartspaceDataPlugin extends Plugin { * Get the index of the currently selected page. */ int getSelectedPage(); + + /** + * Return the top padding value from the currently visible card, or 0 if there is no current + * card. + */ + int getCurrentCardTopPadding(); } /** Interface for launching Intents, which can differ on the lockscreen */ diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt index 6dfc5e192abb..d63403033723 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt @@ -409,7 +409,19 @@ class KeyguardUnlockAnimationController @Inject constructor( if (willUnlockWithSmartspaceTransition) { lockscreenSmartspaceBounds = Rect().apply { lockscreenSmartspace!!.getBoundsOnScreen(this) + + // The smartspace container on the lockscreen has left and top padding to align it + // with other lockscreen content. This padding is inside the bounds on screen, so + // add it to those bounds so that the padding-less launcher smartspace is properly + // aligned. offset(lockscreenSmartspace!!.paddingLeft, lockscreenSmartspace!!.paddingTop) + + // Also offset by the current card's top padding, if it has any. This allows us to + // align the tops of the lockscreen/launcher smartspace cards. Some cards, such as + // the three-line date/weather/alarm card, only have three lines on lockscreen but + // two on launcher. + offset(0, (lockscreenSmartspace + as? BcSmartspaceDataPlugin.SmartspaceView)?.currentCardTopPadding ?: 0) } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/smartspace/DreamSmartspaceControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/smartspace/DreamSmartspaceControllerTest.kt index 834090057334..2cfe6be5c6b2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/smartspace/DreamSmartspaceControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/smartspace/DreamSmartspaceControllerTest.kt @@ -151,6 +151,8 @@ class DreamSmartspaceControllerTest : SysuiTestCase() { override fun setMediaTarget(target: SmartspaceTarget?) {} override fun getSelectedPage(): Int { return 0; } + + override fun getCurrentCardTopPadding(): Int { return 0; } } /** diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt index 64aa7fb57da8..b44f53c67714 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/lockscreen/LockscreenSmartspaceControllerTest.kt @@ -603,6 +603,10 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() { override fun getSelectedPage(): Int { return -1 } + + override fun getCurrentCardTopPadding(): Int { + return 0 + } }) } } |