Bug
36854321
Test: adb shell am instrument -e class 'com.android.server.pm.ShortcutManagerTest2' -w com.android.frameworks.servicestests
Change-Id: I80f2a326b70f8d0598246732510e3725a0c58871
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (!DumpUtils.checkDumpAndUsageStatsPermission(mContext, TAG, pw)) return;
+ dumpNoCheck(fd, pw, args);
+ }
+
+ @VisibleForTesting
+ void dumpNoCheck(FileDescriptor fd, PrintWriter pw, String[] args) {
boolean checkin = false;
boolean clear = false;
if (args != null) {
try {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
final PrintWriter pw = new PrintWriter(out);
- mService.dump(/* fd */ null, pw, args);
+ mService.dumpNoCheck(/* fd */ null, pw, args);
pw.close();
return out.toString();
assertEquals(expected, dumpCheckin());
}
- public void testDumpsysNoPermission() {
- assertExpectException(SecurityException.class, "android.permission.DUMP",
- () -> mService.dump(null, new PrintWriter(new StringWriter()), null));
-
- // System can call it without the permission.
- runWithSystemUid(() -> {
- mService.dump(null, new PrintWriter(new StringWriter()), null);
- });
- }
-
/**
* Make sure the legacy file format that only supported a single intent per shortcut
* can still be read.