diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml index 6a38507b2ad75..87a9825af1cb9 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml @@ -31,7 +31,7 @@ android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:paddingStart="@dimen/clock_padding_start"> - - + + + + + + diff --git a/packages/SystemUI/res-keyguard/values/donottranslate.xml b/packages/SystemUI/res-keyguard/values/donottranslate.xml index f9872f8da1920..e677797dc4a7a 100644 --- a/packages/SystemUI/res-keyguard/values/donottranslate.xml +++ b/packages/SystemUI/res-keyguard/values/donottranslate.xml @@ -23,5 +23,11 @@ MMMd + + hm + + + Hm + 1 diff --git a/packages/SystemUI/shared/Android.bp b/packages/SystemUI/shared/Android.bp index 165f9eba6f4c7..114ea657a7583 100644 --- a/packages/SystemUI/shared/Android.bp +++ b/packages/SystemUI/shared/Android.bp @@ -47,7 +47,6 @@ android_library { ], static_libs: [ "PluginCoreLib", - "SystemUIAnimationLib", "SystemUIUnfoldLib", "androidx.dynamicanimation_dynamicanimation", "androidx.concurrent_concurrent-futures", diff --git a/packages/SystemUI/shared/res/values/attrs.xml b/packages/SystemUI/shared/res/values/attrs.xml deleted file mode 100644 index f9d66ee583da1..0000000000000 --- a/packages/SystemUI/shared/res/values/attrs.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - diff --git a/packages/SystemUI/shared/res/values/donottranslate.xml b/packages/SystemUI/shared/res/values/donottranslate.xml deleted file mode 100644 index 383d5521f1566..0000000000000 --- a/packages/SystemUI/shared/res/values/donottranslate.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - hm - - - Hm - diff --git a/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java b/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java index 1c8ffb9b56b24..3c4c1b6dc2d12 100644 --- a/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java +++ b/packages/SystemUI/src/com/android/keyguard/AnimatableClockController.java @@ -33,7 +33,6 @@ import com.android.systemui.R; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.shared.clocks.AnimatableClockView; import com.android.systemui.statusbar.policy.BatteryController; import com.android.systemui.util.ViewController; @@ -136,21 +135,6 @@ public class AnimatableClockController extends ViewController Boolean) { + fun animateCharge(dozeStateGetter: DozeStateGetter) { if (textAnimator == null || textAnimator!!.isRunning()) { // Skip charge animation if dozing animation is already playing. return } val startAnimPhase2 = Runnable { setTextStyle( - weight = if (isDozing()) dozingWeight else lockScreenWeight, + weight = if (dozeStateGetter.isDozing) dozingWeight else lockScreenWeight, textSize = -1f, color = null, animate = true, @@ -263,7 +262,7 @@ class AnimatableClockView @JvmOverloads constructor( ) } setTextStyle( - weight = if (isDozing()) lockScreenWeight else dozingWeight, + weight = if (dozeStateGetter.isDozing) lockScreenWeight else dozingWeight, textSize = -1f, color = null, animate = true, @@ -413,14 +412,14 @@ class AnimatableClockView @JvmOverloads constructor( } } - companion object { - private val TAG = AnimatableClockView::class.simpleName - const val ANIMATION_DURATION_FOLD_TO_AOD: Int = 600 - private const val DOUBLE_LINE_FORMAT_12_HOUR = "hh\nmm" - private const val DOUBLE_LINE_FORMAT_24_HOUR = "HH\nmm" - private const val DOZE_ANIM_DURATION: Long = 300 - private const val APPEAR_ANIM_DURATION: Long = 350 - private const val CHARGE_ANIM_DURATION_PHASE_0: Long = 500 - private const val CHARGE_ANIM_DURATION_PHASE_1: Long = 1000 + interface DozeStateGetter { + val isDozing: Boolean } } + +private const val DOUBLE_LINE_FORMAT_12_HOUR = "hh\nmm" +private const val DOUBLE_LINE_FORMAT_24_HOUR = "HH\nmm" +private const val DOZE_ANIM_DURATION: Long = 300 +private const val APPEAR_ANIM_DURATION: Long = 350 +private const val CHARGE_ANIM_DURATION_PHASE_0: Long = 500 +private const val CHARGE_ANIM_DURATION_PHASE_1: Long = 1000 diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/FontInterpolator.kt b/packages/SystemUI/src/com/android/keyguard/FontInterpolator.kt similarity index 99% rename from packages/SystemUI/animation/src/com/android/systemui/animation/FontInterpolator.kt rename to packages/SystemUI/src/com/android/keyguard/FontInterpolator.kt index fbaf81678b633..962c0023cf3b9 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/FontInterpolator.kt +++ b/packages/SystemUI/src/com/android/keyguard/FontInterpolator.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.animation +package com.android.keyguard import android.graphics.fonts.Font import android.graphics.fonts.FontVariationAxis diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java index fc48b3b3a9798..bd5bceb4b3f99 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java @@ -22,7 +22,6 @@ import com.android.keyguard.dagger.KeyguardStatusViewScope; import com.android.systemui.R; import com.android.systemui.animation.Interpolators; import com.android.systemui.plugins.ClockPlugin; -import com.android.systemui.shared.clocks.AnimatableClockView; import java.io.PrintWriter; import java.lang.annotation.Retention; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java index fa251946007ff..ea14b64b8b182 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java @@ -385,6 +385,17 @@ public class KeyguardClockSwitchController extends ViewController Unit ) { // Following two members are for mutable for testing purposes. - public var textInterpolator: TextInterpolator = TextInterpolator(layout) - public var animator: ValueAnimator = ValueAnimator.ofFloat(1f).apply { + internal var textInterpolator: TextInterpolator = TextInterpolator(layout) + internal var animator: ValueAnimator = ValueAnimator.ofFloat(1f).apply { duration = DEFAULT_ANIMATION_DURATION addUpdateListener { textInterpolator.progress = it.animatedValue as Float diff --git a/packages/SystemUI/animation/src/com/android/systemui/animation/TextInterpolator.kt b/packages/SystemUI/src/com/android/keyguard/TextInterpolator.kt similarity index 99% rename from packages/SystemUI/animation/src/com/android/systemui/animation/TextInterpolator.kt rename to packages/SystemUI/src/com/android/keyguard/TextInterpolator.kt index ff64c78911285..20dbe29efb35f 100644 --- a/packages/SystemUI/animation/src/com/android/systemui/animation/TextInterpolator.kt +++ b/packages/SystemUI/src/com/android/keyguard/TextInterpolator.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.systemui.animation +package com.android.keyguard import android.graphics.Canvas import android.graphics.Paint diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java index 174bf4c27de8b..7c9df426aba60 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java @@ -25,7 +25,6 @@ import android.view.View; import com.android.keyguard.KeyguardSliceView; import com.android.systemui.R; import com.android.systemui.animation.Interpolators; -import com.android.systemui.shared.clocks.AnimatableClockView; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.StatusBarIconView; import com.android.systemui.statusbar.notification.collection.NotificationEntry; @@ -53,8 +52,7 @@ public class StackStateAnimator { public static final int ANIMATION_DURATION_CLOSE_REMOTE_INPUT = 150; public static final int ANIMATION_DURATION_HEADS_UP_APPEAR = 400; public static final int ANIMATION_DURATION_HEADS_UP_DISAPPEAR = 400; - public static final int ANIMATION_DURATION_FOLD_TO_AOD = - AnimatableClockView.ANIMATION_DURATION_FOLD_TO_AOD; + public static final int ANIMATION_DURATION_FOLD_TO_AOD = 600; public static final int ANIMATION_DURATION_PULSE_APPEAR = KeyguardSliceView.DEFAULT_ANIM_DURATION; public static final int ANIMATION_DURATION_BLOCKING_HELPER_FADE = 240; diff --git a/packages/SystemUI/tests/src/com/android/systemui/animation/FontInterpolatorTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/FontInterpolatorTest.kt similarity index 99% rename from packages/SystemUI/tests/src/com/android/systemui/animation/FontInterpolatorTest.kt rename to packages/SystemUI/tests/src/com/android/keyguard/FontInterpolatorTest.kt index f01da2dd3a6bb..95fa3b9c594bc 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/animation/FontInterpolatorTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/FontInterpolatorTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.animation +package com.android.keyguard import android.graphics.Paint import android.graphics.fonts.Font diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java index a553d2320fff4..fe9e75c4ce006 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchControllerTest.java @@ -51,7 +51,6 @@ import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.plugins.ClockPlugin; import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.shared.clocks.AnimatableClockView; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController; import com.android.systemui.statusbar.phone.KeyguardBypassController; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java index 6c6f0acd70859..8717a0eaf57fd 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardClockSwitchTest.java @@ -43,7 +43,6 @@ import android.widget.TextClock; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.ClockPlugin; -import com.android.systemui.shared.clocks.AnimatableClockView; import com.android.systemui.statusbar.StatusBarState; import org.junit.Before; diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java index 0846317766245..650a5d0a87129 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardStatusViewControllerTest.java @@ -87,6 +87,28 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase { verify(mKeyguardClockSwitchController).refresh(); } + @Test + public void timeFormatUpdateNotifiesClockSwitchController() { + mController.onViewAttached(); + + verify(mKeyguardUpdateMonitor).registerCallback( + mKeyguardUpdateMonitorCallbackCaptor.capture()); + + mKeyguardUpdateMonitorCallbackCaptor.getValue().onTimeFormatChanged(""); + verify(mKeyguardClockSwitchController).refreshFormat(); + } + + @Test + public void userChangeNotifiesClockSwitchController() { + mController.onViewAttached(); + + verify(mKeyguardUpdateMonitor).registerCallback( + mKeyguardUpdateMonitorCallbackCaptor.capture()); + + mKeyguardUpdateMonitorCallbackCaptor.getValue().onUserSwitchComplete(0); + verify(mKeyguardClockSwitchController).refreshFormat(); + } + @Test public void setTranslationYExcludingMedia_forwardsCallToView() { float translationY = 123f; diff --git a/packages/SystemUI/tests/src/com/android/systemui/animation/TextAnimatorTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/TextAnimatorTest.kt similarity index 99% rename from packages/SystemUI/tests/src/com/android/systemui/animation/TextAnimatorTest.kt rename to packages/SystemUI/tests/src/com/android/keyguard/TextAnimatorTest.kt index d7aa6e063d1ec..3322414e9e7ad 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/animation/TextAnimatorTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/TextAnimatorTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.animation +package com.android.keyguard import android.animation.AnimatorListenerAdapter import android.animation.ValueAnimator diff --git a/packages/SystemUI/tests/src/com/android/systemui/animation/TextInterpolatorTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/TextInterpolatorTest.kt similarity index 99% rename from packages/SystemUI/tests/src/com/android/systemui/animation/TextInterpolatorTest.kt rename to packages/SystemUI/tests/src/com/android/keyguard/TextInterpolatorTest.kt index 02d4ecd665fce..603cf3bcef745 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/animation/TextInterpolatorTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/TextInterpolatorTest.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui.animation +package com.android.keyguard import android.graphics.Bitmap import android.graphics.Canvas diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/AnimatableClockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/AnimatableClockControllerTest.java index df506b479b88a..5a4bb86dba451 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/AnimatableClockControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/AnimatableClockControllerTest.java @@ -34,12 +34,12 @@ import android.view.View; import androidx.test.filters.SmallTest; import com.android.keyguard.AnimatableClockController; +import com.android.keyguard.AnimatableClockView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.settingslib.Utils; import com.android.systemui.SysuiTestCase; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.plugins.statusbar.StatusBarStateController; -import com.android.systemui.shared.clocks.AnimatableClockView; import com.android.systemui.statusbar.policy.BatteryController; import org.junit.After;