Loading packages/SystemUI/res/values-land/bools.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (c) 2023, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <resources> <!-- Only use small clock on lockscreen. True here because only small clock used on small devices in landscape --> <bool name="force_small_clock_on_lockscreen">true</bool> </resources> packages/SystemUI/res/values-sw600dp-land/bools.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (c) 2023, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <resources> <!-- Only use small clock on lockscreen. False here because large clock is allowed on large devices in landscape --> <bool name="force_small_clock_on_lockscreen">false</bool> </resources> packages/SystemUI/res/values/bools.xml +4 −0 Original line number Diff line number Diff line Loading @@ -59,4 +59,8 @@ True here so bouncers constraints are updated when rotating on small screens --> <bool name="update_bouncer_constraints">true</bool> <!-- Only use small clock on lockscreen. False here because large clock used by default, unless otherwise specified --> <bool name="force_small_clock_on_lockscreen">false</bool> </resources> packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +11 −0 Original line number Diff line number Diff line Loading @@ -1675,6 +1675,10 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump @ClockSize private int computeDesiredClockSize() { if (shouldForceSmallClock()) { return SMALL; } if (mSplitShadeEnabled) { return computeDesiredClockSizeForSplitShade(); } Loading Loading @@ -1707,6 +1711,13 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return LARGE; } private boolean shouldForceSmallClock() { return mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ENABLE_LANDSCAPE) && !isOnAod() // True on small landscape screens && mResources.getBoolean(R.bool.force_small_clock_on_lockscreen); } private void updateKeyguardStatusViewAlignment(boolean animate) { boolean shouldBeCentered = shouldKeyguardStatusViewBeCentered(); ConstraintLayout layout; Loading packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +36 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.shade; import static com.android.keyguard.FaceAuthApiRequestReason.NOTIFICATION_PANEL_CLICKED; import static com.android.keyguard.KeyguardClockSwitch.LARGE; import static com.android.keyguard.KeyguardClockSwitch.SMALL; import static com.android.systemui.shade.ShadeExpansionStateManagerKt.STATE_CLOSED; Loading Loading @@ -834,6 +833,42 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ false); } @Test public void switchesToBigClockInSplitShadeOn_landFlagOn_ForceSmallClock() { when(mScreenOffAnimationController.shouldAnimateClockChange()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ false); mNotificationPanelViewController.setDozing(false, false); when(mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ENABLE_LANDSCAPE)).thenReturn(true); when(mResources.getBoolean(R.bool.force_small_clock_on_lockscreen)).thenReturn(true); when(mMediaDataManager.hasActiveMedia()).thenReturn(false); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); clearInvocations(mKeyguardStatusViewController); enableSplitShade(/* enabled= */ true); mNotificationPanelViewController.updateResources(); verify(mKeyguardStatusViewController).displayClock(SMALL, /* animate */ false); } @Test public void switchesToBigClockInSplitShadeOn_landFlagOff_DontForceSmallClock() { when(mScreenOffAnimationController.shouldAnimateClockChange()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ false); mNotificationPanelViewController.setDozing(false, false); when(mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ENABLE_LANDSCAPE)).thenReturn(false); when(mResources.getBoolean(R.bool.force_small_clock_on_lockscreen)).thenReturn(true); when(mMediaDataManager.hasActiveMedia()).thenReturn(false); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); clearInvocations(mKeyguardStatusViewController); enableSplitShade(/* enabled= */ true); mNotificationPanelViewController.updateResources(); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ false); } @Test public void testDisplaysSmallClockOnLockscreenInSplitShadeWhenMediaIsPlaying() { mStatusBarStateController.setState(KEYGUARD); Loading Loading
packages/SystemUI/res/values-land/bools.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (c) 2023, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <resources> <!-- Only use small clock on lockscreen. True here because only small clock used on small devices in landscape --> <bool name="force_small_clock_on_lockscreen">true</bool> </resources>
packages/SystemUI/res/values-sw600dp-land/bools.xml 0 → 100644 +22 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- * Copyright (c) 2023, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ --> <resources> <!-- Only use small clock on lockscreen. False here because large clock is allowed on large devices in landscape --> <bool name="force_small_clock_on_lockscreen">false</bool> </resources>
packages/SystemUI/res/values/bools.xml +4 −0 Original line number Diff line number Diff line Loading @@ -59,4 +59,8 @@ True here so bouncers constraints are updated when rotating on small screens --> <bool name="update_bouncer_constraints">true</bool> <!-- Only use small clock on lockscreen. False here because large clock used by default, unless otherwise specified --> <bool name="force_small_clock_on_lockscreen">false</bool> </resources>
packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +11 −0 Original line number Diff line number Diff line Loading @@ -1675,6 +1675,10 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump @ClockSize private int computeDesiredClockSize() { if (shouldForceSmallClock()) { return SMALL; } if (mSplitShadeEnabled) { return computeDesiredClockSizeForSplitShade(); } Loading Loading @@ -1707,6 +1711,13 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return LARGE; } private boolean shouldForceSmallClock() { return mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ENABLE_LANDSCAPE) && !isOnAod() // True on small landscape screens && mResources.getBoolean(R.bool.force_small_clock_on_lockscreen); } private void updateKeyguardStatusViewAlignment(boolean animate) { boolean shouldBeCentered = shouldKeyguardStatusViewBeCentered(); ConstraintLayout layout; Loading
packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +36 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.shade; import static com.android.keyguard.FaceAuthApiRequestReason.NOTIFICATION_PANEL_CLICKED; import static com.android.keyguard.KeyguardClockSwitch.LARGE; import static com.android.keyguard.KeyguardClockSwitch.SMALL; import static com.android.systemui.shade.ShadeExpansionStateManagerKt.STATE_CLOSED; Loading Loading @@ -834,6 +833,42 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ false); } @Test public void switchesToBigClockInSplitShadeOn_landFlagOn_ForceSmallClock() { when(mScreenOffAnimationController.shouldAnimateClockChange()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ false); mNotificationPanelViewController.setDozing(false, false); when(mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ENABLE_LANDSCAPE)).thenReturn(true); when(mResources.getBoolean(R.bool.force_small_clock_on_lockscreen)).thenReturn(true); when(mMediaDataManager.hasActiveMedia()).thenReturn(false); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); clearInvocations(mKeyguardStatusViewController); enableSplitShade(/* enabled= */ true); mNotificationPanelViewController.updateResources(); verify(mKeyguardStatusViewController).displayClock(SMALL, /* animate */ false); } @Test public void switchesToBigClockInSplitShadeOn_landFlagOff_DontForceSmallClock() { when(mScreenOffAnimationController.shouldAnimateClockChange()).thenReturn(false); mStatusBarStateController.setState(KEYGUARD); enableSplitShade(/* enabled= */ false); mNotificationPanelViewController.setDozing(false, false); when(mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ENABLE_LANDSCAPE)).thenReturn(false); when(mResources.getBoolean(R.bool.force_small_clock_on_lockscreen)).thenReturn(true); when(mMediaDataManager.hasActiveMedia()).thenReturn(false); when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0); clearInvocations(mKeyguardStatusViewController); enableSplitShade(/* enabled= */ true); mNotificationPanelViewController.updateResources(); verify(mKeyguardStatusViewController).displayClock(LARGE, /* animate */ false); } @Test public void testDisplaysSmallClockOnLockscreenInSplitShadeWhenMediaIsPlaying() { mStatusBarStateController.setState(KEYGUARD); Loading