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

Commit 1659f536 authored by Ivan Chiang's avatar Ivan Chiang Committed by Android (Google) Code Review
Browse files

Merge "[PM Archive] Fix arhcive send ACTION_UID_REMOVED issue and NPE" into main

parents 258a02dd c1f6dcf5
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -966,7 +966,14 @@ public final class BroadcastHelper {
        if (packageRemovedInfo.mIsAppIdRemoved) {
            // If a system app's updates are uninstalled the UID is not actually removed. Some
            // services need to know the package name affected.
            if (isReplace) {
            //
            // When setting Intent.EXTRA_REPLACING is true for isReplace or isArchived above,
            // the system triggers AppOpsService#resetAllModes in
            // ActivityManagerService#broadcastIntentLockedTraced when the action is
            // ACTION_UID_REMOVED. Add Intent.EXTRA_PACKAGE_NAME for isReplace or isArchived too.
            // Because AppOpsService#resetAllModes needs the packageName to define which uid to be
            // reset. If there is no package name, it resets the all appOps for all uids.
            if (isReplace || isArchived) {
                extras.putString(Intent.EXTRA_PACKAGE_NAME, removedPackage);
            }

+2 −2
Original line number Diff line number Diff line
@@ -284,7 +284,7 @@ public class PackageArchiver {
        }

        String currentLauncherPackageName = getCurrentLauncherPackageName(getParentUserId(userId));
        if ((currentLauncherPackageName == null || !callerPackageName.equals(
        if ((currentLauncherPackageName == null || !TextUtils.equals(callerPackageName,
                currentLauncherPackageName)) && callingUid != Process.SHELL_UID) {
            // TODO(b/311619990): Remove dependency on SHELL_UID for testing
            Slog.e(TAG, TextUtils.formatSimple(
@@ -830,7 +830,7 @@ public class PackageArchiver {
                mPm.mInstallerService.getAllSessions(userId).getList();
        for (int idx = 0; idx < activeSessions.size(); idx++) {
            PackageInstaller.SessionInfo activeSession = activeSessions.get(idx);
            if (activeSession.appPackageName.equals(packageName)
            if (TextUtils.equals(activeSession.appPackageName, packageName)
                    && activeSession.userId == userId && activeSession.active
                    && activeSession.isUnarchival()) {
                return activeSession;