Loading packages/SystemUI/AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -1171,5 +1171,16 @@ android:exported="false" /> <service android:name="com.google.android.systemui.lowlightclock.LowLightClockDreamService" android:enabled="false" android:exported="false" android:directBootAware="true" android:permission="android.permission.BIND_DREAM_SERVICE"> <intent-filter> <action android:name="android.service.dreams.DreamService" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </service> </application> </manifest> packages/SystemUI/res/layout/low_light_clock_dream.xml 0 → 100644 +39 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/low_light_clock_dream" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/low_light_clock_background_color"> <TextClock android:id="@+id/low_light_text_clock" android:layout_width="match_parent" android:layout_height="@dimen/low_light_clock_text_size" android:layout_gravity="center" android:fontFamily="google-sans-clock" android:gravity="center_horizontal" android:textColor="@color/low_light_clock_text_color" android:autoSizeTextType="uniform" android:autoSizeMaxTextSize="@dimen/low_light_clock_text_size" android:format12Hour="h:mm" android:format24Hour="H:mm"/> <TextView android:id="@+id/charging_status_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/keyguard_indication_margin_bottom" android:gravity="center" android:minHeight="@dimen/low_light_clock_charging_text_min_height" android:layout_gravity="center_horizontal|bottom" android:paddingStart="@dimen/keyguard_indication_text_padding" android:paddingEnd="@dimen/keyguard_indication_text_padding" android:textAppearance="@style/TextAppearance.Keyguard.BottomArea" android:textSize="@dimen/low_light_clock_charging_text_size" android:textFontWeight="@integer/low_light_clock_charging_text_font_weight" android:maxLines="2" android:ellipsize="end" android:accessibilityLiveRegion="polite" /> </FrameLayout> packages/SystemUI/res/values/colors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -260,4 +260,8 @@ <!-- Rear Display Education --> <color name="rear_display_overlay_animation_background_color">#1E1B17</color> <color name="rear_display_overlay_dialog_background_color">#1E1B17</color> <!-- Low light Dream --> <color name="low_light_clock_background_color">#000000</color> <color name="low_light_clock_text_color">#CCCCCC</color> </resources> packages/SystemUI/res/values/dimens.xml +12 −0 Original line number Diff line number Diff line Loading @@ -1614,6 +1614,18 @@ <!-- GLANCEABLE_HUB -> DREAMING transition: Amount to shift dream overlay on entering --> <dimen name="hub_to_dreaming_transition_dream_overlay_translation_x">824dp</dimen> <!-- Low light clock --> <!-- The text size of the low light clock is intentionally defined in dp to avoid scaling --> <dimen name="low_light_clock_text_size">260dp</dimen> <dimen name="low_light_clock_charging_text_size">14sp</dimen> <dimen name="low_light_clock_charging_text_min_height">48dp</dimen> <integer name="low_light_clock_charging_text_font_weight">500</integer> <dimen name="low_light_clock_translate_animation_offset">40dp</dimen> <integer name="low_light_clock_translate_animation_duration_ms">1167</integer> <integer name="low_light_clock_alpha_animation_in_start_delay_ms">233</integer> <integer name="low_light_clock_alpha_animation_duration_ms">250</integer> <!-- Distance that the full shade transition takes in order for media to fully transition to the shade --> <dimen name="lockscreen_shade_media_transition_distance">120dp</dimen> Loading packages/SystemUI/src/com/android/systemui/communal/DeviceInactiveCondition.java 0 → 100644 +101 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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. */ package com.android.systemui.communal; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.shared.condition.Condition; import com.android.systemui.statusbar.policy.KeyguardStateController; import kotlinx.coroutines.CoroutineScope; import javax.inject.Inject; /** * Condition which estimates device inactivity in order to avoid launching a full-screen activity * while the user is actively using the device. */ public class DeviceInactiveCondition extends Condition { private final KeyguardStateController mKeyguardStateController; private final WakefulnessLifecycle mWakefulnessLifecycle; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final KeyguardStateController.Callback mKeyguardStateCallback = new KeyguardStateController.Callback() { @Override public void onKeyguardShowingChanged() { updateState(); } }; private final WakefulnessLifecycle.Observer mWakefulnessObserver = new WakefulnessLifecycle.Observer() { @Override public void onStartedGoingToSleep() { updateState(); } }; private final KeyguardUpdateMonitorCallback mKeyguardUpdateCallback = new KeyguardUpdateMonitorCallback() { @Override public void onDreamingStateChanged(boolean dreaming) { updateState(); } }; @Inject public DeviceInactiveCondition(@Application CoroutineScope scope, KeyguardStateController keyguardStateController, WakefulnessLifecycle wakefulnessLifecycle, KeyguardUpdateMonitor keyguardUpdateMonitor) { super(scope); mKeyguardStateController = keyguardStateController; mWakefulnessLifecycle = wakefulnessLifecycle; mKeyguardUpdateMonitor = keyguardUpdateMonitor; } @Override protected void start() { updateState(); mKeyguardStateController.addCallback(mKeyguardStateCallback); mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateCallback); mWakefulnessLifecycle.addObserver(mWakefulnessObserver); } @Override protected void stop() { mKeyguardStateController.removeCallback(mKeyguardStateCallback); mKeyguardUpdateMonitor.removeCallback(mKeyguardUpdateCallback); mWakefulnessLifecycle.removeObserver(mWakefulnessObserver); } @Override protected int getStartStrategy() { return START_EAGERLY; } private void updateState() { final boolean asleep = mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_ASLEEP || mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_GOING_TO_SLEEP; updateCondition(asleep || mKeyguardStateController.isShowing() || mKeyguardUpdateMonitor.isDreaming()); } } Loading
packages/SystemUI/AndroidManifest.xml +11 −0 Original line number Diff line number Diff line Loading @@ -1171,5 +1171,16 @@ android:exported="false" /> <service android:name="com.google.android.systemui.lowlightclock.LowLightClockDreamService" android:enabled="false" android:exported="false" android:directBootAware="true" android:permission="android.permission.BIND_DREAM_SERVICE"> <intent-filter> <action android:name="android.service.dreams.DreamService" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </service> </application> </manifest>
packages/SystemUI/res/layout/low_light_clock_dream.xml 0 → 100644 +39 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/low_light_clock_dream" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/low_light_clock_background_color"> <TextClock android:id="@+id/low_light_text_clock" android:layout_width="match_parent" android:layout_height="@dimen/low_light_clock_text_size" android:layout_gravity="center" android:fontFamily="google-sans-clock" android:gravity="center_horizontal" android:textColor="@color/low_light_clock_text_color" android:autoSizeTextType="uniform" android:autoSizeMaxTextSize="@dimen/low_light_clock_text_size" android:format12Hour="h:mm" android:format24Hour="H:mm"/> <TextView android:id="@+id/charging_status_text_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/keyguard_indication_margin_bottom" android:gravity="center" android:minHeight="@dimen/low_light_clock_charging_text_min_height" android:layout_gravity="center_horizontal|bottom" android:paddingStart="@dimen/keyguard_indication_text_padding" android:paddingEnd="@dimen/keyguard_indication_text_padding" android:textAppearance="@style/TextAppearance.Keyguard.BottomArea" android:textSize="@dimen/low_light_clock_charging_text_size" android:textFontWeight="@integer/low_light_clock_charging_text_font_weight" android:maxLines="2" android:ellipsize="end" android:accessibilityLiveRegion="polite" /> </FrameLayout>
packages/SystemUI/res/values/colors.xml +4 −0 Original line number Diff line number Diff line Loading @@ -260,4 +260,8 @@ <!-- Rear Display Education --> <color name="rear_display_overlay_animation_background_color">#1E1B17</color> <color name="rear_display_overlay_dialog_background_color">#1E1B17</color> <!-- Low light Dream --> <color name="low_light_clock_background_color">#000000</color> <color name="low_light_clock_text_color">#CCCCCC</color> </resources>
packages/SystemUI/res/values/dimens.xml +12 −0 Original line number Diff line number Diff line Loading @@ -1614,6 +1614,18 @@ <!-- GLANCEABLE_HUB -> DREAMING transition: Amount to shift dream overlay on entering --> <dimen name="hub_to_dreaming_transition_dream_overlay_translation_x">824dp</dimen> <!-- Low light clock --> <!-- The text size of the low light clock is intentionally defined in dp to avoid scaling --> <dimen name="low_light_clock_text_size">260dp</dimen> <dimen name="low_light_clock_charging_text_size">14sp</dimen> <dimen name="low_light_clock_charging_text_min_height">48dp</dimen> <integer name="low_light_clock_charging_text_font_weight">500</integer> <dimen name="low_light_clock_translate_animation_offset">40dp</dimen> <integer name="low_light_clock_translate_animation_duration_ms">1167</integer> <integer name="low_light_clock_alpha_animation_in_start_delay_ms">233</integer> <integer name="low_light_clock_alpha_animation_duration_ms">250</integer> <!-- Distance that the full shade transition takes in order for media to fully transition to the shade --> <dimen name="lockscreen_shade_media_transition_distance">120dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/communal/DeviceInactiveCondition.java 0 → 100644 +101 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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. */ package com.android.systemui.communal; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_GOING_TO_SLEEP; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.dagger.qualifiers.Application; import com.android.systemui.keyguard.WakefulnessLifecycle; import com.android.systemui.shared.condition.Condition; import com.android.systemui.statusbar.policy.KeyguardStateController; import kotlinx.coroutines.CoroutineScope; import javax.inject.Inject; /** * Condition which estimates device inactivity in order to avoid launching a full-screen activity * while the user is actively using the device. */ public class DeviceInactiveCondition extends Condition { private final KeyguardStateController mKeyguardStateController; private final WakefulnessLifecycle mWakefulnessLifecycle; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final KeyguardStateController.Callback mKeyguardStateCallback = new KeyguardStateController.Callback() { @Override public void onKeyguardShowingChanged() { updateState(); } }; private final WakefulnessLifecycle.Observer mWakefulnessObserver = new WakefulnessLifecycle.Observer() { @Override public void onStartedGoingToSleep() { updateState(); } }; private final KeyguardUpdateMonitorCallback mKeyguardUpdateCallback = new KeyguardUpdateMonitorCallback() { @Override public void onDreamingStateChanged(boolean dreaming) { updateState(); } }; @Inject public DeviceInactiveCondition(@Application CoroutineScope scope, KeyguardStateController keyguardStateController, WakefulnessLifecycle wakefulnessLifecycle, KeyguardUpdateMonitor keyguardUpdateMonitor) { super(scope); mKeyguardStateController = keyguardStateController; mWakefulnessLifecycle = wakefulnessLifecycle; mKeyguardUpdateMonitor = keyguardUpdateMonitor; } @Override protected void start() { updateState(); mKeyguardStateController.addCallback(mKeyguardStateCallback); mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateCallback); mWakefulnessLifecycle.addObserver(mWakefulnessObserver); } @Override protected void stop() { mKeyguardStateController.removeCallback(mKeyguardStateCallback); mKeyguardUpdateMonitor.removeCallback(mKeyguardUpdateCallback); mWakefulnessLifecycle.removeObserver(mWakefulnessObserver); } @Override protected int getStartStrategy() { return START_EAGERLY; } private void updateState() { final boolean asleep = mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_ASLEEP || mWakefulnessLifecycle.getWakefulness() == WAKEFULNESS_GOING_TO_SLEEP; updateCondition(asleep || mKeyguardStateController.isShowing() || mKeyguardUpdateMonitor.isDreaming()); } }