Add glUseProgram to the list of GL functions requiring synchronization

We have observed an internal deadlock in libGLESv2_adreno where one
thread is in eglCreateContext and another thread in glUseProgram. We
have observed similar deadlocks before and started to synchronize all
access to the offending GL functions. Calls to eglCreateContext are
already synchronized, and this CL synchronizes calls to glUseProgram as
well.

Bug: b/153513005
Change-Id: I576e564aab44c9e429f2b1407105ed72942c309e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173742
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31118}
diff --git a/sdk/android/api/org/webrtc/GlShader.java b/sdk/android/api/org/webrtc/GlShader.java
index db5c630..8f4cda3 100644
--- a/sdk/android/api/org/webrtc/GlShader.java
+++ b/sdk/android/api/org/webrtc/GlShader.java
@@ -114,7 +114,9 @@
     if (program == -1) {
       throw new RuntimeException("The program has been released");
     }
-    GLES20.glUseProgram(program);
+    synchronized (EglBase.lock) {
+      GLES20.glUseProgram(program);
+    }
     GlUtil.checkNoGLES2Error("glUseProgram");
   }