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

Commit 3bdbf985 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Make "cmd package set-home-activity" more CTS friendly

- Print "Success" when it went well.
- Catch all exceptions and print error message, not just
RemoteExceptions

- Update the shortcut manger test utility to match the new behavior

Bug 29612099

Change-Id: If6a80241ea5e8ef0b2d3f961d1442e730b908764
parent 9981d94d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1099,8 +1099,9 @@ class PackageManagerShellCommand extends ShellCommand {

        try {
            mInterface.setHomeActivity(componentName, userId);
            pw.println("Success");
            return 0;
        } catch (RemoteException e) {
        } catch (Exception e) {
            pw.println(e.toString());
            return 1;
        }
+3 −1
Original line number Diff line number Diff line
@@ -168,7 +168,8 @@ public class ShortcutManagerTestUtils {
    }

    public static void setDefaultLauncher(Instrumentation instrumentation, String component) {
        runCommandForNoOutput(instrumentation, "cmd package set-home-activity " + component);
        runCommand(instrumentation, "cmd package set-home-activity " + component,
                result -> result.contains("Success"));
    }

    public static void setDefaultLauncher(Instrumentation instrumentation, Context packageContext) {
@@ -202,6 +203,7 @@ public class ShortcutManagerTestUtils {
        if (!ENABLE_DUMPSYS) {
            return;
        }
        Log.e(TAG, "Dumpsys shortcut");
        for (String s : runCommand(instrumentation, "dumpsys shortcut")) {
            Log.e(TAG, s);
        }