summaryrefslogtreecommitdiffstats
path: root/opengl/java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2013-04-18 15:17:48 -0700
committerJeff Brown <jeffbrown@google.com>2013-04-18 19:04:39 -0700
commit8b60e4514702edd1eb4b6f2bfc027e04a94369c0 (patch)
tree83ba3f9cbbb4a7bae7a5069622b7c31d1a135775 /opengl/java
parenta454c5732cacffdda53ae277b1e43d87b43044b1 (diff)
downloadframeworks_base-8b60e4514702edd1eb4b6f2bfc027e04a94369c0.zip
frameworks_base-8b60e4514702edd1eb4b6f2bfc027e04a94369c0.tar.gz
frameworks_base-8b60e4514702edd1eb4b6f2bfc027e04a94369c0.tar.bz2
Fix change of behavior in Looper.quit().
It seems some applications rely on Looper.quit() terminating the loop immediately without processing all messages. Rather than risk breaking them, make the safer behavior optional. Also take care to properly drain the message queue before quitting so that all of the Message instances are recycled. This may help release storage sooner in case the Looper doesn't get GC'd promptly and its remaining queue of undelivered messages sticks around. Improve docs on runWithScissors. Bug: 8596303 Change-Id: I8cbeb6f7a5f6b8e618b5109f87a03defc1486b9f
Diffstat (limited to 'opengl/java')
-rw-r--r--opengl/java/android/opengl/GLSurfaceView.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index 235829e..dac3506 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -245,7 +245,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
if (mGLThread != null) {
// GLThread may still be running if this view was never
// attached to a window.
- mGLThread.requestExitAndWait();
+ mGLThread.quitSafely();
}
} finally {
super.finalize();
@@ -628,7 +628,11 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
Log.d(TAG, "onDetachedFromWindow");
}
if (mGLThread != null) {
- mGLThread.requestExitAndWait();
+ mGLThread.quitSafely();
+ try {
+ mGLThread.join();
+ } catch (InterruptedException ex) {
+ }
}
mDetached = true;
super.onDetachedFromWindow();
@@ -1627,14 +1631,6 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
mGLHandler.runWithScissors(mGetRenderModeRunnable, 0);
return mGetRenderModeRunnable.renderMode;
}
-
- public void requestExitAndWait() {
- getLooper().quit();
- try {
- this.join();
- } catch (InterruptedException e) {
- }
- }
} // class GLThread
static class LogWriter extends Writer {