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

Commit e0a1e3ae authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "Ensure we apply override configuration to the global one." into nyc-dev

parents 1493fdd3 c24d8f9c
Loading
Loading
Loading
Loading
+31 −13
Original line number Diff line number Diff line
@@ -184,6 +184,10 @@ final class WindowState implements WindowManagerPolicy.WindowState {

    private Configuration mConfiguration = Configuration.EMPTY;
    private Configuration mOverrideConfig = Configuration.EMPTY;
    // Represents the changes from our override configuration applied
    // to the global configuration. This is the only form of configuration
    // which is suitable for delivery to the client.
    private Configuration mMergedConfiguration = new Configuration();
    // Sticky answer to isConfigChanged(), remains true until new Configuration is assigned.
    // Used only on {@link #TYPE_KEYGUARD}.
    private boolean mConfigHasChanged;
@@ -1355,6 +1359,11 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        mConfiguration = newConfig;
        mOverrideConfig = newOverrideConfig;
        mConfigHasChanged = false;

        mMergedConfiguration.setTo(newConfig);
        if (newOverrideConfig != null && newOverrideConfig != Configuration.EMPTY) {
            mMergedConfiguration.updateFrom(newOverrideConfig);
        }
    }

    void setHasSurface(boolean hasSurface) {
@@ -1616,9 +1625,10 @@ final class WindowState implements WindowManagerPolicy.WindowState {
            mTurnOnScreen = true;
        }
        if (isConfigChanged()) {
            final Configuration newConfig = updateConfiguration();
            if (DEBUG_CONFIGURATION) Slog.i(TAG, "Window " + this + " visible with new config: "
                    + mService.mCurConfiguration);
            outConfig.setTo(mService.mCurConfiguration);
                    + newConfig);
            outConfig.setTo(newConfig);
        }
    }

@@ -2061,21 +2071,30 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        }
    }

    void reportResized() {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "wm.reportResized_" + getWindowTag());
        try {
            if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to " + this
                    + ": " + mCompatFrame);
            final boolean configChanged = isConfigChanged();
    /**
     * Update our current configurations, based on task configuration.
     *
     * @return A configuration suitable for sending to the client.
     */
    private Configuration updateConfiguration() {
        final Task task = getTask();
        final Configuration overrideConfig =
            (task != null) ? task.mOverrideConfig : Configuration.EMPTY;
        final boolean configChanged = isConfigChanged();
        if ((DEBUG_RESIZE || DEBUG_ORIENTATION || DEBUG_CONFIGURATION) && configChanged) {
                Slog.i(TAG, "Sending new config to window " + this + ": "
                        + " / config="
                        + mService.mCurConfiguration + " overrideConfig=" + overrideConfig);
            Slog.i(TAG, "Sending new config to window " + this + ": " +
                    " / config=" + mService.mCurConfiguration + " overrideConfig=" + overrideConfig);
        }
        setConfiguration(mService.mCurConfiguration, overrideConfig);
        return mMergedConfiguration;
    }

    void reportResized() {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "wm.reportResized_" + getWindowTag());
        try {
            if (DEBUG_RESIZE || DEBUG_ORIENTATION) Slog.v(TAG, "Reporting new frame to " + this
                    + ": " + mCompatFrame);
            final Configuration newConfig = isConfigChanged() ? updateConfiguration() : null;
            if (DEBUG_ORIENTATION && mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING)
                Slog.i(TAG, "Resizing " + this + " WITH DRAW PENDING");

@@ -2086,7 +2105,6 @@ final class WindowState implements WindowManagerPolicy.WindowState {
            final Rect stableInsets = mLastStableInsets;
            final Rect outsets = mLastOutsets;
            final boolean reportDraw = mWinAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
            final Configuration newConfig = configChanged ? mConfiguration : null;
            if (mAttrs.type != WindowManager.LayoutParams.TYPE_APPLICATION_STARTING
                    && mClient instanceof IWindow.Stub) {
                // To prevent deadlock simulate one-way call if win.mClient is a local object.