Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39da4a78 authored by Graciela Putri's avatar Graciela Putri Committed by Automerger Merge Worker
Browse files

Merge "Send update config change when letterbox is moved" into udc-dev am:...

Merge "Send update config change when letterbox is moved" into udc-dev am: 40ae027d am: 8724c53e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22893140



Change-Id: I060c2784fa849b9f4af56244778ab2731b865d3b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b4f817fe 8724c53e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import static android.view.Display.INVALID_DISPLAY;
import static android.window.ConfigurationHelper.freeTextLayoutCachesIfNeeded;
import static android.window.ConfigurationHelper.isDifferentDisplay;
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.os.SafeZipPathValidatorCallback.VALIDATE_ZIP_PATH_FOR_PATH_TRAVERSAL;
@@ -6112,6 +6113,11 @@ public final class ActivityThread extends ClientTransactionHandler
    public static boolean shouldReportChange(@Nullable Configuration currentConfig,
            @NonNull Configuration newConfig, @Nullable SizeConfigurationBuckets sizeBuckets,
            int handledConfigChanges, boolean alwaysReportChange) {
        // Always report changes in window configuration bounds
        if (shouldUpdateWindowMetricsBounds(currentConfig, newConfig)) {
            return true;
        }

        final int publicDiff = currentConfig.diffPublicOnly(newConfig);
        // Don't report the change if there's no public diff between current and new config.
        if (publicDiff == 0) {
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public class ConfigurationHelper {
     * @see WindowManager#getCurrentWindowMetrics()
     * @see WindowManager#getMaximumWindowMetrics()
     */
    private static boolean shouldUpdateWindowMetricsBounds(@NonNull Configuration currentConfig,
    public static boolean shouldUpdateWindowMetricsBounds(@NonNull Configuration currentConfig,
            @NonNull Configuration newConfig) {
        final Rect currentBounds = currentConfig.windowConfiguration.getBounds();
        final Rect newBounds = newConfig.windowConfiguration.getBounds();
+2 −4
Original line number Diff line number Diff line
@@ -451,10 +451,8 @@ public class ActivityThreadTest {
        final Rect bounds = activity.getWindowManager().getCurrentWindowMetrics().getBounds();
        assertEquals(activityConfigPortrait.windowConfiguration.getBounds(), bounds);

        // Ensure that Activity#onConfigurationChanged() not be called because the changes in
        // WindowConfiguration shouldn't be reported, and we only apply the latest Configuration
        // update in transaction.
        assertEquals(numOfConfig, activity.mNumOfConfigChanges);
        // Ensure changes in window configuration bounds are reported
        assertEquals(numOfConfig + 1, activity.mNumOfConfigChanges);
    }

    @Test