summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
Diffstat (limited to 'cmds')
-rw-r--r--cmds/svc/src/com/android/commands/svc/PowerCommand.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/cmds/svc/src/com/android/commands/svc/PowerCommand.java b/cmds/svc/src/com/android/commands/svc/PowerCommand.java
index ec3ec3e..58105fa 100644
--- a/cmds/svc/src/com/android/commands/svc/PowerCommand.java
+++ b/cmds/svc/src/com/android/commands/svc/PowerCommand.java
@@ -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);