construct MediaRecorder in setup
- it is destroyed in teardown, but not created in setup
Bug: 6469397
Change-Id: I80ac4e2d4ba3eeacc333cd5f60ff57172007f08c
diff --git a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
index 25e1694..55be9ac 100644
--- a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
@@ -61,14 +61,7 @@
private Camera mCamera;
private MediaStubActivity mActivity = null;
- /*
- * InstrumentationTestRunner.onStart() calls Looper.prepare(), which creates a looper
- * for the current thread. However, since we don't actually call loop() in the test,
- * any messages queued with that looper will never be consumed. We instantiate the recorder
- * in the constructor, before setUp(), so that its constructor does not see the
- * nonfunctional Looper.
- */
- private MediaRecorder mMediaRecorder = new MediaRecorder();
+ private MediaRecorder mMediaRecorder;
public MediaRecorderTest() {
super("com.android.cts.media", MediaStubActivity.class);
@@ -101,9 +94,9 @@
completeOnUiThread(new Runnable() {
@Override
public void run() {
+ mMediaRecorder = new MediaRecorder();
mOutFile = new File(OUTPUT_PATH);
mOutFile2 = new File(OUTPUT_PATH2);
- mMediaRecorder.reset();
mMediaRecorder.setOutputFile(OUTPUT_PATH);
mMediaRecorder.setOnInfoListener(new OnInfoListener() {
public void onInfo(MediaRecorder mr, int what, int extra) {