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

Commit 634da079 authored by wilsonshih's avatar wilsonshih
Browse files

Only initialize Session's package name once.

A session should only corresponding to a process and shouldn't be
changed after it was created, we can get the package name from process
map and only initialize it once.

Bug: 182803586
Test: manual
Change-Id: Ifdeb618952adf82cb0fac4bfa15f70b344604b1e
parent 751bafe6
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -640,9 +640,16 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
        }
    }

    void windowAddedLocked(String packageName) {
        mPackageName = packageName;
    void windowAddedLocked() {
        if (mPackageName == null) {
            final WindowProcessController wpc = mService.mAtmService.mProcessMap.getProcess(mPid);
            if (wpc != null) {
                mPackageName = wpc.mInfo.packageName;
                mRelayoutTag = "relayoutWindow: " + mPackageName;
            } else {
                Slog.e(TAG_WM, "Unknown process pid=" + mPid);
            }
        }
        if (mSurfaceSession == null) {
            if (DEBUG) {
                Slog.v(TAG_WM, "First window added to " + this + ", creating SurfaceSession");
+1 −1
Original line number Diff line number Diff line
@@ -1140,7 +1140,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP

    void attach() {
        if (DEBUG) Slog.v(TAG, "Attaching " + this + " token=" + mToken);
        mSession.windowAddedLocked(mAttrs.packageName);
        mSession.windowAddedLocked();
    }

    /**