Loading core/api/current.txt +13 −13 Original line number Original line Diff line number Diff line Loading @@ -12487,33 +12487,33 @@ package android.content.pm { } } public class LauncherApps { public class LauncherApps { method public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(String, android.os.UserHandle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(String, android.os.UserHandle); method @NonNull public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getAllPackageInstallerSessions(); method @NonNull @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getAllPackageInstallerSessions(); method @FlaggedApi("android.os.allow_private_profile") @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.content.IntentSender getAppMarketActivityIntent(@Nullable String, @NonNull android.os.UserHandle); method @FlaggedApi("android.os.allow_private_profile") @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.content.IntentSender getAppMarketActivityIntent(@Nullable String, @NonNull android.os.UserHandle); method public android.content.pm.ApplicationInfo getApplicationInfo(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException; method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.content.pm.ApplicationInfo getApplicationInfo(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException; method @FlaggedApi("android.os.allow_private_profile") @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public final android.content.pm.LauncherUserInfo getLauncherUserInfo(@NonNull android.os.UserHandle); method @FlaggedApi("android.os.allow_private_profile") @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public final android.content.pm.LauncherUserInfo getLauncherUserInfo(@NonNull android.os.UserHandle); method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent); method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent); method @FlaggedApi("android.os.allow_private_profile") @NonNull @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<java.lang.String> getPreInstalledSystemPackages(@NonNull android.os.UserHandle); method @FlaggedApi("android.os.allow_private_profile") @NonNull @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<java.lang.String> getPreInstalledSystemPackages(@NonNull android.os.UserHandle); method public java.util.List<android.os.UserHandle> getProfiles(); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<android.os.UserHandle> getProfiles(); method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int); method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int); method @Nullable public android.content.IntentSender getShortcutConfigActivityIntent(@NonNull android.content.pm.LauncherActivityInfo); method @Nullable public android.content.IntentSender getShortcutConfigActivityIntent(@NonNull android.content.pm.LauncherActivityInfo); method public java.util.List<android.content.pm.LauncherActivityInfo> getShortcutConfigActivityList(@Nullable String, @NonNull android.os.UserHandle); method public java.util.List<android.content.pm.LauncherActivityInfo> getShortcutConfigActivityList(@Nullable String, @NonNull android.os.UserHandle); method public android.graphics.drawable.Drawable getShortcutIconDrawable(@NonNull android.content.pm.ShortcutInfo, int); method public android.graphics.drawable.Drawable getShortcutIconDrawable(@NonNull android.content.pm.ShortcutInfo, int); method @Nullable public android.app.PendingIntent getShortcutIntent(@NonNull String, @NonNull String, @Nullable android.os.Bundle, @NonNull android.os.UserHandle); method @Nullable public android.app.PendingIntent getShortcutIntent(@NonNull String, @NonNull String, @Nullable android.os.Bundle, @NonNull android.os.UserHandle); method @Nullable public java.util.List<android.content.pm.ShortcutInfo> getShortcuts(@NonNull android.content.pm.LauncherApps.ShortcutQuery, @NonNull android.os.UserHandle); method @Nullable public java.util.List<android.content.pm.ShortcutInfo> getShortcuts(@NonNull android.content.pm.LauncherApps.ShortcutQuery, @NonNull android.os.UserHandle); method @Nullable public android.os.Bundle getSuspendedPackageLauncherExtras(String, android.os.UserHandle); method @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.os.Bundle getSuspendedPackageLauncherExtras(String, android.os.UserHandle); method public boolean hasShortcutHostPermission(); method public boolean hasShortcutHostPermission(); method 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 isActivityEnabled(android.content.ComponentName, android.os.UserHandle); method public boolean isPackageEnabled(String, 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 public void pinShortcuts(@NonNull String, @NonNull java.util.List<java.lang.String>, @NonNull android.os.UserHandle); method 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); method public void registerCallback(android.content.pm.LauncherApps.Callback, android.os.Handler); 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); method public void registerPackageInstallerSessionCallback(@NonNull java.util.concurrent.Executor, @NonNull android.content.pm.PackageInstaller.SessionCallback); method public android.content.pm.LauncherActivityInfo resolveActivity(android.content.Intent, android.os.UserHandle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.content.pm.LauncherActivityInfo resolveActivity(android.content.Intent, android.os.UserHandle); method @FlaggedApi("android.content.pm.archiving") public void setArchiveCompatibility(@NonNull android.content.pm.LauncherApps.ArchiveCompatibilityParams); method @FlaggedApi("android.content.pm.archiving") public void setArchiveCompatibility(@NonNull android.content.pm.LauncherApps.ArchiveCompatibilityParams); method public boolean shouldHideFromSuggestions(@NonNull String, @NonNull android.os.UserHandle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public boolean shouldHideFromSuggestions(@NonNull String, @NonNull android.os.UserHandle); method public void startAppDetailsActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public void startAppDetailsActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); method public void startMainActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public void startMainActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); method public void startPackageInstallerSessionDetailsActivity(@NonNull android.content.pm.PackageInstaller.SessionInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle); method public void startPackageInstallerSessionDetailsActivity(@NonNull android.content.pm.PackageInstaller.SessionInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle); method public void startShortcut(@NonNull String, @NonNull String, @Nullable android.graphics.Rect, @Nullable android.os.Bundle, @NonNull android.os.UserHandle); method public void startShortcut(@NonNull String, @NonNull String, @Nullable android.graphics.Rect, @Nullable android.os.Bundle, @NonNull android.os.UserHandle); method public void startShortcut(@NonNull android.content.pm.ShortcutInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle); method public void startShortcut(@NonNull android.content.pm.ShortcutInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle); core/java/android/content/pm/LauncherApps.java +77 −0 Original line number Original line Diff line number Diff line Loading @@ -693,7 +693,12 @@ public class LauncherApps { * * * <p>If the caller is running on a managed profile, it'll return only the current profile. * <p>If the caller is running on a managed profile, it'll return only the current profile. * Otherwise it'll return the same list as {@link UserManager#getUserProfiles()} would. * Otherwise it'll return the same list as {@link UserManager#getUserProfiles()} would. * * <p> To get hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public List<UserHandle> getProfiles() { public List<UserHandle> getProfiles() { if (mUserManager.isManagedProfile() if (mUserManager.isManagedProfile() || (android.multiuser.Flags.enableLauncherAppsHiddenProfileChecks() || (android.multiuser.Flags.enableLauncherAppsHiddenProfileChecks() Loading Loading @@ -751,11 +756,17 @@ public class LauncherApps { * list.</li> * list.</li> * </ul> * </ul> * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param packageName The specific package to query. If null, it checks all installed packages * @param packageName The specific package to query. If null, it checks all installed packages * in the profile. * in the profile. * @param user The UserHandle of the profile. * @param user The UserHandle of the profile. * @return List of launchable activities. Can be an empty list but will not be null. * @return List of launchable activities. Can be an empty list but will not be null. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) { public List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading Loading @@ -925,10 +936,16 @@ public class LauncherApps { * Returns the activity info for a given intent and user handle, if it resolves. Otherwise it * Returns the activity info for a given intent and user handle, if it resolves. Otherwise it * returns null. * returns null. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param intent The intent to find a match for. * @param intent The intent to find a match for. * @param user The profile to look in for a match. * @param user The profile to look in for a match. * @return An activity info object if there is a match. * @return An activity info object if there is a match. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public LauncherActivityInfo resolveActivity(Intent intent, UserHandle user) { public LauncherActivityInfo resolveActivity(Intent intent, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading Loading @@ -978,11 +995,17 @@ public class LauncherApps { /** /** * Starts a Main activity in the specified profile. * Starts a Main activity in the specified profile. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param component The ComponentName of the activity to launch * @param component The ComponentName of the activity to launch * @param user The UserHandle of the profile * @param user The UserHandle of the profile * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param opts Options to pass to startActivity * @param opts Options to pass to startActivity */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public void startMainActivity(ComponentName component, UserHandle user, Rect sourceBounds, public void startMainActivity(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts) { Bundle opts) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); Loading Loading @@ -1020,11 +1043,17 @@ public class LauncherApps { * Starts the settings activity to show the application details for a * Starts the settings activity to show the application details for a * package in the specified profile. * package in the specified profile. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param component The ComponentName of the package to launch settings for. * @param component The ComponentName of the package to launch settings for. * @param user The UserHandle of the profile * @param user The UserHandle of the profile * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param opts Options to pass to startActivity * @param opts Options to pass to startActivity */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public void startAppDetailsActivity(ComponentName component, UserHandle user, public void startAppDetailsActivity(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts) { Rect sourceBounds, Bundle opts) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); Loading Loading @@ -1135,11 +1164,17 @@ public class LauncherApps { /** /** * Checks if the package is installed and enabled for a profile. * Checks if the package is installed and enabled for a profile. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param packageName The package to check. * @param packageName The package to check. * @param user The UserHandle of the profile. * @param user The UserHandle of the profile. * * * @return true if the package exists and is enabled. * @return true if the package exists and is enabled. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public boolean isPackageEnabled(String packageName, UserHandle user) { public boolean isPackageEnabled(String packageName, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading @@ -1157,6 +1192,10 @@ public class LauncherApps { * <p>The contents of this {@link Bundle} are supposed to be a contract between the suspending * <p>The contents of this {@link Bundle} are supposed to be a contract between the suspending * app and the launcher. * app and the launcher. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * <p>Note: This just returns whatever extras were provided to the system, <em>which might * <p>Note: This just returns whatever extras were provided to the system, <em>which might * even be {@code null}.</em> * even be {@code null}.</em> * * Loading @@ -1168,6 +1207,8 @@ public class LauncherApps { * @see Callback#onPackagesSuspended(String[], UserHandle, Bundle) * @see Callback#onPackagesSuspended(String[], UserHandle, Bundle) * @see PackageManager#isPackageSuspended() * @see PackageManager#isPackageSuspended() */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public @Nullable Bundle getSuspendedPackageLauncherExtras(String packageName, UserHandle user) { public @Nullable Bundle getSuspendedPackageLauncherExtras(String packageName, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading @@ -1182,10 +1223,16 @@ public class LauncherApps { * could be done because the package was marked as distracting to the user via * could be done because the package was marked as distracting to the user via * {@code PackageManager.setDistractingPackageRestrictions(String[], int)}. * {@code PackageManager.setDistractingPackageRestrictions(String[], int)}. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param packageName The package for which to check. * @param packageName The package for which to check. * @param user the {@link UserHandle} of the profile. * @param user the {@link UserHandle} of the profile. * @return * @return */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public boolean shouldHideFromSuggestions(@NonNull String packageName, public boolean shouldHideFromSuggestions(@NonNull String packageName, @NonNull UserHandle user) { @NonNull UserHandle user) { Objects.requireNonNull(packageName, "packageName"); Objects.requireNonNull(packageName, "packageName"); Loading @@ -1200,6 +1247,10 @@ public class LauncherApps { /** /** * Returns {@link ApplicationInfo} about an application installed for a specific user profile. * Returns {@link ApplicationInfo} about an application installed for a specific user profile. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param packageName The package name of the application * @param packageName The package name of the application * @param flags Additional option flags {@link PackageManager#getApplicationInfo} * @param flags Additional option flags {@link PackageManager#getApplicationInfo} * @param user The UserHandle of the profile. * @param user The UserHandle of the profile. Loading @@ -1208,6 +1259,8 @@ public class LauncherApps { * {@code null} if the package isn't installed for the given profile, or the profile * {@code null} if the package isn't installed for the given profile, or the profile * isn't enabled. * isn't enabled. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public ApplicationInfo getApplicationInfo(@NonNull String packageName, public ApplicationInfo getApplicationInfo(@NonNull String packageName, @ApplicationInfoFlagsBits int flags, @NonNull UserHandle user) @ApplicationInfoFlagsBits int flags, @NonNull UserHandle user) throws PackageManager.NameNotFoundException { throws PackageManager.NameNotFoundException { Loading Loading @@ -1257,11 +1310,17 @@ public class LauncherApps { * <p>The activity may still not be exported, in which case {@link #startMainActivity} will * <p>The activity may still not be exported, in which case {@link #startMainActivity} will * throw a {@link SecurityException} unless the caller has the same UID as the target app's. * throw a {@link SecurityException} unless the caller has the same UID as the target app's. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param component The activity to check. * @param component The activity to check. * @param user The UserHandle of the profile. * @param user The UserHandle of the profile. * * * @return true if the activity exists and is enabled. * @return true if the activity exists and is enabled. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public boolean isActivityEnabled(ComponentName component, UserHandle user) { public boolean isActivityEnabled(ComponentName component, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading Loading @@ -1816,8 +1875,14 @@ public class LauncherApps { /** /** * Registers a callback for changes to packages in this user and managed profiles. * Registers a callback for changes to packages in this user and managed profiles. * * * <p>To receive callbacks for hidden profile{@link UserManager.USER_TYPE_PROFILE_PRIVATE}, * caller should have {@link android.app.role.RoleManager.ROLE_HOME} and either of the * permissions required. * * @param callback The callback to register. * @param callback The callback to register. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public void registerCallback(Callback callback) { public void registerCallback(Callback callback) { registerCallback(callback, null); registerCallback(callback, null); } } Loading @@ -1825,9 +1890,15 @@ public class LauncherApps { /** /** * Registers a callback for changes to packages in this user and managed profiles. * Registers a callback for changes to packages in this user and managed profiles. * * * <p>To receive callbacks for hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, * caller should have {@link android.app.role.RoleManager.ROLE_HOME} and either of the * permissions required. * * @param callback The callback to register. * @param callback The callback to register. * @param handler that should be used to post callbacks on, may be null. * @param handler that should be used to post callbacks on, may be null. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public void registerCallback(Callback callback, Handler handler) { public void registerCallback(Callback callback, Handler handler) { synchronized (this) { synchronized (this) { if (callback != null && findCallbackLocked(callback) < 0) { if (callback != null && findCallbackLocked(callback) < 0) { Loading Loading @@ -2275,8 +2346,14 @@ public class LauncherApps { * package name in the app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be * package name in the app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be * the session owner to retrieve these details. * the session owner to retrieve these details. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @see PackageInstaller#getAllSessions() * @see PackageInstaller#getAllSessions() */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public @NonNull List<SessionInfo> getAllPackageInstallerSessions() { public @NonNull List<SessionInfo> getAllPackageInstallerSessions() { try { try { return mService.getAllSessions(mContext.getPackageName()).getList(); return mService.getAllSessions(mContext.getPackageName()).getList(); Loading Loading
core/api/current.txt +13 −13 Original line number Original line Diff line number Diff line Loading @@ -12487,33 +12487,33 @@ package android.content.pm { } } public class LauncherApps { public class LauncherApps { method public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(String, android.os.UserHandle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(String, android.os.UserHandle); method @NonNull public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getAllPackageInstallerSessions(); method @NonNull @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getAllPackageInstallerSessions(); method @FlaggedApi("android.os.allow_private_profile") @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.content.IntentSender getAppMarketActivityIntent(@Nullable String, @NonNull android.os.UserHandle); method @FlaggedApi("android.os.allow_private_profile") @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.content.IntentSender getAppMarketActivityIntent(@Nullable String, @NonNull android.os.UserHandle); method public android.content.pm.ApplicationInfo getApplicationInfo(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException; method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.content.pm.ApplicationInfo getApplicationInfo(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException; method @FlaggedApi("android.os.allow_private_profile") @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public final android.content.pm.LauncherUserInfo getLauncherUserInfo(@NonNull android.os.UserHandle); method @FlaggedApi("android.os.allow_private_profile") @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public final android.content.pm.LauncherUserInfo getLauncherUserInfo(@NonNull android.os.UserHandle); method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent); method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent); method @FlaggedApi("android.os.allow_private_profile") @NonNull @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<java.lang.String> getPreInstalledSystemPackages(@NonNull android.os.UserHandle); method @FlaggedApi("android.os.allow_private_profile") @NonNull @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<java.lang.String> getPreInstalledSystemPackages(@NonNull android.os.UserHandle); method public java.util.List<android.os.UserHandle> getProfiles(); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public java.util.List<android.os.UserHandle> getProfiles(); method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int); method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int); method @Nullable public android.content.IntentSender getShortcutConfigActivityIntent(@NonNull android.content.pm.LauncherActivityInfo); method @Nullable public android.content.IntentSender getShortcutConfigActivityIntent(@NonNull android.content.pm.LauncherActivityInfo); method public java.util.List<android.content.pm.LauncherActivityInfo> getShortcutConfigActivityList(@Nullable String, @NonNull android.os.UserHandle); method public java.util.List<android.content.pm.LauncherActivityInfo> getShortcutConfigActivityList(@Nullable String, @NonNull android.os.UserHandle); method public android.graphics.drawable.Drawable getShortcutIconDrawable(@NonNull android.content.pm.ShortcutInfo, int); method public android.graphics.drawable.Drawable getShortcutIconDrawable(@NonNull android.content.pm.ShortcutInfo, int); method @Nullable public android.app.PendingIntent getShortcutIntent(@NonNull String, @NonNull String, @Nullable android.os.Bundle, @NonNull android.os.UserHandle); method @Nullable public android.app.PendingIntent getShortcutIntent(@NonNull String, @NonNull String, @Nullable android.os.Bundle, @NonNull android.os.UserHandle); method @Nullable public java.util.List<android.content.pm.ShortcutInfo> getShortcuts(@NonNull android.content.pm.LauncherApps.ShortcutQuery, @NonNull android.os.UserHandle); method @Nullable public java.util.List<android.content.pm.ShortcutInfo> getShortcuts(@NonNull android.content.pm.LauncherApps.ShortcutQuery, @NonNull android.os.UserHandle); method @Nullable public android.os.Bundle getSuspendedPackageLauncherExtras(String, android.os.UserHandle); method @Nullable @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.os.Bundle getSuspendedPackageLauncherExtras(String, android.os.UserHandle); method public boolean hasShortcutHostPermission(); method public boolean hasShortcutHostPermission(); method 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 isActivityEnabled(android.content.ComponentName, android.os.UserHandle); method public boolean isPackageEnabled(String, 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 public void pinShortcuts(@NonNull String, @NonNull java.util.List<java.lang.String>, @NonNull android.os.UserHandle); method 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); method public void registerCallback(android.content.pm.LauncherApps.Callback, android.os.Handler); 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); method public void registerPackageInstallerSessionCallback(@NonNull java.util.concurrent.Executor, @NonNull android.content.pm.PackageInstaller.SessionCallback); method public android.content.pm.LauncherActivityInfo resolveActivity(android.content.Intent, android.os.UserHandle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public android.content.pm.LauncherActivityInfo resolveActivity(android.content.Intent, android.os.UserHandle); method @FlaggedApi("android.content.pm.archiving") public void setArchiveCompatibility(@NonNull android.content.pm.LauncherApps.ArchiveCompatibilityParams); method @FlaggedApi("android.content.pm.archiving") public void setArchiveCompatibility(@NonNull android.content.pm.LauncherApps.ArchiveCompatibilityParams); method public boolean shouldHideFromSuggestions(@NonNull String, @NonNull android.os.UserHandle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public boolean shouldHideFromSuggestions(@NonNull String, @NonNull android.os.UserHandle); method public void startAppDetailsActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public void startAppDetailsActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); method public void startMainActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); method @RequiresPermission(conditional=true, anyOf={"android.permission.ACCESS_HIDDEN_PROFILES_FULL", android.Manifest.permission.ACCESS_HIDDEN_PROFILES}) public void startMainActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle); method public void startPackageInstallerSessionDetailsActivity(@NonNull android.content.pm.PackageInstaller.SessionInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle); method public void startPackageInstallerSessionDetailsActivity(@NonNull android.content.pm.PackageInstaller.SessionInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle); method public void startShortcut(@NonNull String, @NonNull String, @Nullable android.graphics.Rect, @Nullable android.os.Bundle, @NonNull android.os.UserHandle); method public void startShortcut(@NonNull String, @NonNull String, @Nullable android.graphics.Rect, @Nullable android.os.Bundle, @NonNull android.os.UserHandle); method public void startShortcut(@NonNull android.content.pm.ShortcutInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle); method public void startShortcut(@NonNull android.content.pm.ShortcutInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle);
core/java/android/content/pm/LauncherApps.java +77 −0 Original line number Original line Diff line number Diff line Loading @@ -693,7 +693,12 @@ public class LauncherApps { * * * <p>If the caller is running on a managed profile, it'll return only the current profile. * <p>If the caller is running on a managed profile, it'll return only the current profile. * Otherwise it'll return the same list as {@link UserManager#getUserProfiles()} would. * Otherwise it'll return the same list as {@link UserManager#getUserProfiles()} would. * * <p> To get hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public List<UserHandle> getProfiles() { public List<UserHandle> getProfiles() { if (mUserManager.isManagedProfile() if (mUserManager.isManagedProfile() || (android.multiuser.Flags.enableLauncherAppsHiddenProfileChecks() || (android.multiuser.Flags.enableLauncherAppsHiddenProfileChecks() Loading Loading @@ -751,11 +756,17 @@ public class LauncherApps { * list.</li> * list.</li> * </ul> * </ul> * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param packageName The specific package to query. If null, it checks all installed packages * @param packageName The specific package to query. If null, it checks all installed packages * in the profile. * in the profile. * @param user The UserHandle of the profile. * @param user The UserHandle of the profile. * @return List of launchable activities. Can be an empty list but will not be null. * @return List of launchable activities. Can be an empty list but will not be null. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) { public List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading Loading @@ -925,10 +936,16 @@ public class LauncherApps { * Returns the activity info for a given intent and user handle, if it resolves. Otherwise it * Returns the activity info for a given intent and user handle, if it resolves. Otherwise it * returns null. * returns null. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param intent The intent to find a match for. * @param intent The intent to find a match for. * @param user The profile to look in for a match. * @param user The profile to look in for a match. * @return An activity info object if there is a match. * @return An activity info object if there is a match. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public LauncherActivityInfo resolveActivity(Intent intent, UserHandle user) { public LauncherActivityInfo resolveActivity(Intent intent, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading Loading @@ -978,11 +995,17 @@ public class LauncherApps { /** /** * Starts a Main activity in the specified profile. * Starts a Main activity in the specified profile. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param component The ComponentName of the activity to launch * @param component The ComponentName of the activity to launch * @param user The UserHandle of the profile * @param user The UserHandle of the profile * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param opts Options to pass to startActivity * @param opts Options to pass to startActivity */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public void startMainActivity(ComponentName component, UserHandle user, Rect sourceBounds, public void startMainActivity(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts) { Bundle opts) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); Loading Loading @@ -1020,11 +1043,17 @@ public class LauncherApps { * Starts the settings activity to show the application details for a * Starts the settings activity to show the application details for a * package in the specified profile. * package in the specified profile. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param component The ComponentName of the package to launch settings for. * @param component The ComponentName of the package to launch settings for. * @param user The UserHandle of the profile * @param user The UserHandle of the profile * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param sourceBounds The Rect containing the source bounds of the clicked icon * @param opts Options to pass to startActivity * @param opts Options to pass to startActivity */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public void startAppDetailsActivity(ComponentName component, UserHandle user, public void startAppDetailsActivity(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts) { Rect sourceBounds, Bundle opts) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); Loading Loading @@ -1135,11 +1164,17 @@ public class LauncherApps { /** /** * Checks if the package is installed and enabled for a profile. * Checks if the package is installed and enabled for a profile. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param packageName The package to check. * @param packageName The package to check. * @param user The UserHandle of the profile. * @param user The UserHandle of the profile. * * * @return true if the package exists and is enabled. * @return true if the package exists and is enabled. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public boolean isPackageEnabled(String packageName, UserHandle user) { public boolean isPackageEnabled(String packageName, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading @@ -1157,6 +1192,10 @@ public class LauncherApps { * <p>The contents of this {@link Bundle} are supposed to be a contract between the suspending * <p>The contents of this {@link Bundle} are supposed to be a contract between the suspending * app and the launcher. * app and the launcher. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * <p>Note: This just returns whatever extras were provided to the system, <em>which might * <p>Note: This just returns whatever extras were provided to the system, <em>which might * even be {@code null}.</em> * even be {@code null}.</em> * * Loading @@ -1168,6 +1207,8 @@ public class LauncherApps { * @see Callback#onPackagesSuspended(String[], UserHandle, Bundle) * @see Callback#onPackagesSuspended(String[], UserHandle, Bundle) * @see PackageManager#isPackageSuspended() * @see PackageManager#isPackageSuspended() */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public @Nullable Bundle getSuspendedPackageLauncherExtras(String packageName, UserHandle user) { public @Nullable Bundle getSuspendedPackageLauncherExtras(String packageName, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading @@ -1182,10 +1223,16 @@ public class LauncherApps { * could be done because the package was marked as distracting to the user via * could be done because the package was marked as distracting to the user via * {@code PackageManager.setDistractingPackageRestrictions(String[], int)}. * {@code PackageManager.setDistractingPackageRestrictions(String[], int)}. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param packageName The package for which to check. * @param packageName The package for which to check. * @param user the {@link UserHandle} of the profile. * @param user the {@link UserHandle} of the profile. * @return * @return */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public boolean shouldHideFromSuggestions(@NonNull String packageName, public boolean shouldHideFromSuggestions(@NonNull String packageName, @NonNull UserHandle user) { @NonNull UserHandle user) { Objects.requireNonNull(packageName, "packageName"); Objects.requireNonNull(packageName, "packageName"); Loading @@ -1200,6 +1247,10 @@ public class LauncherApps { /** /** * Returns {@link ApplicationInfo} about an application installed for a specific user profile. * Returns {@link ApplicationInfo} about an application installed for a specific user profile. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param packageName The package name of the application * @param packageName The package name of the application * @param flags Additional option flags {@link PackageManager#getApplicationInfo} * @param flags Additional option flags {@link PackageManager#getApplicationInfo} * @param user The UserHandle of the profile. * @param user The UserHandle of the profile. Loading @@ -1208,6 +1259,8 @@ public class LauncherApps { * {@code null} if the package isn't installed for the given profile, or the profile * {@code null} if the package isn't installed for the given profile, or the profile * isn't enabled. * isn't enabled. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public ApplicationInfo getApplicationInfo(@NonNull String packageName, public ApplicationInfo getApplicationInfo(@NonNull String packageName, @ApplicationInfoFlagsBits int flags, @NonNull UserHandle user) @ApplicationInfoFlagsBits int flags, @NonNull UserHandle user) throws PackageManager.NameNotFoundException { throws PackageManager.NameNotFoundException { Loading Loading @@ -1257,11 +1310,17 @@ public class LauncherApps { * <p>The activity may still not be exported, in which case {@link #startMainActivity} will * <p>The activity may still not be exported, in which case {@link #startMainActivity} will * throw a {@link SecurityException} unless the caller has the same UID as the target app's. * throw a {@link SecurityException} unless the caller has the same UID as the target app's. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @param component The activity to check. * @param component The activity to check. * @param user The UserHandle of the profile. * @param user The UserHandle of the profile. * * * @return true if the activity exists and is enabled. * @return true if the activity exists and is enabled. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public boolean isActivityEnabled(ComponentName component, UserHandle user) { public boolean isActivityEnabled(ComponentName component, UserHandle user) { logErrorForInvalidProfileAccess(user); logErrorForInvalidProfileAccess(user); try { try { Loading Loading @@ -1816,8 +1875,14 @@ public class LauncherApps { /** /** * Registers a callback for changes to packages in this user and managed profiles. * Registers a callback for changes to packages in this user and managed profiles. * * * <p>To receive callbacks for hidden profile{@link UserManager.USER_TYPE_PROFILE_PRIVATE}, * caller should have {@link android.app.role.RoleManager.ROLE_HOME} and either of the * permissions required. * * @param callback The callback to register. * @param callback The callback to register. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public void registerCallback(Callback callback) { public void registerCallback(Callback callback) { registerCallback(callback, null); registerCallback(callback, null); } } Loading @@ -1825,9 +1890,15 @@ public class LauncherApps { /** /** * Registers a callback for changes to packages in this user and managed profiles. * Registers a callback for changes to packages in this user and managed profiles. * * * <p>To receive callbacks for hidden profile {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, * caller should have {@link android.app.role.RoleManager.ROLE_HOME} and either of the * permissions required. * * @param callback The callback to register. * @param callback The callback to register. * @param handler that should be used to post callbacks on, may be null. * @param handler that should be used to post callbacks on, may be null. */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public void registerCallback(Callback callback, Handler handler) { public void registerCallback(Callback callback, Handler handler) { synchronized (this) { synchronized (this) { if (callback != null && findCallbackLocked(callback) < 0) { if (callback != null && findCallbackLocked(callback) < 0) { Loading Loading @@ -2275,8 +2346,14 @@ public class LauncherApps { * package name in the app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be * package name in the app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be * the session owner to retrieve these details. * the session owner to retrieve these details. * * * <p>If the user in question is a hidden profile * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required. * * @see PackageInstaller#getAllSessions() * @see PackageInstaller#getAllSessions() */ */ @RequiresPermission(conditional = true, anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES}) public @NonNull List<SessionInfo> getAllPackageInstallerSessions() { public @NonNull List<SessionInfo> getAllPackageInstallerSessions() { try { try { return mService.getAllSessions(mContext.getPackageName()).getList(); return mService.getAllSessions(mContext.getPackageName()).getList(); Loading