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

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

Merge "Revert "Update resources when config update of sysUiContext"" into main

parents d02140d4 a030f3fe
Loading
Loading
Loading
Loading
+7 −40
Original line number Diff line number Diff line
@@ -162,7 +162,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;
@@ -457,7 +456,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;

@@ -544,7 +542,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();
@@ -1104,29 +1101,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.
@@ -2823,10 +2797,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();

@@ -3406,9 +3381,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;
        }
@@ -5457,7 +5429,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();
@@ -5465,15 +5437,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
@@ -6652,7 +6620,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;
    }