Skip to content
Commit 9a0be727 authored by Kazuki Takise's avatar Kazuki Takise
Browse files

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
parent 5e92684e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment