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.
This commit is contained in:
Andrii Kulian
2016-11-11 11:14:12 -08:00
parent 53ad29fe53
commit 03c403d273
3 changed files with 11 additions and 8 deletions

View File

@@ -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));

View File

@@ -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;

View File

@@ -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);