Merge remote branch 'goog/honeycomb' into honeycomb-mr1
diff --git a/tests/res/raw/a_4_aac.mp4 b/tests/res/raw/a_4_aac.mp4
new file mode 100644
index 0000000..05a776f
--- /dev/null
+++ b/tests/res/raw/a_4_aac.mp4
Binary files differ
diff --git a/tests/res/raw/b_5_aac.mp4 b/tests/res/raw/b_5_aac.mp4
new file mode 100644
index 0000000..9bce44d
--- /dev/null
+++ b/tests/res/raw/b_5_aac.mp4
Binary files differ
diff --git a/tests/res/raw/c_sharp_5_aac.mp4 b/tests/res/raw/c_sharp_5_aac.mp4
new file mode 100644
index 0000000..1e7f988
--- /dev/null
+++ b/tests/res/raw/c_sharp_5_aac.mp4
Binary files differ
diff --git a/tests/res/raw/e_5_aac.mp4 b/tests/res/raw/e_5_aac.mp4
new file mode 100644
index 0000000..95bad2a
--- /dev/null
+++ b/tests/res/raw/e_5_aac.mp4
Binary files differ
diff --git a/tests/res/raw/g_sharp_5_aac.mp4 b/tests/res/raw/g_sharp_5_aac.mp4
new file mode 100644
index 0000000..a357912
--- /dev/null
+++ b/tests/res/raw/g_sharp_5_aac.mp4
Binary files differ
diff --git a/tests/tests/media/src/android/media/cts/SoundPoolAacTest.java b/tests/tests/media/src/android/media/cts/SoundPoolAacTest.java
new file mode 100644
index 0000000..edd4d58
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/SoundPoolAacTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media.cts;
+
+import com.android.cts.stub.R;
+
+public class SoundPoolAacTest extends SoundPoolTest {
+
+    @Override
+    protected int getSoundA() {
+        return R.raw.a_4_aac;
+    }
+
+    @Override
+    protected int getSoundCs() {
+        return R.raw.c_sharp_5_aac;
+    }
+
+    @Override
+    protected int getSoundE() {
+        return R.raw.e_5_aac;
+    }
+
+    @Override
+    protected int getSoundB() {
+        return R.raw.b_5_aac;
+    }
+
+    @Override
+    protected int getSoundGs() {
+        return R.raw.g_sharp_5_aac;
+    }
+
+    @Override
+    protected String getFileName() {
+        return "a_4_aac.mp4";
+    }
+}
diff --git a/tests/tests/media/src/android/media/cts/SoundPoolOggTest.java b/tests/tests/media/src/android/media/cts/SoundPoolOggTest.java
new file mode 100644
index 0000000..14bb47e
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/SoundPoolOggTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media.cts;
+
+import com.android.cts.stub.R;
+
+public class SoundPoolOggTest extends SoundPoolTest {
+
+    @Override
+    protected int getSoundA() {
+        return R.raw.a_4;
+    }
+
+    @Override
+    protected int getSoundCs() {
+        return R.raw.c_sharp_5;
+    }
+
+    @Override
+    protected int getSoundE() {
+        return R.raw.e_5;
+    }
+
+    @Override
+    protected int getSoundB() {
+        return R.raw.b_5;
+    }
+
+    @Override
+    protected int getSoundGs() {
+        return R.raw.g_sharp_5;
+    }
+
+    @Override
+    protected String getFileName() {
+        return "a_4.ogg";
+    }
+}
diff --git a/tests/tests/media/src/android/media/cts/SoundPoolTest.java b/tests/tests/media/src/android/media/cts/SoundPoolTest.java
index 2764c8b..d5b33b4 100644
--- a/tests/tests/media/src/android/media/cts/SoundPoolTest.java
+++ b/tests/tests/media/src/android/media/cts/SoundPoolTest.java
@@ -36,29 +36,46 @@
 import java.io.InputStream;
 
 @TestTargetClass(SoundPool.class)
