Fix minimized dock stack for translucent activity over home task
Previously, we only looked at whether home task is going away or getting visible. This doesn't work anymore, as we also need to un-minimize docked stack if another task is visible with translucency over the home task. Change-Id: I993f58a25d99d2ef9f562f7d1587c2dec0d05142 Fixes: 28434466 Fixes: 27906038
This commit is contained in:
committed by
Andrii Kulian
parent
a092aa436e
commit
d3ec507160
@@ -372,7 +372,7 @@ public class AppTransition implements Dump {
|
||||
topOpeningAppAnimator != null ? topOpeningAppAnimator.animation : null,
|
||||
topClosingAppAnimator != null ? topClosingAppAnimator.animation : null);
|
||||
mService.getDefaultDisplayContentLocked().getDockedDividerController()
|
||||
.notifyAppTransitionStarting(openingApps, closingApps);
|
||||
.notifyAppTransitionStarting();
|
||||
|
||||
// Prolong the start for the transition when docking a task from recents, unless recents
|
||||
// ended it already then we don't need to wait.
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
|
||||
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
|
||||
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
|
||||
import static android.view.WindowManager.DOCKED_BOTTOM;
|
||||
import static android.view.WindowManager.DOCKED_LEFT;
|
||||
@@ -24,7 +25,6 @@ import static android.view.WindowManager.DOCKED_RIGHT;
|
||||
import static android.view.WindowManager.DOCKED_TOP;
|
||||
import static com.android.server.wm.AppTransition.DEFAULT_APP_TRANSITION_DURATION;
|
||||
import static com.android.server.wm.AppTransition.TOUCH_RESPONSE_INTERPOLATOR;
|
||||
import static com.android.server.wm.DragResizeMode.DRAG_RESIZE_MODE_DOCKED_DIVIDER;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
||||
import static com.android.server.wm.WindowManagerService.H.NOTIFY_DOCKED_STACK_MINIMIZED_CHANGED;
|
||||
@@ -33,7 +33,6 @@ import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.RemoteCallbackList;
|
||||
import android.os.RemoteException;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Slog;
|
||||
import android.view.DisplayInfo;
|
||||
import android.view.IDockedStackListener;
|
||||
@@ -369,44 +368,31 @@ public class DockedStackDividerController implements DimLayerUser {
|
||||
* Notifies the docked stack divider controller of a visibility change that happens without
|
||||
* an animation.
|
||||
*/
|
||||
void notifyAppVisibilityChanged(AppWindowToken wtoken, boolean visible) {
|
||||
final Task task = wtoken.mTask;
|
||||
if (!task.isHomeTask() || !task.isVisibleForUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the app that having visibility change is not the top visible one in the task,
|
||||
// it does not affect whether the docked stack is minimized, ignore it.
|
||||
if (task.getTopAppToken() == null || task.getTopAppToken() != wtoken) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the stack is completely offscreen, this might just be an intermediate state when
|
||||
// docking a task/launching recents at the same time, but home doesn't actually get
|
||||
// visible after the state settles in.
|
||||
if (isWithinDisplay(task)
|
||||
&& mDisplayContent.getDockedStackVisibleForUserLocked() != null) {
|
||||
setMinimizedDockedStack(visible, false /* animate */);
|
||||
}
|
||||
void notifyAppVisibilityChanged() {
|
||||
checkMinimizeChanged(false /* animate */);
|
||||
}
|
||||
|
||||
void notifyAppTransitionStarting(ArraySet<AppWindowToken> openingApps,
|
||||
ArraySet<AppWindowToken> closingApps) {
|
||||
if (containsHomeTaskWithinDisplay(openingApps)) {
|
||||
setMinimizedDockedStack(true /* minimized */, true /* animate */);
|
||||
} else if (containsHomeTaskWithinDisplay(closingApps)) {
|
||||
setMinimizedDockedStack(false /* minimized */, true /* animate */);
|
||||
}
|
||||
void notifyAppTransitionStarting() {
|
||||
checkMinimizeChanged(true /* animate */);
|
||||
}
|
||||
|
||||
private boolean containsHomeTaskWithinDisplay(ArraySet<AppWindowToken> apps) {
|
||||
for (int i = apps.size() - 1; i >= 0; i--) {
|
||||
final Task task = apps.valueAt(i).mTask;
|
||||
if (task != null && task.isHomeTask()) {
|
||||
return isWithinDisplay(task);
|
||||
}
|
||||
private void checkMinimizeChanged(boolean animate) {
|
||||
final TaskStack homeStack = mDisplayContent.getHomeStack();
|
||||
if (homeStack == null) {
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
final Task homeTask = homeStack.findHomeTask();
|
||||
if (homeTask == null || !isWithinDisplay(homeTask)) {
|
||||
return;
|
||||
}
|
||||
final TaskStack fullscreenStack
|
||||
= mService.mStackIdToStack.get(FULLSCREEN_WORKSPACE_STACK_ID);
|
||||
final ArrayList<Task> homeStackTasks = homeStack.getTasks();
|
||||
final Task topHomeStackTask = homeStackTasks.get(homeStackTasks.size() - 1);
|
||||
final boolean homeVisible = homeTask.getTopVisibleAppToken() != null;
|
||||
final boolean homeBehind = (fullscreenStack != null && fullscreenStack.isVisibleLocked())
|
||||
|| (homeStackTasks.size() > 1 && topHomeStackTask != homeTask);
|
||||
setMinimizedDockedStack(homeVisible && !homeBehind, animate);
|
||||
}
|
||||
|
||||
private boolean isWithinDisplay(Task task) {
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.server.wm;
|
||||
|
||||
import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
|
||||
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
|
||||
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
|
||||
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
|
||||
import static android.content.res.Configuration.DENSITY_DPI_UNDEFINED;
|
||||
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
||||
@@ -155,6 +156,19 @@ public class TaskStack implements DimLayer.DimLayerUser,
|
||||
return mTasks;
|
||||
}
|
||||
|
||||
Task findHomeTask() {
|
||||
if (mStackId != HOME_STACK_ID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = mTasks.size() - 1; i >= 0; i--) {
|
||||
if (mTasks.get(i).isHomeTask()) {
|
||||
return mTasks.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the bounds of the stack and its containing tasks.
|
||||
* @param stackBounds New stack bounds. Passing in null sets the bounds to fullscreen.
|
||||
|
||||
@@ -4348,7 +4348,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// doesn't mean that it goes through the normal app transition cycle so we have
|
||||
// to inform the docked controller about visibility change.
|
||||
getDefaultDisplayContentLocked().getDockedDividerController()
|
||||
.notifyAppVisibilityChanged(wtoken, visible);
|
||||
.notifyAppVisibilityChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user