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

Commit 6cb3181a authored by Nicolò Mazzucato's avatar Nicolò Mazzucato Committed by Android (Google) Code Review
Browse files

Merge "Ensure up-to-date WindowContext resources before configuration change" into main

parents cec81bad d245cab3
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ import static android.window.DesktopModeFlags.ENABLE_CAPTION_COMPAT_INSET_FORCE_
import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE;
import static com.android.text.flags.Flags.disableHandwritingInitiatorForIme;
import static com.android.window.flags.Flags.enableBufferTransformHintFromDisplay;
import static com.android.window.flags.Flags.enableWindowContextResourcesUpdateOnConfigChange;
import static com.android.window.flags.Flags.predictiveBackSwipeEdgeNoneApi;
import static com.android.window.flags.Flags.setScPropertiesInClient;
@@ -271,7 +272,9 @@ import android.window.OnBackInvokedCallback;
import android.window.OnBackInvokedDispatcher;
import android.window.ScreenCapture;
import android.window.SurfaceSyncGroup;
import android.window.WindowContext;
import android.window.WindowOnBackInvokedDispatcher;
import android.window.WindowTokenClient;
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
@@ -6609,12 +6612,26 @@ public final class ViewRootImpl implements ViewParent,
            mActivityConfigCallback.onConfigurationChanged(overrideConfig, newDisplayId,
                    activityWindowInfo);
        } else {
            // There is no activity callback - update the configuration right away.
            if (enableWindowContextResourcesUpdateOnConfigChange()) {
                // There is no activity callback - update resources for window token, if needed.
                final WindowTokenClient windowTokenClient = getWindowTokenClient();
                if (windowTokenClient != null) {
                    windowTokenClient.onConfigurationChanged(
                            mLastReportedMergedConfiguration.getMergedConfiguration(),
                            newDisplayId == INVALID_DISPLAY ? mDisplay.getDisplayId()
                                    : newDisplayId);
                }
            }
            updateConfiguration(newDisplayId);
        }
        mForceNextConfigUpdate = false;
    }
    private WindowTokenClient getWindowTokenClient() {
        if (!(mContext instanceof WindowContext)) return null;
        return (WindowTokenClient) mContext.getWindowContextToken();
    }
    /**
     * Update display and views if last applied merged configuration changed.
     * @param newDisplayId Id of new display if moved, {@link Display#INVALID_DISPLAY} otherwise.
+0 −1
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ public class WindowTokenClient extends Binder {
     * @param newConfig the updated {@link Configuration}
     * @param newDisplayId the updated {@link android.view.Display} ID
     */
    @VisibleForTesting(visibility = PACKAGE)
    @MainThread
    public void onConfigurationChanged(Configuration newConfig, int newDisplayId) {
        onConfigurationChanged(newConfig, newDisplayId, true /* shouldReportConfigChange */);
+11 −0
Original line number Diff line number Diff line
@@ -676,6 +676,17 @@ flag {
    }
}

flag {
    name: "enable_window_context_resources_update_on_config_change"
    namespace: "lse_desktop_experience"
    description: "Updates window context resources before the view receives the config change callback."
    bug: "394527409"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "enable_desktop_tab_tearing_minimize_animation_bugfix"
    namespace: "lse_desktop_experience"