Resolve race condition in TaskStackChangedListenerTest
This CL makes sure that the start-up process of an activity has completed and ActivityStack#mResumedActivity is set as the activity before removing the activity in TaskStackChangedListenerTest. Otherwise, onTaskRemovalStarted, which is a callback expected to be called in TaskStackChangedListenerTest is not called because of the following logic in ActivityStack#finishActivityLocked(). if (mResumedActivity == r) { mService.getTaskChangeNotificationController().notifyTaskRemovalStarted(task.taskId); } Currently, whether mResumeActivity is set before removing the activity is not guaranteed, which causes flakiness in some environments such as ARC. (it's 50/50 whether it's set properly or not. ) This CL guarantees this and make the tests pass all the time. Bug: 110908055 Test: atest TaskStackChangedListenerTest Change-Id: Ieb9f2ffe40de4e79ef2bf43c4036625ce0b63304
Loading
Please register or sign in to comment