Merge "Defer TaskFragment removal until appeared" into sc-v2-dev am: b2b7e5b1e5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15756816 Change-Id: I56a47f7f703799535c3a7df9c1c985074d99bac9
This commit is contained in:
@@ -117,6 +117,10 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
|||||||
}
|
}
|
||||||
|
|
||||||
container.setInfo(taskFragmentAppearedInfo.getTaskFragmentInfo());
|
container.setInfo(taskFragmentAppearedInfo.getTaskFragmentInfo());
|
||||||
|
if (container.isFinished()) {
|
||||||
|
mPresenter.cleanupContainer(container, false /* shouldFinishDependent */);
|
||||||
|
updateCallbackIfNecessary();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class TaskFragmentContainer {
|
|||||||
return mInfo;
|
return mInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInfo(@Nullable TaskFragmentInfo info) {
|
void setInfo(@NonNull TaskFragmentInfo info) {
|
||||||
mInfo = info;
|
mInfo = info;
|
||||||
if (mInfo == null || mPendingAppearedActivities.isEmpty()) {
|
if (mInfo == null || mPendingAppearedActivities.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -190,20 +190,30 @@ class TaskFragmentContainer {
|
|||||||
*/
|
*/
|
||||||
void finish(boolean shouldFinishDependent, @NonNull SplitPresenter presenter,
|
void finish(boolean shouldFinishDependent, @NonNull SplitPresenter presenter,
|
||||||
@NonNull WindowContainerTransaction wct, @NonNull SplitController controller) {
|
@NonNull WindowContainerTransaction wct, @NonNull SplitController controller) {
|
||||||
if (mIsFinished) {
|
if (!mIsFinished) {
|
||||||
return;
|
mIsFinished = true;
|
||||||
|
finishActivities(shouldFinishDependent, presenter, wct, controller);
|
||||||
}
|
}
|
||||||
mIsFinished = true;
|
|
||||||
|
|
||||||
// Finish own activities
|
if (mInfo == null) {
|
||||||
for (Activity activity : collectActivities()) {
|
// Defer removal the container and wait until TaskFragment appeared.
|
||||||
activity.finish();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup the visuals
|
// Cleanup the visuals
|
||||||
presenter.deleteTaskFragment(wct, getTaskFragmentToken());
|
presenter.deleteTaskFragment(wct, getTaskFragmentToken());
|
||||||
// Cleanup the records
|
// Cleanup the records
|
||||||
controller.removeContainer(this);
|
controller.removeContainer(this);
|
||||||
|
// Clean up task fragment information
|
||||||
|
mInfo = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finishActivities(boolean shouldFinishDependent, @NonNull SplitPresenter presenter,
|
||||||
|
@NonNull WindowContainerTransaction wct, @NonNull SplitController controller) {
|
||||||
|
// Finish own activities
|
||||||
|
for (Activity activity : collectActivities()) {
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
|
||||||
if (!shouldFinishDependent) {
|
if (!shouldFinishDependent) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user