summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2012-09-09 14:46:44 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-09 14:46:44 -0700
commit5de4d989fbc08cf5135c07a74e2062bf64af95f1 (patch)
tree6e1740df03f570f31767f2516879bc4550e59da2 /cmds
parent8727a73127dde026a797511d28355868797f0e46 (diff)
parent783f9e6615db5c90c184397cf1ee271e302c398b (diff)
downloadframeworks_base-5de4d989fbc08cf5135c07a74e2062bf64af95f1.zip
frameworks_base-5de4d989fbc08cf5135c07a74e2062bf64af95f1.tar.gz
frameworks_base-5de4d989fbc08cf5135c07a74e2062bf64af95f1.tar.bz2
Merge "Use correct PowerManager call to wake up screen" into jb-mr1-dev
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);