SurfaceFlinger: Set property in separate thread in init
By setting property in a separate thread, the CL aims to
avoid slow initilization in SurfaceFlinger::init where
SurfaceFlinger is waiting on property_service.
Bug: 34499826
Test: on marlin
Change-Id: I91afad3cbc9a2b31aa89ae9cc752ad491cc9d8e4
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index c9445e7..9e25e07 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -338,6 +338,9 @@
void SurfaceFlinger::bootFinished()
{
+ if (mStartBootAnimThread->join() != NO_ERROR) {
+ ALOGE("Join StartBootAnimThread failed!");
+ }
const nsecs_t now = systemTime();
const nsecs_t duration = now - mBootTime;
ALOGI("Boot is finished (%ld ms)", long(ns2ms(duration)) );
@@ -579,16 +582,22 @@
mRenderEngine->primeCache();
- // start boot animation
- startBootAnim();
+ mStartBootAnimThread = new StartBootAnimThread();
+ if (mStartBootAnimThread->Start() != NO_ERROR) {
+ ALOGE("Run StartBootAnimThread failed!");
+ }
ALOGV("Done initializing");
}
void SurfaceFlinger::startBootAnim() {
- // start boot animation
- property_set("service.bootanim.exit", "0");
- property_set("ctl.start", "bootanim");
+ // Start boot animation service by setting a property mailbox
+ // if property setting thread is already running, Start() will be just a NOP
+ mStartBootAnimThread->Start();
+ // Wait until property was set
+ if (mStartBootAnimThread->join() != NO_ERROR) {
+ ALOGE("Join StartBootAnimThread failed!");
+ }
}
size_t SurfaceFlinger::getMaxTextureSize() const {