From 6875d472092a4f40865f590e68a24be18727d4c3 Mon Sep 17 00:00:00 2001 From: Matthew Ng Date: Mon, 1 May 2017 13:59:50 -0700 Subject: [PATCH] Stack is visible if behind docked which is behind pinned stack (1/2) Handles the case if pip is shown with splitscreen when the stack order is pinned, docked, current stack, etc (top to bottom). Added a condition to check to make sure that this order of stacks allows the current stack to be visible. Also added a condition to not hide docked stack when pip appears (this only occurs with command line or cts tests); added TODO for refactor. Change-Id: I53bd55014c08c60f360b95ed7100ef49778f891b Fixes: 37294521 Test: run-test CtsServicesHostTestCases android.server.cts.ActivityManagerPinnedStackTests# testPinnedStackWithDockedStack --- .../com/android/server/am/ActivityStack.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 912b22c84946f..d348224df3772 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -1659,21 +1659,13 @@ class ActivityStack extends ConfigurationContai } if (mStackId == DOCKED_STACK_ID) { - final ActivityRecord r = topStack.topRunningActivityLocked(); - // If the assistant stack is focused and translucent, then the docked stack is always // visible if (topStack.isAssistantStack()) { return (topStack.isStackTranslucent(starting, DOCKED_STACK_ID)) ? STACK_VISIBLE : STACK_INVISIBLE; } - - // Otherwise, the docked stack is always visible, except in the case where the top - // running activity task in the focus stack doesn't support any form of resizing but we - // show it for the home task even though it's not resizable. - final TaskRecord task = r != null ? r.getTask() : null; - return task == null || task.supportsSplitScreen() || task.isHomeTask() ? STACK_VISIBLE - : STACK_INVISIBLE; + return STACK_VISIBLE; } // Set home stack to invisible when it is below but not immediately below the docked stack @@ -1692,14 +1684,17 @@ class ActivityStack extends ConfigurationContai mStacks.get(stackBehindTopIndex).topRunningActivityLocked() == null) { stackBehindTopIndex--; } - if ((topStackId == DOCKED_STACK_ID || topStackId == PINNED_STACK_ID) - && stackIndex == stackBehindTopIndex) { - // Stacks directly behind the docked or pinned stack are always visible. - return STACK_VISIBLE; - } - final int stackBehindTopId = (stackBehindTopIndex >= 0) ? mStacks.get(stackBehindTopIndex).mStackId : INVALID_STACK_ID; + if ((topStackId == DOCKED_STACK_ID || topStackId == PINNED_STACK_ID) + && (stackIndex == stackBehindTopIndex + || (stackBehindTopId == DOCKED_STACK_ID + && stackIndex == stackBehindTopIndex - 1))) { + // Stacks directly behind the docked or pinned stack are always visible. + // Also this stack is visible if behind docked stack and the docked stack is behind the + // top-most pinned stack + return STACK_VISIBLE; + } if (StackId.isBackdropToTranslucentActivity(topStackId) && topStack.isStackTranslucent(starting, stackBehindTopId)) {