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
This commit is contained in:
Makoto Onuki
2016-06-23 16:56:35 -07:00
parent 9981d94d54
commit 3bdbf985e1
2 changed files with 5 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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);
}