diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
index 3fb2da0..92ac9eb 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
@@ -39,6 +39,7 @@
 import com.android.mediaframeworktest.functional.videoeditor.VideoEditorPreviewTest;
 import junit.framework.TestSuite;
 
+import android.os.Bundle;
 import android.test.InstrumentationTestRunner;
 import android.test.InstrumentationTestSuite;
 
@@ -54,6 +55,7 @@
 
 public class MediaFrameworkTestRunner extends InstrumentationTestRunner {
 
+    public static int mMinCameraFps = 0;
 
     @Override
     public TestSuite getAllTests() {
@@ -87,4 +89,16 @@
     public ClassLoader getLoader() {
         return MediaFrameworkTestRunner.class.getClassLoader();
     }
+
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+
+        String minCameraFps = (String) icicle.get("min_camera_fps");
+        System.out.print("min_camera_" + minCameraFps);
+
+        if (minCameraFps != null ) {
+            mMinCameraFps = Integer.parseInt(minCameraFps);
+        }
+    }
 }
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java
index b5c8c8c..0684946 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/mediarecorder/MediaRecorderTest.java
@@ -33,6 +33,7 @@
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 import com.android.mediaframeworktest.MediaProfileReader;
+import com.android.mediaframeworktest.MediaFrameworkTestRunner;
 
 import android.test.suitebuilder.annotation.LargeTest;
 import android.test.suitebuilder.annotation.Suppress;
@@ -115,9 +116,16 @@
         int audioChannels = highQuality? audioCap.mMaxChannels: audioCap.mMinChannels ;
         int audioSamplingRate = highQuality? audioCap.mMaxSampleRate: audioCap.mMinSampleRate;
 
+        //Overide the fps if the min_camera_fps is set
+        if (MediaFrameworkTestRunner.mMinCameraFps != 0 &&
+            MediaFrameworkTestRunner.mMinCameraFps > videoFps){
+            videoFps = MediaFrameworkTestRunner.mMinCameraFps;
+        }
+
         if (videoFps < MIN_VIDEO_FPS) {
             videoFps = MIN_VIDEO_FPS;
         }
+
         mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
         String filename = ("/sdcard/" + videoEncoder + "_" + audioEncoder + "_" + highQuality + ".3gp");
         try {
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
index 0b887b9..4f6e7d2 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/performance/MediaPlayerPerformance.java
@@ -37,11 +37,13 @@
 import android.view.SurfaceHolder;
 
 import java.util.List;
+import java.io.BufferedReader;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.Writer;
 import java.io.File;
 import java.io.FileWriter;
@@ -68,6 +70,8 @@
     private static final long MEDIA_STRESS_WAIT_TIME = 5000; //5 seconds
     private static final String MEDIA_MEMORY_OUTPUT =
         "/sdcard/mediaMemOutput.txt";
+    private static final String MEDIA_PROCMEM_OUTPUT =
+        "/sdcard/mediaProcmemOutput.txt";
 
     private static int mStartMemory = 0;
     private static int mEndMemory = 0;
@@ -84,6 +88,9 @@
     private static int DECODER_LIMIT = 150;
     private static int CAMERA_LIMIT = 80;
 
+    private Writer mProcMemWriter;
+    private Writer mMemWriter;
+
     private static List<VideoEncoderCap> videoEncoders = MediaProfileReader.getVideoEncoders();
 
     Camera mCamera;
@@ -97,12 +104,21 @@
         getActivity();
         if (MediaFrameworkPerfTestRunner.mGetNativeHeapDump)
             MediaTestUtil.getNativeHeapDump(this.getName() + "_before");
+
+        mProcMemWriter = new BufferedWriter(new FileWriter
+                (new File(MEDIA_PROCMEM_OUTPUT), true));
+        mProcMemWriter.write(this.getName() + "\n");
+        mMemWriter = new BufferedWriter(new FileWriter
+                (new File(MEDIA_MEMORY_OUTPUT), true));
+
     }
 
     protected void tearDown() throws Exception {
-        super.tearDown();
         if (MediaFrameworkPerfTestRunner.mGetNativeHeapDump)
             MediaTestUtil.getNativeHeapDump(this.getName() + "_after");
+        mProcMemWriter.close();
+        mMemWriter.close();
+        super.tearDown();
     }
 
     private void initializeMessageLooper() {
@@ -247,24 +263,39 @@
     }
 
     //Write the ps output to the file
