Fix issue 2622023: Clean up all hardcoded '/sdcard' in camera related codes
http://2622023

Change-Id: I10205ab378c863e2ffed460c83b0037311a6d1a1
diff --git a/tests/src/com/android/camera/stress/CameraLatency.java b/tests/src/com/android/camera/stress/CameraLatency.java
index 5c6d308..76805c4 100755
--- a/tests/src/com/android/camera/stress/CameraLatency.java
+++ b/tests/src/com/android/camera/stress/CameraLatency.java
@@ -18,15 +18,16 @@
 
 import com.android.camera.Camera;
 
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-
 import android.app.Instrumentation;
+import android.os.Environment;
 import android.test.ActivityInstrumentationTestCase2;
 import android.test.suitebuilder.annotation.LargeTest;
 import android.util.Log;
 import android.view.KeyEvent;
 
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+
 /**
  * Junit / Instrumentation test case for camera test
  *
@@ -36,7 +37,8 @@
     private String TAG = "CameraLatency";
     private static final int TOTAL_NUMBER_OF_IMAGECAPTURE = 20;
     private static final long WAIT_FOR_IMAGE_CAPTURE_TO_BE_TAKEN = 4000;
-    private static final String CAMERA_TEST_OUTPUT_FILE = "/sdcard/mediaStressOut.txt";
+    private static final String CAMERA_TEST_OUTPUT_FILE =
+            Environment.getExternalStorageDirectory().toString() + "/mediaStressOut.txt";
 
     private long mTotalAutoFocusTime;
     private long mTotalShutterLag;
diff --git a/tests/src/com/android/camera/stress/CameraStartUp.java b/tests/src/com/android/camera/stress/CameraStartUp.java
index a07b6ba..8aec0a9 100644
--- a/tests/src/com/android/camera/stress/CameraStartUp.java
+++ b/tests/src/com/android/camera/stress/CameraStartUp.java
@@ -1,12 +1,14 @@
 package com.android.camera.stress;
 
+import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.Intent;
 import android.os.Debug;
+import android.os.Environment;
 import android.test.InstrumentationTestCase;
 import android.test.suitebuilder.annotation.LargeTest;
-import android.app.Activity;
 import android.util.Log;
+
 import java.io.FileWriter;
 import java.io.BufferedWriter;
 
@@ -18,7 +20,8 @@
     private static final int TOTAL_NUMBER_OF_STARTUP = 20;
 
     private String TAG = "CameraStartUp";
-    private static final String CAMERA_TEST_OUTPUT_FILE = "/sdcard/mediaStressOut.txt";
+    private static final String CAMERA_TEST_OUTPUT_FILE =
+            Environment.getExternalStorageDirectory().toString() + "/mediaStressOut.txt";
     private static final String CAMERA_PACKAGE_NAME = "com.google.android.camera";
     private static final String CAMERA_ACTIVITY_NAME = "com.android.camera.Camera";
     private static final String VIDEORECORDER_ACTIVITY_NAME = "com.android.camera.VideoCamera";
diff --git a/tests/src/com/android/camera/stress/ImageCapture.java b/tests/src/com/android/camera/stress/ImageCapture.java
index 0eb5586..8c20d37 100755
--- a/tests/src/com/android/camera/stress/ImageCapture.java
+++ b/tests/src/com/android/camera/stress/ImageCapture.java
@@ -19,10 +19,13 @@
 import com.android.camera.Camera;
 
 import android.app.Instrumentation;
+import android.content.Intent;
+import android.os.Environment;
 import android.test.ActivityInstrumentationTestCase2;
 import android.test.suitebuilder.annotation.LargeTest;
 import android.util.Log;
 import android.view.KeyEvent;
+
 import java.io.FileWriter;
 import java.io.Writer;
 import java.io.File;
@@ -30,7 +33,6 @@
 import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.InputStream;
-import android.content.Intent;
 /**
  * Junit / Instrumentation test case for camera test
  *
@@ -51,7 +53,8 @@
     private static final long WAIT_FOR_PREVIEW = 1500; //1.5 seconds
     private static final long WAIT_FOR_STABLE_STATE = 2000; //2 seconds
     private static final int NO_OF_LOOPS_TAKE_MEMORY_SNAPSHOT = 10;
-    private static final String CAMERA_MEM_OUTPUTFILE = "/sdcard/ImageCaptureMemOut.txt";
+    private static final String CAMERA_MEM_OUTPUTFILE =
+            Environment.getExternalStorageDirectory().toString() + "/ImageCaptureMemOut.txt";
 
     //the tolerant memory leak
     private static final int MAX_ACCEPTED_MEMORY_LEAK_KB = 150;
diff --git a/tests/src/com/android/camera/stress/SwitchPreview.java b/tests/src/com/android/camera/stress/SwitchPreview.java
index 4575043..3c4bfaf 100755
--- a/tests/src/com/android/camera/stress/SwitchPreview.java
+++ b/tests/src/com/android/camera/stress/SwitchPreview.java
@@ -17,15 +17,17 @@
 package com.android.camera.stress;
 
 import com.android.camera.VideoCamera;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
 
 import android.app.Instrumentation;
 import android.content.Intent;
 import android.test.ActivityInstrumentationTestCase2;
 import android.test.suitebuilder.annotation.LargeTest;
+import android.os.Environment;
 import android.util.Log;
 
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+
 /**
  * Junit / Instrumentation test case for camera test
  *
@@ -41,7 +43,8 @@
     private static final int TOTAL_NUMBER_OF_SWITCHING = 200;
     private static final long WAIT_FOR_PREVIEW = 4000;
 
-    private static final String CAMERA_TEST_OUTPUT_FILE = "/sdcard/mediaStressOut.txt";
+    private static final String CAMERA_TEST_OUTPUT_FILE =
+            Environment.getExternalStorageDirectory().toString() + "/mediaStressOut.txt";
     private BufferedWriter mOut;
     private FileWriter mfstream;