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

Commit 4b31cfd6 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by android-build-merger
Browse files

Merge "Fixed issue with associating WindowToken with null binder." into oc-dev

am: d193972a

Change-Id: I70b18aebd8ba5eb0cb8bac5c8bfdb4ca460885e1
parents ec73b8a9 d193972a
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -759,16 +759,25 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        return token.asAppWindowToken();
    }

    void addWindowToken(IBinder binder, WindowToken token) {
    private void addWindowToken(IBinder binder, WindowToken token) {
        final DisplayContent dc = mService.mRoot.getWindowTokenDisplay(token);
        if (dc != null) {
            // We currently don't support adding a window token to the display if the display
            // already has the binder mapped to another token. If there is a use case for supporting
            // this moving forward we will either need to merge the WindowTokens some how or have
            // the binder map to a list of window tokens.
            throw new IllegalArgumentException("Can't map token=" + token + " to display=" + this
                    + " already mapped to display=" + dc + " tokens=" + dc.mTokenMap);
            throw new IllegalArgumentException("Can't map token=" + token + " to display="
                    + getName() + " already mapped to display=" + dc + " tokens=" + dc.mTokenMap);
        }
        if (binder == null) {
            throw new IllegalArgumentException("Can't map token=" + token + " to display="
                    + getName() + " binder is null");
        }
        if (token == null) {
            throw new IllegalArgumentException("Can't map null token to display="
                    + getName() + " binder=" + binder);
        }

        mTokenMap.put(binder, token);

        if (token.asAppWindowToken() == null) {
+3 −2
Original line number Diff line number Diff line
@@ -1239,7 +1239,8 @@ public class WindowManagerService extends IWindowManager.Stub
                        return WindowManagerGlobal.ADD_BAD_APP_TOKEN;
                    }
                }
                token = new WindowToken(this, attrs.token, type, false, displayContent,
                final IBinder binder = attrs.token != null ? attrs.token : client.asBinder();
                token = new WindowToken(this, binder, type, false, displayContent,
                        session.mCanAddInternalSystemWindow);
            } else if (rootType >= FIRST_APPLICATION_WINDOW && rootType <= LAST_APPLICATION_WINDOW) {
                atoken = token.asAppWindowToken();
@@ -1310,7 +1311,7 @@ public class WindowManagerService extends IWindowManager.Stub
                // It is not valid to use an app token with other system types; we will
                // 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, type, false, displayContent,
                token = new WindowToken(this, client.asBinder(), type, false, displayContent,
                        session.mCanAddInternalSystemWindow);
            }

+2 −3
Original line number Diff line number Diff line
@@ -66,8 +66,7 @@ public class WindowTestUtils {
    /** Creates a {@link Task} and adds it to the specified {@link TaskStack}. */
    public static Task createTaskInStack(WindowManagerService service, TaskStack stack,
            int userId) {
        final Task newTask = new Task(WindowTestUtils.sNextTaskId++, stack, userId, service, null,
                EMPTY, 0, false,
        final Task newTask = new Task(sNextTaskId++, stack, userId, service, null, EMPTY, 0, false,
                false, new ActivityManager.TaskDescription(), null);
        stack.addTask(newTask, POSITION_TOP);
        return newTask;
@@ -92,7 +91,7 @@ public class WindowTestUtils {
    public static class TestAppWindowToken extends AppWindowToken {

        TestAppWindowToken(DisplayContent dc) {
            super(dc.mService, null, false, dc, true /* fillsParent */,
            super(dc.mService, new IApplicationToken.Stub() {}, false, dc, true /* fillsParent */,
                    null /* overrideConfig */, null /* bounds */);
        }