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

Commit 04082fcf authored by Charles Chen's avatar Charles Chen Committed by Automerger Merge Worker
Browse files

Merge "Move initialization from onCreate to attachBaseContext" into sc-v2-dev...

Merge "Move initialization from onCreate to attachBaseContext" into sc-v2-dev am: 4a20c942 am: 46c16674

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

Change-Id: Iec3dd30355e4c7f18341a964d75d286366c41915
parents bef5ea37 46c16674
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ public abstract class WindowProviderService extends Service {
    private final WindowTokenClient mWindowToken = new WindowTokenClient();
    private final WindowContextController mController = new WindowContextController(mWindowToken);
    private WindowManager mWindowManager;
    private boolean mInitialized;

    /**
     * Returns the type of this {@link WindowProviderService}.
@@ -122,13 +123,17 @@ public abstract class WindowProviderService extends Service {
        return context.createTokenContext(mWindowToken, display);
    }

    @CallSuper
    /** @hide */
    @Override
    public void onCreate() {
        super.onCreate();
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(newBase);
        if (!mInitialized) {
            mWindowToken.attachContext(this);
        mController.attachToDisplayArea(getWindowType(), getDisplayId(), getWindowContextOptions());
            mController.attachToDisplayArea(getWindowType(), getDisplayId(),
                    getWindowContextOptions());
            mWindowManager = WindowManagerImpl.createWindowContextWindowManager(this);
            mInitialized = true;
        }
    }

    @SuppressLint("OnNameExpected")