Loading core/java/android/app/ApplicationPackageManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -2909,7 +2909,7 @@ public class ApplicationPackageManager extends PackageManager { try { return mPM.setPackagesSuspendedAsUser(packageNames, suspended, appExtras, launcherExtras, dialogInfo, flags, mContext.getOpPackageName(), getUserId()); UserHandle.myUserId() /* suspendingUserId */, getUserId() /* targetUserId */); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading core/java/android/content/pm/IPackageManager.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -300,7 +300,8 @@ interface IPackageManager { String[] setPackagesSuspendedAsUser(in String[] packageNames, boolean suspended, in PersistableBundle appExtras, in PersistableBundle launcherExtras, in SuspendDialogInfo dialogInfo, int flags, String callingPackage, int userId); in SuspendDialogInfo dialogInfo, int flags, String suspendingPackage, int suspendingUserId, int targetUserId); String[] getUnsuspendablePackagesForUser(in String[] packageNames, int userId); Loading core/java/android/content/pm/PackageManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -10000,6 +10000,9 @@ 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. Loading core/java/com/android/internal/app/SuspendedAppActivity.java +8 −4 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ 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; Loading Loading @@ -308,7 +309,8 @@ public class SuspendedAppActivity extends AlertActivity try { final String[] errored = ipm.setPackagesSuspendedAsUser( new String[]{mSuspendedPackage}, false, null, null, null, 0, mSuspendingPackage, mUserId); mSuspendingPackage, mUserId /* suspendingUserId */, mUserId /* targetUserId */); if (ArrayUtils.contains(errored, mSuspendedPackage)) { Slog.e(TAG, "Could not unsuspend " + mSuspendedPackage); break; Loading Loading @@ -350,17 +352,19 @@ public class SuspendedAppActivity extends AlertActivity } public static Intent createSuspendedAppInterceptIntent(String suspendedPackage, String suspendingPackage, SuspendDialogInfo dialogInfo, Bundle options, UserPackage suspendingPackage, SuspendDialogInfo dialogInfo, Bundle options, IntentSender onUnsuspend, int userId) { return new Intent() Intent intent = new Intent() .setClassName("android", SuspendedAppActivity.class.getName()) .putExtra(EXTRA_SUSPENDED_PACKAGE, suspendedPackage) .putExtra(EXTRA_DIALOG_INFO, dialogInfo) .putExtra(EXTRA_SUSPENDING_PACKAGE, suspendingPackage) .putExtra(EXTRA_SUSPENDING_PACKAGE, suspendingPackage != null ? suspendingPackage.packageName : null) .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; } } services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +4 −2 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ 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; Loading Loading @@ -559,10 +560,11 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku onClickIntent = UnlaunchableAppActivity.createInQuietModeDialogIntent(appUserId); } else if (provider.maskedBySuspendedPackage) { showBadge = mUserManager.hasBadge(appUserId); final String suspendingPackage = mPackageManagerInternal.getSuspendingPackage( final UserPackage suspendingPackage = mPackageManagerInternal.getSuspendingPackage( appInfo.packageName, appUserId); // TODO(b/281839596): don't rely on platform always meaning suspended by admin. if (PLATFORM_PACKAGE_NAME.equals(suspendingPackage)) { if (suspendingPackage != null && PLATFORM_PACKAGE_NAME.equals(suspendingPackage.packageName)) { onClickIntent = mDevicePolicyManagerInternal.createShowAdminSupportIntent( appUserId, true); } else { Loading Loading
core/java/android/app/ApplicationPackageManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -2909,7 +2909,7 @@ public class ApplicationPackageManager extends PackageManager { try { return mPM.setPackagesSuspendedAsUser(packageNames, suspended, appExtras, launcherExtras, dialogInfo, flags, mContext.getOpPackageName(), getUserId()); UserHandle.myUserId() /* suspendingUserId */, getUserId() /* targetUserId */); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading
core/java/android/content/pm/IPackageManager.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -300,7 +300,8 @@ interface IPackageManager { String[] setPackagesSuspendedAsUser(in String[] packageNames, boolean suspended, in PersistableBundle appExtras, in PersistableBundle launcherExtras, in SuspendDialogInfo dialogInfo, int flags, String callingPackage, int userId); in SuspendDialogInfo dialogInfo, int flags, String suspendingPackage, int suspendingUserId, int targetUserId); String[] getUnsuspendablePackagesForUser(in String[] packageNames, int userId); Loading
core/java/android/content/pm/PackageManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -10000,6 +10000,9 @@ 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. Loading
core/java/com/android/internal/app/SuspendedAppActivity.java +8 −4 Original line number Diff line number Diff line Loading @@ -39,6 +39,7 @@ 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; Loading Loading @@ -308,7 +309,8 @@ public class SuspendedAppActivity extends AlertActivity try { final String[] errored = ipm.setPackagesSuspendedAsUser( new String[]{mSuspendedPackage}, false, null, null, null, 0, mSuspendingPackage, mUserId); mSuspendingPackage, mUserId /* suspendingUserId */, mUserId /* targetUserId */); if (ArrayUtils.contains(errored, mSuspendedPackage)) { Slog.e(TAG, "Could not unsuspend " + mSuspendedPackage); break; Loading Loading @@ -350,17 +352,19 @@ public class SuspendedAppActivity extends AlertActivity } public static Intent createSuspendedAppInterceptIntent(String suspendedPackage, String suspendingPackage, SuspendDialogInfo dialogInfo, Bundle options, UserPackage suspendingPackage, SuspendDialogInfo dialogInfo, Bundle options, IntentSender onUnsuspend, int userId) { return new Intent() Intent intent = new Intent() .setClassName("android", SuspendedAppActivity.class.getName()) .putExtra(EXTRA_SUSPENDED_PACKAGE, suspendedPackage) .putExtra(EXTRA_DIALOG_INFO, dialogInfo) .putExtra(EXTRA_SUSPENDING_PACKAGE, suspendingPackage) .putExtra(EXTRA_SUSPENDING_PACKAGE, suspendingPackage != null ? suspendingPackage.packageName : null) .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; } }
services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +4 −2 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ 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; Loading Loading @@ -559,10 +560,11 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku onClickIntent = UnlaunchableAppActivity.createInQuietModeDialogIntent(appUserId); } else if (provider.maskedBySuspendedPackage) { showBadge = mUserManager.hasBadge(appUserId); final String suspendingPackage = mPackageManagerInternal.getSuspendingPackage( final UserPackage suspendingPackage = mPackageManagerInternal.getSuspendingPackage( appInfo.packageName, appUserId); // TODO(b/281839596): don't rely on platform always meaning suspended by admin. if (PLATFORM_PACKAGE_NAME.equals(suspendingPackage)) { if (suspendingPackage != null && PLATFORM_PACKAGE_NAME.equals(suspendingPackage.packageName)) { onClickIntent = mDevicePolicyManagerInternal.createShowAdminSupportIntent( appUserId, true); } else { Loading