SurfaceFlinger: Avoid overlapping calls to BOOT_FINISHED
Handling BOOT_FINISHED we write to mInputFlinger and mWindowManager.
This could trigger crashes if we write from multiple concurrent threads
or if we try and use it from the main thread while decing the strong
pointer. The easiest way to work around this seems to just to only
be willing to handle BOOT_FINISHED once, until the WM dies.
Bug: 150227563
Bug: 150225569
Test: Existing tests pass
Change-Id: I10f4b9359a5f3dc49e3360f28fbe808f0fc2afc8
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 224f093..29fe5d9 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -409,6 +409,7 @@
void SurfaceFlinger::binderDied(const wp<IBinder>& /* who */)
{
// the window manager died on us. prepare its eulogy.
+ mBootFinished = false;
// restore initial conditions (default device unblank, etc)
initializeDisplays();
@@ -525,6 +526,11 @@
void SurfaceFlinger::bootFinished()
{
+ if (mBootFinished == true) {
+ ALOGE("Extra call to bootFinished");
+ return;
+ }
+ mBootFinished = true;
if (mStartPropertySetThread->join() != NO_ERROR) {
ALOGE("Join StartPropertySetThread failed!");
}