Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java +5 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,11 @@ public interface StatusBarStateController { */ default void onDozingChanged(boolean isDozing) {} /** * Callback to be notified when Dreaming changes. Dreaming is stored separately from state. */ default void onDreamingChanged(boolean isDreaming) {} /** * Callback to be notified when the doze amount changes. Useful for animations. * Note: this will be called for each animation frame. Please be careful to avoid Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java +5 −2 Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ public class QuickStepContract { public static final int SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING = 1 << 25; // Freeform windows are showing in desktop mode public static final int SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE = 1 << 26; // Device dreaming state public static final int SYSUI_STATE_DEVICE_DREAMING = 1 << 27; @Retention(RetentionPolicy.SOURCE) @IntDef({SYSUI_STATE_SCREEN_PINNING, Loading Loading @@ -141,7 +142,8 @@ public class QuickStepContract { SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED, SYSUI_STATE_IMMERSIVE_MODE, SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING, SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE, SYSUI_STATE_DEVICE_DREAMING }) public @interface SystemUiStateFlags {} Loading Loading @@ -179,6 +181,7 @@ public class QuickStepContract { str.add((flags & SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING) != 0 ? "vis_win_showing" : ""); str.add((flags & SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE) != 0 ? "freeform_active_in_desktop_mode" : ""); str.add((flags & SYSUI_STATE_DEVICE_DREAMING) != 0 ? "device_dreaming" : ""); return str.toString(); } Loading packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java +2 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,8 @@ public class SystemActions implements CoreStartable { // Saving in instance variable since to prevent GC since // NotificationShadeWindowController.registerCallback() only keeps weak references. mNotificationShadeCallback = (keyguardShowing, keyguardOccluded, bouncerShowing, mDozing, panelExpanded) -> (keyguardShowing, keyguardOccluded, bouncerShowing, mDozing, panelExpanded, isDreaming) -> registerOrUnregisterDismissNotificationShadeAction(); mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; } Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt +7 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.systemui.accessibility.WindowMagnification import com.android.systemui.biometrics.AuthController import com.android.systemui.clipboardoverlay.ClipboardListener import com.android.systemui.dagger.qualifiers.PerUser import com.android.systemui.dreams.DreamMonitor import com.android.systemui.globalactions.GlobalActionsComponent import com.android.systemui.keyboard.KeyboardUI import com.android.systemui.keyguard.KeyguardViewMediator Loading Loading @@ -286,4 +287,10 @@ abstract class SystemUICoreStartableModule { @IntoMap @ClassKey(StylusUsiPowerStartable::class) abstract fun bindStylusUsiPowerStartable(sysui: StylusUsiPowerStartable): CoreStartable /**Inject into DreamMonitor */ @Binds @IntoMap @ClassKey(DreamMonitor::class) abstract fun bindDreamMonitor(sysui: DreamMonitor): CoreStartable } packages/SystemUI/src/com/android/systemui/dreams/DreamMonitor.java 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.systemui.dreams; import android.util.Log; import com.android.systemui.CoreStartable; import com.android.systemui.dreams.callbacks.DreamStatusBarStateCallback; import com.android.systemui.dreams.conditions.DreamCondition; import com.android.systemui.shared.condition.Monitor; import javax.inject.Inject; /** * A {@link CoreStartable} to retain a monitor for tracking dreaming. */ public class DreamMonitor implements CoreStartable { private static final String TAG = "DreamMonitor"; // We retain a reference to the monitor so it is not garbage-collected. private final Monitor mConditionMonitor; private final DreamCondition mDreamCondition; private final DreamStatusBarStateCallback mCallback; @Inject public DreamMonitor(Monitor monitor, DreamCondition dreamCondition, DreamStatusBarStateCallback callback) { mConditionMonitor = monitor; mDreamCondition = dreamCondition; mCallback = callback; } @Override public void start() { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "started"); } mConditionMonitor.addSubscription(new Monitor.Subscription.Builder(mCallback) .addCondition(mDreamCondition) .build()); } } Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/statusbar/StatusBarStateController.java +5 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,11 @@ public interface StatusBarStateController { */ default void onDozingChanged(boolean isDozing) {} /** * Callback to be notified when Dreaming changes. Dreaming is stored separately from state. */ default void onDreamingChanged(boolean isDreaming) {} /** * Callback to be notified when the doze amount changes. Useful for animations. * Note: this will be called for each animation frame. Please be careful to avoid Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/QuickStepContract.java +5 −2 Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ public class QuickStepContract { public static final int SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING = 1 << 25; // Freeform windows are showing in desktop mode public static final int SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE = 1 << 26; // Device dreaming state public static final int SYSUI_STATE_DEVICE_DREAMING = 1 << 27; @Retention(RetentionPolicy.SOURCE) @IntDef({SYSUI_STATE_SCREEN_PINNING, Loading Loading @@ -141,7 +142,8 @@ public class QuickStepContract { SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED, SYSUI_STATE_IMMERSIVE_MODE, SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING, SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE, SYSUI_STATE_DEVICE_DREAMING }) public @interface SystemUiStateFlags {} Loading Loading @@ -179,6 +181,7 @@ public class QuickStepContract { str.add((flags & SYSUI_STATE_VOICE_INTERACTION_WINDOW_SHOWING) != 0 ? "vis_win_showing" : ""); str.add((flags & SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE) != 0 ? "freeform_active_in_desktop_mode" : ""); str.add((flags & SYSUI_STATE_DEVICE_DREAMING) != 0 ? "device_dreaming" : ""); return str.toString(); } Loading
packages/SystemUI/src/com/android/systemui/accessibility/SystemActions.java +2 −1 Original line number Diff line number Diff line Loading @@ -207,7 +207,8 @@ public class SystemActions implements CoreStartable { // Saving in instance variable since to prevent GC since // NotificationShadeWindowController.registerCallback() only keeps weak references. mNotificationShadeCallback = (keyguardShowing, keyguardOccluded, bouncerShowing, mDozing, panelExpanded) -> (keyguardShowing, keyguardOccluded, bouncerShowing, mDozing, panelExpanded, isDreaming) -> registerOrUnregisterDismissNotificationShadeAction(); mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; } Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt +7 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import com.android.systemui.accessibility.WindowMagnification import com.android.systemui.biometrics.AuthController import com.android.systemui.clipboardoverlay.ClipboardListener import com.android.systemui.dagger.qualifiers.PerUser import com.android.systemui.dreams.DreamMonitor import com.android.systemui.globalactions.GlobalActionsComponent import com.android.systemui.keyboard.KeyboardUI import com.android.systemui.keyguard.KeyguardViewMediator Loading Loading @@ -286,4 +287,10 @@ abstract class SystemUICoreStartableModule { @IntoMap @ClassKey(StylusUsiPowerStartable::class) abstract fun bindStylusUsiPowerStartable(sysui: StylusUsiPowerStartable): CoreStartable /**Inject into DreamMonitor */ @Binds @IntoMap @ClassKey(DreamMonitor::class) abstract fun bindDreamMonitor(sysui: DreamMonitor): CoreStartable }
packages/SystemUI/src/com/android/systemui/dreams/DreamMonitor.java 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * 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. */ package com.android.systemui.dreams; import android.util.Log; import com.android.systemui.CoreStartable; import com.android.systemui.dreams.callbacks.DreamStatusBarStateCallback; import com.android.systemui.dreams.conditions.DreamCondition; import com.android.systemui.shared.condition.Monitor; import javax.inject.Inject; /** * A {@link CoreStartable} to retain a monitor for tracking dreaming. */ public class DreamMonitor implements CoreStartable { private static final String TAG = "DreamMonitor"; // We retain a reference to the monitor so it is not garbage-collected. private final Monitor mConditionMonitor; private final DreamCondition mDreamCondition; private final DreamStatusBarStateCallback mCallback; @Inject public DreamMonitor(Monitor monitor, DreamCondition dreamCondition, DreamStatusBarStateCallback callback) { mConditionMonitor = monitor; mDreamCondition = dreamCondition; mCallback = callback; } @Override public void start() { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "started"); } mConditionMonitor.addSubscription(new Monitor.Subscription.Builder(mCallback) .addCondition(mDreamCondition) .build()); } }