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

Commit 194b6e97 authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Power manager rewrite." into jb-mr1-dev

parents 1d64f9f4 9630704e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -16273,6 +16273,7 @@ package android.os {
    method public android.os.PowerManager.WakeLock newWakeLock(int, java.lang.String);
    method public void reboot(java.lang.String);
    method public void userActivity(long, boolean);
    method public void wakeUp(long);
    field public static final int ACQUIRE_CAUSES_WAKEUP = 268435456; // 0x10000000
    field public static final deprecated int FULL_WAKE_LOCK = 26; // 0x1a
    field public static final int ON_AFTER_RELEASE = 536870912; // 0x20000000
@@ -18763,7 +18764,7 @@ package android.provider {
    field public static final android.net.Uri DEFAULT_NOTIFICATION_URI;
    field public static final android.net.Uri DEFAULT_RINGTONE_URI;
    field public static final deprecated java.lang.String DEVICE_PROVISIONED = "device_provisioned";
    field public static final java.lang.String DIM_SCREEN = "dim_screen";
    field public static final deprecated java.lang.String DIM_SCREEN = "dim_screen";
    field public static final java.lang.String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
    field public static final java.lang.String END_BUTTON_BEHAVIOR = "end_button_behavior";
    field public static final java.lang.String FONT_SCALE = "font_scale";
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class PowerCommand extends Svc.Command {
                            = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE));
                    try {
                        IBinder lock = new Binder();
                        pm.acquireWakeLock(PowerManager.FULL_WAKE_LOCK, lock, "svc power", null);
                        pm.acquireWakeLock(lock, PowerManager.FULL_WAKE_LOCK, "svc power", null);
                        pm.setStayOnSetting(val);
                        pm.releaseWakeLock(lock, 0);
                    }
+2 −1
Original line number Diff line number Diff line
@@ -418,7 +418,8 @@ class ContextImpl extends Context {
                public Object createService(ContextImpl ctx) {
                    IBinder b = ServiceManager.getService(POWER_SERVICE);
                    IPowerManager service = IPowerManager.Stub.asInterface(b);
                    return new PowerManager(service, ctx.mMainThread.getHandler());
                    return new PowerManager(ctx.getOuterContext(),
                            service, ctx.mMainThread.getHandler());
                }});

        registerService(SEARCH_SERVICE, new ServiceFetcher() {
+22 −16
Original line number Diff line number Diff line
@@ -23,27 +23,33 @@ import android.os.WorkSource;

interface IPowerManager
{
    // WARNING: changes in acquireWakeLock() signature must be reflected in IPowerManager.cpp/h
    void acquireWakeLock(int flags, IBinder lock, String tag, in WorkSource ws);
    void updateWakeLockWorkSource(IBinder lock, in WorkSource ws);
    void goToSleep(long time);
    void goToSleepWithReason(long time, int reason);
    // WARNING: changes in releaseWakeLock() signature must be reflected in IPowerManager.cpp/h
    // WARNING: The first two methods must remain the first two methods because their
    // transaction numbers must not change unless IPowerManager.cpp is also updated.
    void acquireWakeLock(IBinder lock, int flags, String tag, in WorkSource ws);
    void releaseWakeLock(IBinder lock, int flags);
    void userActivity(long when, boolean noChangeLights);
    void userActivityWithForce(long when, boolean noChangeLights, boolean force);

    void updateWakeLockWorkSource(IBinder lock, in WorkSource ws);
    boolean isWakeLockLevelSupported(int level);

    void userActivity(long time, int event, int flags);
    void wakeUp(long time);
    void goToSleep(long time, int reason);

    boolean isScreenOn();
    void reboot(String reason);
    void crash(String message);

    void clearUserActivityTimeout(long now, long timeout);
    void setPokeLock(int pokey, IBinder lock, String tag);
    int getSupportedWakeLockFlags();
    void setStayOnSetting(int val);
    void setMaximumScreenOffTimeount(int timeMs);
    void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs);
    void preventScreenOn(boolean prevent);
    boolean isScreenOn();
    void reboot(String reason);
    void crash(String message);

    // sets the brightness of the backlights (screen, keyboard, button) 0-255
    void setBacklightBrightness(int brightness);
    // temporarily overrides the screen brightness settings to allow the user to
    // see the effect of a settings change without applying it immediately
    void setTemporaryScreenBrightnessSettingOverride(int brightness);
    void setTemporaryScreenAutoBrightnessAdjustmentSettingOverride(float adj);

    // sets the attention light (used by phone app only)
    void setAttentionLight(boolean on, int color);
    void setAutoBrightnessAdjustment(float adj);
}
+2 −16
Original line number Diff line number Diff line
@@ -18,25 +18,11 @@ package android.os;

/** @hide */
public interface LocalPowerManager {
    // FIXME: Replace poke locks with something else.

    public static final int POKE_LOCK_IGNORE_TOUCH_EVENTS = 0x1;

    public static final int POKE_LOCK_SHORT_TIMEOUT = 0x2;
    public static final int POKE_LOCK_MEDIUM_TIMEOUT = 0x4;
    public static final int POKE_LOCK_TIMEOUT_MASK = 0x6;

    void goToSleep(long time);
    
    // notify power manager when keyboard is opened/closed
    void setKeyboardVisibility(boolean visible);

    // when the keyguard is up, it manages the power state, and userActivity doesn't do anything.
    void enableUserActivity(boolean enabled);

    // the same as the method on PowerManager
    void userActivity(long time, boolean noChangeLights, int eventType);

    boolean isScreenOn();

    void setScreenBrightnessOverride(int brightness);
    void setButtonBrightnessOverride(int brightness);
}
Loading