-    public void getMemoryWriteToLog(Writer output, int writeCount) {
+    public void getMemoryWriteToLog(int writeCount) {
         String memusage = null;
         try {
             if (writeCount == 0) {
                 mStartMemory = getMediaserverVsize();
-                output.write("Start memory : " + mStartMemory + "\n");
+                mMemWriter.write("Start memory : " + mStartMemory + "\n");
             }
             memusage = captureMediaserverInfo();
-            output.write(memusage);
+            mMemWriter.write(memusage);
             if (writeCount == NUM_STRESS_LOOP - 1) {
                 mEndMemory = getMediaserverVsize();
-                output.write("End Memory :" + mEndMemory + "\n");
+                mMemWriter.write("End Memory :" + mEndMemory + "\n");
             }
         } catch (Exception e) {
             e.toString();
         }
     }
 
+    public void writeProcmemInfo() throws Exception{
+        String cmd = "procmem " + getMediaserverPid();
+        Process p = Runtime.getRuntime().exec(cmd);
+
+        InputStream inStream = p.getInputStream();
+        InputStreamReader inReader = new InputStreamReader(inStream);
+        BufferedReader inBuffer = new BufferedReader(inReader);
+        String s;
+        while ((s = inBuffer.readLine()) != null) {
+              mProcMemWriter.write(s);
+              mProcMemWriter.write("\n");
+        }
+        mProcMemWriter.write("\n\n");
+    }
+
     public String captureMediaserverInfo() {
         String cm = "ps mediaserver";
         String memoryUsage = null;
@@ -306,7 +337,7 @@
         return vsizevalue;
     }
 
-    public boolean validateMemoryResult(int startPid, int startMemory, Writer output, int limit)
+    public boolean validateMemoryResult(int startPid, int startMemory, int limit)
             throws Exception {
         // Wait for 10 seconds to make sure the memory settle.
         Thread.sleep(10000);
@@ -315,11 +346,11 @@
         if (memDiff < 0) {
             memDiff = 0;
         }
-        output.write("The total diff = " + memDiff);
-        output.write("\n\n");
+        mMemWriter.write("The total diff = " + memDiff);
+        mMemWriter.write("\n\n");
         // mediaserver crash
         if (startPid != mEndPid) {
-            output.write("mediaserver died. Test failed\n");
+            mMemWriter.write("mediaserver died. Test failed\n");
             return false;
         }
         // memory leak greter than the tolerant
@@ -331,18 +362,16 @@
     @LargeTest
     public void testH263VideoPlaybackMemoryUsage() throws Exception {
         boolean memoryResult = false;
-        mStartPid = getMediaserverPid();
 
-        File h263MemoryOut = new File(MEDIA_MEMORY_OUTPUT);
-        Writer output = new BufferedWriter(new FileWriter(h263MemoryOut, true));
-        output.write("H263 Video Playback Only\n");
+        mStartPid = getMediaserverPid();
+        mMemWriter.write("H263 Video Playback Only\n");
         for (int i = 0; i < NUM_STRESS_LOOP; i++) {
             mediaStressPlayback(MediaNames.VIDEO_HIGHRES_H263);
-            getMemoryWriteToLog(output, i);
+            getMemoryWriteToLog(i);
+            writeProcmemInfo();
         }
-        output.write("\n");
-        memoryResult = validateMemoryResult(mStartPid, mStartMemory, output, DECODER_LIMIT);
-        output.close();
+        mMemWriter.write("\n");
+        memoryResult = validateMemoryResult(mStartPid, mStartMemory, DECODER_LIMIT);
         assertTrue("H263 playback memory test", memoryResult);
     }
 
@@ -350,18 +379,16 @@
     @LargeTest
     public void testH264VideoPlaybackMemoryUsage() throws Exception {
         boolean memoryResult = false;
-        mStartPid = getMediaserverPid();
 
-        File h264MemoryOut = new File(MEDIA_MEMORY_OUTPUT);
-        Writer output = new BufferedWriter(new FileWriter(h264MemoryOut, true));
-        output.write("H264 Video Playback only\n");
+        mStartPid = getMediaserverPid();
+        mMemWriter.write("H264 Video Playback only\n");
         for (int i = 0; i < NUM_STRESS_LOOP; i++) {
             mediaStressPlayback(MediaNames.VIDEO_H264_AMR);
-            getMemoryWriteToLog(output, i);
+            getMemoryWriteToLog(i);
+            writeProcmemInfo();
         }
-        output.write("\n");
-        memoryResult = validateMemoryResult(mStartPid, mStartMemory, output, DECODER_LIMIT);
-        output.close();
+        mMemWriter.write("\n");
+        memoryResult = validateMemoryResult(mStartPid, mStartMemory, DECODER_LIMIT);
         assertTrue("H264 playback memory test", memoryResult);
     }
 
@@ -369,21 +396,19 @@
     @LargeTest
     public void testH263RecordVideoOnlyMemoryUsage() throws Exception {
         boolean memoryResult = false;
-        mStartPid = getMediaserverPid();
 
-        File videoH263RecordOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
-        Writer output = new BufferedWriter(new FileWriter(videoH263RecordOnlyMemoryOut, true));
-        output.write("H263 video record only\n");
+        mStartPid = getMediaserverPid();
+        mMemWriter.write("H263 video record only\n");
         int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.H263);
         assertTrue("H263 video recording frame rate", frameRate != -1);
         for (int i = 0; i < NUM_STRESS_LOOP; i++) {
             assertTrue(stressVideoRecord(frameRate, 352, 288, MediaRecorder.VideoEncoder.H263,
                     MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, true));
-            getMemoryWriteToLog(output, i);
+            getMemoryWriteToLog(i);
+            writeProcmemInfo();
         }
-        output.write("\n");
-        memoryResult = validateMemoryResult(mStartPid, mStartMemory, output, ENCODER_LIMIT);
-        output.close();
+        mMemWriter.write("\n");
+        memoryResult = validateMemoryResult(mStartPid, mStartMemory, ENCODER_LIMIT);
         assertTrue("H263 record only memory test", memoryResult);
     }
 
@@ -391,21 +416,19 @@
     @LargeTest
     public void testMpeg4RecordVideoOnlyMemoryUsage() throws Exception {
         boolean memoryResult = false;
-        mStartPid = getMediaserverPid();
 
-        File videoMp4RecordOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
-        Writer output = new BufferedWriter(new FileWriter(videoMp4RecordOnlyMemoryOut, true));
-        output.write("MPEG4 video record only\n");
+        mStartPid = getMediaserverPid();
+        mMemWriter.write("MPEG4 video record only\n");
         int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.MPEG_4_SP);
         assertTrue("MPEG4 video recording frame rate", frameRate != -1);
         for (int i = 0; i < NUM_STRESS_LOOP; i++) {
             assertTrue(stressVideoRecord(frameRate, 352, 288, MediaRecorder.VideoEncoder.MPEG_4_SP,
                     MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, true));
-            getMemoryWriteToLog(output, i);
+            getMemoryWriteToLog(i);
+            writeProcmemInfo();
         }
-        output.write("\n");
-        memoryResult = validateMemoryResult(mStartPid, mStartMemory, output, ENCODER_LIMIT);
-        output.close();
+        mMemWriter.write("\n");
+        memoryResult = validateMemoryResult(mStartPid, mStartMemory, ENCODER_LIMIT);
         assertTrue("mpeg4 record only memory test", memoryResult);
     }
 
