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

Commit 5f035983 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

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

Merge "Store ambient display suppression state in memory." into rvc-dev am: 1399825f am: f411b288

Change-Id: Ib47cb66bd3cf2e38e5dffbd18c84098400041ba6
parents bc95628e f411b288
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -220,4 +220,10 @@ oneway interface IStatusBar
     * Notifies SystemUI to stop tracing.
     * Notifies SystemUI to stop tracing.
     */
     */
    void stopTracing();
    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 Original line Diff line number Diff line
@@ -139,4 +139,10 @@ interface IStatusBarService
     * Returns whether SystemUI tracing is enabled.
     * Returns whether SystemUI tracing is enabled.
     */
     */
    boolean isTracing();
    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 Original line Diff line number Diff line
@@ -102,7 +102,8 @@ public class DozeFactory {
                wrappedService, mDozeParameters);
                wrappedService, mDozeParameters);


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


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


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

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

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


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


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


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


    /** Initializes the set of {@link Part}s. Must be called exactly once after construction. */
    /** 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) {
        if (mState == State.FINISH) {
            return 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);
            Log.i(TAG, "Doze is suppressed. Suppressing state: " + requestedState);
            mDozeLog.traceDozeSuppressed(requestedState);
            mDozeLog.traceDozeSuppressed(requestedState);
            return State.DOZE;
            return State.DOZE;
Loading