OSDN Git Service

Add a method to set a list of uids for a wake lock
authorMarco Nelissen <marcone@google.com>
Wed, 16 Oct 2013 17:57:05 +0000 (10:57 -0700)
committerMarco Nelissen <marcone@google.com>
Fri, 25 Oct 2013 19:49:55 +0000 (12:49 -0700)
Cherrypicked from master.

b/9464621

Change-Id: Ia6a9d36d55129ae87d3ec070fbf10dc02f4b6cb4

core/java/android/os/IPowerManager.aidl
services/java/com/android/server/power/PowerManagerService.java
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgePowerManager.java

index 4c7bbb4..56176a4 100644 (file)
@@ -23,11 +23,12 @@ import android.os.WorkSource;
 
 interface IPowerManager
 {
-    // WARNING: The first three methods must remain the first three methods because their
+    // WARNING: The first four methods must remain the first three methods because their
     // transaction numbers must not change unless IPowerManager.cpp is also updated.
     void acquireWakeLock(IBinder lock, int flags, String tag, String packageName, in WorkSource ws);
     void acquireWakeLockWithUid(IBinder lock, int flags, String tag, String packageName, int uidtoblame);
     void releaseWakeLock(IBinder lock, int flags);
+    void updateWakeLockUids(IBinder lock, in int[] uids);
 
     void updateWakeLockWorkSource(IBinder lock, in WorkSource ws);
     boolean isWakeLockLevelSupported(int level);
index 8fbde14..da9548f 100644 (file)
@@ -747,6 +747,21 @@ public final class PowerManagerService extends IPowerManager.Stub
     }
 
     @Override // Binder call
+    public void updateWakeLockUids(IBinder lock, int[] uids) {
+        WorkSource ws = null;
+
+        if (uids != null) {
+            ws = new WorkSource();
+            // XXX should WorkSource have a way to set uids as an int[] instead of adding them
+            // one at a time?
+            for (int i = 0; i < uids.length; i++) {
+                ws.add(uids[i]);
+            }
+        }
+        updateWakeLockWorkSource(lock, ws);
+    }
+
+    @Override // Binder call
     public void updateWakeLockWorkSource(IBinder lock, WorkSource ws) {
         if (lock == null) {
             throw new IllegalArgumentException("lock must not be null");
index a8b58aa..281337c 100644 (file)
@@ -81,6 +81,11 @@ public class BridgePowerManager implements IPowerManager {
     }
 
     @Override
+    public void updateWakeLockUids(IBinder arg0, int[] arg1) throws RemoteException {
+        // pass for now.
+    }
+
+    @Override
     public void setAttentionLight(boolean arg0, int arg1) throws RemoteException {
         // pass for now.
     }