Revert "Apply overlay changes with config change"
Revert submission 15058002 Reason for revert: Causes crash in com.android.cts.splitapp, breaks android.appsecurity.cts.SplitTests#testFeatureWithoutRestart_full. Bug: 192242649 Reverted Changes: Icf81845da:Apply overlay changes with config change Iea54abf38:Version LoadedApk cache using base code path I986563142:Revert "Deprecate Context#createApplicationContext... Change-Id: Ifb30daa85d9de4587bc39e074341ebdefaf26f84
This commit is contained in:
@@ -1182,7 +1182,6 @@ public final class ActivityThread extends ClientTransactionHandler
|
||||
}
|
||||
|
||||
public void scheduleApplicationInfoChanged(ApplicationInfo ai) {
|
||||
mResourcesManager.updatePendingAppInfoUpdates(ai);
|
||||
mH.removeMessages(H.APPLICATION_INFO_CHANGED, ai);
|
||||
sendMessage(H.APPLICATION_INFO_CHANGED, ai);
|
||||
}
|
||||
|
||||
@@ -98,12 +98,6 @@ public class ResourcesManager {
|
||||
*/
|
||||
private int mResDisplayId = DEFAULT_DISPLAY;
|
||||
|
||||
/**
|
||||
* ApplicationInfo changes that need to be applied to Resources when the next configuration
|
||||
* change occurs.
|
||||
*/
|
||||
private ArrayList<ApplicationInfo> mPendingAppInfoUpdates;
|
||||
|
||||
/**
|
||||
* A mapping of ResourceImpls and their configurations. These are heavy weight objects
|
||||
* which should be reused as much as possible.
|
||||
@@ -1038,7 +1032,7 @@ public class ResourcesManager {
|
||||
* @param classLoader The classloader to use for the Resources object.
|
||||
* If null, {@link ClassLoader#getSystemClassLoader()} is used.
|
||||
* @return A Resources object that gets updated when
|
||||
* {@link #applyConfigurationToResources(Configuration, CompatibilityInfo)}
|
||||
* {@link #applyConfigurationToResourcesLocked(Configuration, CompatibilityInfo)}
|
||||
* is called.
|
||||
*/
|
||||
@Nullable
|
||||
@@ -1165,8 +1159,8 @@ public class ResourcesManager {
|
||||
/**
|
||||
* Updates an Activity's Resources object with overrideConfig. The Resources object
|
||||
* that was previously returned by {@link #getResources(IBinder, String, String[], String[],
|
||||
* String[], String[], Integer, Configuration, CompatibilityInfo, ClassLoader, List)} is still
|
||||
* valid and will have the updated configuration.
|
||||
* String[], Integer, Configuration, CompatibilityInfo, ClassLoader, List)} is still valid and
|
||||
* will have the updated configuration.
|
||||
*
|
||||
* @param activityToken The Activity token.
|
||||
* @param overrideConfig The configuration override to update.
|
||||
@@ -1317,22 +1311,6 @@ public class ResourcesManager {
|
||||
return newKey;
|
||||
}
|
||||
|
||||
public void updatePendingAppInfoUpdates(@NonNull ApplicationInfo appInfo) {
|
||||
synchronized (mLock) {
|
||||
if (mPendingAppInfoUpdates == null) {
|
||||
mPendingAppInfoUpdates = new ArrayList<>();
|
||||
}
|
||||
// Clear previous app info changes for the package to prevent multiple ResourcesImpl
|
||||
// recreations when only the last recreation will be used.
|
||||
for (int i = mPendingAppInfoUpdates.size() - 1; i >= 0; i--) {
|
||||
if (appInfo.sourceDir.equals(mPendingAppInfoUpdates.get(i).sourceDir)) {
|
||||
mPendingAppInfoUpdates.remove(i);
|
||||
}
|
||||
}
|
||||
mPendingAppInfoUpdates.add(appInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean applyConfigurationToResources(@NonNull Configuration config,
|
||||
@Nullable CompatibilityInfo compat) {
|
||||
return applyConfigurationToResources(config, compat, null /* adjustments */);
|
||||
@@ -1346,18 +1324,7 @@ public class ResourcesManager {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_RESOURCES,
|
||||
"ResourcesManager#applyConfigurationToResources");
|
||||
|
||||
final boolean assetsUpdated = mPendingAppInfoUpdates != null
|
||||
&& config.assetsSeq > mResConfiguration.assetsSeq;
|
||||
if (assetsUpdated) {
|
||||
for (int i = 0, n = mPendingAppInfoUpdates.size(); i < n; i++) {
|
||||
final ApplicationInfo appInfo = mPendingAppInfoUpdates.get(i);
|
||||
applyNewResourceDirs(appInfo, new String[]{appInfo.sourceDir});
|
||||
}
|
||||
mPendingAppInfoUpdates = null;
|
||||
}
|
||||
|
||||
if (!assetsUpdated && !mResConfiguration.isOtherSeqNewer(config)
|
||||
&& compat == null) {
|
||||
if (!mResConfiguration.isOtherSeqNewer(config) && compat == null) {
|
||||
if (DEBUG || DEBUG_CONFIGURATION) {
|
||||
Slog.v(TAG, "Skipping new config: curSeq="
|
||||
+ mResConfiguration.seq + ", newSeq=" + config.seq);
|
||||
@@ -1400,7 +1367,7 @@ public class ResourcesManager {
|
||||
}
|
||||
}
|
||||
|
||||
return assetsUpdated || changes != 0;
|
||||
return changes != 0;
|
||||
} finally {
|
||||
Trace.traceEnd(Trace.TRACE_TAG_RESOURCES);
|
||||
}
|
||||
|
||||
@@ -4698,10 +4698,10 @@ public final class ProcessList {
|
||||
final ApplicationInfo ai = AppGlobals.getPackageManager()
|
||||
.getApplicationInfo(packageName, STOCK_PM_FLAGS, app.userId);
|
||||
if (ai != null) {
|
||||
app.getThread().scheduleApplicationInfoChanged(ai);
|
||||
if (ai.packageName.equals(app.info.packageName)) {
|
||||
app.info = ai;
|
||||
}
|
||||
app.getThread().scheduleApplicationInfoChanged(ai);
|
||||
targetProcesses.add(app.getWindowProcessController());
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
@@ -4712,7 +4712,8 @@ public final class ProcessList {
|
||||
});
|
||||
}
|
||||
|
||||
mService.mActivityTaskManager.updateAssetConfiguration(targetProcesses, updateFrameworkRes);
|
||||
mService.mActivityTaskManager.updateAssetConfiguration(
|
||||
updateFrameworkRes ? null : targetProcesses);
|
||||
}
|
||||
|
||||
@GuardedBy("mService")
|
||||
|
||||
@@ -4146,21 +4146,21 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
|
||||
/**
|
||||
* Update the asset configuration and increase the assets sequence number.
|
||||
* @param processes the processes that needs to update the asset configuration
|
||||
* @param processes the processes that needs to update the asset configuration, if none
|
||||
* updates the global configuration for all processes.
|
||||
*/
|
||||
public void updateAssetConfiguration(List<WindowProcessController> processes,
|
||||
boolean updateFrameworkRes) {
|
||||
public void updateAssetConfiguration(List<WindowProcessController> processes) {
|
||||
synchronized (mGlobalLock) {
|
||||
final int assetSeq = increaseAssetConfigurationSeq();
|
||||
|
||||
if (updateFrameworkRes) {
|
||||
// Update the global configuration if the no target processes
|
||||
if (processes == null) {
|
||||
Configuration newConfig = new Configuration();
|
||||
newConfig.assetsSeq = assetSeq;
|
||||
updateConfiguration(newConfig);
|
||||
return;
|
||||
}
|
||||
|
||||
// Always update the override of every process so the asset sequence of the process is
|
||||
// always greater than or equal to the global configuration.
|
||||
for (int i = processes.size() - 1; i >= 0; i--) {
|
||||
final WindowProcessController wpc = processes.get(i);
|
||||
wpc.updateAssetConfiguration(assetSeq);
|
||||
|
||||
Reference in New Issue
Block a user