summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-08-23 13:23:02 -0700
committerBobby Georgescu <georgescu@google.com>2012-08-23 13:38:27 -0700
commitb0b56b7d5e2d707c8094b23b058da3cfd1446d3c (patch)
tree19bc84c5e9383e71435156acd2760ae67b88e364 /src
parentc021f58653f8350a2d86753fadfb2feda177d03f (diff)
downloadandroid_packages_apps_Snap-b0b56b7d5e2d707c8094b23b058da3cfd1446d3c.tar.gz
android_packages_apps_Snap-b0b56b7d5e2d707c8094b23b058da3cfd1446d3c.tar.bz2
android_packages_apps_Snap-b0b56b7d5e2d707c8094b23b058da3cfd1446d3c.zip
Fix ANRs in Gallery
Bug: 7041769 Change-Id: Idc2a266bffd0d2c641fba69cfede13e1e83f276b
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java b/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java
index 475906c81..250d17a2b 100644
--- a/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java
+++ b/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java
@@ -1,10 +1,13 @@
package com.android.gallery3d.ui;
+import android.os.ConditionVariable;
+
import com.android.gallery3d.ui.GLRoot.OnGLIdleListener;
public class PreparePageFadeoutTexture implements OnGLIdleListener {
+ private static final long TIMEOUT = FadeTexture.DURATION;
private RawTexture mTexture;
- private boolean mResultReady = false;
+ private ConditionVariable mResultReady = new ConditionVariable(false);
private GLView mRootPane;
public PreparePageFadeoutTexture(int w, int h, GLView rootPane) {
@@ -13,14 +16,11 @@ public class PreparePageFadeoutTexture implements OnGLIdleListener {
}
public synchronized RawTexture get() {
- try {
- while (!mResultReady) {
- wait();
- }
- } catch (InterruptedException e) {
- // Since this is just used for a transition, not that important
+ if (mResultReady.block(TIMEOUT)) {
+ return mTexture;
+ } else {
+ return null;
}
- return mTexture;
}
@Override
@@ -28,10 +28,7 @@ public class PreparePageFadeoutTexture implements OnGLIdleListener {
canvas.beginRenderTarget(mTexture);
mRootPane.render(canvas);
canvas.endRenderTarget();
- synchronized (this) {
- mResultReady = true;
- notifyAll();
- }
+ mResultReady.open();
return false;
}
}