Some Audio Quality Verifier Fixes

- Add WRITE_EXTERNAL_STORAGE permissions to be able to store the
  samples onto the SD card
- Fixed a wrong path to the pink noise samples
- Center the buttons of the Audio Quality Verifier

Change-Id: I366c2a811da6bc8faa753cc23ff7d60050cc3459
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 60ebf63..24e9fdc 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -21,9 +21,12 @@
       android:versionName="1.0">
       
     <uses-sdk android:minSdkVersion="5"></uses-sdk>
-    
-    <uses-permission android:name="android.permission.WAKE_LOCK" />
+
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+    
+    <!-- Needed by the Audio Quality Verifier to store the sound samples that will be mailed. -->
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 
     <application android:label="@string/app_name">
 
@@ -58,7 +61,7 @@
         </activity>
 
         <activity android:name=".sensors.AccelerometerTestActivity" android:label="@string/snsr_accel_test"
-        android:screenOrientation="nosensor">
+                android:screenOrientation="nosensor">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
@@ -67,7 +70,7 @@
         </activity>
 
         <activity android:name=".sensors.MagnetometerTestActivity" android:label="@string/snsr_mag_test"
-        android:screenOrientation="nosensor">
+                android:screenOrientation="nosensor">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
@@ -76,8 +79,7 @@
         </activity>
 
       <activity android:name=".audioquality.AudioQualityVerifierActivity"
-                android:label="@string/aq_verifier"
-                android:screenOrientation="portrait">
+              android:label="@string/aq_verifier">
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.cts.intent.category.MANUAL_TEST" />
diff --git a/apps/CtsVerifier/res/layout/aq_verifier_activity.xml b/apps/CtsVerifier/res/layout/aq_verifier_activity.xml
index 12703ee..3961e92 100644
--- a/apps/CtsVerifier/res/layout/aq_verifier_activity.xml
+++ b/apps/CtsVerifier/res/layout/aq_verifier_activity.xml
@@ -41,8 +41,9 @@
     </FrameLayout>
 
     <LinearLayout
+        android:gravity="center_horizontal"
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginTop="10px"
         android:layout_marginBottom="10px"
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/AudioAssets.java b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/AudioAssets.java
index 9725a4c..7b7d427 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/AudioAssets.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/AudioAssets.java
@@ -34,7 +34,7 @@
     }
 
     public static byte[] getPinkNoise(Context context, int ampl, int duration) {
-        return readAsset(context, "pink_" + ampl + "_" + duration + "s");
+        return readAsset(context, "audioquality/pink_" + ampl + "_" + duration + "s");
     }
 
     private static byte[] readAsset(Context context, String filename) {
@@ -43,7 +43,7 @@
         try {
             ais = assetManager.open(filename);
         } catch (IOException e) {
-            Log.e(TAG, "Cannot load asset " + filename);
+            Log.e(TAG, "Cannot load asset " + filename, e);
             return null;
         }
         byte[] buffer = Utils.readFile(ais);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Utils.java b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Utils.java
index 885e18c..5774782 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Utils.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audioquality/Utils.java
@@ -234,7 +234,7 @@
             fos.write(data);
             fos.close();
         } catch (IOException e) {
-            Log.e(TAG, "Error writing to file " + filename);
+            Log.e(TAG, "Error writing to file " + filename, e);
         }
     }