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

Commit 040e425b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ia33ab1ab,I1d01ab5d

* changes:
  AOD: Add toggle for waking up instead of ambient display on sensors
  AOD: Refactor DozeMachine to allow waking up
parents 8d6a6170 7a1654e8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1725,6 +1725,10 @@
        not appear on production builds ever. -->
    <string name="tuner_doze" translatable="false">Ambient Display</string>

    <!-- Ambient display, Sensors wake up device of the tuner. Non-translatable since it should
        not appear on production builds ever. -->
    <string name="tuner_doze_sensors_wake_up_fully" translatable="false">Wake up device on double tap or lift</string>

    <!-- Ambient display always-on of the tuner. Non-translatable since it should
        not appear on production builds ever. -->
    <string name="tuner_doze_always_on" translatable="false">Always on</string>
+5 −0
Original line number Diff line number Diff line
@@ -131,6 +131,11 @@
          android:title="@string/tuner_doze_always_on"
          sysui:defValue="false" />

        <com.android.systemui.tuner.TunerSwitch
          android:key="doze_sensors_wake_up_fully"
          android:title="@string/tuner_doze_sensors_wake_up_fully"
          sysui:defValue="false" />

    </PreferenceScreen>
    -->

+1 −2
Original line number Diff line number Diff line
@@ -91,8 +91,7 @@ public class DozeFactory {
            @Override
            public void requestState(DozeProvider.DozeState state) {
                if (state == DozeProvider.DozeState.WAKE_UP) {
                    PowerManager pm = context.getSystemService(PowerManager.class);
                    pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:NODOZE");
                    machine.wakeUp();
                    return;
                }
                machine.requestState(implState(state));
+8 −0
Original line number Diff line number Diff line
@@ -158,6 +158,11 @@ public class DozeMachine {
        return mState;
    }

    /** Requests the PowerManager to wake up now. */
    public void wakeUp() {
        mDozeService.requestWakeUp();
    }

    private boolean isExecutingTransition() {
        return !mQueuedRequests.isEmpty();
    }
@@ -300,5 +305,8 @@ public class DozeMachine {

        /** Request a display state. See {@link android.view.Display#STATE_DOZE}. */
        void setDozeScreenState(int state);

        /** Request waking up. */
        void requestWakeUp();
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.doze;

import android.os.PowerManager;
import android.os.SystemClock;
import android.service.dreams.DreamService;
import android.util.Log;

@@ -72,4 +74,10 @@ public class DozeService extends DreamService implements DozeMachine.Service {
            mDozeMachine.dump(pw);
        }
    }

    @Override
    public void requestWakeUp() {
        PowerManager pm = getSystemService(PowerManager.class);
        pm.wakeUp(SystemClock.uptimeMillis(), "com.android.systemui:NODOZE");
    }
}
Loading