Adding "help/info" panels to USB Audio Perifpheral CTS tests.

Bug: 35784252

Test: manual
Change-Id: Ib63d9b7b8034d2a3451965cda2c3f3ff3788425d
diff --git a/apps/CtsVerifier/res/layout/uap_attribs_panel.xml b/apps/CtsVerifier/res/layout/uap_attribs_panel.xml
index ea4e719..6c33d9f 100644
--- a/apps/CtsVerifier/res/layout/uap_attribs_panel.xml
+++ b/apps/CtsVerifier/res/layout/uap_attribs_panel.xml
@@ -7,21 +7,19 @@
 
 <LinearLayout android:orientation="vertical"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="wrap_content">
 
     <include layout="@layout/uap_profile_header"/>
 
     <LinearLayout
         android:orientation="vertical"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        >
+        android:layout_height="match_parent">
 
         <TextView
             android:text="@string/uapPeripheralProfileStatus"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            />
+            android:layout_height="wrap_content"/>
 
         <TextView
             android:text="status"
@@ -29,7 +27,12 @@
             android:layout_height="wrap_content"
             android:id="@+id/uap_attribsStatusTx"
             android:paddingLeft="16dp"/>
-    </LinearLayout>
+        </LinearLayout>
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/usbaudio_results_text"/>
 
     <include layout="@layout/pass_fail_buttons"/>
 </LinearLayout>
diff --git a/apps/CtsVerifier/res/layout/uap_buttons_panel.xml b/apps/CtsVerifier/res/layout/uap_buttons_panel.xml
index 2aeaca2..3da7247 100644
--- a/apps/CtsVerifier/res/layout/uap_buttons_panel.xml
+++ b/apps/CtsVerifier/res/layout/uap_buttons_panel.xml
@@ -16,11 +16,19 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
+         <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
         <TextView
             android:text="@string/uapButtonTestInstructions"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
+         <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
         <TextView
             android:text="@string/uapButtonsBtnALbl"
             android:id="@+id/uap_buttonsBtnALabelTx"
@@ -35,6 +43,10 @@
             android:id="@+id/uap_buttonsBtnAStatusTx"
             android:paddingLeft="16dp"/>
 
+         <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
         <TextView
             android:text="@string/uapButtonsBtnBLbl"
             android:id="@+id/uap_buttonsBtnBLabelTx"
@@ -49,6 +61,10 @@
             android:id="@+id/uap_buttonsBtnBStatusTx"
             android:paddingLeft="16dp"/>
 
+         <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
         <TextView
             android:text="@string/uapButtonsBtnCLbl"
             android:id="@+id/uap_buttonsBtnCLabelTx"
@@ -63,6 +79,10 @@
             android:id="@+id/uap_buttonsBtnCStatusTx"
             android:paddingLeft="16dp"/>
 
+         <Space
+            android:layout_width="match_parent"
+            android:layout_height="5dp"/>
+
         <TextView
             android:text="@string/uapButtonsBtnDLbl"
             android:id="@+id/uap_buttonsBtnDLabelTx"
@@ -76,8 +96,17 @@
             android:layout_height="wrap_content"
             android:id="@+id/uap_buttonsBtnDStatusTx"
             android:paddingLeft="16dp"/>
+
+         <Space
+            android:layout_width="match_parent"
+            android:layout_height="5dp"/>
         </LinearLayout>
 
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/usbaudio_results_text"/>
+
     <include layout="@layout/pass_fail_buttons"/>
 </LinearLayout>
 </ScrollView>
\ No newline at end of file
diff --git a/apps/CtsVerifier/res/layout/uap_play_panel.xml b/apps/CtsVerifier/res/layout/uap_play_panel.xml
index 1cb469a..2faa50c 100644
--- a/apps/CtsVerifier/res/layout/uap_play_panel.xml
+++ b/apps/CtsVerifier/res/layout/uap_play_panel.xml
@@ -16,11 +16,19 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
+         <Space
+            android:layout_width="match_parent"
+            android:layout_height="5dp"/>
+
         <TextView
             android:text="@string/uapPlayTestInstructions"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
+         <Space
+            android:layout_width="match_parent"
+            android:layout_height="5dp"/>
+
         <Button
             android:text="@string/audio_uap_play_playBtn"
             android:layout_width="match_parent"
@@ -28,7 +36,13 @@
             android:id="@+id/uap_playPlayBtn"
             android:nextFocusUp="@+id/fail_button"
             android:nextFocusDown="@+id/pass_button"/>
-    </LinearLayout>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/usbaudio_results_text"/>
+
+        </LinearLayout>
 
     <include layout="@layout/pass_fail_buttons"/>
 </LinearLayout>
diff --git a/apps/CtsVerifier/res/layout/uap_record_panel.xml b/apps/CtsVerifier/res/layout/uap_record_panel.xml
index 5277389..2deb738 100644
--- a/apps/CtsVerifier/res/layout/uap_record_panel.xml
+++ b/apps/CtsVerifier/res/layout/uap_record_panel.xml
@@ -16,11 +16,19 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
+         <Space
+            android:layout_width="match_parent"
+            android:layout_height="5dp"/>
+
         <TextView
             android:text="@string/uapRecordTestInstructions"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
