Merge change 26332 into eclair

* changes:
  1) Add the wma / wmv profile reader. 2) Add the flag which check the wma/wmv enable properties. If the codec is not enable, then skip the wma / wmv related test cases. 3) Added a workaround which let the testcodecspecific test case continue even though there is a failure in the middle of the test. Besides, take out the remvoeFile for temporary usage.
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
index 0401390..53afb1d 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaProfileReader.java
@@ -32,6 +32,29 @@
         return s;
     }
 
+    public static boolean getWMAEnable() {
+        // push all the property into one big table
+        int wmaEnable = 1;
+        wmaEnable = SystemProperties.getInt("ro.media.dec.aud.wma.enabled",
+                wmaEnable);
+        if (wmaEnable == 1) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public static boolean getWMVEnable(){
+        int wmvEnable = 1;
+        wmvEnable = SystemProperties.getInt("ro.media.dec.vid.wmv.enabled",
+                wmvEnable);
+        if (wmvEnable == 1) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
     public static void createVideoProfileTable() {
         // push all the property into one big table
         String encoderType = getVideoCodecProperty();
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
index 30e2d6c..392d1d5 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaPlayerApiTest.java
@@ -18,6 +18,7 @@
 
 import com.android.mediaframeworktest.MediaFrameworkTest;
 import com.android.mediaframeworktest.MediaNames;
+import com.android.mediaframeworktest.MediaProfileReader;
 
 import android.content.Context;
 import android.test.ActivityInstrumentationTestCase;
@@ -35,11 +36,15 @@
 public class MediaPlayerApiTest extends ActivityInstrumentationTestCase<MediaFrameworkTest> {    
    private boolean duratoinWithinTolerence = false;
    private String TAG = "MediaPlayerApiTest";
+   private boolean isWMAEnable = false;
+   private boolean isWMVEnable = false;
    
    Context mContext;
   
    public MediaPlayerApiTest() {
      super("com.android.mediaframeworktest", MediaFrameworkTest.class);
+     isWMAEnable = MediaProfileReader.getWMAEnable();
+     isWMVEnable = MediaProfileReader.getWMVEnable();
    }
 
     protected void setUp() throws Exception {
@@ -82,9 +87,11 @@
     
     @MediumTest
     public void testWMA9GetDuration() throws Exception {
-      int duration = CodecTest.getDuration(MediaNames.WMA9); 
-      duratoinWithinTolerence = verifyDuration(duration, MediaNames.WMA9_LENGTH);
-      assertTrue("WMA9 getDuration", duratoinWithinTolerence);  
+      if (isWMAEnable) {
+            int duration = CodecTest.getDuration(MediaNames.WMA9);
+            duratoinWithinTolerence = verifyDuration(duration, MediaNames.WMA9_LENGTH);
+            assertTrue("WMA9 getDuration", duratoinWithinTolerence);
+        }
     }
 
     @MediumTest
@@ -123,8 +130,10 @@
     
     @LargeTest
     public void testWMA9GetCurrentPosition() throws Exception {
-      boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.WMA9);  
-      assertTrue("WMA9 GetCurrentPosition", currentPosition);  
+        if (isWMAEnable) {
+            boolean currentPosition = CodecTest.getCurrentPosition(MediaNames.WMA9);
+            assertTrue("WMA9 GetCurrentPosition", currentPosition);
+        }
     }
     
     @LargeTest
@@ -160,8 +169,10 @@
    
     @LargeTest
     public void testWMA9Pause() throws Exception {
-      boolean isPaused = CodecTest.pause(MediaNames.WMA9);  
-      assertTrue("WMA9 Pause", isPaused);  
+        if (isWMAEnable) {
+            boolean isPaused = CodecTest.pause(MediaNames.WMA9);
+            assertTrue("WMA9 Pause", isPaused);
+        }
     }
   
     @LargeTest
@@ -269,8 +280,10 @@
     
     @LargeTest
     public void testWMA9SeekTo() throws Exception {
-      boolean isLoop = CodecTest.seekTo(MediaNames.WMA9);  
-      assertTrue("WMA9 seekTo", isLoop);  
+        if (isWMAEnable) {
+            boolean isLoop = CodecTest.seekTo(MediaNames.WMA9);
+            assertTrue("WMA9 seekTo", isLoop);
+        }
     }
     
     @LargeTest
@@ -309,8 +322,10 @@
     @Suppress
     @LargeTest
     public void testWMA9SeekToEnd() throws Exception {
-      boolean isEnd = CodecTest.seekToEnd(MediaNames.WMA9);  
-      assertTrue("WMA9 seekToEnd", isEnd);  
+        if (isWMAEnable) {
+            boolean isEnd = CodecTest.seekToEnd(MediaNames.WMA9);
+            assertTrue("WMA9 seekToEnd", isEnd);
+        }
     }
     
     @LargeTest
@@ -327,8 +342,10 @@
     
     @LargeTest
     public void testWAVSeekToEnd() throws Exception {
-      boolean isEnd = CodecTest.seekToEnd(MediaNames.WAV);  
-      assertTrue("WAV seekToEnd", isEnd);  
+        if (isWMVEnable) {
+            boolean isEnd = CodecTest.seekToEnd(MediaNames.WAV);
+            assertTrue("WAV seekToEnd", isEnd);
+        }
     }  
     
     @MediumTest
@@ -385,8 +402,12 @@
    
     @LargeTest
     public void testVideoWMVSeekTo() throws Exception {
-      boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_WMV);
-      assertTrue("WMV SeekTo", isSeek);         
+        Log.v(TAG, "wmv not enable");
+        if (isWMVEnable) {
+            Log.v(TAG, "wmv enable");
+            boolean isSeek = CodecTest.videoSeekTo(MediaNames.VIDEO_WMV);
+            assertTrue("WMV SeekTo", isSeek);
+        }
     }
     
     @LargeTest
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
index b4d265d..690eff6 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaRecorderTest.java
@@ -239,7 +239,7 @@
             validVideo = true;
         }
         Log.v(TAG, "width = " + mOutputVideoWidth + " height = " + mOutputVideoHeight + " Duration = " + mOutputDuration);
-        removeFile(filePath);
+        //removeFile(filePath);
         return validVideo;
     }
     
@@ -428,8 +428,9 @@
     }
 
     @LargeTest
-    //est cases for the new codec
+    //test cases for the new codec
     public void testDeviceSpecificCodec() throws Exception {
+        int noOfFailure = 0;
         boolean recordSuccess = false;
         String deviceType = MediaProfileReader.getDeviceType();
         Log.v(TAG, "deviceType = " + deviceType);
@@ -450,10 +451,18 @@
                         } else {
                             recordSuccess = recordVideoWithPara(encoder[i], audio[j], "low");
                         }
-                        assertTrue((encoder[i] + audio[j]), recordSuccess);
+                        if (!recordSuccess){
+                            Log.v(TAG, "testDeviceSpecificCodec failed");
+                            Log.v(TAG, "Encoder = " + encoder[i] + "Audio Encoder = " + audio[j]);
+                            noOfFailure++;
+                        }
+                       //assertTrue((encoder[i] + audio[j]), recordSuccess);
                     }
                 }
             }
         }
+        if (noOfFailure != 0){
+            assertTrue("testDeviceSpecificCodec", false);
+        }
     }
 }