Skip to content

Commit 783f9e6

Browse files
committed
Use correct PowerManager call to wake up screen
The current implementation does not actually wakes up the screen. Change-Id: Ief2dca013cfe40e03b64273fe7b09822e9ad42a7
1 parent add52a9 commit 783f9e6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

cmds/svc/src/com/android/commands/svc/PowerCommand.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616

1717
package com.android.commands.svc;
1818

19-
import android.os.Binder;
20-
import android.os.IBinder;
19+
import android.content.Context;
20+
import android.os.BatteryManager;
2121
import android.os.IPowerManager;
22-
import android.os.PowerManager;
23-
import android.os.ServiceManager;
2422
import android.os.RemoteException;
25-
import android.os.BatteryManager;
26-
import android.content.Context;
23+
import android.os.ServiceManager;
24+
import android.os.SystemClock;
2725

2826
public class PowerCommand extends Svc.Command {
2927
public PowerCommand() {
@@ -65,10 +63,12 @@ else if ("false".equals(args[2])) {
6563
IPowerManager pm
6664
= IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE));
6765
try {
68-
IBinder lock = new Binder();
69-
pm.acquireWakeLock(lock, PowerManager.FULL_WAKE_LOCK, "svc power", null);
66+
if (val != 0) {
67+
// if the request is not to set it to false, wake up the screen so that
68+
// it can stay on as requested
69+
pm.wakeUp(SystemClock.uptimeMillis());
70+
}
7071
pm.setStayOnSetting(val);
71-
pm.releaseWakeLock(lock, 0);
7272
}
7373
catch (RemoteException e) {
7474
System.err.println("Faild to set setting: " + e);

0 commit comments

Comments
 (0)