Loading packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt +5 −2 Original line number Diff line number Diff line Loading @@ -44,9 +44,13 @@ import platform.test.screenshot.DeviceEmulationSpec import platform.test.screenshot.MaterialYouColorsRule import platform.test.screenshot.ScreenshotTestRule import platform.test.screenshot.getEmulatedDevicePathConfig import platform.test.screenshot.matchers.BitmapMatcher /** A rule for View screenshot diff unit tests. */ class ViewScreenshotTestRule(emulationSpec: DeviceEmulationSpec) : TestRule { class ViewScreenshotTestRule( emulationSpec: DeviceEmulationSpec, private val matcher: BitmapMatcher = UnitTestBitmapMatcher ) : TestRule { private val colorsRule = MaterialYouColorsRule() private val deviceEmulationRule = DeviceEmulationRule(emulationSpec) private val screenshotRule = Loading @@ -59,7 +63,6 @@ class ViewScreenshotTestRule(emulationSpec: DeviceEmulationSpec) : TestRule { .around(deviceEmulationRule) .around(screenshotRule) .around(activityRule) private val matcher = UnitTestBitmapMatcher override fun apply(base: Statement, description: Description): Statement { return delegateRule.apply(base, description) Loading packages/SystemUI/shared/src/com/android/systemui/shared/clocks/AnimatableClockView.kt +3 −1 Original line number Diff line number Diff line Loading @@ -69,6 +69,8 @@ class AnimatableClockView @JvmOverloads constructor( private var textAnimator: TextAnimator? = null private var onTextAnimatorInitialized: Runnable? = null var timeOverrideInMillis: Long? = null val dozingWeight: Int get() = if (useBoldedVersion()) dozingWeightInternal + 100 else dozingWeightInternal Loading Loading @@ -125,7 +127,7 @@ class AnimatableClockView @JvmOverloads constructor( } fun refreshTime() { time.timeInMillis = System.currentTimeMillis() time.timeInMillis = timeOverrideInMillis ?: System.currentTimeMillis() contentDescription = DateFormat.format(descFormat, time) val formattedText = DateFormat.format(format, time) // Setting text actually triggers a layout pass (because the text view is set to Loading packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +2 −1 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ public class KeyguardClockSwitch extends RelativeLayout { private int mClockSwitchYAmount; @VisibleForTesting boolean mChildrenAreLaidOut = false; @VisibleForTesting boolean mAnimateOnLayout = true; public KeyguardClockSwitch(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -305,7 +306,7 @@ public class KeyguardClockSwitch extends RelativeLayout { super.onLayout(changed, l, t, r, b); if (mDisplayedClockSize != null && !mChildrenAreLaidOut) { post(() -> updateClockViews(mDisplayedClockSize == LARGE, /* animate */ true)); post(() -> updateClockViews(mDisplayedClockSize == LARGE, mAnimateOnLayout)); } mChildrenAreLaidOut = true; Loading Loading
packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt +5 −2 Original line number Diff line number Diff line Loading @@ -44,9 +44,13 @@ import platform.test.screenshot.DeviceEmulationSpec import platform.test.screenshot.MaterialYouColorsRule import platform.test.screenshot.ScreenshotTestRule import platform.test.screenshot.getEmulatedDevicePathConfig import platform.test.screenshot.matchers.BitmapMatcher /** A rule for View screenshot diff unit tests. */ class ViewScreenshotTestRule(emulationSpec: DeviceEmulationSpec) : TestRule { class ViewScreenshotTestRule( emulationSpec: DeviceEmulationSpec, private val matcher: BitmapMatcher = UnitTestBitmapMatcher ) : TestRule { private val colorsRule = MaterialYouColorsRule() private val deviceEmulationRule = DeviceEmulationRule(emulationSpec) private val screenshotRule = Loading @@ -59,7 +63,6 @@ class ViewScreenshotTestRule(emulationSpec: DeviceEmulationSpec) : TestRule { .around(deviceEmulationRule) .around(screenshotRule) .around(activityRule) private val matcher = UnitTestBitmapMatcher override fun apply(base: Statement, description: Description): Statement { return delegateRule.apply(base, description) Loading
packages/SystemUI/shared/src/com/android/systemui/shared/clocks/AnimatableClockView.kt +3 −1 Original line number Diff line number Diff line Loading @@ -69,6 +69,8 @@ class AnimatableClockView @JvmOverloads constructor( private var textAnimator: TextAnimator? = null private var onTextAnimatorInitialized: Runnable? = null var timeOverrideInMillis: Long? = null val dozingWeight: Int get() = if (useBoldedVersion()) dozingWeightInternal + 100 else dozingWeightInternal Loading Loading @@ -125,7 +127,7 @@ class AnimatableClockView @JvmOverloads constructor( } fun refreshTime() { time.timeInMillis = System.currentTimeMillis() time.timeInMillis = timeOverrideInMillis ?: System.currentTimeMillis() contentDescription = DateFormat.format(descFormat, time) val formattedText = DateFormat.format(format, time) // Setting text actually triggers a layout pass (because the text view is set to Loading
packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitch.java +2 −1 Original line number Diff line number Diff line Loading @@ -88,6 +88,7 @@ public class KeyguardClockSwitch extends RelativeLayout { private int mClockSwitchYAmount; @VisibleForTesting boolean mChildrenAreLaidOut = false; @VisibleForTesting boolean mAnimateOnLayout = true; public KeyguardClockSwitch(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -305,7 +306,7 @@ public class KeyguardClockSwitch extends RelativeLayout { super.onLayout(changed, l, t, r, b); if (mDisplayedClockSize != null && !mChildrenAreLaidOut) { post(() -> updateClockViews(mDisplayedClockSize == LARGE, /* animate */ true)); post(() -> updateClockViews(mDisplayedClockSize == LARGE, mAnimateOnLayout)); } mChildrenAreLaidOut = true; Loading