@@ -414,21 +437,19 @@
     @LargeTest
     public void testRecordVideoAudioMemoryUsage() throws Exception {
         boolean memoryResult = false;
-        mStartPid = getMediaserverPid();
 
-        File videoRecordAudioMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
-        Writer output = new BufferedWriter(new FileWriter(videoRecordAudioMemoryOut, true));
+        mStartPid = getMediaserverPid();
         int frameRate = MediaProfileReader.getMaxFrameRateForCodec(MediaRecorder.VideoEncoder.H263);
         assertTrue("H263 video recording frame rate", frameRate != -1);
-        output.write("Audio and h263 video record\n");
+        mMemWriter.write("Audio and h263 video record\n");
         for (int i = 0; i < NUM_STRESS_LOOP; i++) {
             assertTrue(stressVideoRecord(frameRate, 352, 288, MediaRecorder.VideoEncoder.H263,
                     MediaRecorder.OutputFormat.MPEG_4, MediaNames.RECORDED_VIDEO_3GP, false));
-            getMemoryWriteToLog(output, i);
+            getMemoryWriteToLog(i);
+            writeProcmemInfo();
         }
-        output.write("\n");
-        memoryResult = validateMemoryResult(mStartPid, mStartMemory, output, ENCODER_LIMIT);
-        output.close();
+        mMemWriter.write("\n");
+        memoryResult = validateMemoryResult(mStartPid, mStartMemory, ENCODER_LIMIT);
         assertTrue("H263 audio video record memory test", memoryResult);
     }
 
