From d983ba5cac232c01dff818556b57f497f7d99854 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Thu, 3 Oct 2013 08:49:36 -0700 Subject: [PATCH] Add PowerManager method to assign blame to a single uid Currently used by audioflinger to account for recording wakelocks. b/10985160 Change-Id: I18fc8487f2a197bf02b5269a4bcae9e75b6c2207 --- core/java/android/os/IPowerManager.aidl | 3 ++- data/etc/platform.xml | 1 + services/java/com/android/server/power/PowerManagerService.java | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl index 23492ff96340..4c7bbb48f52b 100644 --- a/core/java/android/os/IPowerManager.aidl +++ b/core/java/android/os/IPowerManager.aidl @@ -23,9 +23,10 @@ import android.os.WorkSource; 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 89d102d79703..3857ec09033f 100644 --- a/data/etc/platform.xml +++ b/data/etc/platform.xml @@ -128,6 +128,7 @@ + diff --git a/services/java/com/android/server/power/PowerManagerService.java b/services/java/com/android/server/power/PowerManagerService.java index fe09a33b3d3b..4407de669439 100644 --- a/services/java/com/android/server/power/PowerManagerService.java +++ b/services/java/com/android/server/power/PowerManagerService.java @@ -579,6 +579,12 @@ public final class PowerManagerService extends IPowerManager.Stub } @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) { -- 2.11.0