Loading core/java/android/app/ActivityThread.java +0 −6 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,6 @@ import static android.view.Display.INVALID_DISPLAY; import static android.window.ConfigurationHelper.freeTextLayoutCachesIfNeeded; import static android.window.ConfigurationHelper.freeTextLayoutCachesIfNeeded; import static android.window.ConfigurationHelper.isDifferentDisplay; import static android.window.ConfigurationHelper.isDifferentDisplay; import static android.window.ConfigurationHelper.shouldUpdateResources; import static android.window.ConfigurationHelper.shouldUpdateResources; import static android.window.ConfigurationHelper.shouldUpdateWindowMetricsBounds; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.internal.os.SafeZipPathValidatorCallback.VALIDATE_ZIP_PATH_FOR_PATH_TRAVERSAL; import static com.android.internal.os.SafeZipPathValidatorCallback.VALIDATE_ZIP_PATH_FOR_PATH_TRAVERSAL; Loading Loading @@ -6118,11 +6117,6 @@ public final class ActivityThread extends ClientTransactionHandler public static boolean shouldReportChange(@Nullable Configuration currentConfig, public static boolean shouldReportChange(@Nullable Configuration currentConfig, @NonNull Configuration newConfig, @Nullable SizeConfigurationBuckets sizeBuckets, @NonNull Configuration newConfig, @Nullable SizeConfigurationBuckets sizeBuckets, int handledConfigChanges, boolean alwaysReportChange) { int handledConfigChanges, boolean alwaysReportChange) { // Always report changes in window configuration bounds if (shouldUpdateWindowMetricsBounds(currentConfig, newConfig)) { return true; } final int publicDiff = currentConfig.diffPublicOnly(newConfig); final int publicDiff = currentConfig.diffPublicOnly(newConfig); // Don't report the change if there's no public diff between current and new config. // Don't report the change if there's no public diff between current and new config. if (publicDiff == 0) { if (publicDiff == 0) { Loading core/java/android/window/ConfigurationHelper.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -106,7 +106,7 @@ public class ConfigurationHelper { * @see WindowManager#getCurrentWindowMetrics() * @see WindowManager#getCurrentWindowMetrics() * @see WindowManager#getMaximumWindowMetrics() * @see WindowManager#getMaximumWindowMetrics() */ */ public static boolean shouldUpdateWindowMetricsBounds(@NonNull Configuration currentConfig, private static boolean shouldUpdateWindowMetricsBounds(@NonNull Configuration currentConfig, @NonNull Configuration newConfig) { @NonNull Configuration newConfig) { final Rect currentBounds = currentConfig.windowConfiguration.getBounds(); final Rect currentBounds = currentConfig.windowConfiguration.getBounds(); final Rect newBounds = newConfig.windowConfiguration.getBounds(); final Rect newBounds = newConfig.windowConfiguration.getBounds(); Loading core/tests/coretests/src/android/app/activity/ActivityThreadTest.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -451,8 +451,10 @@ public class ActivityThreadTest { final Rect bounds = activity.getWindowManager().getCurrentWindowMetrics().getBounds(); final Rect bounds = activity.getWindowManager().getCurrentWindowMetrics().getBounds(); assertEquals(activityConfigPortrait.windowConfiguration.getBounds(), bounds); assertEquals(activityConfigPortrait.windowConfiguration.getBounds(), bounds); // Ensure changes in window configuration bounds are reported // Ensure that Activity#onConfigurationChanged() not be called because the changes in assertEquals(numOfConfig + 1, activity.mNumOfConfigChanges); // WindowConfiguration shouldn't be reported, and we only apply the latest Configuration // update in transaction. assertEquals(numOfConfig, activity.mNumOfConfigChanges); } } @Test @Test Loading Loading
core/java/android/app/ActivityThread.java +0 −6 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,6 @@ import static android.view.Display.INVALID_DISPLAY; import static android.window.ConfigurationHelper.freeTextLayoutCachesIfNeeded; import static android.window.ConfigurationHelper.freeTextLayoutCachesIfNeeded; import static android.window.ConfigurationHelper.isDifferentDisplay; import static android.window.ConfigurationHelper.isDifferentDisplay; import static android.window.ConfigurationHelper.shouldUpdateResources; import static android.window.ConfigurationHelper.shouldUpdateResources; import static android.window.ConfigurationHelper.shouldUpdateWindowMetricsBounds; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; import static com.android.internal.os.SafeZipPathValidatorCallback.VALIDATE_ZIP_PATH_FOR_PATH_TRAVERSAL; import static com.android.internal.os.SafeZipPathValidatorCallback.VALIDATE_ZIP_PATH_FOR_PATH_TRAVERSAL; Loading Loading @@ -6118,11 +6117,6 @@ public final class ActivityThread extends ClientTransactionHandler public static boolean shouldReportChange(@Nullable Configuration currentConfig, public static boolean shouldReportChange(@Nullable Configuration currentConfig, @NonNull Configuration newConfig, @Nullable SizeConfigurationBuckets sizeBuckets, @NonNull Configuration newConfig, @Nullable SizeConfigurationBuckets sizeBuckets, int handledConfigChanges, boolean alwaysReportChange) { int handledConfigChanges, boolean alwaysReportChange) { // Always report changes in window configuration bounds if (shouldUpdateWindowMetricsBounds(currentConfig, newConfig)) { return true; } final int publicDiff = currentConfig.diffPublicOnly(newConfig); final int publicDiff = currentConfig.diffPublicOnly(newConfig); // Don't report the change if there's no public diff between current and new config. // Don't report the change if there's no public diff between current and new config. if (publicDiff == 0) { if (publicDiff == 0) { Loading
core/java/android/window/ConfigurationHelper.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -106,7 +106,7 @@ public class ConfigurationHelper { * @see WindowManager#getCurrentWindowMetrics() * @see WindowManager#getCurrentWindowMetrics() * @see WindowManager#getMaximumWindowMetrics() * @see WindowManager#getMaximumWindowMetrics() */ */ public static boolean shouldUpdateWindowMetricsBounds(@NonNull Configuration currentConfig, private static boolean shouldUpdateWindowMetricsBounds(@NonNull Configuration currentConfig, @NonNull Configuration newConfig) { @NonNull Configuration newConfig) { final Rect currentBounds = currentConfig.windowConfiguration.getBounds(); final Rect currentBounds = currentConfig.windowConfiguration.getBounds(); final Rect newBounds = newConfig.windowConfiguration.getBounds(); final Rect newBounds = newConfig.windowConfiguration.getBounds(); Loading
core/tests/coretests/src/android/app/activity/ActivityThreadTest.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -451,8 +451,10 @@ public class ActivityThreadTest { final Rect bounds = activity.getWindowManager().getCurrentWindowMetrics().getBounds(); final Rect bounds = activity.getWindowManager().getCurrentWindowMetrics().getBounds(); assertEquals(activityConfigPortrait.windowConfiguration.getBounds(), bounds); assertEquals(activityConfigPortrait.windowConfiguration.getBounds(), bounds); // Ensure changes in window configuration bounds are reported // Ensure that Activity#onConfigurationChanged() not be called because the changes in assertEquals(numOfConfig + 1, activity.mNumOfConfigChanges); // WindowConfiguration shouldn't be reported, and we only apply the latest Configuration // update in transaction. assertEquals(numOfConfig, activity.mNumOfConfigChanges); } } @Test @Test Loading