Merge "Resize pinned stack with bounds in ActivityOptions."
This commit is contained in:
committed by
Android (Google) Code Review
commit
08b55823eb
@@ -600,6 +600,14 @@ public class ActivityManager {
|
||||
public static boolean allowTopTaskToReturnHome(int stackId) {
|
||||
return stackId != PINNED_STACK_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the stack should be resized to match the bounds specified by
|
||||
* {@link ActivityOptions#setLaunchBounds} when launching an activity into the stack.
|
||||
*/
|
||||
public static boolean resizeStackWithLaunchBounds(int stackId) {
|
||||
return stackId == PINNED_STACK_ID;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1719,11 +1719,17 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
||||
// moveTaskToStackUncheckedLocked() should already placed the task on top,
|
||||
// still need moveTaskToFrontLocked() below for any transition settings.
|
||||
}
|
||||
// WM resizeTask must be done after the task is moved to the correct stack,
|
||||
// because Task's setBounds() also updates dim layer's bounds, but that has
|
||||
// dependency on the stack.
|
||||
mWindowManager.resizeTask(task.taskId, bounds, task.mOverrideConfig,
|
||||
false /*relayout*/, false /*forced*/);
|
||||
if (StackId.resizeStackWithLaunchBounds(stackId)) {
|
||||
resizeStackLocked(stackId, bounds,
|
||||
null /* tempTaskBounds */, null /* tempTaskInsetBounds */,
|
||||
!PRESERVE_WINDOWS, true /* allowResizeInDockedMode */);
|
||||
} else {
|
||||
// WM resizeTask must be done after the task is moved to the correct stack,
|
||||
// because Task's setBounds() also updates dim layer's bounds, but that has
|
||||
// dependency on the stack.
|
||||
mWindowManager.resizeTask(task.taskId, bounds, task.mOverrideConfig,
|
||||
false /* relayout */, false /* forced */);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ import static com.android.server.am.ActivityStack.STACK_INVISIBLE;
|
||||
import static com.android.server.am.ActivityStackSupervisor.CREATE_IF_NEEDED;
|
||||
import static com.android.server.am.ActivityStackSupervisor.FORCE_FOCUS;
|
||||
import static com.android.server.am.ActivityStackSupervisor.ON_TOP;
|
||||
import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS;
|
||||
import static com.android.server.am.ActivityStackSupervisor.TAG_TASKS;
|
||||
import static com.android.server.am.EventLogTags.AM_NEW_INTENT;
|
||||
|
||||
@@ -1429,7 +1430,14 @@ class ActivityStarter {
|
||||
mVoiceSession, mVoiceInteractor, !mLaunchTaskBehind /* toTop */);
|
||||
mStartActivity.setTask(task, taskToAffiliate);
|
||||
if (mLaunchBounds != null) {
|
||||
mStartActivity.task.updateOverrideConfiguration(mLaunchBounds);
|
||||
final int stackId = mTargetStack.mStackId;
|
||||
if (StackId.resizeStackWithLaunchBounds(stackId)) {
|
||||
mSupervisor.resizeStackLocked(stackId, mLaunchBounds,
|
||||
null /* tempTaskBounds */, null /* tempTaskInsetBounds */,
|
||||
!PRESERVE_WINDOWS, true /* allowResizeInDockedMode */);
|
||||
} else {
|
||||
mStartActivity.task.updateOverrideConfiguration(mLaunchBounds);
|
||||
}
|
||||
}
|
||||
if (DEBUG_TASKS) Slog.v(TAG_TASKS,
|
||||
"Starting new activity " +
|
||||
@@ -1512,6 +1520,11 @@ class ActivityStarter {
|
||||
mSupervisor.moveTaskToStackUncheckedLocked(
|
||||
mInTask, stackId, ON_TOP, !FORCE_FOCUS, "inTaskToFront");
|
||||
}
|
||||
if (StackId.resizeStackWithLaunchBounds(stackId)) {
|
||||
mSupervisor.resizeStackLocked(stackId, mLaunchBounds,
|
||||
null /* tempTaskBounds */, null /* tempTaskInsetBounds */,
|
||||
!PRESERVE_WINDOWS, true /* allowResizeInDockedMode */);
|
||||
}
|
||||
}
|
||||
mTargetStack = mInTask.stack;
|
||||
mTargetStack.moveTaskToFrontLocked(
|
||||
|
||||
Reference in New Issue
Block a user