summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/api/current.txt2
-rw-r--r--core/java/android/appwidget/AppWidgetManager.java3
-rw-r--r--core/java/android/content/pm/LauncherApps.java10
-rw-r--r--core/java/android/content/pm/PackageInstaller.java4
-rw-r--r--core/java/android/content/pm/ShortcutManager.java4
5 files changed, 18 insertions, 5 deletions
diff --git a/core/api/current.txt b/core/api/current.txt
index 93c34cd5e5ec..982ab640af7c 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -12507,7 +12507,7 @@ package android.content.pm {
method public boolean hasShortcutHostPermission();
method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public boolean isActivityEnabled(android.content.ComponentName, android.os.UserHandle);
method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public boolean isPackageEnabled(String, android.os.UserHandle);
- method public void pinShortcuts(@NonNull String, @NonNull java.util.List<java.lang.String>, @NonNull android.os.UserHandle);
+ method @RequiresPermission(conditional=true, value="android.permission.ACCESS_SHORTCUTS") public void pinShortcuts(@NonNull String, @NonNull java.util.List<java.lang.String>, @NonNull android.os.UserHandle);
method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public void registerCallback(android.content.pm.LauncherApps.Callback);
method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public void registerCallback(android.content.pm.LauncherApps.Callback, android.os.Handler);
method public void registerPackageInstallerSessionCallback(@NonNull java.util.concurrent.Executor, @NonNull android.content.pm.PackageInstaller.SessionCallback);
diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java
index 2c0e035e80c4..57b5c13a659d 100644
--- a/core/java/android/appwidget/AppWidgetManager.java
+++ b/core/java/android/appwidget/AppWidgetManager.java
@@ -1384,7 +1384,8 @@ public class AppWidgetManager {
*
* @return {@code TRUE} if the launcher supports this feature. Note the API will return without
* waiting for the user to respond, so getting {@code TRUE} from this API does *not* mean
- * the shortcut is pinned. {@code FALSE} if the launcher doesn't support this feature.
+ * the shortcut is pinned. {@code FALSE} if the launcher doesn't support this feature or if
+ * calling app belongs to a user-profile with items restricted on home screen.
*
* @see android.content.pm.ShortcutManager#isRequestPinShortcutSupported()
* @see android.content.pm.ShortcutManager#requestPinShortcut(ShortcutInfo, IntentSender)
diff --git a/core/java/android/content/pm/LauncherApps.java b/core/java/android/content/pm/LauncherApps.java
index 39b914975362..27ab5d05fab3 100644
--- a/core/java/android/content/pm/LauncherApps.java
+++ b/core/java/android/content/pm/LauncherApps.java
@@ -1097,7 +1097,8 @@ public class LauncherApps {
* @param packageName The specific package to query. If null, it checks all installed packages
* in the profile.
* @param user The UserHandle of the profile.
- * @return List of config activities. Can be an empty list but will not be null.
+ * @return List of config activities. Can be an empty list but will not be null. Empty list will
+ * be returned for user-profiles that have items restricted on home screen.
*
* @see Intent#ACTION_CREATE_SHORTCUT
* @see #getShortcutConfigActivityIntent(LauncherActivityInfo)
@@ -1488,6 +1489,9 @@ public class LauncherApps {
* <p>The calling launcher application must be allowed to access the shortcut information,
* as defined in {@link #hasShortcutHostPermission()}.
*
+ * <p>For user-profiles with items restricted on home screen, caller must have the required
+ * permission.
+ *
* @param packageName The target package name.
* @param shortcutIds The IDs of the shortcut to be pinned.
* @param user The UserHandle of the profile.
@@ -1496,6 +1500,7 @@ public class LauncherApps {
*
* @see ShortcutManager
*/
+ @RequiresPermission(conditional = true, value = android.Manifest.permission.ACCESS_SHORTCUTS)
public void pinShortcuts(@NonNull String packageName, @NonNull List<String> shortcutIds,
@NonNull UserHandle user) {
logErrorForInvalidProfileAccess(user);
@@ -2298,6 +2303,9 @@ public class LauncherApps {
* app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be the session owner to
* watch for these events.
*
+ * <p> Session callbacks are not sent for user-profiles that have items restricted on home
+ * screen.
+ *
* @param callback The callback to register.
* @param executor {@link Executor} to handle the callbacks, cannot be null.
*
diff --git a/core/java/android/content/pm/PackageInstaller.java b/core/java/android/content/pm/PackageInstaller.java
index 17e6f167b06d..270fc32a4e32 100644
--- a/core/java/android/content/pm/PackageInstaller.java
+++ b/core/java/android/content/pm/PackageInstaller.java
@@ -177,6 +177,10 @@ public class PackageInstaller {
* Broadcast Action: Explicit broadcast sent to the last known default launcher when a session
* for a new install is committed. For managed profile, this is sent to the default launcher
* of the primary profile.
+ * For user-profiles that have items restricted on home screen, this broadcast is sent to
+ * the default launcher of the primary profile, only if it has either
+ * {@link Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL} or
+ * {@link Manifest.permission.ACCESS_HIDDEN_PROFILES} permission.
* <p>
* The associated session is defined in {@link #EXTRA_SESSION} and the user for which this
* session was created in {@link Intent#EXTRA_USER}.
diff --git a/core/java/android/content/pm/ShortcutManager.java b/core/java/android/content/pm/ShortcutManager.java
index e48a02a192d2..3514914b1d86 100644
--- a/core/java/android/content/pm/ShortcutManager.java
+++ b/core/java/android/content/pm/ShortcutManager.java
@@ -583,8 +583,8 @@ public class ShortcutManager {
*
* @return {@code TRUE} if the launcher supports this feature. Note the API will return without
* waiting for the user to respond, so getting {@code TRUE} from this API does *not* mean
- * the shortcut was pinned successfully. {@code FALSE} if the launcher doesn't support this
- * feature.
+ * the shortcut was pinned successfully. {@code FALSE} if the launcher doesn't support this
+ * feature or if calling app belongs to a user-profile with items restricted on home screen.
*
* @see #isRequestPinShortcutSupported()
* @see IntentSender