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

Commit be049246 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Update the application info of all activities" into main

parents b472a2f4 b9dfa31c
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -4907,6 +4907,18 @@ public final class ProcessList {
    @GuardedBy(anyOf = {"mService", "mProcLock"})
    void updateApplicationInfoLOSP(List<String> packagesToUpdate, int userId,
            boolean updateFrameworkRes) {
        final ArrayMap<String, ApplicationInfo> applicationInfoByPackage = new ArrayMap<>();
        for (int i = packagesToUpdate.size() - 1; i >= 0; i--) {
            final String packageName = packagesToUpdate.get(i);
            final ApplicationInfo ai = mService.getPackageManagerInternal().getApplicationInfo(
                    packageName, STOCK_PM_FLAGS, Process.SYSTEM_UID, userId);
            if (ai != null) {
                applicationInfoByPackage.put(packageName, ai);
            }
        }
        mService.mActivityTaskManager.updateActivityApplicationInfo(userId,
                applicationInfoByPackage);

        final ArrayList<WindowProcessController> targetProcesses = new ArrayList<>();
        for (int i = mLruProcesses.size() - 1; i >= 0; i--) {
            final ProcessRecord app = mLruProcesses.get(i);
@@ -4921,8 +4933,7 @@ public final class ProcessList {
            app.getPkgList().forEachPackage(packageName -> {
                if (updateFrameworkRes || packagesToUpdate.contains(packageName)) {
                    try {
                        final ApplicationInfo ai = AppGlobals.getPackageManager()
                                .getApplicationInfo(packageName, STOCK_PM_FLAGS, app.userId);
                        final ApplicationInfo ai = applicationInfoByPackage.get(packageName);
                        if (ai != null) {
                            if (ai.packageName.equals(app.info.packageName)) {
                                app.info = ai;
+14 −0
Original line number Diff line number Diff line
@@ -4587,6 +4587,20 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        return mGlobalAssetsSeq;
    }

    /**
     * Updates the {@link ApplicationInfo}s of the package activities th that are attached in the
     * WM hierarchy.
     */
    public void updateActivityApplicationInfo(int userId,
            ArrayMap<String, ApplicationInfo> applicationInfoByPackage) {
        synchronized (mGlobalLock) {
            if (mRootWindowContainer != null) {
                mRootWindowContainer.updateActivityApplicationInfo(userId,
                        applicationInfoByPackage);
            }
        }
    }

    /**
     * Update the asset configuration and increase the assets sequence number.
     * @param processes the processes that needs to update the asset configuration
+14 −0
Original line number Diff line number Diff line
@@ -3172,6 +3172,20 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        });
    }

    void updateActivityApplicationInfo(int userId,
            ArrayMap<String, ApplicationInfo> applicationInfoByPackage) {
        forAllActivities(r -> {
            if (r.mUserId != userId) {
                return;
            }

            final ApplicationInfo aInfo = applicationInfoByPackage.get(r.packageName);
            if (aInfo != null) {
                r.updateApplicationInfo(aInfo);
            }
        });
    }

    void finishVoiceTask(IVoiceInteractionSession session) {
        final IBinder binder = session.asBinder();
        forAllLeafTasks(t -> t.finishIfVoiceTask(binder), true /* traverseTopToBottom */);