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

Commit 5de4d989 authored by Guang Zhu's avatar Guang Zhu Committed by Android (Google) Code Review
Browse files

Merge "Use correct PowerManager call to wake up screen" into jb-mr1-dev

parents 8727a731 783f9e66
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -16,14 +16,12 @@

package com.android.commands.svc;

import android.os.Binder;
import android.os.IBinder;
import android.content.Context;
import android.os.BatteryManager;
import android.os.IPowerManager;
import android.os.PowerManager;
import android.os.ServiceManager;
import android.os.RemoteException;
import android.os.BatteryManager;
import android.content.Context;
import android.os.ServiceManager;
import android.os.SystemClock;

public class PowerCommand extends Svc.Command {
    public PowerCommand() {
@@ -65,10 +63,12 @@ public class PowerCommand extends Svc.Command {
                    IPowerManager pm
                            = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE));
                    try {
                        IBinder lock = new Binder();
                        pm.acquireWakeLock(lock, PowerManager.FULL_WAKE_LOCK, "svc power", null);
                        if (val != 0) {
                            // if the request is not to set it to false, wake up the screen so that
                            // it can stay on as requested
                            pm.wakeUp(SystemClock.uptimeMillis());
                        }
                        pm.setStayOnSetting(val);
                        pm.releaseWakeLock(lock, 0);
                    }
                    catch (RemoteException e) {
                        System.err.println("Faild to set setting: " + e);