Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09cafe32 authored by Bryce Lee's avatar Bryce Lee Committed by Android (Google) Code Review
Browse files

Merge "Publish dream state to OverviewProxyService."

parents 6cb649ef 7daefa75
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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
+6 −2
Original line number Diff line number Diff line
@@ -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,
@@ -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 {}

@@ -179,6 +181,8 @@ 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();
    }

+2 −1
Original line number Diff line number Diff line
@@ -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;
    }
+7 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.systemui.biometrics.AuthController
import com.android.systemui.biometrics.UdfpsOverlay
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
@@ -293,4 +294,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
}
+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