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

Commit 0b5adb38 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Add new WindowToken to WMS.mTokenMap when constructed

Adding it to the map in the ctor makes it easier to follow what is
going on and reduces the chance of errors in the future.

Bug: 30060889
Change-Id: I7e56bc51be1067c6f4ad47188679d2fbabb04921
parent 2049dbf0
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -1507,7 +1507,6 @@ public class WindowManagerService extends IWindowManager.Stub
                return WindowManagerGlobal.ADD_PERMISSION_DENIED;
            }

            boolean addToken = false;
            WindowToken token = mTokenMap.get(attrs.token);
            AppWindowToken atoken = null;
            if (token == null) {
@@ -1547,7 +1546,6 @@ public class WindowManagerService extends IWindowManager.Stub
                    return WindowManagerGlobal.ADD_BAD_APP_TOKEN;
                }
                token = new WindowToken(this, attrs.token, -1, false);
                addToken = true;
            } else if (type >= FIRST_APPLICATION_WINDOW && type <= LAST_APPLICATION_WINDOW) {
                atoken = token.asAppWindowToken();
                if (atoken == null) {
@@ -1607,7 +1605,6 @@ public class WindowManagerService extends IWindowManager.Stub
                // instead make a new token for it (as if null had been passed in for the token).
                attrs.token = null;
                token = new WindowToken(this, null, -1, false);
                addToken = true;
            }

            WindowState win = new WindowState(this, session, client, token, attachedWindow,
@@ -1649,9 +1646,6 @@ public class WindowManagerService extends IWindowManager.Stub

            origId = Binder.clearCallingIdentity();

            if (addToken) {
                mTokenMap.put(attrs.token, token);
            }
            win.attach();
            mWindowMap.put(client.asBinder(), win);
            if (win.mAppOp != AppOpsManager.OP_NONE) {
@@ -2743,7 +2737,6 @@ public class WindowManagerService extends IWindowManager.Stub
                return;
            }
            wtoken = new WindowToken(this, token, type, true);
            mTokenMap.put(token, wtoken);
            if (type == TYPE_WALLPAPER) {
                mWallpaperControllerLocked.addWallpaperToken(wtoken);
            }
@@ -2842,8 +2835,6 @@ public class WindowManagerService extends IWindowManager.Stub
            }
            task.addAppToken(addPos, atoken, taskResizeMode, homeTask);

            mTokenMap.put(token.asBinder(), atoken);

            // Application tokens start out hidden.
            atoken.hidden = true;
            atoken.hiddenRequested = true;
+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ class WindowToken {
        token = _token;
        windowType = type;
        explicit = _explicit;
        mService.mTokenMap.put(token, this);
    }

    void removeAllWindows() {