Merge "Make sure to apply latest configuration to resources" into nyc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8fcd8f1fb9
@@ -4627,11 +4627,12 @@ public final class ActivityThread {
|
|||||||
if ((activity == null) || (activity.mCurrentConfig == null)) {
|
if ((activity == null) || (activity.mCurrentConfig == null)) {
|
||||||
shouldChangeConfig = true;
|
shouldChangeConfig = true;
|
||||||
} else {
|
} else {
|
||||||
// If the new config is the same as the config this Activity
|
// If the new config is the same as the config this Activity is already
|
||||||
// is already running with then don't bother calling
|
// running with and the override config also didn't change, then don't
|
||||||
// onConfigurationChanged
|
// bother calling onConfigurationChanged.
|
||||||
int diff = activity.mCurrentConfig.diff(newConfig);
|
int diff = activity.mCurrentConfig.diff(newConfig);
|
||||||
if (diff != 0) {
|
if (diff != 0 || !mResourcesManager.isSameResourcesOverrideConfig(activityToken,
|
||||||
|
amOverrideConfig)) {
|
||||||
// Always send the task-level config changes. For system-level configuration, if
|
// Always send the task-level config changes. For system-level configuration, if
|
||||||
// this activity doesn't handle any of the config changes, then don't bother
|
// this activity doesn't handle any of the config changes, then don't bother
|
||||||
// calling onConfigurationChanged as we're going to destroy it.
|
// calling onConfigurationChanged as we're going to destroy it.
|
||||||
|
|||||||
@@ -364,6 +364,26 @@ public class ResourcesManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if activity resources have same override config as the provided on.
|
||||||
|
* @param activityToken The Activity that resources should be associated with.
|
||||||
|
* @param overrideConfig The override configuration to be checked for equality with.
|
||||||
|
* @return true if activity resources override config matches the provided one or they are both
|
||||||
|
* null, false otherwise.
|
||||||
|
*/
|
||||||
|
boolean isSameResourcesOverrideConfig(@Nullable IBinder activityToken,
|
||||||
|
@Nullable Configuration overrideConfig) {
|
||||||
|
synchronized (this) {
|
||||||
|
final ActivityResources activityResources
|
||||||
|
= activityToken != null ? mActivityResourceReferences.get(activityToken) : null;
|
||||||
|
if (activityResources == null) {
|
||||||
|
return overrideConfig == null;
|
||||||
|
} else {
|
||||||
|
return Objects.equals(activityResources.overrideConfig, overrideConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ActivityResources getOrCreateActivityResourcesStructLocked(
|
private ActivityResources getOrCreateActivityResourcesStructLocked(
|
||||||
@NonNull IBinder activityToken) {
|
@NonNull IBinder activityToken) {
|
||||||
ActivityResources activityResources = mActivityResourceReferences.get(activityToken);
|
ActivityResources activityResources = mActivityResourceReferences.get(activityToken);
|
||||||
|
|||||||
Reference in New Issue
Block a user