Merge "Update configuration of all visible activities in a stack when resizing" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fc932b9d69
@@ -4383,14 +4383,49 @@ final class ActivityStack {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make sure the given activity matches the current configuration. Returns
|
* Ensures all visible activities at or below the input activity have the right configuration.
|
||||||
* false if the activity had to be destroyed. Returns true if the
|
*/
|
||||||
* configuration is the same, or the activity will remain running as-is
|
void ensureVisibleActivitiesConfigurationLocked(ActivityRecord start, boolean preserveWindow) {
|
||||||
* for whatever reason. Ensures the HistoryRecord is updated with the
|
if (start == null || !start.visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final TaskRecord startTask = start.task;
|
||||||
|
boolean behindFullscreen = false;
|
||||||
|
boolean updatedConfig = false;
|
||||||
|
|
||||||
|
for (int taskIndex = mTaskHistory.indexOf(startTask); taskIndex >= 0; --taskIndex) {
|
||||||
|
final TaskRecord task = mTaskHistory.get(taskIndex);
|
||||||
|
final ArrayList<ActivityRecord> activities = task.mActivities;
|
||||||
|
int activityIndex =
|
||||||
|
(start.task == task) ? activities.indexOf(start) : activities.size() - 1;
|
||||||
|
for (; activityIndex >= 0; --activityIndex) {
|
||||||
|
final ActivityRecord r = activities.get(activityIndex);
|
||||||
|
updatedConfig |= ensureActivityConfigurationLocked(r, 0, preserveWindow);
|
||||||
|
if (r.fullscreen) {
|
||||||
|
behindFullscreen = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (behindFullscreen) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (updatedConfig) {
|
||||||
|
// Ensure the resumed state of the focus activity if we updated the confiugaration of
|
||||||
|
// any activity.
|
||||||
|
mStackSupervisor.resumeFocusedStackTopActivityLocked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make sure the given activity matches the current configuration. Returns false if the activity
|
||||||
|
* had to be destroyed. Returns true if the configuration is the same, or the activity will
|
||||||
|
* remain running as-is for whatever reason. Ensures the HistoryRecord is updated with the
|
||||||
* correct configuration and all other bookkeeping is handled.
|
* correct configuration and all other bookkeeping is handled.
|
||||||
*/
|
*/
|
||||||
final boolean ensureActivityConfigurationLocked(ActivityRecord r, int globalChanges,
|
boolean ensureActivityConfigurationLocked(
|
||||||
boolean preserveWindow) {
|
ActivityRecord r, int globalChanges, boolean preserveWindow) {
|
||||||
if (mConfigWillChange) {
|
if (mConfigWillChange) {
|
||||||
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
|
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
|
||||||
"Skipping config check (will change): " + r);
|
"Skipping config check (will change): " + r);
|
||||||
|
|||||||
@@ -2014,8 +2014,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
try {
|
try {
|
||||||
resizeStackUncheckedLocked(stack, bounds, tempTaskBounds, tempTaskInsetBounds);
|
resizeStackUncheckedLocked(stack, bounds, tempTaskBounds, tempTaskInsetBounds);
|
||||||
if (!deferResume) {
|
if (!deferResume) {
|
||||||
ensureConfigurationAndResume(
|
stack.ensureVisibleActivitiesConfigurationLocked(
|
||||||
stack, stack.topRunningActivityLocked(), preserveWindows);
|
stack.topRunningActivityLocked(), preserveWindows);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
mWindowManager.continueSurfaceLayout();
|
mWindowManager.continueSurfaceLayout();
|
||||||
@@ -2091,18 +2091,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
stack.setBounds(bounds);
|
stack.setBounds(bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ensureConfigurationAndResume(ActivityStack stack, ActivityRecord r,
|
|
||||||
boolean preserveWindows) {
|
|
||||||
if (r == null || !r.visible) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final boolean updated = stack.ensureActivityConfigurationLocked(r, 0,
|
|
||||||
preserveWindows);
|
|
||||||
if (!updated) {
|
|
||||||
resumeFocusedStackTopActivityLocked();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void moveTasksToFullscreenStackLocked(int fromStackId, boolean onTop) {
|
void moveTasksToFullscreenStackLocked(int fromStackId, boolean onTop) {
|
||||||
final ActivityStack stack = getStack(fromStackId);
|
final ActivityStack stack = getStack(fromStackId);
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
@@ -2204,7 +2192,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ensureConfigurationAndResume(stack, r, preserveWindows);
|
stack.ensureVisibleActivitiesConfigurationLocked(r, preserveWindows);
|
||||||
} finally {
|
} finally {
|
||||||
mAllowDockedStackResize = true;
|
mAllowDockedStackResize = true;
|
||||||
mWindowManager.continueSurfaceLayout();
|
mWindowManager.continueSurfaceLayout();
|
||||||
@@ -2230,7 +2218,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
|
|||||||
ActivityRecord r = stack.topRunningActivityLocked();
|
ActivityRecord r = stack.topRunningActivityLocked();
|
||||||
resizeStackUncheckedLocked(stack, pinnedBounds, tempPinnedTaskBounds,
|
resizeStackUncheckedLocked(stack, pinnedBounds, tempPinnedTaskBounds,
|
||||||
null);
|
null);
|
||||||
ensureConfigurationAndResume(stack, r, false);
|
stack.ensureVisibleActivitiesConfigurationLocked(r, false);
|
||||||
} finally {
|
} finally {
|
||||||
mWindowManager.continueSurfaceLayout();
|
mWindowManager.continueSurfaceLayout();
|
||||||
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
|
Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
|
||||||
|
|||||||
Reference in New Issue
Block a user