-public class SoundPoolTest extends AndroidTestCase {
+abstract class SoundPoolTest extends AndroidTestCase {
 
     private static final int SOUNDPOOL_STREAMS = 4;
-    private static final int SOUND_A = R.raw.a_4;
-    private static final int SOUND_CS = R.raw.c_sharp_5;
-    private static final int SOUND_E = R.raw.e_5;
-    private static final int SOUND_B = R.raw.b_5;
-    private static final int SOUND_GS = R.raw.g_sharp_5;
     private static final int PRIORITY = 1;
     private static final int LOUD = 20;
     private static final int QUIET = LOUD / 2;
     private static final int SILENT = 0;
-
-    private static final int[] SOUNDS = { SOUND_A, SOUND_CS, SOUND_E, SOUND_B, SOUND_GS };
-
-    private static final String FILE_NAME = "a_4.ogg";
     private File mFile;
     private SoundPool mSoundPool;
 
+    /**
+     * function to return resource ID for A4 sound.
+     * should be implemented by child class
+     * @return resource ID
+     */
+    protected abstract int getSoundA();
+
+    protected abstract int getSoundCs();
+
+    protected abstract int getSoundE();
+
+    protected abstract int getSoundB();
+
+    protected abstract int getSoundGs();
+
+    protected abstract String getFileName();
+
+    private int[] getSounds() {
+        int[] sounds = { getSoundA(),
+                         getSoundCs(),
+                         getSoundE(),
+                         getSoundB(),
+                         getSoundGs() };
+        return sounds;
+    }
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-        mFile = new File(mContext.getFilesDir(), FILE_NAME);
+        mFile = new File(mContext.getFilesDir(), getFileName());
     }
 
     @Override
@@ -110,12 +127,12 @@
     public void testLoad() throws Exception {
         int srcQuality = 100;
         mSoundPool = new SoundPool(SOUNDPOOL_STREAMS, AudioManager.STREAM_MUSIC, srcQuality);
-        int sampleId1 = mSoundPool.load(mContext, SOUND_A, PRIORITY);
+        int sampleId1 = mSoundPool.load(mContext, getSoundA(), PRIORITY);
         waitUntilLoaded(sampleId1);
         // should return true, but returns false
         mSoundPool.unload(sampleId1);
 
-        AssetFileDescriptor afd = mContext.getResources().openRawResourceFd(SOUND_CS);
+        AssetFileDescriptor afd = mContext.getResources().openRawResourceFd(getSoundCs());
         int sampleId2;
         sampleId2 = mSoundPool.load(afd, PRIORITY);
         waitUntilLoaded(sampleId2);
@@ -141,7 +158,7 @@
         FileOutputStream fOutput = null;
         try {
             fOutput = new FileOutputStream(f);
-            InputStream is = mContext.getResources().openRawResource(SOUND_A);
+            InputStream is = mContext.getResources().openRawResource(getSoundA());
             byte[] buffer = new byte[1024];
             int length = is.read(buffer);
             while (length != -1) {
@@ -211,7 +228,7 @@
     public void testSoundPoolOp() throws Exception {
         int srcQuality = 100;
         mSoundPool = new SoundPool(SOUNDPOOL_STREAMS, AudioManager.STREAM_MUSIC, srcQuality);
-        int sampleID = loadSampleSync(SOUND_A, PRIORITY);
+        int sampleID = loadSampleSync(getSoundA(), PRIORITY);
 
         int waitMsec = 1000;
         float leftVolume = SILENT;
@@ -276,8 +293,8 @@
     public void testMultiSound() throws Exception {
         int srcQuality = 100;
         mSoundPool = new SoundPool(SOUNDPOOL_STREAMS, AudioManager.STREAM_MUSIC, srcQuality);
-        int sampleID1 = loadSampleSync(SOUND_A, PRIORITY);
-        int sampleID2 = loadSampleSync(SOUND_CS, PRIORITY);
+        int sampleID1 = loadSampleSync(getSoundA(), PRIORITY);
+        int sampleID2 = loadSampleSync(getSoundCs(), PRIORITY);
         long waitMsec = 1000;
         Thread.sleep(waitMsec);
 
@@ -317,10 +334,11 @@
     })
     public void testLoadMore() throws Exception {
         mSoundPool = new SoundPool(SOUNDPOOL_STREAMS, AudioManager.STREAM_MUSIC, 0);
-        int[] soundIds = new int[SOUNDS.length];
-        int[] streamIds = new int[SOUNDS.length];
-        for (int i = 0; i < SOUNDS.length; i++) {
-            soundIds[i] = loadSampleSync(SOUNDS[i], PRIORITY);
+        int[] sounds = getSounds();
+        int[] soundIds = new int[sounds.length];
+        int[] streamIds = new int[sounds.length];
+        for (int i = 0; i < sounds.length; i++) {
+            soundIds[i] = loadSampleSync(sounds[i], PRIORITY);
             System.out.println("load: " + soundIds[i]);
         }
         for (int i = 0; i < soundIds.length; i++) {
diff --git a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
index 4c4d82c..a90d48d 100644
--- a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
@@ -183,10 +183,26 @@
                     "/data/dalvik-cache",
                     "/data/data/.drm",
                     "/data/data/.drm/.wmdrm",
+                    "/data/data/cw",
+                    "/data/data/com.android.htcprofile",
+                    "/data/data/com.htc.android.qxdm2sd",
+                    "/data/data/com.htc.android.qxdm2sd/bin",
+                    "/data/data/com.htc.android.qxdm2sd/data",
+                    "/data/data/com.htc.android.qxdm2sd/tmp",
+                    "/data/data/com.htc.android.netlogger/data",
+                    "/data/data/com.htc.messagecs/att",
+                    "/data/data/com.htc.messagecs/pdu",
+                    "/data/data/com.htc.loggers/bin",
+                    "/data/data/com.htc.loggers/data",
+                    "/data/data/com.htc.loggers/htclog",
+                    "/data/data/com.htc.loggers/tmp",
+                    "/data/data/com.htc.loggers/htcghost",
+                    "/data/data/com.android.providers.drm/rights",
                     "/data/dontpanic",
                     "/data/drm",
                     "/data/drm/rights",
                     "/data/dump",
+                    "/data/htcfs",
                     "/data/local",
                     "/data/local/tmp/com.nuance.android.vsuite.vsuiteapp",
                     "/data/log",
@@ -204,11 +220,13 @@
                     "/data/wiper",
                     "/data/wpstiles",
                     "/dbdata/databases",
+                    "/efs/.android",
                     "/mnt_ext",
                     "/mnt_ext/badablk2",
                     "/mnt_ext/badablk3",
                     "/mnt_ext/cache",
-                    "/mnt_ext/data"
+                    "/mnt_ext/data",
+                    "/system/etc/security/drm"
             )
     );
 
diff --git a/tests/tests/security/src/android/security/cts/VoldExploitTest.java b/tests/tests/security/src/android/security/cts/VoldExploitTest.java
index 8fbf874..3957bbe 100644
--- a/tests/tests/security/src/android/security/cts/VoldExploitTest.java
+++ b/tests/tests/security/src/android/security/cts/VoldExploitTest.java
@@ -25,7 +25,9 @@
 import android.os.storage.StorageManager;
 import android.test.AndroidTestCase;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
@@ -50,8 +52,7 @@
      * is the typical failure for this test.
      */
     public void testZergRushCrash() throws Exception {
-        Set<Integer> pids = getPids();
-        assertTrue(pids.size() > 1);  // at least vold and netd should exist
+        int pid = findVold();
 
         StorageManager sm = (StorageManager) getContext().getSystemService(Context.STORAGE_SERVICE);
         try {
@@ -63,19 +64,17 @@
                     + "AAAA AAAA AAAA AAAA"
                     + "AAAA AAAA AAAA AAAA"
                     + "AAAA AAAA AAAA AAAA");
-            fail("Should have gotten an IllegalStateException");
         } catch (IllegalStateException e) {
             // expected
         }
 
-        // Check to see if all the processes are still alive.  If
-        // any of them have died, we found an exploitable bug.
-        for (int i : pids) {
-            assertTrue(
-                    "PID=" + i + " crashed due to a malformed mount message."
-                    + " Detected unpatched ZergRush vulnerability (CVE-2011-3874).",
-                    new File("/proc/" + i + "/cmdline").exists());
-        }
+        Thread.sleep(2000);  // give vold some time to crash
+
+        // Check to see if vold is still alive.
+        assertTrue(
+                "PID=" + pid + " crashed due to a malformed mount message."
+                        + " Detected unpatched ZergRush vulnerability (CVE-2011-3874).",
+                new File("/proc/" + pid + "/cmdline").exists());
     }
 
     /**
@@ -91,15 +90,14 @@
      *
      * This test accomplishes the same thing as {@link #testZergRushCrash()}
      */
-    public void testZergRushUsingRelection() {
+    public void testZergRushUsingRelection() throws Exception {
         // This test assumes we have the MOUNT_UNMOUNT_FILESYSTEMS permission
         // Check it first so we know we're reaching the vulnerable code.
         assertEquals(PackageManager.PERMISSION_GRANTED,
                 getContext().checkCallingOrSelfPermission(
                         android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS));
 
-        Set<Integer> pids = getPids();
-        assertTrue(pids.size() > 1);  // at least vold and netd should exist
+        int pid = findVold();
 
         try {
             Object iBinderObj = Class.forName("android.os.ServiceManager")
@@ -143,14 +141,13 @@
             // remote failure. Assume not exploitable.
         }
 
-        // Check to see if all the processes are still alive.  If
-        // any of them have died, we found an exploitable bug.
-        for (int i : pids) {
-            assertTrue(
-                    "PID=" + i + " crashed due to a malformed mount message."
-                    + " Detected unpatched ZergRush vulnerability (CVE-2011-3874).",
-                    new File("/proc/" + i + "/cmdline").exists());
-        }
+        Thread.sleep(2000);  // give vold some time to crash
+
+        // Check to see if vold is still alive.
+        assertTrue(
+                "PID=" + pid + " crashed due to a malformed mount message."
+                        + " Detected unpatched ZergRush vulnerability (CVE-2011-3874).",
+                new File("/proc/" + pid + "/cmdline").exists());
     }
 
     /**
@@ -282,6 +279,29 @@
         }
     }
 
+    private static int findVold() throws IOException {
+        File f = new File("/proc");
+        for (File d : f.listFiles()) {
+            String cmdLineString = d.getAbsolutePath() + "/cmdline";
+            File cmdLine = new File(cmdLineString);
+            if (cmdLine.exists()) {
+                BufferedReader in = null;
+                try {
+                    in = new BufferedReader(new FileReader(cmdLine));
+                    String line = in.readLine();
+                    if ((line != null) && line.startsWith("/system/bin/vold")) {
+                        return Integer.decode(d.getName());
+                    }
+                } finally {
+                    if (in != null) {
+                        in.close();
+                    }
+                }
+            }
+        }
+        throw new RuntimeException("should never get here");
+    }
+
     /**
      * Extract all the PIDs listening for netlink messages.
      */
diff --git a/tools/utils/host_config.xml b/tools/utils/host_config.xml
index 661b1a3..1a99e75 100644
--- a/tools/utils/host_config.xml
+++ b/tools/utils/host_config.xml
@@ -34,7 +34,7 @@
     <!-- Max time [ms] from start of package in batch mode and the first test status update. -->
     <IntValue name="batchStartTimeoutMs" value="1800000" />
     <!-- Max time [ms] from start of test in individual mode to the first test status update. -->
-    <IntValue name="individualStartTimeoutMs" value="300000" />
+    <IntValue name="individualStartTimeoutMs" value="600000" />
     <!-- Timeout [ms] for the signature check. -->
     <IntValue name="signatureTestTimeoutMs" value="600000" />
     <!-- Timeout [ms] for package installations. -->