Add PowerManager method to assign blame to a single uid
Currently used by audioflinger to account for recording wakelocks.
b/10985160
Change-Id: I18fc8487f2a197bf02b5269a4bcae9e75b6c2207
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index 23492ff..4c7bbb4 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -23,9 +23,10 @@
interface IPowerManager
{
- // WARNING: The first two methods must remain the first two methods because their
+ // WARNING: The first three 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 updateWakeLockWorkSource(IBinder lock, in WorkSource ws);
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index 89d102d..3857ec0 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -128,6 +128,7 @@
<assign-permission name="android.permission.MODIFY_AUDIO_SETTINGS" uid="media" />
<assign-permission name="android.permission.ACCESS_SURFACE_FLINGER" uid="media" />
<assign-permission name="android.permission.WAKE_LOCK" uid="media" />
+ <assign-permission name="android.permission.UPDATE_DEVICE_STATS" uid="media" />
<assign-permission name="android.permission.UPDATE_APP_OPS_STATS" uid="media" />
<assign-permission name="android.permission.ACCESS_SURFACE_FLINGER" uid="graphics" />
diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java
index fe09a33..4407de6 100644
--- a/services/java/com/android/server/power/PowerManagerService.java
+++ b/services/java/com/android/server/power/PowerManagerService.java
@@ -579,6 +579,12 @@
}
@Override // Binder call
+ public void acquireWakeLockWithUid(IBinder lock, int flags, String tag, String packageName,
+ int uid) {
+ acquireWakeLock(lock, flags, tag, packageName, new WorkSource(uid));
+ }
+
+ @Override // Binder call
public void acquireWakeLock(IBinder lock, int flags, String tag, String packageName,
WorkSource ws) {
if (lock == null) {