Loading services/core/java/com/android/server/pm/LauncherAppsService.java +1 −1 Original line number Diff line number Diff line Loading @@ -363,7 +363,7 @@ public class LauncherAppsService extends SystemService { private void ensureShortcutPermission(@NonNull String callingPackage, int userId) { verifyCallingPackage(callingPackage); ensureInUserProfiles(userId, "Cannot start activity for unrelated profile " + userId); ensureInUserProfiles(userId, "Cannot access shortcuts for unrelated profile " + userId); if (!mShortcutServiceInternal.hasShortcutHostPermission(getCallingUserId(), callingPackage)) { Loading services/tests/shortcutmanagerutils/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,6 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE := ShortcutManagerTestUtils LOCAL_SDK_VERSION := current LOCAL_SDK_VERSION := test_current include $(BUILD_STATIC_JAVA_LIBRARY) services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java +7 −5 Original line number Diff line number Diff line Loading @@ -156,10 +156,11 @@ public class ShortcutManagerTestUtils { return result; } private static List<String> runCommand(Instrumentation instrumentation, String command) { public static List<String> runCommand(Instrumentation instrumentation, String command) { return runCommand(instrumentation, command, null); } private static List<String> runCommand(Instrumentation instrumentation, String command, public static List<String> runCommand(Instrumentation instrumentation, String command, Predicate<List<String>> resultAsserter) { Log.d(TAG, "Running command: " + command); final List<String> result; Loading @@ -175,11 +176,11 @@ public class ShortcutManagerTestUtils { return result; } private static void runCommandForNoOutput(Instrumentation instrumentation, String command) { public static void runCommandForNoOutput(Instrumentation instrumentation, String command) { runCommand(instrumentation, command, result -> result.size() == 0); } private static List<String> runShortcutCommand(Instrumentation instrumentation, String command, public static List<String> runShortcutCommand(Instrumentation instrumentation, String command, Predicate<List<String>> resultAsserter) { return runCommand(instrumentation, "cmd shortcut " + command, resultAsserter); } Loading @@ -204,7 +205,8 @@ public class ShortcutManagerTestUtils { } public static void setDefaultLauncher(Instrumentation instrumentation, String component) { runCommand(instrumentation, "cmd package set-home-activity " + component, runCommand(instrumentation, "cmd package set-home-activity --user " + instrumentation.getContext().getUserId() + " " + component, result -> result.contains("Success")); } Loading Loading
services/core/java/com/android/server/pm/LauncherAppsService.java +1 −1 Original line number Diff line number Diff line Loading @@ -363,7 +363,7 @@ public class LauncherAppsService extends SystemService { private void ensureShortcutPermission(@NonNull String callingPackage, int userId) { verifyCallingPackage(callingPackage); ensureInUserProfiles(userId, "Cannot start activity for unrelated profile " + userId); ensureInUserProfiles(userId, "Cannot access shortcuts for unrelated profile " + userId); if (!mShortcutServiceInternal.hasShortcutHostPermission(getCallingUserId(), callingPackage)) { Loading
services/tests/shortcutmanagerutils/Android.mk +1 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,6 @@ LOCAL_MODULE_TAGS := optional LOCAL_MODULE := ShortcutManagerTestUtils LOCAL_SDK_VERSION := current LOCAL_SDK_VERSION := test_current include $(BUILD_STATIC_JAVA_LIBRARY)
services/tests/shortcutmanagerutils/src/com/android/server/pm/shortcutmanagertest/ShortcutManagerTestUtils.java +7 −5 Original line number Diff line number Diff line Loading @@ -156,10 +156,11 @@ public class ShortcutManagerTestUtils { return result; } private static List<String> runCommand(Instrumentation instrumentation, String command) { public static List<String> runCommand(Instrumentation instrumentation, String command) { return runCommand(instrumentation, command, null); } private static List<String> runCommand(Instrumentation instrumentation, String command, public static List<String> runCommand(Instrumentation instrumentation, String command, Predicate<List<String>> resultAsserter) { Log.d(TAG, "Running command: " + command); final List<String> result; Loading @@ -175,11 +176,11 @@ public class ShortcutManagerTestUtils { return result; } private static void runCommandForNoOutput(Instrumentation instrumentation, String command) { public static void runCommandForNoOutput(Instrumentation instrumentation, String command) { runCommand(instrumentation, command, result -> result.size() == 0); } private static List<String> runShortcutCommand(Instrumentation instrumentation, String command, public static List<String> runShortcutCommand(Instrumentation instrumentation, String command, Predicate<List<String>> resultAsserter) { return runCommand(instrumentation, "cmd shortcut " + command, resultAsserter); } Loading @@ -204,7 +205,8 @@ public class ShortcutManagerTestUtils { } public static void setDefaultLauncher(Instrumentation instrumentation, String component) { runCommand(instrumentation, "cmd package set-home-activity " + component, runCommand(instrumentation, "cmd package set-home-activity --user " + instrumentation.getContext().getUserId() + " " + component, result -> result.contains("Success")); } Loading