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

Commit 6a7a967b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove/fix broken test due to change to DUMP permission check." into oc-dev

parents 9077faab c4361e34
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3421,6 +3421,11 @@ public class ShortcutService extends IShortcutService.Stub {
    @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) {
+1 −1
Original line number Diff line number Diff line
@@ -1275,7 +1275,7 @@ public abstract class BaseShortcutManagerTest extends InstrumentationTestCase {
        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();
+0 −10
Original line number Diff line number Diff line
@@ -2040,16 +2040,6 @@ public class ShortcutManagerTest2 extends BaseShortcutManagerTest {
        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.