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

Commit 56b5f1bc authored by Priyanka Advani's avatar Priyanka Advani Committed by Android (Google) Code Review
Browse files

Merge "Revert "Update data types to support cross user suspension"" into main

parents 86ddc657 44bdb8ab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2909,7 +2909,7 @@ public class ApplicationPackageManager extends PackageManager {
        try {
            return mPM.setPackagesSuspendedAsUser(packageNames, suspended, appExtras,
                    launcherExtras, dialogInfo, flags, mContext.getOpPackageName(),
                    UserHandle.myUserId() /* suspendingUserId */, getUserId() /* targetUserId */);
                    getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+1 −2
Original line number Diff line number Diff line
@@ -300,8 +300,7 @@ interface IPackageManager {

    String[] setPackagesSuspendedAsUser(in String[] packageNames, boolean suspended,
            in PersistableBundle appExtras, in PersistableBundle launcherExtras,
            in SuspendDialogInfo dialogInfo, int flags, String suspendingPackage,
            int suspendingUserId, int targetUserId);
            in SuspendDialogInfo dialogInfo, int flags, String callingPackage, int userId);

    String[] getUnsuspendablePackagesForUser(in String[] packageNames, int userId);

+0 −3
Original line number Diff line number Diff line
@@ -10000,9 +10000,6 @@ public abstract class PackageManager {
     * device administrators or apps holding {@link android.Manifest.permission#MANAGE_USERS} or
     * {@link android.Manifest.permission#SUSPEND_APPS}.
     *
     * <p>
     * <strong>Note:</strong>This API doesn't support cross user suspension and should only be used
     * for testing.
     * @param suspendedPackage The package that has been suspended.
     * @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.
+4 −7
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.SuspendDialogInfo;
import android.content.pm.UserPackage;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -309,8 +308,7 @@ public class SuspendedAppActivity extends AlertActivity
                        try {
                            final String[] errored = ipm.setPackagesSuspendedAsUser(
                                    new String[]{mSuspendedPackage}, false, null, null, null, 0,
                                    mSuspendingPackage, mUserId /* suspendingUserId */,
                                    mUserId /* targetUserId */);
                                    mSuspendingPackage, mUserId);
                            if (ArrayUtils.contains(errored, mSuspendedPackage)) {
                                Slog.e(TAG, "Could not unsuspend " + mSuspendedPackage);
                                break;
@@ -352,18 +350,17 @@ public class SuspendedAppActivity extends AlertActivity
    }

    public static Intent createSuspendedAppInterceptIntent(String suspendedPackage,
            UserPackage suspendingPackage, SuspendDialogInfo dialogInfo, Bundle options,
            String suspendingPackage, SuspendDialogInfo dialogInfo, Bundle options,
            IntentSender onUnsuspend, int userId) {
        Intent intent = new Intent()
        return new Intent()
                .setClassName("android", SuspendedAppActivity.class.getName())
                .putExtra(EXTRA_SUSPENDED_PACKAGE, suspendedPackage)
                .putExtra(EXTRA_DIALOG_INFO, dialogInfo)
                .putExtra(EXTRA_SUSPENDING_PACKAGE, suspendingPackage.packageName)
                .putExtra(EXTRA_SUSPENDING_PACKAGE, suspendingPackage)
                .putExtra(EXTRA_UNSUSPEND_INTENT, onUnsuspend)
                .putExtra(EXTRA_ACTIVITY_OPTIONS, options)
                .putExtra(Intent.EXTRA_USER_ID, userId)
                .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        return intent;
    }
}
+2 −4
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ import android.content.pm.ServiceInfo;
import android.content.pm.ShortcutServiceInternal;
import android.content.pm.SuspendDialogInfo;
import android.content.pm.UserInfo;
import android.content.pm.UserPackage;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
@@ -560,11 +559,10 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
                onClickIntent = UnlaunchableAppActivity.createInQuietModeDialogIntent(appUserId);
            } else if (provider.maskedBySuspendedPackage) {
                showBadge = mUserManager.hasBadge(appUserId);
                final UserPackage suspendingPackage = mPackageManagerInternal.getSuspendingPackage(
                final String suspendingPackage = mPackageManagerInternal.getSuspendingPackage(
                        appInfo.packageName, appUserId);
                // TODO(b/281839596): don't rely on platform always meaning suspended by admin.
                if (suspendingPackage != null
                        && PLATFORM_PACKAGE_NAME.equals(suspendingPackage.packageName)) {
                if (PLATFORM_PACKAGE_NAME.equals(suspendingPackage)) {
                    onClickIntent = mDevicePolicyManagerInternal.createShowAdminSupportIntent(
                            appUserId, true);
                } else {
Loading