+         <Space
+            android:layout_width="match_parent"
+            android:layout_height="5dp"/>
+
         <Button
             android:text="@string/audio_uap_record_recordBtn"
             android:layout_width="match_parent"
@@ -38,11 +46,20 @@
             android:nextFocusDown="@+id/pass_button"/>
         </LinearLayout>
 
+     <Space
+        android:layout_width="match_parent"
+        android:layout_height="5dp"/>
+
     <com.android.cts.verifier.audio.audiolib.WaveScopeView
         android:id="@+id/uap_recordWaveView"
         android:layout_width="match_parent"
         android:layout_height="256dp"/>
 
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/usbaudio_results_text"/>
+
     <include layout="@layout/pass_fail_buttons"/>
 
 </LinearLayout>
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 139555c..417b48f 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -3340,8 +3340,8 @@
     <string name="uapPeripheralProfileStatus">Peripheral Profile Status</string>
 
     <string name="audio_uap_play_test">USB Audio Peripheral Play Test</string>
-    <string name="uapPlayTestInstructions">Connect the USB Audio Peripheral and press the PLAY button below.
-        Verify that a tone is correctly played.</string>
+    <string name="uapPlayTestInstructions">Connect the USB Audio Interface Peripheral and press the
+        PLAY button below. Verify that a tone is correctly played.</string>
     <string name="audio_uap_play_playBtn">Play</string>
     <string name="audio_uap_play_stopBtn">Stop</string>
 
@@ -3685,4 +3685,37 @@
     <string name="ringtone_hidden">Ringtone settings does not exist</string>
     <string name="ringtone_not_hidden">Ringtone settings exists</string>
 
+    <!-- USB Audio Peripheral Tests -->
+    <string name="usbaudio_results_text">Results...</string>
+
+    <!-- USB Audio Peripheral Attributes Test -->
+    <string name="usbaudio_attribs_test"> USB Audio Peripheral Attributes Test</string>
+    <string name="usbaudio_attribs_info">
+        This test requires that you have connected a mandated USB Audio Interface peripheral.
+        If the discovered attributes of the peripheral matches the known attributes of the
+        peripheral the test passes and the \"pass\" button will be enabled.
+       </string>
+
+    <!-- USB Audio Peripheral Play Test -->
+    <string name="usbaudio_play_test"> USB Audio Peripheral Play Test</string>
+    <string name="usbaudio_play_info">
+        This test requires that you have connected a mandated USB Audio Interface peripheral and
+        some way to monitor the output. Press the \"Play\" button and verify that a tone is produced.
+       </string>
+
+    <!-- USB Audio Peripheral Record Test -->
+    <string name="usbaudio_record_test"> USB Audio Peripheral Record Test</string>
+    <string name="usbaudio_record_info">
+        This test requires that you have connected a mandated USB Audio Interface peripheral.
+        Connect the outputs to the inputs (with patch cables). Start playback by pressing the
+        \"Record Loopback\" button and verify that the recorded signal is displayed in the wave
+        display view. ()It may be necessary to adjust the input controls on the peripheral).
+       </string>
+
+    <!-- USB Audio Peripheral Buttons Test -->
+    <string name="usbaudio_buttons_test"> USB Audio Peripheral Buttons Test</string>
+    <string name="usbaudio_buttons_info">
+        This test requires that you have connected a mandated USB Audio headset. Press each
+        \"transport\" button and verify that it is recognized by the test.
+       </string>
 </resources>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java
index f0c75c4..6ed38e3 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java
@@ -42,6 +42,7 @@
         mTestStatusTx = (TextView)findViewById(R.id.uap_attribsStatusTx);
 
         setPassFailButtonClickListeners();
+        setInfoResources(R.string.usbaudio_attribs_test, R.string.usbaudio_attribs_info, -1);
     }
 
     //
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralButtonsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralButtonsActivity.java
index fbaf877..4718db0 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralButtonsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralButtonsActivity.java
@@ -65,6 +65,7 @@
         mBtnDStatusTxt = (TextView)findViewById(R.id.uap_buttonsBtnDStatusTx);
 
         setPassFailButtonClickListeners();
+        setInfoResources(R.string.usbaudio_buttons_test, R.string.usbaudio_buttons_info, -1);
     }
 
     private void showButtonsState() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayActivity.java
index c2b3b2c..5389afb 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayActivity.java
@@ -45,6 +45,7 @@
         setupPlayer();
 
         setPassFailButtonClickListeners();
+        setInfoResources(R.string.usbaudio_play_test, R.string.usbaudio_play_info, -1);
     }
 
     //
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayerActivity.java
index 675d658..33417d1 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayerActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayerActivity.java
@@ -74,4 +74,11 @@
     public boolean isPlaying() {
         return mIsPlaying;
     }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+
+        stopPlay();
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java
index 41350c9..428c475 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java
@@ -129,6 +129,7 @@
         mWaveView.setTraceColor(Color.WHITE);
 
         setPassFailButtonClickListeners();
+        setInfoResources(R.string.usbaudio_record_test, R.string.usbaudio_record_info, -1);
     }
 
     //
@@ -193,5 +194,12 @@
             }
         }
     }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+
+        stopPlay();
+    }
 }