[automerger skipped] hwc2: add locks for callback functions am: f0360a1db2 -s ours am: 3ddcbd6d99 -s ours am: 712e117152 -s ours

am skip reason: Change-Id I9ae8ac8968f4ff9286846de15df0411b5d79ae63 with SHA-1 f0360a1db2 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/qcom/sdm845/display/+/11902060

Change-Id: Ie217855819ba8074c8e4812539dec1feb96cdfcd
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d97975c
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,3 @@
+third_party {
+  license_type: NOTICE
+}
diff --git a/gpu_tonemapper/glengine.cpp b/gpu_tonemapper/glengine.cpp
index 35e1932..bf3b58a 100644
--- a/gpu_tonemapper/glengine.cpp
+++ b/gpu_tonemapper/glengine.cpp
@@ -315,36 +315,30 @@
 //-----------------------------------------------------------------------------
 {
   for (GLint error = glGetError(); error; error = glGetError()) {
-    char *pError;
+    const char *pError = "<unknown error>";
     switch (error) {
       case GL_NO_ERROR:
-        pError = (char *)"GL_NO_ERROR";
+        pError = "GL_NO_ERROR";
         break;
       case GL_INVALID_ENUM:
-        pError = (char *)"GL_INVALID_ENUM";
+        pError = "GL_INVALID_ENUM";
         break;
       case GL_INVALID_VALUE:
-        pError = (char *)"GL_INVALID_VALUE";
+        pError = "GL_INVALID_VALUE";
         break;
       case GL_INVALID_OPERATION:
-        pError = (char *)"GL_INVALID_OPERATION";
+        pError = "GL_INVALID_OPERATION";
         break;
       case GL_OUT_OF_MEMORY:
-        pError = (char *)"GL_OUT_OF_MEMORY";
+        pError = "GL_OUT_OF_MEMORY";
         break;
       case GL_INVALID_FRAMEBUFFER_OPERATION:
-        pError = (char *)"GL_INVALID_FRAMEBUFFER_OPERATION";
+        pError = "GL_INVALID_FRAMEBUFFER_OPERATION";
         break;
-
-      default:
-        ALOGE("glError (0x%x) %s:%d\n", error, file, line);
-        return;
     }
 
     ALOGE("glError (%s) %s:%d\n", pError, file, line);
-    return;
   }
-  return;
 }
 
 //-----------------------------------------------------------------------------
@@ -357,59 +351,54 @@
       break;
     }
 
-    char *pError;
+    const char *pError = "<unknown error>";
     switch (error) {
       case EGL_SUCCESS:
-        pError = (char *)"EGL_SUCCESS";
+        pError = "EGL_SUCCESS";
         break;
       case EGL_NOT_INITIALIZED:
-        pError = (char *)"EGL_NOT_INITIALIZED";
+        pError = "EGL_NOT_INITIALIZED";
         break;
       case EGL_BAD_ACCESS:
-        pError = (char *)"EGL_BAD_ACCESS";
+        pError = "EGL_BAD_ACCESS";
         break;
       case EGL_BAD_ALLOC:
-        pError = (char *)"EGL_BAD_ALLOC";
+        pError = "EGL_BAD_ALLOC";
         break;
       case EGL_BAD_ATTRIBUTE:
-        pError = (char *)"EGL_BAD_ATTRIBUTE";
+        pError = "EGL_BAD_ATTRIBUTE";
         break;
       case EGL_BAD_CONTEXT:
-        pError = (char *)"EGL_BAD_CONTEXT";
+        pError = "EGL_BAD_CONTEXT";
         break;
       case EGL_BAD_CONFIG:
-        pError = (char *)"EGL_BAD_CONFIG";
+        pError = "EGL_BAD_CONFIG";
         break;
       case EGL_BAD_CURRENT_SURFACE:
-        pError = (char *)"EGL_BAD_CURRENT_SURFACE";
+        pError = "EGL_BAD_CURRENT_SURFACE";
         break;
       case EGL_BAD_DISPLAY:
-        pError = (char *)"EGL_BAD_DISPLAY";
+        pError = "EGL_BAD_DISPLAY";
         break;
       case EGL_BAD_SURFACE:
-        pError = (char *)"EGL_BAD_SURFACE";
+        pError = "EGL_BAD_SURFACE";
         break;
       case EGL_BAD_MATCH:
-        pError = (char *)"EGL_BAD_MATCH";
+        pError = "EGL_BAD_MATCH";
         break;
       case EGL_BAD_PARAMETER:
-        pError = (char *)"EGL_BAD_PARAMETER";
+        pError = "EGL_BAD_PARAMETER";
         break;
       case EGL_BAD_NATIVE_PIXMAP:
-        pError = (char *)"EGL_BAD_NATIVE_PIXMAP";
+        pError = "EGL_BAD_NATIVE_PIXMAP";
         break;
       case EGL_BAD_NATIVE_WINDOW:
-        pError = (char *)"EGL_BAD_NATIVE_WINDOW";
+        pError = "EGL_BAD_NATIVE_WINDOW";
         break;
       case EGL_CONTEXT_LOST:
-        pError = (char *)"EGL_CONTEXT_LOST";
+        pError = "EGL_CONTEXT_LOST";
         break;
-      default:
-        ALOGE("eglError (0x%x) %s:%d\n", error, file, line);
-        return;
     }
     ALOGE("eglError (%s) %s:%d\n", pError, file, line);
-    return;
   }
-  return;
 }
diff --git a/liblight/Android.mk b/liblight/Android.mk
index d485c7e..3db3634 100644
--- a/liblight/Android.mk
+++ b/liblight/Android.mk
@@ -27,7 +27,7 @@
 endif
 LOCAL_CFLAGS += -Wno-error
 LOCAL_CLANG  := true
-LOCAL_MODULE := lights.$(TARGET_BOARD_PLATFORM)
+LOCAL_MODULE := lights.qcom
 LOCAL_MODULE_TAGS := optional
 LOCAL_VENDOR_MODULE := true