Merge "Do not relaunch bg activities when application info changes" into sc-dev
This commit is contained in:
@@ -5968,20 +5968,6 @@ 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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -184,15 +184,6 @@ 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);
|
||||
|
||||
@@ -77,6 +77,7 @@ import android.content.IntentFilter;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.PackageManagerInternal;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Point;
|
||||
import android.net.LocalSocket;
|
||||
@@ -4643,6 +4644,12 @@ 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")
|
||||
|
||||
Reference in New Issue
Block a user