summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2012-09-09 14:38:23 -0700
committerGuang Zhu <guangzhu@google.com>2012-09-09 14:43:09 -0700
commit783f9e6615db5c90c184397cf1ee271e302c398b (patch)
treec552f9768c06a47f2515f7ef116aea5bcb8c7cbc /cmds
parentadd52a975aa78d9e24d3e63a8168c00a9bfb80ec (diff)
downloadframeworks_base-783f9e6615db5c90c184397cf1ee271e302c398b.zip
frameworks_base-783f9e6615db5c90c184397cf1ee271e302c398b.tar.gz
frameworks_base-783f9e6615db5c90c184397cf1ee271e302c398b.tar.bz2
Use correct PowerManager call to wake up screen
The current implementation does not actually wakes up the screen. Change-Id: Ief2dca013cfe40e03b64273fe7b09822e9ad42a7
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);