Explain test need 5 passes.

Add explanitory text to info panel and UI to communicate
the requirement for 5 taps.

As CDD latency value is STRONGLY RECOMMENED, allow
test pass after 5 iterations even if the latency is > 80ms.

Bug: 189289501
Test: build, install, run, verifiy the new text and UI.
Change-Id: I397eb1056b6968047eec26b23fda7444fc884bdf
diff --git a/apps/CtsVerifier/res/layout/audio_tap2tone_activity.xml b/apps/CtsVerifier/res/layout/audio_tap2tone_activity.xml
index 66548b2..65994c0 100644
--- a/apps/CtsVerifier/res/layout/audio_tap2tone_activity.xml
+++ b/apps/CtsVerifier/res/layout/audio_tap2tone_activity.xml
@@ -69,6 +69,13 @@
             android:textSize="20sp"
             android:textStyle="bold"/>
 
+        <TextView
+            android:id="@+id/tap2tone_phaseInfo"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textSize="20sp"
+            android:textStyle="bold"/>
+
         <Button
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index d26a00c..5d599de 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -5229,12 +5229,17 @@
     <!-- AudioTap2Tone test -->
     <string name="audio_tap2tone">Audio Tap To Tone Test</string>
     <string name="audio_tap2tone_info">This tests the latency from a screen interaction to a
-        resulting tone. This time is a combination of touch screen latency and audio latency\nSelect
+        resulting tone. This time is a combination of touch screen latency and audio latency.\nThis
+        test is best conducted in a quiet room with the device laying on a table. Select
         the Audio API to test and press the \"Start\" button. Use your fingernail to tap on the
-        field below to trigger the test tone. Results will be displayed in the field.</string>
-    <string name="audio_tap2tone_spec">80ms average is required to pass.</string>
+        field below to trigger the test tone. Results will be displayed in the field above the
+        waveform display.\nFive successful tests runs are required to determine if the test
+        as a whole succeeds.
+    </string>
+    <string name="audio_tap2tone_spec">80ms or less average latency is STRONGLY RECOMMENDED to pass.</string>
     <string name="audio_tap2tone_too_few">Not enough edges. Use fingernail.</string>
-    <string name="audio_tap2tone_too_many">Too many edges. Use fingernail.</string>
+    <string name="audio_tap2tone_too_many">Too many edges. Use fingernail. Ensure there is
+    no background noise.</string>
 
     <!-- Strings for 6DoF test -->
     <string name="six_dof_test">6DoF Test</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioTap2ToneActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioTap2ToneActivity.java
index 1dd9fd6..04cfa7c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioTap2ToneActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioTap2ToneActivity.java
@@ -78,6 +78,7 @@
     private TextView mSpecView;
     private TextView mResultsView;
     private TextView mStatsView;
+    private TextView mPhaseView;
 
     private WaveformView mWaveformView;
 
@@ -150,6 +151,7 @@
         mSpecView = (TextView) findViewById(R.id.tap2tone_specTxt);
         mResultsView = (TextView) findViewById(R.id.tap2tone_resultTxt);
         mStatsView = (TextView) findViewById(R.id.tap2tone_statsTxt);
+        mPhaseView = (TextView) findViewById(R.id.tap2tone_phaseInfo);
 
         mWaveformView = (WaveformView) findViewById(R.id.tap2tone_waveView);
         // Start a blip test when the waveform view is tapped.
@@ -190,7 +192,6 @@
     }
 
     private void startAudio() {
-        Log.i(TAG, "---- startAudio() mIsRecording:" + mIsRecording);
         if (mIsRecording) {
             return;
         }
@@ -206,7 +207,6 @@
         mDuplexAudioManager.start();
 
         mBlipSource = (AudioSource) mDuplexAudioManager.getAudioSource();
-        Log.i(TAG, "---- smBlipSource:" + mBlipSource);
 
         mIsRecording = true;
         enableAudioButtons();
@@ -246,15 +246,21 @@
     }
 
     private void calculateTestPass() {
+        // 80ms is currently STRONGLY RECOMMENDED, so pass the test as long as they have run it.
+        boolean testCompleted = mTestPhase >= NUM_TEST_PHASES;
         boolean pass = mLatencyAve[mActiveTestAPI] != 0
-                && mTestPhase >= NUM_TEST_PHASES
                 && mLatencyAve[mActiveTestAPI] <= MAX_TAP_2_TONE_LATENCY;
 
-        if (pass) {
-            mSpecView.setText("Ave: " + mLatencyAve[mActiveTestAPI] + " ms <= "
-                    + MAX_TAP_2_TONE_LATENCY + " ms -- PASS");
+        if (testCompleted) {
+            if (pass) {
+                mSpecView.setText("Ave: " + mLatencyAve[mActiveTestAPI] + " ms <= "
+                        + MAX_TAP_2_TONE_LATENCY + " ms -- PASS");
+            } else {
+                mSpecView.setText("Ave: " + mLatencyAve[mActiveTestAPI] + " ms > "
+                        + MAX_TAP_2_TONE_LATENCY + " ms -- DOES NOT MEET STRONGLY RECOMMENDED");
+            }
         }
-        getPassButton().setEnabled(pass);
+        getPassButton().setEnabled(testCompleted);
     }
 
     private void recordTestStatus() {
@@ -352,6 +358,8 @@
         mResultsView.setText("Phase: " + mTestPhase + " : " + latencyMillis
                 + " ms, Ave: " + mLatencyAve[mActiveTestAPI] + " ms");
         mStatsView.setText("Deviation: " + String.format("%.2f",meanAbsoluteDeviation));
+
+        mPhaseView.setText("" + mTestPhase + " of " + NUM_TEST_PHASES + " completed.");
     }
 
     private void analyzeCapturedAudio() {