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

Commit a030f3fe authored by Charles Chen's avatar Charles Chen Committed by Android (Google) Code Review
Browse files

Revert "Update resources when config update of sysUiContext"

Revert submission 31401215

Reason for revert: Regression in WmTests b/397133940 and flag rollback failed.

Reverted changes: /q/submissionid:31401215

Change-Id: I741d5c01511f0f7ebee8a627f63517f7e9cb22c9
parent 09e7382f
Loading
Loading
Loading
Loading
+7 −40
Original line number Diff line number Diff line
@@ -164,7 +164,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.content.ComponentCallbacks;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ActivityInfo;
@@ -471,7 +470,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    private DisplayInfo mLastDisplayInfoOverride;

    private final DisplayMetrics mDisplayMetrics = new DisplayMetrics();
    @NonNull
    private final DisplayPolicy mDisplayPolicy;
    private final DisplayRotation mDisplayRotation;

@@ -558,7 +556,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    /** Remove this display when animation on it has completed. */
    private boolean mDeferredRemoval;

    @NonNull
    final PinnedTaskController mPinnedTaskController;

    private final LinkedList<ActivityRecord> mTmpUpdateAllDrawn = new LinkedList();
@@ -1118,29 +1115,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        w.updateResizingWindowIfNeeded();
    };

    /**
     * Called to update fields retrieve from {@link #getDisplayUiContext()} resources when
     * there's a configuration update on {@link #getDisplayUiContext()}.
     */
    @NonNull
    private final ComponentCallbacks mSysUiContextConfigCallback = new ComponentCallbacks() {

        @Override
        public void onConfigurationChanged(@NonNull Configuration newConfig) {
            synchronized (mWmService.mGlobalLock) {
                if (mDisplayReady) {
                    mDisplayPolicy.onConfigurationChanged();
                    mMinSizeOfResizeableTaskDp = getMinimalTaskSizeDp();
                }
            }
        }

        @Override
        public void onLowMemory() {
            // Do nothing.
        }
    };

    /**
     * Create new {@link DisplayContent} instance, add itself to the root window container and
     * initialize direct children.
@@ -2849,10 +2823,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        final int lastOrientation = getConfiguration().orientation;
        final int lastWindowingMode = getWindowingMode();
        super.onConfigurationChanged(newParentConfig);
        if (!Flags.trackSystemUiContextBeforeWms()) {
            mSysUiContextConfigCallback.onConfigurationChanged(newParentConfig);
        }
        if (mDisplayPolicy != null) {
            mDisplayPolicy.onConfigurationChanged();
            mPinnedTaskController.onPostDisplayConfigurationChanged();
            mMinSizeOfResizeableTaskDp = getMinimalTaskSizeDp();
        }
        // Update IME parent if needed.
        updateImeParent();

@@ -3413,9 +3388,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                    .getKeyguardController().onDisplayRemoved(mDisplayId);
            mWallpaperController.resetLargestDisplay(mDisplay);
            mWmService.mDisplayWindowSettings.onDisplayRemoved(this);
            if (Flags.trackSystemUiContextBeforeWms()) {
                getDisplayUiContext().unregisterComponentCallbacks(mSysUiContextConfigCallback);
            }
        } finally {
            mDisplayReady = false;
        }
@@ -5512,7 +5484,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            reconfigureDisplayLocked();
            onRequestedOverrideConfigurationChanged(getRequestedOverrideConfiguration());
            mWmService.mDisplayNotificationController.dispatchDisplayAdded(this);
            // Attach the SystemUiContext to this DisplayContent to get latest configuration.
            // Attach the SystemUiContext to this DisplayContent the get latest configuration.
            // Note that the SystemUiContext will be removed automatically if this DisplayContent
            // is detached.
            registerSystemUiContext();
@@ -5520,15 +5492,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    }

    private void registerSystemUiContext() {
        final Context systemUiContext = getDisplayUiContext();
        final WindowProcessController wpc = mAtmService.getProcessController(
                systemUiContext.getIApplicationThread());
                getDisplayUiContext().getIApplicationThread());
        mWmService.mWindowContextListenerController.registerWindowContainerListener(
                wpc, systemUiContext.getWindowContextToken(), this,
                wpc, getDisplayUiContext().getWindowContextToken(), this,
                INVALID_WINDOW_TYPE, null /* options */);
        if (Flags.trackSystemUiContextBeforeWms()) {
            systemUiContext.registerComponentCallbacks(mSysUiContextConfigCallback);
        }
    }

    @Override
@@ -6721,7 +6689,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        forAllTasks((t) -> { t.getRootTask().removeChild(t, "removeAllTasks"); });
    }

    @NonNull
    Context getDisplayUiContext() {
        return mDisplayPolicy.getSystemUiContext();
    }
+0 −1
Original line number Diff line number Diff line
@@ -1865,7 +1865,6 @@ public class DisplayPolicy {
        return mContext;
    }

    @NonNull
    Context getSystemUiContext() {
        return mUiContext;
    }