Improve wakelock debugging:
Throw NullPointerException if tag is null in PowerManager.newWakelock()
Print wakelock owner's uid and pid in dumpsys power output.
BUG: 2522675
Change-Id: I462c7f8c49f9896b2f58cef5a678ebd2c062a8f7
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index d72416d..848997b 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -571,6 +571,7 @@
binder = b;
tag = t;
uid = u == MY_UID ? Process.SYSTEM_UID : u;
+ pid = Binder.getCallingPid();
if (u != MY_UID || (
!"KEEP_SCREEN_ON_FLAG".equals(tag)
&& !"KeyInputQueue".equals(tag))) {
@@ -595,6 +596,7 @@
final IBinder binder;
final String tag;
final int uid;
+ final int pid;
final int monitorType;
boolean activated = true;
int minState;
@@ -998,7 +1000,8 @@
activated = " activated";
}
pw.println(" " + type + " '" + wl.tag + "'" + acquireCausesWakeup
- + activated + " (minState=" + wl.minState + ")");
+ + activated + " (minState=" + wl.minState + ", uid=" + wl.uid
+ + ", pid=" + wl.pid + ")");
}
pw.println();