Merge "Fix unminimizing dock stack for AppTask.moveToFront" into nyc-dev

am: 6321f42fbe

* commit '6321f42fbee425745de9636d45e4973fa6c470b9':
  Fix unminimizing dock stack for AppTask.moveToFront

Change-Id: I8cb3702db22d24de2aa64360e8e22577f320d00d
This commit is contained in:
Jorim Jaggi
2016-06-02 22:19:12 +00:00
committed by android-build-merger
2 changed files with 20 additions and 7 deletions

View File

@@ -4404,6 +4404,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
"startActivityFromRecentsInner: Task " + taskId + " not found."); "startActivityFromRecentsInner: Task " + taskId + " not found.");
} }
// Since we don't have an actual source record here, we assume that the currently focused
// activity was the source.
final ActivityStack focusedStack = getFocusedStack();
final ActivityRecord sourceRecord =
focusedStack != null ? focusedStack.topActivity() : null;
if (launchStackId != INVALID_STACK_ID) { if (launchStackId != INVALID_STACK_ID) {
if (task.stack.mStackId != launchStackId) { if (task.stack.mStackId != launchStackId) {
moveTaskToStackLocked( moveTaskToStackLocked(
@@ -4427,6 +4433,11 @@ public final class ActivityStackSupervisor implements DisplayListener {
if (launchStackId == DOCKED_STACK_ID) { if (launchStackId == DOCKED_STACK_ID) {
setResizingDuringAnimation(taskId); setResizingDuringAnimation(taskId);
} }
mService.mActivityStarter.postStartActivityUncheckedProcessing(task.getTopActivity(),
ActivityManager.START_TASK_TO_FRONT,
sourceRecord != null ? sourceRecord.task.stack.mStackId : INVALID_STACK_ID,
sourceRecord, task.stack);
return ActivityManager.START_TASK_TO_FRONT; return ActivityManager.START_TASK_TO_FRONT;
} }
callingUid = task.mCallingUid; callingUid = task.mCallingUid;

View File

@@ -536,12 +536,13 @@ class ActivityStarter {
} finally { } finally {
mService.mWindowManager.continueSurfaceLayout(); mService.mWindowManager.continueSurfaceLayout();
} }
postStartActivityUncheckedProcessing(r, err, stack.mStackId); postStartActivityUncheckedProcessing(r, err, stack.mStackId, mSourceRecord, mTargetStack);
return err; return err;
} }
void postStartActivityUncheckedProcessing( void postStartActivityUncheckedProcessing(
ActivityRecord r, int result, int prevFocusedStackId) { ActivityRecord r, int result, int prevFocusedStackId, ActivityRecord sourceRecord,
ActivityStack targetStack) {
if (result < START_SUCCESS) { if (result < START_SUCCESS) {
// If someone asked to have the keyguard dismissed on the next activity start, // If someone asked to have the keyguard dismissed on the next activity start,
@@ -555,7 +556,7 @@ class ActivityStarter {
if (r.task != null && r.task.stack != null) { if (r.task != null && r.task.stack != null) {
startedActivityStackId = r.task.stack.mStackId; startedActivityStackId = r.task.stack.mStackId;
} else if (mTargetStack != null) { } else if (mTargetStack != null) {
startedActivityStackId = mTargetStack.mStackId; startedActivityStackId = targetStack.mStackId;
} }
// If we launched the activity from a no display activity that was launched from the home // If we launched the activity from a no display activity that was launched from the home
@@ -563,9 +564,9 @@ class ActivityStarter {
// noDisplay activity will be finished shortly after. // noDisplay activity will be finished shortly after.
// TODO: We should prevent noDisplay activities from affecting task/stack ordering and // TODO: We should prevent noDisplay activities from affecting task/stack ordering and
// visibility instead of using this flag. // visibility instead of using this flag.
final boolean noDisplayActivityOverHome = mSourceRecord != null final boolean noDisplayActivityOverHome = sourceRecord != null
&& mSourceRecord.noDisplay && sourceRecord.noDisplay
&& mSourceRecord.task.getTaskToReturnTo() == HOME_ACTIVITY_TYPE; && sourceRecord.task.getTaskToReturnTo() == HOME_ACTIVITY_TYPE;
if (startedActivityStackId == DOCKED_STACK_ID if (startedActivityStackId == DOCKED_STACK_ID
&& (prevFocusedStackId == HOME_STACK_ID || noDisplayActivityOverHome)) { && (prevFocusedStackId == HOME_STACK_ID || noDisplayActivityOverHome)) {
final ActivityStack homeStack = mSupervisor.getStack(HOME_STACK_ID); final ActivityStack homeStack = mSupervisor.getStack(HOME_STACK_ID);
@@ -1788,7 +1789,8 @@ class ActivityStarter {
final int result = startActivityUnchecked( final int result = startActivityUnchecked(
pal.r, pal.sourceRecord, null, null, pal.startFlags, resume, null, null); pal.r, pal.sourceRecord, null, null, pal.startFlags, resume, null, null);
postStartActivityUncheckedProcessing( postStartActivityUncheckedProcessing(
pal.r, result, mSupervisor.mFocusedStack.mStackId); pal.r, result, mSupervisor.mFocusedStack.mStackId, mSourceRecord,
mTargetStack);
} catch (Exception e) { } catch (Exception e) {
Slog.e(TAG, "Exception during pending activity launch pal=" + pal, e); Slog.e(TAG, "Exception during pending activity launch pal=" + pal, e);
pal.sendErrorResult(e.getMessage()); pal.sendErrorResult(e.getMessage());