Merge "Merge "Not removing primary TaskFragment when clear task" into sc-v2-dev am: c08fc30d0e" into sc-v2-dev-plus-aosp
This commit is contained in:
committed by
Android (Google) Code Review
commit
91985df99e
@@ -3234,6 +3234,7 @@ package android.window {
|
|||||||
method public int getWindowingMode();
|
method public int getWindowingMode();
|
||||||
method public boolean hasRunningActivity();
|
method public boolean hasRunningActivity();
|
||||||
method public boolean isEmpty();
|
method public boolean isEmpty();
|
||||||
|
method public boolean isTaskClearedForReuse();
|
||||||
method public boolean isVisible();
|
method public boolean isVisible();
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.window.TaskFragmentInfo> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.window.TaskFragmentInfo> CREATOR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,11 +71,18 @@ public final class TaskFragmentInfo implements Parcelable {
|
|||||||
/** Relative position of the fragment's top left corner in the parent container. */
|
/** Relative position of the fragment's top left corner in the parent container. */
|
||||||
private final Point mPositionInParent;
|
private final Point mPositionInParent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the last running activity in the TaskFragment was finished due to clearing task while
|
||||||
|
* launching an activity in the host Task.
|
||||||
|
*/
|
||||||
|
private final boolean mIsTaskClearedForReuse;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public TaskFragmentInfo(
|
public TaskFragmentInfo(
|
||||||
@NonNull IBinder fragmentToken, @NonNull WindowContainerToken token,
|
@NonNull IBinder fragmentToken, @NonNull WindowContainerToken token,
|
||||||
@NonNull Configuration configuration, boolean isEmpty, int runningActivityCount,
|
@NonNull Configuration configuration, boolean isEmpty, int runningActivityCount,
|
||||||
boolean isVisible, @NonNull List<IBinder> activities, @NonNull Point positionInParent) {
|
boolean isVisible, @NonNull List<IBinder> activities, @NonNull Point positionInParent,
|
||||||
|
boolean isTaskClearedForReuse) {
|
||||||
mFragmentToken = requireNonNull(fragmentToken);
|
mFragmentToken = requireNonNull(fragmentToken);
|
||||||
mToken = requireNonNull(token);
|
mToken = requireNonNull(token);
|
||||||
mConfiguration.setTo(configuration);
|
mConfiguration.setTo(configuration);
|
||||||
@@ -84,6 +91,7 @@ public final class TaskFragmentInfo implements Parcelable {
|
|||||||
mIsVisible = isVisible;
|
mIsVisible = isVisible;
|
||||||
mActivities.addAll(activities);
|
mActivities.addAll(activities);
|
||||||
mPositionInParent = requireNonNull(positionInParent);
|
mPositionInParent = requireNonNull(positionInParent);
|
||||||
|
mIsTaskClearedForReuse = isTaskClearedForReuse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -128,6 +136,10 @@ public final class TaskFragmentInfo implements Parcelable {
|
|||||||
return mPositionInParent;
|
return mPositionInParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTaskClearedForReuse() {
|
||||||
|
return mIsTaskClearedForReuse;
|
||||||
|
}
|
||||||
|
|
||||||
@WindowingMode
|
@WindowingMode
|
||||||
public int getWindowingMode() {
|
public int getWindowingMode() {
|
||||||
return mConfiguration.windowConfiguration.getWindowingMode();
|
return mConfiguration.windowConfiguration.getWindowingMode();
|
||||||
@@ -149,7 +161,8 @@ public final class TaskFragmentInfo implements Parcelable {
|
|||||||
&& mIsVisible == that.mIsVisible
|
&& mIsVisible == that.mIsVisible
|
||||||
&& getWindowingMode() == that.getWindowingMode()
|
&& getWindowingMode() == that.getWindowingMode()
|
||||||
&& mActivities.equals(that.mActivities)
|
&& mActivities.equals(that.mActivities)
|
||||||
&& mPositionInParent.equals(that.mPositionInParent);
|
&& mPositionInParent.equals(that.mPositionInParent)
|
||||||
|
&& mIsTaskClearedForReuse == that.mIsTaskClearedForReuse;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TaskFragmentInfo(Parcel in) {
|
private TaskFragmentInfo(Parcel in) {
|
||||||
@@ -161,6 +174,7 @@ public final class TaskFragmentInfo implements Parcelable {
|
|||||||
mIsVisible = in.readBoolean();
|
mIsVisible = in.readBoolean();
|
||||||
in.readBinderList(mActivities);
|
in.readBinderList(mActivities);
|
||||||
mPositionInParent = requireNonNull(in.readTypedObject(Point.CREATOR));
|
mPositionInParent = requireNonNull(in.readTypedObject(Point.CREATOR));
|
||||||
|
mIsTaskClearedForReuse = in.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@@ -174,6 +188,7 @@ public final class TaskFragmentInfo implements Parcelable {
|
|||||||
dest.writeBoolean(mIsVisible);
|
dest.writeBoolean(mIsVisible);
|
||||||
dest.writeBinderList(mActivities);
|
dest.writeBinderList(mActivities);
|
||||||
dest.writeTypedObject(mPositionInParent, flags);
|
dest.writeTypedObject(mPositionInParent, flags);
|
||||||
|
dest.writeBoolean(mIsTaskClearedForReuse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@@ -199,6 +214,7 @@ public final class TaskFragmentInfo implements Parcelable {
|
|||||||
+ " runningActivityCount=" + mRunningActivityCount
|
+ " runningActivityCount=" + mRunningActivityCount
|
||||||
+ " isVisible=" + mIsVisible
|
+ " isVisible=" + mIsVisible
|
||||||
+ " positionInParent=" + mPositionInParent
|
+ " positionInParent=" + mPositionInParent
|
||||||
|
+ " isTaskClearedForReuse=" + mIsTaskClearedForReuse
|
||||||
+ "}";
|
+ "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,11 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
|||||||
// Check if there are no running activities - consider the container empty if there are no
|
// Check if there are no running activities - consider the container empty if there are no
|
||||||
// non-finishing activities left.
|
// non-finishing activities left.
|
||||||
if (!taskFragmentInfo.hasRunningActivity()) {
|
if (!taskFragmentInfo.hasRunningActivity()) {
|
||||||
mPresenter.cleanupContainer(container, true /* shouldFinishDependent */);
|
// Do not finish the dependents if this TaskFragment was cleared due to launching
|
||||||
|
// activity in the Task.
|
||||||
|
final boolean shouldFinishDependent =
|
||||||
|
!taskFragmentInfo.isTaskClearedForReuse();
|
||||||
|
mPresenter.cleanupContainer(container, shouldFinishDependent);
|
||||||
updateCallbackIfNecessary();
|
updateCallbackIfNecessary();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3505,6 +3505,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
|||||||
finishing = true;
|
finishing = true;
|
||||||
final TaskFragment taskFragment = getTaskFragment();
|
final TaskFragment taskFragment = getTaskFragment();
|
||||||
if (taskFragment != null) {
|
if (taskFragment != null) {
|
||||||
|
final Task task = taskFragment.getTask();
|
||||||
|
if (task != null && task.isClearingToReuseTask()
|
||||||
|
&& taskFragment.getTopNonFinishingActivity() == null) {
|
||||||
|
taskFragment.mClearedTaskForReuse = true;
|
||||||
|
}
|
||||||
taskFragment.sendTaskFragmentInfoChanged();
|
taskFragment.sendTaskFragmentInfoChanged();
|
||||||
}
|
}
|
||||||
if (stopped) {
|
if (stopped) {
|
||||||
|
|||||||
@@ -173,6 +173,12 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
|||||||
*/
|
*/
|
||||||
boolean mTaskFragmentAppearedSent;
|
boolean mTaskFragmentAppearedSent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The last running activity of the TaskFragment was finished due to clear task while launching
|
||||||
|
* an activity in the Task.
|
||||||
|
*/
|
||||||
|
boolean mClearedTaskForReuse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When we are in the process of pausing an activity, before starting the
|
* When we are in the process of pausing an activity, before starting the
|
||||||
* next one, this variable holds the activity that is currently being paused.
|
* next one, this variable holds the activity that is currently being paused.
|
||||||
@@ -1587,6 +1593,8 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void addChild(WindowContainer child, int index) {
|
void addChild(WindowContainer child, int index) {
|
||||||
|
mClearedTaskForReuse = false;
|
||||||
|
|
||||||
boolean isAddingActivity = child.asActivityRecord() != null;
|
boolean isAddingActivity = child.asActivityRecord() != null;
|
||||||
final Task task = isAddingActivity ? getTask() : null;
|
final Task task = isAddingActivity ? getTask() : null;
|
||||||
|
|
||||||
@@ -2093,7 +2101,8 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
|||||||
runningActivityCount[0],
|
runningActivityCount[0],
|
||||||
isVisible(),
|
isVisible(),
|
||||||
childActivities,
|
childActivities,
|
||||||
positionInParent);
|
positionInParent,
|
||||||
|
mClearedTaskForReuse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|||||||
Reference in New Issue
Block a user