From 59411b3373dca7582aa1a248d4cff4c2330ee224 Mon Sep 17 00:00:00 2001 From: Wu-cheng Li Date: Thu, 25 Mar 2010 17:27:29 +0800 Subject: [PATCH] Fix testCameraPreviewMemoryUsage test. Looper.quit() is asynchronous. The looper may still has some preview callbacks in the queue after quit is called. The preview callback still uses the camera object (setHasPreviewCallback). After camera is released, RuntimeException will be thrown from the method. So we need to join the looper thread here. This change also fixes a potential race condition. bug:2521202 Change-Id: If69bbb3125d1d30192563559579b87c20fa5aac8 --- .../functional/CameraTest.java | 106 ++++++++---------- .../performance/MediaPlayerPerformance.java | 61 +++++----- 2 files changed, 71 insertions(+), 96 deletions(-) diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java index 784db97a920d5..2e599f22acda3 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/CameraTest.java @@ -30,6 +30,7 @@ import android.test.ActivityInstrumentationTestCase; import android.util.Log; import android.view.SurfaceHolder; +import android.os.ConditionVariable; import android.os.Looper; import android.test.suitebuilder.annotation.LargeTest; @@ -55,8 +56,8 @@ public class CameraTest extends ActivityInstrumentationTestCase