Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt +3 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,9 @@ data class ClockConfig( */ val hasCustomPositionUpdatedAnimation: Boolean = false, /** Transition to AOD should move smartspace like large clock instead of small clock */ val useAlternateSmartspaceAODTransition: Boolean = false, /** True if the clock will react to tone changes in the seed color. */ val isReactiveToTone: Boolean = true, ) Loading packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +21 −5 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV */ private static final int KEYGUARD_STATUS_VIEW_CUSTOM_CLOCK_MOVE_DURATION = 1000; private static final AnimationProperties CLOCK_ANIMATION_PROPERTIES = public static final AnimationProperties CLOCK_ANIMATION_PROPERTIES = new AnimationProperties().setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD); private final KeyguardSliceViewController mKeyguardSliceViewController; Loading Loading @@ -221,16 +221,32 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV mView.setImportantForAccessibility(mode); } @VisibleForTesting void setProperty(AnimatableProperty property, float value, boolean animate) { PropertyAnimator.setProperty(mView, property, value, CLOCK_ANIMATION_PROPERTIES, animate); } /** * Update position of the view with an optional animation */ public void updatePosition(int x, int y, float scale, boolean animate) { float oldY = mView.getY(); PropertyAnimator.setProperty(mView, AnimatableProperty.Y, y, CLOCK_ANIMATION_PROPERTIES, animate); setProperty(AnimatableProperty.Y, y, animate); ClockController clock = mKeyguardClockSwitchController.getClock(); if (clock != null && clock.getConfig().getUseAlternateSmartspaceAODTransition()) { // If requested, scale the entire view instead of just the clock view mKeyguardClockSwitchController.updatePosition(x, 1f /* scale */, CLOCK_ANIMATION_PROPERTIES, animate); setProperty(AnimatableProperty.SCALE_X, scale, animate); setProperty(AnimatableProperty.SCALE_Y, scale, animate); } else { mKeyguardClockSwitchController.updatePosition(x, scale, CLOCK_ANIMATION_PROPERTIES, animate); setProperty(AnimatableProperty.SCALE_X, 1f, animate); setProperty(AnimatableProperty.SCALE_Y, 1f, animate); } mKeyguardClockSwitchController.updatePosition(x, scale, CLOCK_ANIMATION_PROPERTIES, animate); if (oldY != y) { mKeyguardClockSwitchController.updateKeyguardStatusViewOffset(); } Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java +45 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.keyguard; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; Loading @@ -25,6 +27,9 @@ import com.android.internal.jank.InteractionJankMonitor; import com.android.keyguard.logging.KeyguardLogger; import com.android.systemui.SysuiTestCase; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.plugins.ClockConfig; import com.android.systemui.plugins.ClockController; import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.ScreenOffAnimationController; import com.android.systemui.statusbar.policy.ConfigurationController; Loading Loading @@ -76,7 +81,16 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { mScreenOffAnimationController, mKeyguardLogger, mFeatureFlags, mInteractionJankMonitor); mInteractionJankMonitor) { @Override void setProperty( AnimatableProperty property, float value, boolean animate) { // Route into the mock version for verification mControllerMock.setProperty(property, value, animate); } }; } @Test Loading Loading @@ -111,4 +125,34 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { configurationListenerArgumentCaptor.getValue().onLocaleListChanged(); verify(mKeyguardClockSwitchController).onLocaleListChanged(); } @Test public void updatePosition_primaryClockAnimation() { ClockController mockClock = mock(ClockController.class); when(mKeyguardClockSwitchController.getClock()).thenReturn(mockClock); when(mockClock.getConfig()).thenReturn(new ClockConfig(false, false, true)); mController.updatePosition(10, 15, 20f, true); verify(mControllerMock).setProperty(AnimatableProperty.Y, 15f, true); verify(mKeyguardClockSwitchController).updatePosition( 10, 20f, KeyguardStatusViewController.CLOCK_ANIMATION_PROPERTIES, true); verify(mControllerMock).setProperty(AnimatableProperty.SCALE_X, 1f, true); verify(mControllerMock).setProperty(AnimatableProperty.SCALE_Y, 1f, true); } @Test public void updatePosition_alternateClockAnimation() { ClockController mockClock = mock(ClockController.class); when(mKeyguardClockSwitchController.getClock()).thenReturn(mockClock); when(mockClock.getConfig()).thenReturn(new ClockConfig(false, true, true)); mController.updatePosition(10, 15, 20f, true); verify(mControllerMock).setProperty(AnimatableProperty.Y, 15f, true); verify(mKeyguardClockSwitchController).updatePosition( 10, 1f, KeyguardStatusViewController.CLOCK_ANIMATION_PROPERTIES, true); verify(mControllerMock).setProperty(AnimatableProperty.SCALE_X, 20f, true); verify(mControllerMock).setProperty(AnimatableProperty.SCALE_Y, 20f, true); } } Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt +3 −0 Original line number Diff line number Diff line Loading @@ -199,6 +199,9 @@ data class ClockConfig( */ val hasCustomPositionUpdatedAnimation: Boolean = false, /** Transition to AOD should move smartspace like large clock instead of small clock */ val useAlternateSmartspaceAODTransition: Boolean = false, /** True if the clock will react to tone changes in the seed color. */ val isReactiveToTone: Boolean = true, ) Loading
packages/SystemUI/src/com/android/keyguard/KeyguardStatusViewController.java +21 −5 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV */ private static final int KEYGUARD_STATUS_VIEW_CUSTOM_CLOCK_MOVE_DURATION = 1000; private static final AnimationProperties CLOCK_ANIMATION_PROPERTIES = public static final AnimationProperties CLOCK_ANIMATION_PROPERTIES = new AnimationProperties().setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD); private final KeyguardSliceViewController mKeyguardSliceViewController; Loading Loading @@ -221,16 +221,32 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV mView.setImportantForAccessibility(mode); } @VisibleForTesting void setProperty(AnimatableProperty property, float value, boolean animate) { PropertyAnimator.setProperty(mView, property, value, CLOCK_ANIMATION_PROPERTIES, animate); } /** * Update position of the view with an optional animation */ public void updatePosition(int x, int y, float scale, boolean animate) { float oldY = mView.getY(); PropertyAnimator.setProperty(mView, AnimatableProperty.Y, y, CLOCK_ANIMATION_PROPERTIES, animate); setProperty(AnimatableProperty.Y, y, animate); ClockController clock = mKeyguardClockSwitchController.getClock(); if (clock != null && clock.getConfig().getUseAlternateSmartspaceAODTransition()) { // If requested, scale the entire view instead of just the clock view mKeyguardClockSwitchController.updatePosition(x, 1f /* scale */, CLOCK_ANIMATION_PROPERTIES, animate); setProperty(AnimatableProperty.SCALE_X, scale, animate); setProperty(AnimatableProperty.SCALE_Y, scale, animate); } else { mKeyguardClockSwitchController.updatePosition(x, scale, CLOCK_ANIMATION_PROPERTIES, animate); setProperty(AnimatableProperty.SCALE_X, 1f, animate); setProperty(AnimatableProperty.SCALE_Y, 1f, animate); } mKeyguardClockSwitchController.updatePosition(x, scale, CLOCK_ANIMATION_PROPERTIES, animate); if (oldY != y) { mKeyguardClockSwitchController.updateKeyguardStatusViewOffset(); } Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java +45 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.keyguard; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.test.suitebuilder.annotation.SmallTest; import android.testing.AndroidTestingRunner; Loading @@ -25,6 +27,9 @@ import com.android.internal.jank.InteractionJankMonitor; import com.android.keyguard.logging.KeyguardLogger; import com.android.systemui.SysuiTestCase; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.plugins.ClockConfig; import com.android.systemui.plugins.ClockController; import com.android.systemui.statusbar.notification.AnimatableProperty; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.ScreenOffAnimationController; import com.android.systemui.statusbar.policy.ConfigurationController; Loading Loading @@ -76,7 +81,16 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { mScreenOffAnimationController, mKeyguardLogger, mFeatureFlags, mInteractionJankMonitor); mInteractionJankMonitor) { @Override void setProperty( AnimatableProperty property, float value, boolean animate) { // Route into the mock version for verification mControllerMock.setProperty(property, value, animate); } }; } @Test Loading Loading @@ -111,4 +125,34 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { configurationListenerArgumentCaptor.getValue().onLocaleListChanged(); verify(mKeyguardClockSwitchController).onLocaleListChanged(); } @Test public void updatePosition_primaryClockAnimation() { ClockController mockClock = mock(ClockController.class); when(mKeyguardClockSwitchController.getClock()).thenReturn(mockClock); when(mockClock.getConfig()).thenReturn(new ClockConfig(false, false, true)); mController.updatePosition(10, 15, 20f, true); verify(mControllerMock).setProperty(AnimatableProperty.Y, 15f, true); verify(mKeyguardClockSwitchController).updatePosition( 10, 20f, KeyguardStatusViewController.CLOCK_ANIMATION_PROPERTIES, true); verify(mControllerMock).setProperty(AnimatableProperty.SCALE_X, 1f, true); verify(mControllerMock).setProperty(AnimatableProperty.SCALE_Y, 1f, true); } @Test public void updatePosition_alternateClockAnimation() { ClockController mockClock = mock(ClockController.class); when(mKeyguardClockSwitchController.getClock()).thenReturn(mockClock); when(mockClock.getConfig()).thenReturn(new ClockConfig(false, true, true)); mController.updatePosition(10, 15, 20f, true); verify(mControllerMock).setProperty(AnimatableProperty.Y, 15f, true); verify(mKeyguardClockSwitchController).updatePosition( 10, 1f, KeyguardStatusViewController.CLOCK_ANIMATION_PROPERTIES, true); verify(mControllerMock).setProperty(AnimatableProperty.SCALE_X, 20f, true); verify(mControllerMock).setProperty(AnimatableProperty.SCALE_Y, 20f, true); } }