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

Commit 03c403d2 authored by Andrii Kulian's avatar Andrii Kulian
Browse files

Fix minor issues discovered with Multi-Display tests

- NPE when launching activity on secondary display
and there is a docked stack on primary.
- Activities not finished correctly on secondary display
when it is removed.

Change-Id: If527211e8192088790d32b9673b960535e27033f
Test: See ActivityManagerDisplayTests.
parent 53ad29fe
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -3564,7 +3564,10 @@ public class ActivityStackSupervisor extends ConfigurationContainer
            if (activityDisplay != null) {
                ArrayList<ActivityStack> stacks = activityDisplay.mStacks;
                for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
                    stacks.get(stackNdx).mActivityContainer.removeLocked();
                    final ActivityStack stack = stacks.get(stackNdx);
                    // TODO: Implement proper stack removal and ability to choose the behavior -
                    // remove stack completely or move it to other display.
                    moveStackToDisplayLocked(stack.mStackId, DEFAULT_DISPLAY);
                }
                mActivityDisplays.remove(displayId);
            }
@@ -4215,7 +4218,10 @@ public class ActivityStackSupervisor extends ConfigurationContainer
            }
        }

        /** Remove the stack completely. */
        /**
         * Remove the stack completely. Must be called only when there are no tasks left in it,
         * as this method does not finish running activities.
         */
        void removeLocked() {
            if (DEBUG_STACK) Slog.d(TAG_STACK, "removeLocked: " + this + " from display="
                    + mActivityDisplay + " Callers=" + Debug.getCallers(2));
+1 −5
Original line number Diff line number Diff line
@@ -257,11 +257,7 @@ class ActivityStarter {

        if (err == ActivityManager.START_SUCCESS) {
            Slog.i(TAG, "START u" + userId + " {" + intent.toShortString(true, true, true, false)
                    + "} from uid " + callingUid
                    + " on display " + (container == null ? (mSupervisor.mFocusedStack == null ?
                    Display.DEFAULT_DISPLAY : mSupervisor.mFocusedStack.mDisplayId) :
                    (container.mActivityDisplay == null ? Display.DEFAULT_DISPLAY :
                            container.mActivityDisplay.mDisplayId)));
                    + "} from uid " + callingUid);
        }

        ActivityRecord sourceRecord = null;
+2 −1
Original line number Diff line number Diff line
@@ -727,7 +727,8 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            win.getTouchableRegion(mTmpRegion);
            mTouchExcludeRegion.op(mTmpRegion, Region.Op.UNION);
        }
        if (getDockedStackLocked() != null) {
        // TODO(multi-display): Support docked stacks on secondary displays.
        if (mDisplayId == DEFAULT_DISPLAY && getDockedStackLocked() != null) {
            mDividerControllerLocked.getTouchRegion(mTmpRect);
            mTmpRegion.set(mTmpRect);
            mTouchExcludeRegion.op(mTmpRegion, Op.UNION);