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

Commit 0b95567e authored by Himanshu Gupta's avatar Himanshu Gupta Committed by Android (Google) Code Review
Browse files

Merge "Making hidden LauncherApps APIs public" into main

parents a27b3a52 b1482d7f
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -12475,8 +12475,11 @@ package android.content.pm {
  public class LauncherApps {
    method 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 @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 @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 @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 public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int);
    method @Nullable public android.content.IntentSender getShortcutConfigActivityIntent(@NonNull android.content.pm.LauncherActivityInfo);
@@ -12558,6 +12561,14 @@ package android.content.pm {
    field public static final int FLAG_MATCH_PINNED_BY_ANY_LAUNCHER = 1024; // 0x400
  }
  @FlaggedApi("android.os.allow_private_profile") public final class LauncherUserInfo implements android.os.Parcelable {
    method @FlaggedApi("android.os.allow_private_profile") public int describeContents();
    method @FlaggedApi("android.os.allow_private_profile") public int getUserSerialNumber();
    method @FlaggedApi("android.os.allow_private_profile") @NonNull public String getUserType();
    method @FlaggedApi("android.os.allow_private_profile") public void writeToParcel(@NonNull android.os.Parcel, int);
    field @FlaggedApi("android.os.allow_private_profile") @NonNull public static final android.os.Parcelable.Creator<android.content.pm.LauncherUserInfo> CREATOR;
  }
  public final class ModuleInfo implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public CharSequence getName();
@@ -34036,6 +34047,9 @@ package android.os {
    field public static final int USER_OPERATION_ERROR_MAX_USERS = 6; // 0x6
    field public static final int USER_OPERATION_ERROR_UNKNOWN = 1; // 0x1
    field public static final int USER_OPERATION_SUCCESS = 0; // 0x0
    field @FlaggedApi("android.os.allow_private_profile") public static final String USER_TYPE_PROFILE_CLONE = "android.os.usertype.profile.CLONE";
    field @FlaggedApi("android.os.allow_private_profile") public static final String USER_TYPE_PROFILE_MANAGED = "android.os.usertype.profile.MANAGED";
    field @FlaggedApi("android.os.allow_private_profile") public static final String USER_TYPE_PROFILE_PRIVATE = "android.os.usertype.profile.PRIVATE";
  }
  public static class UserManager.UserOperationException extends java.lang.RuntimeException {
+0 −3
Original line number Diff line number Diff line
@@ -11094,9 +11094,6 @@ package android.os {
    field public static final String USER_TYPE_FULL_GUEST = "android.os.usertype.full.GUEST";
    field public static final String USER_TYPE_FULL_SECONDARY = "android.os.usertype.full.SECONDARY";
    field public static final String USER_TYPE_FULL_SYSTEM = "android.os.usertype.full.SYSTEM";
    field public static final String USER_TYPE_PROFILE_CLONE = "android.os.usertype.profile.CLONE";
    field public static final String USER_TYPE_PROFILE_MANAGED = "android.os.usertype.profile.MANAGED";
    field @FlaggedApi("android.os.allow_private_profile") public static final String USER_TYPE_PROFILE_PRIVATE = "android.os.usertype.profile.PRIVATE";
    field public static final String USER_TYPE_SYSTEM_HEADLESS = "android.os.usertype.system.HEADLESS";
  }
+26 −10
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package android.content.pm;

import static android.Manifest.permission;
import static android.Manifest.permission.ACCESS_HIDDEN_PROFILES;
import static android.Manifest.permission.ACCESS_HIDDEN_PROFILES_FULL;
import static android.Manifest.permission.READ_FRAME_BUFFER;

import android.annotation.CallbackExecutor;
@@ -779,15 +781,20 @@ public class LauncherApps {

    /**
     * Returns information related to a user which is useful for displaying UI elements
     * to distinguish it from other users (eg, badges). Only system launchers should
     * call this API.
     * to distinguish it from other users (eg, badges).
     *
     * @param userHandle user handle of the user for which LauncherUserInfo is requested
     * @return the LauncherUserInfo object related to the user specified.
     * @hide
     * <p>If the user in question is a hidden profile like
     * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have
     * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required.
     *
     * @param userHandle user handle of the user for which LauncherUserInfo is requested.
     * @return the {@link LauncherUserInfo} object related to the user specified, null in case
     * the user is inaccessible.
     */
    @Nullable
    @FlaggedApi(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
    @RequiresPermission(conditional = true,
            anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES})
    public final LauncherUserInfo getLauncherUserInfo(@NonNull UserHandle userHandle) {
        if (DEBUG) {
            Log.i(TAG, "getLauncherUserInfo " + userHandle);
@@ -823,17 +830,20 @@ public class LauncherApps {
     * </ul>
     * </p>
     *
     *
     * <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 intent sender to launch App Market Activity is
     *                    required.
     * @param user the profile for which intent sender to launch App Market Activity is required.
     * @return {@link IntentSender} object which launches the App Market Activity, null in case
     *         there is no such activity.
     * @hide
     */
    @Nullable
    @FlaggedApi(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
    @RequiresPermission(conditional = true,
            anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES})
    public IntentSender getAppMarketActivityIntent(@Nullable String packageName,
            @NonNull UserHandle user) {
        if (DEBUG) {
@@ -851,15 +861,21 @@ public class LauncherApps {
    /**
     * Returns the list of the system packages that are installed at user creation.
     *
     * <p>An empty list denotes that all system packages are installed for that user at creation.
     * This behaviour is inherited from the underlining UserManager API.
     * <p>An empty list denotes that all system packages should be treated as pre-installed for that
     * user at creation.
     *
     * <p>If the user in question is a hidden profile like
     * {@link UserManager.USER_TYPE_PROFILE_PRIVATE}, caller should have
     * {@link android.app.role.RoleManager.ROLE_HOME} and either of the permissions required.
     *
     * @param userHandle the user for which installed system packages are required.
     * @return {@link List} of {@link String}, representing the package name of the installed
     *        package. Can be empty but not null.
     * @hide
     */
    @FlaggedApi(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
    @NonNull
    @RequiresPermission(conditional = true,
            anyOf = {ACCESS_HIDDEN_PROFILES_FULL, ACCESS_HIDDEN_PROFILES})
    public List<String> getPreInstalledSystemPackages(@NonNull UserHandle userHandle) {
        if (DEBUG) {
            Log.i(TAG, "getPreInstalledSystemPackages for user: " + userHandle);
+1 −6
Original line number Diff line number Diff line
@@ -27,8 +27,6 @@ import android.os.UserManager;
/**
 * The LauncherUserInfo object holds information about an Android user that is required to display
 * the Launcher related UI elements specific to the user (like badges).
 *
 * @hide
 */
@FlaggedApi(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
public final class LauncherUserInfo implements Parcelable {
@@ -41,11 +39,9 @@ public final class LauncherUserInfo implements Parcelable {
    /**
     * Returns type of the user as defined in {@link UserManager}. e.g.,
     * {@link UserManager.USER_TYPE_PROFILE_MANAGED} or {@link UserManager.USER_TYPE_PROFILE_ClONE}
     * TODO(b/303812736): Make the return type public and update javadoc here once the linked bug
     * is resolved.
     * or {@link UserManager.USER_TYPE_PROFILE_PRIVATE}
     *
     * @return the userType for the user whose LauncherUserInfo this is
     * @hide
     */
    @FlaggedApi(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
    @NonNull
@@ -58,7 +54,6 @@ public final class LauncherUserInfo implements Parcelable {
     * {@link UserManager#getSerialNumberForUser(UserHandle)}
     *
     * @return the serial number associated with the user
     * @hide
     */
    @FlaggedApi(Flags.FLAG_ALLOW_PRIVATE_PROFILE)
    public int getUserSerialNumber() {
+2 −7
Original line number Diff line number Diff line
@@ -163,19 +163,16 @@ public class UserManager {
     * User type representing a managed profile, which is a profile that is to be managed by a
     * device policy controller (DPC).
     * The intended purpose is for work profiles, which are managed by a corporate entity.
     * @hide
     */
    @SystemApi
    @FlaggedApi(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE)
    public static final String USER_TYPE_PROFILE_MANAGED = "android.os.usertype.profile.MANAGED";

    /**
     * User type representing a clone profile. Clone profile is a user profile type used to run
     * second instance of an otherwise single user App (eg, messengers). Currently only the
     * {@link android.content.pm.UserInfo#isMain()} user can have a clone profile.
     *
     * @hide
     */
    @SystemApi
    @FlaggedApi(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE)
    public static final String USER_TYPE_PROFILE_CLONE = "android.os.usertype.profile.CLONE";


@@ -184,10 +181,8 @@ public class UserManager {
     * as an alternative user-space to install and use sensitive apps.
     * UI surfaces can adopt an alternative strategy to show apps belonging to this profile, in line
     * with their sensitive nature.
     * @hide
     */
    @FlaggedApi(android.os.Flags.FLAG_ALLOW_PRIVATE_PROFILE)
    @SystemApi
    public static final String USER_TYPE_PROFILE_PRIVATE = "android.os.usertype.profile.PRIVATE";

    /**
Loading