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

Commit 822ce4f3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Activity interceptor dialog for suspended apps" into pi-dev

parents d2c218f7 3c3af140
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ package android {
    field public static final java.lang.String REVOKE_RUNTIME_PERMISSIONS = "android.permission.REVOKE_RUNTIME_PERMISSIONS";
    field public static final java.lang.String SCORE_NETWORKS = "android.permission.SCORE_NETWORKS";
    field public static final java.lang.String SEND_RESPOND_VIA_MESSAGE = "android.permission.SEND_RESPOND_VIA_MESSAGE";
    field public static final java.lang.String SEND_SHOW_SUSPENDED_APP_DETAILS = "android.permission.SEND_SHOW_SUSPENDED_APP_DETAILS";
    field public static final java.lang.String SEND_SMS_NO_CONFIRMATION = "android.permission.SEND_SMS_NO_CONFIRMATION";
    field public static final java.lang.String SERIAL_PORT = "android.permission.SERIAL_PORT";
    field public static final java.lang.String SET_ACTIVITY_WATCHER = "android.permission.SET_ACTIVITY_WATCHER";
@@ -878,6 +879,7 @@ package android.content {
    field public static final java.lang.String ACTION_QUERY_PACKAGE_RESTART = "android.intent.action.QUERY_PACKAGE_RESTART";
    field public static final java.lang.String ACTION_RESOLVE_INSTANT_APP_PACKAGE = "android.intent.action.RESOLVE_INSTANT_APP_PACKAGE";
    field public static final java.lang.String ACTION_REVIEW_PERMISSIONS = "android.intent.action.REVIEW_PERMISSIONS";
    field public static final java.lang.String ACTION_SHOW_SUSPENDED_APP_DETAILS = "android.intent.action.SHOW_SUSPENDED_APP_DETAILS";
    field public static final deprecated java.lang.String ACTION_SIM_STATE_CHANGED = "android.intent.action.SIM_STATE_CHANGED";
    field public static final java.lang.String ACTION_SPLIT_CONFIGURATION_CHANGED = "android.intent.action.SPLIT_CONFIGURATION_CHANGED";
    field public static final java.lang.String ACTION_UPGRADE_SETUP = "android.intent.action.UPGRADE_SETUP";
+2 −2
Original line number Diff line number Diff line
@@ -2155,10 +2155,10 @@ public class ApplicationPackageManager extends PackageManager {
    public String[] setPackagesSuspended(String[] packageNames, boolean suspended,
            PersistableBundle appExtras, PersistableBundle launcherExtras,
            String dialogMessage) {
        // TODO (b/75332201): Pass in the dialogMessage and use it in the interceptor dialog
        try {
            return mPM.setPackagesSuspendedAsUser(packageNames, suspended, appExtras,
                    launcherExtras, mContext.getOpPackageName(), mContext.getUserId());
                    launcherExtras, dialogMessage, mContext.getOpPackageName(),
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+22 −0
Original line number Diff line number Diff line
@@ -2281,6 +2281,28 @@ public class Intent implements Parcelable, Cloneable {
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_MY_PACKAGE_SUSPENDED = "android.intent.action.MY_PACKAGE_SUSPENDED";

    /**
     * Activity Action: Started to show more details about why an application was suspended.
     *
     * <p>Apps holding {@link android.Manifest.permission#SUSPEND_APPS} must declare an activity
     * handling this intent and protect it with
     * {@link android.Manifest.permission#SEND_SHOW_SUSPENDED_APP_DETAILS}.
     *
     * <p>Includes an extra {@link #EXTRA_PACKAGE_NAME} which is the name of the suspended package.
     *
     * <p class="note">This is a protected intent that can only be sent
     * by the system.
     *
     * @see PackageManager#isPackageSuspended()
     * @see #ACTION_PACKAGES_SUSPENDED
     *
     * @hide
     */
    @SystemApi
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_SHOW_SUSPENDED_APP_DETAILS =
            "android.intent.action.SHOW_SUSPENDED_APP_DETAILS";

    /**
     * Broadcast Action: Sent to a package that has been unsuspended.
     *
+2 −2
Original line number Diff line number Diff line
@@ -273,8 +273,8 @@ interface IPackageManager {
    void clearCrossProfileIntentFilters(int sourceUserId, String ownerPackage);

    String[] setPackagesSuspendedAsUser(in String[] packageNames, boolean suspended,
            in PersistableBundle launcherExtras, in PersistableBundle appExtras,
            String callingPackage, int userId);
            in PersistableBundle appExtras, in PersistableBundle launcherExtras,
            String dialogMessage, String callingPackage, int userId);

    boolean isPackageSuspendedForUser(String packageName, int userId);

+25 −2
Original line number Diff line number Diff line
@@ -191,10 +191,10 @@ public abstract class PackageManagerInternal {
    /**
     * Retrieve launcher extras for a suspended package provided to the system in
     * {@link PackageManager#setPackagesSuspended(String[], boolean, PersistableBundle,
     * PersistableBundle, String)}
     * PersistableBundle, String)}.
     *
     * @param packageName The package for which to return launcher extras.
     * @param userId The user for which to check,
     * @param userId The user for which to check.
     * @return The launcher extras.
     *
     * @see PackageManager#setPackagesSuspended(String[], boolean, PersistableBundle,
@@ -213,6 +213,29 @@ public abstract class PackageManagerInternal {
     */
    public abstract boolean isPackageSuspended(String packageName, int userId);

    /**
     * Get the name of the package that suspended the given package. Packages can be suspended by
     * device administrators or apps holding {@link android.Manifest.permission#MANAGE_USERS} or
     * {@link android.Manifest.permission#SUSPEND_APPS}.
     *
     * @param suspendedPackage The package that has been suspended.
     * @param userId The user for which to check.
     * @return Name of the package that suspended the given package. Returns {@code null} if the
     * given package is not currently suspended and the platform package name - i.e.
     * {@code "android"} - if the package was suspended by a device admin.
     */
    public abstract String getSuspendingPackage(String suspendedPackage, int userId);

    /**
     * Get the dialog message to be shown to the user when they try to launch a suspended
     * application.
     *
     * @param suspendedPackage The package that has been suspended.
     * @param userId The user for which to check.
     * @return The dialog message to be shown to the user.
     */
    public abstract String getSuspendedDialogMessage(String suspendedPackage, int userId);

    /**
     * Do a straight uid lookup for the given package/application in the given user.
     * @see PackageManager#getPackageUidAsUser(String, int, int)
Loading