Fix bug that apps are not unminimizing if recent tasks are empty

am: 936aaeb878

Change-Id: I30d83528945b04fbb39ebf1ec4b98841a551930a
This commit is contained in:
Jorim Jaggi
2016-08-31 00:17:49 +00:00
committed by android-build-merger
4 changed files with 29 additions and 7 deletions

View File

@@ -1591,11 +1591,6 @@ final class ActivityStack {
return STACK_INVISIBLE;
}
final boolean isLockscreenShown = mService.mLockScreenShown == LOCK_SCREEN_SHOWN;
if (isLockscreenShown && !StackId.isAllowedOverLockscreen(mStackId)) {
return STACK_INVISIBLE;
}
final ActivityStack focusedStack = mStackSupervisor.getFocusedStack();
final int focusedStackId = focusedStack.mStackId;

View File

@@ -604,6 +604,9 @@ class ActivityStarter {
// If we launched the activity from a no display activity that was launched from the home
// screen, we also need to start recents to un-minimize the docked stack, since the
// noDisplay activity will be finished shortly after.
// Note that some apps have trampoline activities without noDisplay being set. In that case,
// we have another heuristic in DockedStackDividerController.notifyAppTransitionStarting
// that tries to detect that case.
// TODO: We should prevent noDisplay activities from affecting task/stack ordering and
// visibility instead of using this flag.
final boolean noDisplayActivityOverHome = sourceRecord != null

View File

@@ -382,7 +382,7 @@ public class AppTransition implements Dump {
topOpeningAppAnimator != null ? topOpeningAppAnimator.animation : null,
topClosingAppAnimator != null ? topClosingAppAnimator.animation : null);
mService.getDefaultDisplayContentLocked().getDockedDividerController()
.notifyAppTransitionStarting();
.notifyAppTransitionStarting(openingApps);
// Prolong the start for the transition when docking a task from recents, unless recents
// ended it already then we don't need to wait.

View File

@@ -38,6 +38,7 @@ import android.content.res.Configuration;
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;
@@ -492,8 +493,31 @@ public class DockedStackDividerController implements DimLayerUser {
checkMinimizeChanged(false /* animate */);
}
void notifyAppTransitionStarting() {
void notifyAppTransitionStarting(ArraySet<AppWindowToken> openingApps) {
final boolean wasMinimized = mMinimizedDock;
checkMinimizeChanged(true /* animate */);
// We were minimized, and now we are still minimized, but somebody is trying to launch an
// app in docked stack, better show recent apps so we actually get unminimized! This catches
// any case that was missed in ActivityStarter.postStartActivityUncheckedProcessing because
// we couldn't retrace the launch of the app in the docked stack to the launch from
// homescreen.
if (wasMinimized && mMinimizedDock && containsAppInDockedStack(openingApps)) {
mService.showRecentApps(true /* fromHome */);
}
}
/**
* @return true if {@param apps} contains an activity in the docked stack, false otherwise.
*/
private boolean containsAppInDockedStack(ArraySet<AppWindowToken> apps) {
for (int i = apps.size() - 1; i >= 0; i--) {
final AppWindowToken token = apps.valueAt(i);
if (token.mTask != null && token.mTask.mStack.mStackId == DOCKED_STACK_ID) {
return true;
}
}
return false;
}
boolean isMinimizedDock() {