OSDN Git Service

Fix starting window leak when adding/removing quickly
authorJorim Jaggi <jjaggi@google.com>
Tue, 23 May 2017 16:00:48 +0000 (18:00 +0200)
committerJorim Jaggi <jjaggi@google.com>
Tue, 23 May 2017 16:16:32 +0000 (18:16 +0200)
commitcfeff74317f19d5b90335c3e458ef055bdbd17cd
tree44c61f57e5886dd210ed95d4a6427edfbda8637b
parent23cc9aa50a1afb4ab4834b04c5c051b5b55747a0
Fix starting window leak when adding/removing quickly

The following race condition may happen when transferring starting
windows:
- Add thread (android.anim) calls Snapshot.create
- Remove thread (android.display!) checks that yes there is a
starting window, but no surface yet. Thus, it nulls out everything.
- Add thread returns from Snapshot.create: container.startingData
is null but startingWindow is also null. Thus, we never set
abort=true and we never set the starting window properly or remove
it properly.

Test: Some basic starting window sanity testing. Otherwise, pray
to the race condition gods.
Test: AppWindowContainerControllerTests#testAddRemoveRace
Fixes: 37888853

Change-Id: Ia287bfa52f708b36ff93ef7cd45a0d080bd4dd9c
services/core/java/com/android/server/wm/AppWindowContainerController.java
services/tests/servicestests/src/com/android/server/wm/AppWindowContainerControllerTests.java