Merge "Fixes re-setting activity type when embed activity in split-screen" into sc-v2-dev am: 35eaf77b5d am: e1f231760f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16408201 Change-Id: Ib72c8deca58c589d12ca05cc6bb3883207bbf6c1
This commit is contained in:
@@ -1440,11 +1440,11 @@ class Task extends TaskFragment {
|
||||
}
|
||||
|
||||
/** Called when an {@link ActivityRecord} is added as a descendant */
|
||||
void onDescendantActivityAdded(boolean hadChild, int activityType, ActivityRecord r) {
|
||||
void onDescendantActivityAdded(boolean hadActivity, int activityType, ActivityRecord r) {
|
||||
warnForNonLeafTask("onDescendantActivityAdded");
|
||||
|
||||
// Only set this based on the first activity
|
||||
if (!hadChild) {
|
||||
if (!hadActivity) {
|
||||
if (r.getActivityType() == ACTIVITY_TYPE_UNDEFINED) {
|
||||
// Normally non-standard activity type for the activity record will be set when the
|
||||
// object is created, however we delay setting the standard application type until
|
||||
|
||||
@@ -101,6 +101,7 @@ import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -1666,8 +1667,8 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
||||
boolean isAddingActivity = child.asActivityRecord() != null;
|
||||
final Task task = isAddingActivity ? getTask() : null;
|
||||
|
||||
// If this task had any child before we added this one.
|
||||
boolean taskHadChild = task != null && task.hasChild();
|
||||
// If this task had any activity before we added this one.
|
||||
boolean taskHadActivity = task != null && task.getActivity(Objects::nonNull) != null;
|
||||
// getActivityType() looks at the top child, so we need to read the type before adding
|
||||
// a new child in case the new child is on top and UNDEFINED.
|
||||
final int activityType = task != null ? task.getActivityType() : ACTIVITY_TYPE_UNDEFINED;
|
||||
@@ -1676,7 +1677,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
||||
|
||||
if (isAddingActivity && task != null) {
|
||||
child.asActivityRecord().inHistory = true;
|
||||
task.onDescendantActivityAdded(taskHadChild, activityType, child.asActivityRecord());
|
||||
task.onDescendantActivityAdded(taskHadActivity, activityType, child.asActivityRecord());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user