@@ -436,18 +457,16 @@
     @LargeTest
     public void testRecordAudioOnlyMemoryUsage() throws Exception {
         boolean memoryResult = false;
-        mStartPid = getMediaserverPid();
 
-        File audioOnlyMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
-        Writer output = new BufferedWriter(new FileWriter(audioOnlyMemoryOut, true));
-        output.write("Audio record only\n");
+        mStartPid = getMediaserverPid();
+        mMemWriter.write("Audio record only\n");
         for (int i = 0; i < NUM_STRESS_LOOP; i++) {
             stressAudioRecord(MediaNames.RECORDER_OUTPUT);
-            getMemoryWriteToLog(output, i);
+            getMemoryWriteToLog(i);
+            writeProcmemInfo();
         }
-        output.write("\n");
-        memoryResult = validateMemoryResult(mStartPid, mStartMemory, output, ENCODER_LIMIT);
-        output.close();
+        mMemWriter.write("\n");
+        memoryResult = validateMemoryResult(mStartPid, mStartMemory, ENCODER_LIMIT);
         assertTrue("audio record only memory test", memoryResult);
     }
 
@@ -455,18 +474,16 @@
     @LargeTest
     public void testCameraPreviewMemoryUsage() throws Exception {
         boolean memoryResult = false;
-        mStartPid = getMediaserverPid();
 
-        File cameraPreviewMemoryOut = new File(MEDIA_MEMORY_OUTPUT);
-        Writer output = new BufferedWriter(new FileWriter(cameraPreviewMemoryOut, true));
-        output.write("Camera Preview Only\n");
+        mStartPid = getMediaserverPid();
+        mMemWriter.write("Camera Preview Only\n");
         for (int i = 0; i < NUM_STRESS_LOOP; i++) {
             stressCameraPreview();
-            getMemoryWriteToLog(output, i);
+            getMemoryWriteToLog(i);
+            writeProcmemInfo();
         }
-        output.write("\n");
-        memoryResult = validateMemoryResult(mStartPid, mStartMemory, output, CAMERA_LIMIT);
-        output.close();
+        mMemWriter.write("\n");
+        memoryResult = validateMemoryResult(mStartPid, mStartMemory, CAMERA_LIMIT);
         assertTrue("camera preview memory test", memoryResult);
     }
 }
