diff options
| author | 2022-02-08 14:27:57 +0000 | |
|---|---|---|
| committer | 2022-02-08 14:27:57 +0000 | |
| commit | 18ef32b5b39902023aa6d392f18b097c9c65516b (patch) | |
| tree | cead05b40683d12b6fbe6e399539230d1a5d9843 | |
| parent | 659f944ffb98f1eac6e06511df468c91ab57cb99 (diff) | |
| parent | 286845eb3eecf1647f2536d525234d9cda342d82 (diff) | |
Merge "Report Activity config changes only if it handles the change"
| -rw-r--r-- | core/java/android/app/ActivityThread.java | 11 | ||||
| -rw-r--r-- | core/java/android/window/ConfigurationHelper.java | 18 |
2 files changed, 5 insertions, 24 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 3289304a0df4..5b8969e9374e 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -31,7 +31,6 @@ import static android.content.ContentResolver.DEPRECATE_DATA_COLUMNS; import static android.content.ContentResolver.DEPRECATE_DATA_PREFIX; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.INVALID_DISPLAY; -import static android.window.ConfigurationHelper.diffPublicWithSizeBuckets; import static android.window.ConfigurationHelper.freeTextLayoutCachesIfNeeded; import static android.window.ConfigurationHelper.isDifferentDisplay; import static android.window.ConfigurationHelper.shouldUpdateResources; @@ -5880,15 +5879,15 @@ public final class ActivityThread extends ClientTransactionHandler final boolean movedToDifferentDisplay = isDifferentDisplay(activity.getDisplayId(), displayId); - final ActivityClientRecord r = mActivities.get(activityToken); - final int diff = diffPublicWithSizeBuckets(activity.mCurrentConfig, - newConfig, r != null ? r.mSizeConfigurations : null); + final Configuration currentConfig = activity.mCurrentConfig; + final int diff = (currentConfig == null) ? 0xffffffff + : currentConfig.diffPublicOnly(newConfig); final boolean hasPublicConfigChange = diff != 0; // TODO(b/173090263): Use diff instead after the improvement of AssetManager and // ResourcesImpl constructions. final boolean shouldUpdateResources = hasPublicConfigChange - || shouldUpdateResources(activityToken, activity.mCurrentConfig, newConfig, - amOverrideConfig, movedToDifferentDisplay, hasPublicConfigChange); + || shouldUpdateResources(activityToken, currentConfig, newConfig, amOverrideConfig, + movedToDifferentDisplay, hasPublicConfigChange); final boolean shouldReportChange = hasPublicConfigChange // If this activity doesn't handle any of the config changes, then don't bother // calling onConfigurationChanged. Otherwise, report to the activity for the diff --git a/core/java/android/window/ConfigurationHelper.java b/core/java/android/window/ConfigurationHelper.java index 3a3eb74bf2e3..e32adcf23a3b 100644 --- a/core/java/android/window/ConfigurationHelper.java +++ b/core/java/android/window/ConfigurationHelper.java @@ -48,24 +48,6 @@ public class ConfigurationHelper { } /** - * A helper method to filter out {@link ActivityInfo#CONFIG_SCREEN_SIZE} if the - * {@link Configuration#diffPublicOnly(Configuration) diff} of two {@link Configuration} - * doesn't cross the boundary. - * - * @see SizeConfigurationBuckets#filterDiff(int, Configuration, Configuration, - * SizeConfigurationBuckets) - */ - public static int diffPublicWithSizeBuckets(@Nullable Configuration currentConfig, - @NonNull Configuration newConfig, @Nullable SizeConfigurationBuckets buckets) { - // If current configuration is null, it is definitely different from updated Configuration. - if (currentConfig == null) { - return 0xffffffff; - } - int publicDiff = currentConfig.diffPublicOnly(newConfig); - return SizeConfigurationBuckets.filterDiff(publicDiff, currentConfig, newConfig, buckets); - } - - /** * Returns {@code true} if the {@link android.content.res.Resources} associated with * a {@code token} needs to be updated. * |