Fix starting window isn't removed
In multi-window scenario, there's a case that the Activity that can't be starting window target is the last Activity to draw the first window, which blocks starting window removal. Also, when the Activity finally draws its first window, it can't remove the starting window because it doesn't conatain starting window information. This CL changes to only verify activities which can be the starting window target. That said, activities that can't be the starting window won't block starting window removal. Test: atest ActivityRecordTests Test: manual - reproducible steps in bug Bug: 228194878 Change-Id: Ibc004ca079f0b04609183cd3b6630d70662fdef5
This commit is contained in:
@@ -6340,8 +6340,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|
||||
mSharedStartingData != null ? mSharedStartingData.mAssociatedTask : null;
|
||||
if (associatedTask == null) {
|
||||
removeStartingWindow();
|
||||
} else if (associatedTask.getActivity(
|
||||
r -> r.mVisibleRequested && !r.firstWindowDrawn) == null) {
|
||||
} else if (associatedTask.getActivity(r -> r.mVisibleRequested && !r.firstWindowDrawn
|
||||
// Don't block starting window removal if an Activity can't be a starting window
|
||||
// target.
|
||||
&& r.mSharedStartingData != null) == null) {
|
||||
// The last drawn activity may not be the one that owns the starting window.
|
||||
final ActivityRecord r = associatedTask.topActivityContainsStartingWindow();
|
||||
if (r != null) {
|
||||
|
||||
@@ -2854,6 +2854,11 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
assertTrue(activity2.isResizeable());
|
||||
activity1.reparent(taskFragment1, POSITION_TOP);
|
||||
|
||||
// Adds an Activity which doesn't have shared starting data, and verify if it blocks
|
||||
// starting window removal.
|
||||
final ActivityRecord activity3 = new ActivityBuilder(mAtm).build();
|
||||
taskFragment2.addChild(activity3, POSITION_TOP);
|
||||
|
||||
verify(activity1.getSyncTransaction()).reparent(eq(startingWindow.mSurfaceControl),
|
||||
eq(task.mSurfaceControl));
|
||||
assertEquals(activity1.mStartingData, startingWindow.mStartingData);
|
||||
|
||||
Reference in New Issue
Block a user