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

Commit ab731a19 authored by Louis Chang's avatar Louis Chang Committed by Automerger Merge Worker
Browse files

Merge "Revert "Do not relaunch bg activities when application info changes""...

Merge "Revert "Do not relaunch bg activities when application info changes"" into sc-dev am: 9caa70a8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14305132

Change-Id: Ib00734a051598906c0cf201220cccd85921f41ee
parents 180f5ab2 9caa70a8
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -5968,6 +5968,20 @@ public final class ActivityThread extends ClientTransactionHandler
            // Update all affected Resources objects to use new ResourcesImpl
            mResourcesManager.applyNewResourceDirsLocked(ai, oldResDirs);
        }

        ApplicationPackageManager.configurationChanged();

        // Trigger a regular Configuration change event, only with a different assetsSeq number
        // so that we actually call through to all components.
        // TODO(adamlesinski): Change this to make use of ActivityManager's upcoming ability to
        // store configurations per-process.
        final Configuration config = mConfigurationController.getConfiguration();
        Configuration newConfig = new Configuration();
        newConfig.assetsSeq = (config != null ? config.assetsSeq : 0) + 1;
        mConfigurationController.handleConfigurationChanged(newConfig, null /* compat */);

        // Preserve windows to avoid black flickers when overlays change.
        relaunchAllActivities(true /* preserveWindows */, "handleApplicationInfoChanged");
    }

    /**
+9 −0
Original line number Diff line number Diff line
@@ -184,6 +184,15 @@ public class ActivityThreadTest {
        });
    }

    @Test
    public void testHandleActivity_assetsChanged() {
        relaunchActivityAndAssertPreserveWindow(activity -> {
            // Relaunches all activities.
            activity.getActivityThread().handleApplicationInfoChanged(
                    activity.getApplicationInfo());
        });
    }

    @Test
    public void testRecreateActivity() {
        relaunchActivityAndAssertPreserveWindow(Activity::recreate);
+0 −7
Original line number Diff line number Diff line
@@ -79,7 +79,6 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.PackageManagerInternal;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Point;
import android.net.LocalSocket;
@@ -4652,12 +4651,6 @@ public final class ProcessList {
                }
            });
        }

        // Update the global configuration and increase the assets sequence number.
        Configuration currentConfig = mService.mActivityTaskManager.getConfiguration();
        Configuration newConfig = new Configuration();
        newConfig.assetsSeq = (currentConfig != null ? currentConfig.assetsSeq : 0) + 1;
        mService.mActivityTaskManager.updateConfiguration(newConfig);
    }

    @GuardedBy("mService")