diff --git a/packages/SystemUI/ktfmt_includes.txt b/packages/SystemUI/ktfmt_includes.txt index 7c845ced66f8e..72757121d53fd 100644 --- a/packages/SystemUI/ktfmt_includes.txt +++ b/packages/SystemUI/ktfmt_includes.txt @@ -39,6 +39,7 @@ -packages/SystemUI/src-release/com/android/systemui/flags/FlagsModule.kt -packages/SystemUI/src/com/android/keyguard/ActiveUnlockConfig.kt -packages/SystemUI/src/com/android/keyguard/BouncerPanelExpansionCalculator.kt +-packages/SystemUI/src/com/android/keyguard/ClockEventController.kt -packages/SystemUI/src/com/android/keyguard/KeyguardBiometricLockoutLogger.kt -packages/SystemUI/src/com/android/keyguard/KeyguardListenModel.kt -packages/SystemUI/src/com/android/keyguard/KeyguardListenQueue.kt @@ -156,6 +157,8 @@ -packages/SystemUI/src/com/android/systemui/controls/ui/ToggleRangeBehavior.kt -packages/SystemUI/src/com/android/systemui/controls/ui/TouchBehavior.kt -packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt +-packages/SystemUI/src/com/android/systemui/decor/CutoutDecorProviderFactory.kt +-packages/SystemUI/src/com/android/systemui/decor/CutoutDecorProviderImpl.kt -packages/SystemUI/src/com/android/systemui/decor/DecorProvider.kt -packages/SystemUI/src/com/android/systemui/decor/DecorProviderFactory.kt -packages/SystemUI/src/com/android/systemui/decor/FaceScanningProviderFactory.kt @@ -246,6 +249,7 @@ -packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt -packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/ChipStateSender.kt -packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttChipControllerSender.kt +-packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttChipRootView.kt -packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderLogger.kt -packages/SystemUI/src/com/android/systemui/media/taptotransfer/sender/MediaTttSenderUiEventLogger.kt -packages/SystemUI/src/com/android/systemui/navigationbar/gestural/BackPanel.kt @@ -575,6 +579,7 @@ -packages/SystemUI/src/com/android/systemui/volume/VolumePanelFactory.kt -packages/SystemUI/tests/src/com/android/keyguard/ActiveUnlockConfigTest.kt -packages/SystemUI/tests/src/com/android/keyguard/BouncerPanelExpansionCalculatorTest.kt +-packages/SystemUI/tests/src/com/android/keyguard/ClockEventControllerTest.kt -packages/SystemUI/tests/src/com/android/keyguard/KeyguardBiometricLockoutLoggerTest.kt -packages/SystemUI/tests/src/com/android/keyguard/KeyguardListenQueueTest.kt -packages/SystemUI/tests/src/com/android/keyguard/KeyguardPasswordViewControllerTest.kt @@ -633,6 +638,7 @@ -packages/SystemUI/tests/src/com/android/systemui/controls/management/TestControlsRequestDialog.kt -packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlViewHolderTest.kt -packages/SystemUI/tests/src/com/android/systemui/controls/ui/DetailDialogTest.kt +-packages/SystemUI/tests/src/com/android/systemui/decor/CutoutDecorProviderFactoryTest.kt -packages/SystemUI/tests/src/com/android/systemui/decor/OverlayWindowTest.kt -packages/SystemUI/tests/src/com/android/systemui/decor/PrivacyDotDecorProviderFactoryTest.kt -packages/SystemUI/tests/src/com/android/systemui/decor/RoundedCornerDecorProviderFactoryTest.kt @@ -720,6 +726,7 @@ -packages/SystemUI/tests/src/com/android/systemui/screenrecord/ScreenRecordDialogTest.kt -packages/SystemUI/tests/src/com/android/systemui/screenshot/ImageCaptureImplTest.kt -packages/SystemUI/tests/src/com/android/systemui/screenshot/RequestProcessorTest.kt +-packages/SystemUI/tests/src/com/android/systemui/screenshot/ScreenshotPolicyImplTest.kt -packages/SystemUI/tests/src/com/android/systemui/screenshot/TakeScreenshotServiceTest.kt -packages/SystemUI/tests/src/com/android/systemui/settings/UserFileManagerImplTest.kt -packages/SystemUI/tests/src/com/android/systemui/settings/UserTrackerImplTest.kt diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt index 1ac1e3a9a7313..01e5d86549ebd 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ClockProviderPlugin.kt @@ -17,7 +17,6 @@ import android.content.res.Resources import android.graphics.drawable.Drawable import android.view.View import com.android.systemui.plugins.annotations.ProvidesInterface -import com.android.systemui.shared.regionsampling.RegionDarkness import java.io.PrintWriter import java.util.Locale import java.util.TimeZone @@ -62,7 +61,7 @@ interface Clock { /** Initializes various rendering parameters. If never called, provides reasonable defaults. */ fun initialize(resources: Resources, dozeFraction: Float, foldFraction: Float) { - events.onColorPaletteChanged(resources, RegionDarkness.DEFAULT, RegionDarkness.DEFAULT) + events.onColorPaletteChanged(resources, true, true) animations.doze(dozeFraction) animations.fold(foldFraction) events.onTimeTick() @@ -92,8 +91,8 @@ interface ClockEvents { /** Call whenever the color palette should update */ fun onColorPaletteChanged( resources: Resources, - smallClockIsDark: RegionDarkness, - largeClockIsDark: RegionDarkness + smallClockIsDark: Boolean, + largeClockIsDark: Boolean ) { } } diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml index 8b8ebf00e190d..3ad7c8c4369ca 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_clock_switch.xml @@ -23,6 +23,7 @@ android:id="@+id/keyguard_clock_container" android:layout_width="match_parent" android:layout_height="wrap_content" + android:clipChildren="false" android:layout_gravity="center_horizontal|top"> - + android:paddingStart="@dimen/clock_padding_start" /> - + android:layout_marginTop="@dimen/keyguard_large_clock_top_margin" + android:visibility="gone" /> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 7179c29b80215..2865606860cdb 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -669,7 +669,7 @@ 12dp - 100dp + -60dp 32dp diff --git a/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt b/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt index b3f10718525a2..0b0595f4405f3 100644 --- a/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt +++ b/packages/SystemUI/screenshot/src/com/android/systemui/testing/screenshot/ViewScreenshotTestRule.kt @@ -36,9 +36,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 = @@ -51,7 +55,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) diff --git a/packages/SystemUI/shared/res/layout/clock_default_small.xml b/packages/SystemUI/shared/res/layout/clock_default_small.xml index 390ff5e3ff787..ff6d7f9e22403 100644 --- a/packages/SystemUI/shared/res/layout/clock_default_small.xml +++ b/packages/SystemUI/shared/res/layout/clock_default_small.xml @@ -18,7 +18,7 @@ --> updateClockViews(mDisplayedClockSize == LARGE, /* animate */ true)); + post(() -> updateClockViews(mDisplayedClockSize == LARGE, mAnimateOnLayout)); } mChildrenAreLaidOut = true; @@ -222,7 +220,7 @@ public class KeyguardClockSwitch extends RelativeLayout { public void dump(PrintWriter pw, String[] args) { pw.println("KeyguardClockSwitch:"); - pw.println(" mClockFrame: " + mSmallClockFrame); + pw.println(" mSmallClockFrame: " + mSmallClockFrame); pw.println(" mLargeClockFrame: " + mLargeClockFrame); pw.println(" mStatusArea: " + mStatusArea); pw.println(" mDisplayedClockSize: " + mDisplayedClockSize); diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java index dd78f1cef78ca..2165099b474e3 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardClockSwitchController.java @@ -72,7 +72,6 @@ public class KeyguardClockSwitchController extends ViewController() + val clock = provider.createClock(DEFAULT_CLOCK_ID) + clock.events.onTimeZoneChanged(timeZone) + + verify(mockSmallClockView).onTimeZoneChanged(timeZone) + verify(mockLargeClockView).onTimeZoneChanged(timeZone) + } + + @Test + fun defaultClock_events_onFontSettingChanged() { + val clock = provider.createClock(DEFAULT_CLOCK_ID) + clock.events.onFontSettingChanged() + + verify(mockSmallClockView).setTextSize(eq(TypedValue.COMPLEX_UNIT_PX), anyFloat()) + verify(mockLargeClockView).setTextSize(eq(TypedValue.COMPLEX_UNIT_PX), anyFloat()) + verify(mockLargeClockView).setLayoutParams(any()) + } + + @Test + fun defaultClock_events_onColorPaletteChanged() { + val clock = provider.createClock(DEFAULT_CLOCK_ID) + clock.events.onColorPaletteChanged(resources, true, true) + + verify(mockSmallClockView, times(2)).setColors(eq(DOZE_COLOR), anyInt()) + verify(mockLargeClockView, times(2)).setColors(eq(DOZE_COLOR), anyInt()) + } + + @Test + fun defaultClock_events_onLocaleChanged() { + val clock = provider.createClock(DEFAULT_CLOCK_ID) + clock.events.onLocaleChanged(Locale.getDefault()) + + verify(mockSmallClockView, times(2)).setLineSpacingScale(anyFloat()) + verify(mockLargeClockView, times(2)).setLineSpacingScale(anyFloat()) + verify(mockSmallClockView, times(2)).refreshFormat() + verify(mockLargeClockView, times(2)).refreshFormat() } }