Loading services/core/java/com/android/server/notification/NotificationManagerService.java +39 −26 Original line number Diff line number Diff line Loading @@ -1837,7 +1837,7 @@ public class NotificationManagerService extends SystemService { void dumpImpl(PrintWriter pw, DumpFilter filter) { pw.print("Current Notification Manager state"); if (filter != null) { if (filter.filtered) { pw.print(" (filtered to "); pw.print(filter); pw.print(")"); } pw.println(':'); Loading Loading @@ -1865,7 +1865,7 @@ public class NotificationManagerService extends SystemService { for (int i=0; i<N; i++) { final NotificationRecord nr = mNotificationList.get(i); if (filter != null && !filter.matches(nr.sbn)) continue; nr.dump(pw, " ", getContext()); nr.dump(pw, " ", getContext(), filter.redact); } pw.println(" "); } Loading Loading @@ -1948,7 +1948,7 @@ public class NotificationManagerService extends SystemService { pw.println(" " + entry.getKey() + " -> " + r.getKey()); if (mNotificationsByKey.get(r.getKey()) != r) { pw.println("!!!!!!LEAK: Record not found in mNotificationsByKey."); r.dump(pw, " ", getContext()); r.dump(pw, " ", getContext(), filter.redact); } } Loading Loading @@ -3499,46 +3499,59 @@ public class NotificationManagerService extends SystemService { } public static final class DumpFilter { public boolean filtered = false; public String pkgFilter; public boolean zen; public long since; public boolean stats; private boolean all; public boolean redact = true; public static DumpFilter parseFromArguments(String[] args) { if (args != null && args.length == 2 && "p".equals(args[0]) && args[1] != null && !args[1].trim().isEmpty()) { final DumpFilter filter = new DumpFilter(); filter.pkgFilter = args[1].trim().toLowerCase(); return filter; for (int ai = 0; ai < args.length; ai++) { final String a = args[ai]; if ("--noredact".equals(a) || "--reveal".equals(a)) { filter.redact = false; } else if ("p".equals(a) || "pkg".equals(a) || "--package".equals(a)) { if (ai < args.length-1) { ai++; filter.pkgFilter = args[ai].trim().toLowerCase(); if (filter.pkgFilter.isEmpty()) { filter.pkgFilter = null; } else { filter.filtered = true; } if (args != null && args.length == 1 && "zen".equals(args[0])) { final DumpFilter filter = new DumpFilter(); filter.zen = true; filter.all = true; return filter; } if (args != null && args.length >= 1 && "--stats".equals(args[0])) { final DumpFilter filter = new DumpFilter(); } else if ("--zen".equals(a) || "zen".equals(a)) { filter.filtered = true; filter.zen = true; } else if ("--stats".equals(a)) { filter.stats = true; filter.since = args.length == 2 ? Long.valueOf(args[1]) : 0; filter.all = true; return filter; if (ai < args.length-1) { ai++; filter.since = Long.valueOf(args[ai]); } else { filter.since = 0; } return null; } } return filter; } public boolean matches(StatusBarNotification sbn) { return all ? true : sbn != null if (!filtered) return true; return zen ? true : sbn != null && (matches(sbn.getPackageName()) || matches(sbn.getOpPkg())); } public boolean matches(ComponentName component) { return all ? true : component != null && matches(component.getPackageName()); if (!filtered) return true; return zen ? true : component != null && matches(component.getPackageName()); } public boolean matches(String pkg) { return all ? true : pkg != null && pkg.toLowerCase().contains(pkgFilter); if (!filtered) return true; return zen ? true : pkg != null && pkg.toLowerCase().contains(pkgFilter); } @Override Loading services/core/java/com/android/server/notification/NotificationRecord.java +10 −3 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ public final class NotificationRecord { /** @deprecated Use {@link #getUser()} instead. */ public int getUserId() { return sbn.getUserId(); } void dump(PrintWriter pw, String prefix, Context baseContext) { void dump(PrintWriter pw, String prefix, Context baseContext, boolean redact) { final Notification notification = sbn.getNotification(); final Icon icon = notification.getSmallIcon(); String iconStr = String.valueOf(icon); Loading Loading @@ -164,7 +164,7 @@ public final class NotificationRecord { pw.println("null"); } else { pw.print(val.getClass().getSimpleName()); if (val instanceof CharSequence || val instanceof String) { if (redact && (val instanceof CharSequence || val instanceof String)) { // redact contents from bugreports } else if (val instanceof Bitmap) { pw.print(String.format(" (%dx%d)", Loading @@ -172,7 +172,14 @@ public final class NotificationRecord { ((Bitmap) val).getHeight())); } else if (val.getClass().isArray()) { final int N = Array.getLength(val); pw.println(" (" + N + ")"); pw.print(" (" + N + ")"); if (!redact) { for (int j=0; j<N; j++) { pw.println(); pw.print(String.format("%s [%d] %s", prefix, j, String.valueOf(Array.get(val, j)))); } } } else { pw.print(" (" + String.valueOf(val) + ")"); } Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +39 −26 Original line number Diff line number Diff line Loading @@ -1837,7 +1837,7 @@ public class NotificationManagerService extends SystemService { void dumpImpl(PrintWriter pw, DumpFilter filter) { pw.print("Current Notification Manager state"); if (filter != null) { if (filter.filtered) { pw.print(" (filtered to "); pw.print(filter); pw.print(")"); } pw.println(':'); Loading Loading @@ -1865,7 +1865,7 @@ public class NotificationManagerService extends SystemService { for (int i=0; i<N; i++) { final NotificationRecord nr = mNotificationList.get(i); if (filter != null && !filter.matches(nr.sbn)) continue; nr.dump(pw, " ", getContext()); nr.dump(pw, " ", getContext(), filter.redact); } pw.println(" "); } Loading Loading @@ -1948,7 +1948,7 @@ public class NotificationManagerService extends SystemService { pw.println(" " + entry.getKey() + " -> " + r.getKey()); if (mNotificationsByKey.get(r.getKey()) != r) { pw.println("!!!!!!LEAK: Record not found in mNotificationsByKey."); r.dump(pw, " ", getContext()); r.dump(pw, " ", getContext(), filter.redact); } } Loading Loading @@ -3499,46 +3499,59 @@ public class NotificationManagerService extends SystemService { } public static final class DumpFilter { public boolean filtered = false; public String pkgFilter; public boolean zen; public long since; public boolean stats; private boolean all; public boolean redact = true; public static DumpFilter parseFromArguments(String[] args) { if (args != null && args.length == 2 && "p".equals(args[0]) && args[1] != null && !args[1].trim().isEmpty()) { final DumpFilter filter = new DumpFilter(); filter.pkgFilter = args[1].trim().toLowerCase(); return filter; for (int ai = 0; ai < args.length; ai++) { final String a = args[ai]; if ("--noredact".equals(a) || "--reveal".equals(a)) { filter.redact = false; } else if ("p".equals(a) || "pkg".equals(a) || "--package".equals(a)) { if (ai < args.length-1) { ai++; filter.pkgFilter = args[ai].trim().toLowerCase(); if (filter.pkgFilter.isEmpty()) { filter.pkgFilter = null; } else { filter.filtered = true; } if (args != null && args.length == 1 && "zen".equals(args[0])) { final DumpFilter filter = new DumpFilter(); filter.zen = true; filter.all = true; return filter; } if (args != null && args.length >= 1 && "--stats".equals(args[0])) { final DumpFilter filter = new DumpFilter(); } else if ("--zen".equals(a) || "zen".equals(a)) { filter.filtered = true; filter.zen = true; } else if ("--stats".equals(a)) { filter.stats = true; filter.since = args.length == 2 ? Long.valueOf(args[1]) : 0; filter.all = true; return filter; if (ai < args.length-1) { ai++; filter.since = Long.valueOf(args[ai]); } else { filter.since = 0; } return null; } } return filter; } public boolean matches(StatusBarNotification sbn) { return all ? true : sbn != null if (!filtered) return true; return zen ? true : sbn != null && (matches(sbn.getPackageName()) || matches(sbn.getOpPkg())); } public boolean matches(ComponentName component) { return all ? true : component != null && matches(component.getPackageName()); if (!filtered) return true; return zen ? true : component != null && matches(component.getPackageName()); } public boolean matches(String pkg) { return all ? true : pkg != null && pkg.toLowerCase().contains(pkgFilter); if (!filtered) return true; return zen ? true : pkg != null && pkg.toLowerCase().contains(pkgFilter); } @Override Loading
services/core/java/com/android/server/notification/NotificationRecord.java +10 −3 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ public final class NotificationRecord { /** @deprecated Use {@link #getUser()} instead. */ public int getUserId() { return sbn.getUserId(); } void dump(PrintWriter pw, String prefix, Context baseContext) { void dump(PrintWriter pw, String prefix, Context baseContext, boolean redact) { final Notification notification = sbn.getNotification(); final Icon icon = notification.getSmallIcon(); String iconStr = String.valueOf(icon); Loading Loading @@ -164,7 +164,7 @@ public final class NotificationRecord { pw.println("null"); } else { pw.print(val.getClass().getSimpleName()); if (val instanceof CharSequence || val instanceof String) { if (redact && (val instanceof CharSequence || val instanceof String)) { // redact contents from bugreports } else if (val instanceof Bitmap) { pw.print(String.format(" (%dx%d)", Loading @@ -172,7 +172,14 @@ public final class NotificationRecord { ((Bitmap) val).getHeight())); } else if (val.getClass().isArray()) { final int N = Array.getLength(val); pw.println(" (" + N + ")"); pw.print(" (" + N + ")"); if (!redact) { for (int j=0; j<N; j++) { pw.println(); pw.print(String.format("%s [%d] %s", prefix, j, String.valueOf(Array.get(val, j)))); } } } else { pw.print(" (" + String.valueOf(val) + ")"); } Loading