Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbb4b22f authored by Makoto Onuki's avatar Makoto Onuki
Browse files

NotificationManager: clean calling identity in dump().

When a device has work profile, "dumpsys notifiaction" often crashes
if the caller doesn't have the CROSS_USER permission.

The dump() method is protected with checkDumpAndUsageStatsPermission(),
and it won't need further permission check.

Test: "dumpsys notification"
Change-Id: Ief5269dec1e334bcd96013c349a468a0136a9551
parent 6d5bdf29
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -3125,6 +3125,8 @@ public class NotificationManagerService extends SystemService {
        protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
            if (!DumpUtils.checkDumpAndUsageStatsPermission(getContext(), TAG, pw)) return;
            final DumpFilter filter = DumpFilter.parseFromArguments(args);
            final long token = Binder.clearCallingIdentity();
            try {
                if (filter.stats) {
                    dumpJson(pw, filter);
                } else if (filter.proto) {
@@ -3134,6 +3136,9 @@ public class NotificationManagerService extends SystemService {
                } else {
                    dumpImpl(pw, filter);
                }
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }

        @Override