Fix threading issue with splash screens

If we use a different thread to remove the view than we added it,
it leads to suffering. WindowManagerGlobal.removeView ends up
setting mParent of the DecorView to null, without any locking,
which can lead to crashes.

Test: Device boots, starting windows work. Otherwise: Pray
Change-Id: Ifc1e0d0236746aef4ed2b63e08af7de695ce69aa
Fixes: 63664477
This commit is contained in:
Jorim Jaggi
2017-07-18 14:33:21 +02:00
parent 331a287656
commit a338219a26

View File

@@ -685,7 +685,10 @@ public class AppWindowContainerController
if (DEBUG_STARTING_WINDOW) Slog.v(TAG_WM, "Schedule remove starting " + mContainer
+ " startingWindow=" + mContainer.startingWindow);
mHandler.post(mRemoveStartingWindow);
// Use the same thread to remove the window as we used to add it, as otherwise we end up
// with things in the view hierarchy being called from different threads.
mService.mAnimationHandler.post(mRemoveStartingWindow);
}
}