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>
This commit is contained in:
@@ -361,6 +361,9 @@ public class PowerManager
|
||||
*/
|
||||
public WakeLock newWakeLock(int flags, String tag)
|
||||
{
|
||||
if (tag == null) {
|
||||
throw new NullPointerException("tag is null in PowerManager.newWakeLock");
|
||||
}
|
||||
return new WakeLock(flags, tag);
|
||||
}
|
||||
|
||||
|
||||
@@ -571,6 +571,7 @@ class PowerManagerService extends IPowerManager.Stub
|
||||
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 @@ class PowerManagerService extends IPowerManager.Stub
|
||||
final IBinder binder;
|
||||
final String tag;
|
||||
final int uid;
|
||||
final int pid;
|
||||
final int monitorType;
|
||||
boolean activated = true;
|
||||
int minState;
|
||||
@@ -998,7 +1000,8 @@ class PowerManagerService extends IPowerManager.Stub
|
||||
activated = " activated";
|
||||
}
|
||||
pw.println(" " + type + " '" + wl.tag + "'" + acquireCausesWakeup
|
||||
+ activated + " (minState=" + wl.minState + ")");
|
||||
+ activated + " (minState=" + wl.minState + ", uid=" + wl.uid
|
||||
+ ", pid=" + wl.pid + ")");
|
||||
}
|
||||
|
||||
pw.println();
|
||||
|
||||
Reference in New Issue
Block a user