Limit launching placeholder to top TaskFragment
Currently, we launch placeholder Activity if Activity is not split and matches placeholder rule. However, there's a scenario that the Activity which matches placeholder rule is occulded by a fullscreen Activity, but SplitController still launches placeholder on top of the fullscreen Activity. This CL verifies if the Activity located TaskFragmentContainer is on top to launch placeholder. It also makes #getTopActiveContainer consider Activity from other process by verifying #getRunningActivityCount. Test: manual - Repro steps in bugs Bug: 214175523 Change-Id: Id287d8c5235918b78ccd43bfddf9bb17ee0ff2e8
This commit is contained in:
@@ -404,7 +404,7 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
||||
TaskFragmentContainer getTopActiveContainer() {
|
||||
for (int i = mContainers.size() - 1; i >= 0; i--) {
|
||||
TaskFragmentContainer container = mContainers.get(i);
|
||||
if (!container.isFinished() && container.getTopNonFinishingActivity() != null) {
|
||||
if (!container.isFinished() && container.getRunningActivityCount() > 0) {
|
||||
return container;
|
||||
}
|
||||
}
|
||||
@@ -499,6 +499,10 @@ public class SplitController implements JetpackTaskFragmentOrganizer.TaskFragmen
|
||||
boolean launchPlaceholderIfNecessary(@NonNull Activity activity) {
|
||||
final TaskFragmentContainer container = getContainerWithActivity(
|
||||
activity.getActivityToken());
|
||||
// Don't launch placeholder if the container is occluded.
|
||||
if (container != getTopActiveContainer()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SplitContainer splitContainer = container != null ? getActiveSplitForContainer(container)
|
||||
: null;
|
||||
|
||||
Reference in New Issue
Block a user