surfaceflinger: Fix uninitialized variable

* And don't try to reinit the lib after a failure.

Change-Id: Ic055a48670ed8cf01e27b16c5d4ddf214db53d20
This commit is contained in:
Steve Kondik 2016-08-03 15:28:43 -07:00
parent da998f4845
commit 542b068e32
2 changed files with 9 additions and 1 deletions

View File

@ -404,6 +404,7 @@ void LayerBlur::ensureFbo(FBO& fbo, int width, int height, int textureName) {
// ---------------------------------------------------------------------------
void* LayerBlur::BlurImpl::sLibHandle = NULL;
bool LayerBlur::BlurImpl::sUnsupported = false;
LayerBlur::BlurImpl::initBlurTokenFn LayerBlur::BlurImpl::initBlurToken = NULL;
LayerBlur::BlurImpl::releaseBlurTokenFn LayerBlur::BlurImpl::releaseBlurToken = NULL;
@ -421,8 +422,13 @@ status_t LayerBlur::BlurImpl::initBlurImpl() {
if (sLibHandle != NULL) {
return OK;
}
if (sUnsupported) {
return NO_INIT;
}
sLibHandle = dlopen("libuiblur.so", RTLD_NOW);
if (sLibHandle == NULL) {
sUnsupported = true;
return NO_INIT;
}
@ -444,13 +450,14 @@ status_t LayerBlur::BlurImpl::initBlurImpl() {
if (!initBlurToken || !releaseBlurToken || !doBlur) {
ALOGE("dlsym failed for blur impl!: %s", dlerror());
closeBlurImpl();
sUnsupported = true;
return NO_INIT;
}
return OK;
}
LayerBlur::BlurImpl::BlurImpl() {
LayerBlur::BlurImpl::BlurImpl() : mToken(NULL) {
Mutex::Autolock _l(sLock);
if (initBlurImpl() == OK) {
mToken = initBlurToken();

View File

@ -68,6 +68,7 @@ private:
static status_t initBlurImpl();
static void closeBlurImpl();
static void* sLibHandle;
static bool sUnsupported;
typedef void* (*initBlurTokenFn)();
typedef void* (*releaseBlurTokenFn)(void*);