Fix non-top activity being boosted while finishing.
The endTask condition should check whether there is no un-finishing activity in the task. Fixes: 176942303 Test: atest ActivityRecordTests Change-Id: Id8e28599ba47af0b17a2f6b834b62acfb8d4e99a
This commit is contained in:
@@ -2606,7 +2606,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
|
||||
finishActivityResults(resultCode, resultData, resultGrants);
|
||||
|
||||
final boolean endTask = task.getActivityBelow(this) == null
|
||||
final boolean endTask = task.getTopNonFinishingActivity() == null
|
||||
&& !task.isClearingToReuseTask();
|
||||
final int transit = endTask ? TRANSIT_OLD_TASK_CLOSE : TRANSIT_OLD_ACTIVITY_CLOSE;
|
||||
if (isState(RESUMED)) {
|
||||
|
||||
@@ -1062,6 +1062,21 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
assertEquals(STOPPED, nextTop.getState());
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that finish bottom activity from a task won't boost it to top.
|
||||
*/
|
||||
@Test
|
||||
public void testFinishBottomActivityIfPossible_noZBoost() {
|
||||
final ActivityRecord bottomActivity = createActivityWithTask();
|
||||
final ActivityRecord topActivity = new ActivityBuilder(mAtm)
|
||||
.setTask(bottomActivity.getTask()).build();
|
||||
topActivity.mVisibleRequested = true;
|
||||
// simulating bottomActivity as a trampoline activity.
|
||||
bottomActivity.setState(RESUMED, "test");
|
||||
bottomActivity.finishIfPossible("test", false);
|
||||
assertFalse(bottomActivity.mNeedsZBoost);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that complete finish request for visible activity must be delayed before the next one
|
||||
* becomes visible.
|
||||
|
||||
Reference in New Issue
Block a user