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

Commit 1399825f authored by Yogisha Dixit's avatar Yogisha Dixit Committed by Android (Google) Code Review
Browse files

Merge "Store ambient display suppression state in memory." into rvc-dev

parents 6820d68e 65f26b78
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -220,4 +220,10 @@ oneway interface IStatusBar
     * Notifies SystemUI to stop tracing.
     */
    void stopTracing();

    /**
     * If true, suppresses the ambient display from showing. If false, re-enables the ambient
     * display.
     */
    void suppressAmbientDisplay(boolean suppress);
}
+6 −0
Original line number Diff line number Diff line
@@ -139,4 +139,10 @@ interface IStatusBarService
     * Returns whether SystemUI tracing is enabled.
     */
    boolean isTracing();

    /**
     * If true, suppresses the ambient display from showing. If false, re-enables the ambient
     * display.
     */
    void suppressAmbientDisplay(boolean suppress);
}
+2 −2
Original line number Diff line number Diff line
@@ -102,7 +102,8 @@ public class DozeFactory {
                wrappedService, mDozeParameters);

        DozeMachine machine = new DozeMachine(wrappedService, config, wakeLock,
                mWakefulnessLifecycle, mBatteryController, mDozeLog, mDockManager);
                mWakefulnessLifecycle, mBatteryController, mDozeLog, mDockManager,
                mDozeServiceHost);
        machine.setParts(new DozeMachine.Part[]{
                new DozePauser(mHandler, machine, mAlarmManager, mDozeParameters.getPolicy()),
                new DozeFalsingManagerAdapter(mFalsingManager),
@@ -118,7 +119,6 @@ public class DozeFactory {
                new DozeWallpaperState(mWallpaperManager, mBiometricUnlockController,
                        mDozeParameters),
                new DozeDockHandler(config, machine, mDockManager),
                new DozeSuppressedHandler(dozeService, config, machine),
                new DozeAuthRemover(dozeService)
        });

+6 −0
Original line number Diff line number Diff line
@@ -81,6 +81,9 @@ public interface DozeHost {
     */
    void stopPulsing();

    /** Returns whether doze is suppressed. */
    boolean isDozeSuppressed();

    interface Callback {
        /**
         * Called when a high priority notification is added.
@@ -94,6 +97,9 @@ public interface DozeHost {
         * @param active whether power save is active or not
         */
        default void onPowerSaveChanged(boolean active) {}

        /** Called when the doze suppression state changes. */
        default void onDozeSuppressedChanged(boolean suppressed) {}
    }

    interface PulseCallback {
+4 −2
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ public class DozeMachine {
    private final AmbientDisplayConfiguration mConfig;
    private final WakefulnessLifecycle mWakefulnessLifecycle;
    private final BatteryController mBatteryController;
    private final DozeHost mDozeHost;
    private Part[] mParts;

    private final ArrayList<State> mQueuedRequests = new ArrayList<>();
@@ -144,7 +145,7 @@ public class DozeMachine {

    public DozeMachine(Service service, AmbientDisplayConfiguration config, WakeLock wakeLock,
            WakefulnessLifecycle wakefulnessLifecycle, BatteryController batteryController,
            DozeLog dozeLog, DockManager dockManager) {
            DozeLog dozeLog, DockManager dockManager, DozeHost dozeHost) {
        mDozeService = service;
        mConfig = config;
        mWakefulnessLifecycle = wakefulnessLifecycle;
@@ -152,6 +153,7 @@ public class DozeMachine {
        mBatteryController = batteryController;
        mDozeLog = dozeLog;
        mDockManager = dockManager;
        mDozeHost = dozeHost;
    }

    /** Initializes the set of {@link Part}s. Must be called exactly once after construction. */
@@ -328,7 +330,7 @@ public class DozeMachine {
        if (mState == State.FINISH) {
            return State.FINISH;
        }
        if (mConfig.dozeSuppressed(UserHandle.USER_CURRENT) && requestedState.isAlwaysOn()) {
        if (mDozeHost.isDozeSuppressed() && requestedState.isAlwaysOn()) {
            Log.i(TAG, "Doze is suppressed. Suppressing state: " + requestedState);
            mDozeLog.traceDozeSuppressed(requestedState);
            return State.DOZE;
Loading