Refactored "Audio Devices Notifications" and "Audio Routing Notifications" testing into separate Input & Output flavors.
Bug: 24298086
Bug: 24300680
Change-Id: Ifdad6edd3b9e19920e5979eb06ad1371a0d45fa2
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index e1d4eb0..ea16821 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -1708,8 +1708,8 @@
<meta-data android:name="test_required_features" android:value="android.hardware.microphone" />
</activity>
- <activity android:name=".audio.AudioDeviceNotificationsActivity"
- android:label="@string/audio_devices_notifications_test">
+ <activity android:name=".audio.AudioOutputDeviceNotificationsActivity"
+ android:label="@string/audio_in_devices_notifications_test">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.cts.intent.category.MANUAL_TEST" />
@@ -1718,18 +1718,37 @@
<!--
<meta-data android:name="test_required_features" android:value="android.hardware.microphone" />
-->
+ <meta-data android:name="test_required_features" android:value="android.hardware.audio.output" />
</activity>
- <activity android:name=".audio.AudioRoutingNotificationsActivity"
- android:label="@string/audio_routingnotifications_test">
+ <activity android:name=".audio.AudioInputDeviceNotificationsActivity"
+ android:label="@string/audio_in_devices_notifications_test">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_audio" />
- <!--
<meta-data android:name="test_required_features" android:value="android.hardware.microphone" />
- -->
+ </activity>
+
+ <activity android:name=".audio.AudioOutputRoutingNotificationsActivity"
+ android:label="@string/audio_output_routingnotifications_test">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+ <meta-data android:name="test_category" android:value="@string/test_category_audio" />
+ <meta-data android:name="test_required_features" android:value="android.hardware.audio.output" />
+ </activity>
+
+ <activity android:name=".audio.AudioInputRoutingNotificationsActivity"
+ android:label="@string/audio_input_routingnotifications_test">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+ <meta-data android:name="test_category" android:value="@string/test_category_audio" />
+ <meta-data android:name="test_required_features" android:value="android.hardware.microphone" />
</activity>
<activity android:name=".audio.AudioLoopbackActivity"
diff --git a/apps/CtsVerifier/res/layout/audio_dev_notify.xml b/apps/CtsVerifier/res/layout/audio_dev_notify.xml
index 98dbd8b..0975ab9 100644
--- a/apps/CtsVerifier/res/layout/audio_dev_notify.xml
+++ b/apps/CtsVerifier/res/layout/audio_dev_notify.xml
@@ -24,8 +24,7 @@
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:gravity="bottom"
- android:id="@+id/info_text"
- android:text="@string/audio_devices_notification_instructions" />
+ android:id="@+id/info_text"/>
<LinearLayout
android:layout_width="match_parent"
diff --git a/apps/CtsVerifier/res/layout/audio_routingnotifications_test.xml b/apps/CtsVerifier/res/layout/audio_input_routingnotifications_test.xml
similarity index 64%
copy from apps/CtsVerifier/res/layout/audio_routingnotifications_test.xml
copy to apps/CtsVerifier/res/layout/audio_input_routingnotifications_test.xml
index cef30d6..ca7dd19 100644
--- a/apps/CtsVerifier/res/layout/audio_routingnotifications_test.xml
+++ b/apps/CtsVerifier/res/layout/audio_input_routingnotifications_test.xml
@@ -26,40 +26,7 @@
android:scrollbars="vertical"
android:gravity="bottom"
android:id="@+id/info_text"
- android:text="@string/audio_dev_routingnotification_instructions" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:id="@+id/audioTrackRoutingLayout">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/audio_routingnotification_playHeader"/>
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/audio_routingnotification_audioTrack_change"/>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/audio_routingnotification_playBtn"
- android:text="@string/audio_routingnotification_playBtn"/>
-
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/audio_routingnotification_playStopBtn"
- android:text="@string/audio_routingnotification_playStopBtn"/>
- </LinearLayout>
- </LinearLayout>
+ android:text="@string/audio_input_routingnotification_instructions" />
<LinearLayout
android:layout_width="match_parent"
diff --git a/apps/CtsVerifier/res/layout/audio_routingnotifications_test.xml b/apps/CtsVerifier/res/layout/audio_output_routingnotifications_test.xml
similarity index 64%
rename from apps/CtsVerifier/res/layout/audio_routingnotifications_test.xml
rename to apps/CtsVerifier/res/layout/audio_output_routingnotifications_test.xml
index cef30d6..b321000 100644
--- a/apps/CtsVerifier/res/layout/audio_routingnotifications_test.xml
+++ b/apps/CtsVerifier/res/layout/audio_output_routingnotifications_test.xml
@@ -26,7 +26,7 @@
android:scrollbars="vertical"
android:gravity="bottom"
android:id="@+id/info_text"
- android:text="@string/audio_dev_routingnotification_instructions" />
+ android:text="@string/audio_output_routingnotification_instructions" />
<LinearLayout
android:layout_width="match_parent"
@@ -61,39 +61,6 @@
</LinearLayout>
</LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:id="@+id/audioRecordRoutingLayout">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/audio_routingnotification_recHeader"/>
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/audio_routingnotification_audioRecord_change"/>
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:id="@+id/audio_routingnotification_recordBtn"
- android:text="@string/audio_routingnotification_recBtn"/>
-
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/audio_routingnotification_recordStopBtn"
- android:text="@string/audio_routingnotification_recStopBtn"/>
- </LinearLayout>
- </LinearLayout>
-
<include layout="@layout/pass_fail_buttons" />
</LinearLayout>
\ No newline at end of file
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 1c4ec06..d8a96eb 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -2040,25 +2040,34 @@
<string name="error_screen_pinning_did_not_exit">Screen was not unpinned.</string>
<string name="error_screen_pinning_couldnt_exit">Could not exit screen pinning through API.</string>
- <!-- Audio Devices Notifcations Test -->
- <string name="audio_devices_notifications_test">Audio Devices Notifications Test</string>
- <string name="audio_devices_notification_instructions">
+ <!-- Audio Devices Notifcations Tests -->
+ <string name="audio_out_devices_notifications_test">Audio Output Devices Notifications Test</string>
+ <string name="audio_out_devices_notification_instructions">
Click the "Clear Messages" button then connect and disconnect a wired headset.
Note if the appropriate notification messages appear below.
</string>
+ <string name="audio_in_devices_notifications_test">Audio Input Devices Notifications Test</string>
+ <string name="audio_in_devices_notification_instructions">
+ Click the "Clear Messages" button then connect and disconnect a microphone or wired headset.
+ Note if the appropriate notification messages appear below.
+ </string>
<string name="audio_dev_notification_clearmsgs">Clear Messages</string>
<string name="audio_dev_notification_connectMsg">CONNECT DETECTED</string>
<string name="audio_dev_notification_disconnectMsg">DISCONNECT DETECTED</string>
- <!-- Audio Routing Notifcations Test -->
- <string name="audio_routingnotifications_test">Audio Routing Notifications Test</string>
- <string name="audio_dev_routingnotification_instructions">
- Click on the "Play" button in the AudioTrack Routing Notifictions section below to
+ <string name="audio_input_routingnotifications_test">Audio Input Routing Notifications Test</string>
+ <string name="audio_input_routingnotification_instructions">
+ Click on the "Record" button in the AudioRecord Routing Notifications section below to
+ start recording. Insert a wired headset or microphone. Observe a message acknowledging the
+ rerouting event below. Remove the wired headset and observe the new routing message.
+ Click on the "Stop" button to stop recording.\n
+ </string>
+ <string name="audio_output_routingnotifications_test">Audio Output Routing Notifications Test</string>
+ <string name="audio_output_routingnotification_instructions">
+ Click on the "Play" button in the AudioTrack Routing Notifications section below to
start (silent) playback. Insert a wired headset. Observe a message acknowledging the
rerouting event below. Remove the wired headset and observe the new routing message.
Click on the "Stop" button to stop playback.\n
- Repeat the process with "Record" and "Stop" button in the AudioRecord Routing
- Notifications section below.
</string>
<string name="audio_routingnotification_playBtn">Play</string>
<string name="audio_routingnotification_playStopBtn">Stop</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDeviceNotificationsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioInputDeviceNotificationsActivity.java
similarity index 86%
copy from apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDeviceNotificationsActivity.java
copy to apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioInputDeviceNotificationsActivity.java
index 93e0507..3513774 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDeviceNotificationsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioInputDeviceNotificationsActivity.java
@@ -34,10 +34,10 @@
import android.widget.TextView;
/**
- * Tests Audio Device Connection events by prompting the user to insert/remove a wired headset
- * and noting the presence (or absence) of notifictions.
+ * Tests Audio Device Connection events for output by prompting the user to insert/remove a
+ * wired headset (or microphone) and noting the presence (or absence) of notifications.
*/
-public class AudioDeviceNotificationsActivity extends PassFailButtons.Activity {
+public class AudioInputDeviceNotificationsActivity extends PassFailButtons.Activity {
Context mContext;
TextView mConnectView;
@@ -71,6 +71,9 @@
mConnectView = (TextView)findViewById(R.id.audio_dev_notification_connect_msg);
mDisconnectView = (TextView)findViewById(R.id.audio_dev_notification_disconnect_msg);
+ ((TextView)findViewById(R.id.info_text)).setText(mContext.getResources().getString(
+ R.string.audio_in_devices_notification_instructions));
+
mClearMsgsBtn = (Button)findViewById(R.id.audio_dev_notification_connect_clearmsgs_btn);
mClearMsgsBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioRoutingNotificationsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioInputRoutingNotificationsActivity.java
similarity index 63%
rename from apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioRoutingNotificationsActivity.java
rename to apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioInputRoutingNotificationsActivity.java
index 47bc48a..cdc8199 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioRoutingNotificationsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioInputRoutingNotificationsActivity.java
@@ -25,7 +25,6 @@
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.media.AudioRecord;
-import android.media.AudioTrack;
import android.os.Bundle;
import android.os.Handler;
@@ -39,33 +38,23 @@
import android.widget.TextView;
/**
- * Tests AudioTrack and AudioRecord (re)Routing messages.
+ * Tests AudioRecord (re)Routing messages.
*/
-public class AudioRoutingNotificationsActivity extends PassFailButtons.Activity {
- private static final String TAG = "AudioRoutingNotificationsActivity";
+public class AudioInputRoutingNotificationsActivity extends PassFailButtons.Activity {
+ private static final String TAG = "AudioInputRoutingNotificationsActivity";
Context mContext;
- OnBtnClickListener mBtnClickListener = new OnBtnClickListener();
-
- int mNumTrackNotifications = 0;
int mNumRecordNotifications = 0;
- TrivialPlayer mAudioPlayer = new TrivialPlayer();
+ OnBtnClickListener mBtnClickListener = new OnBtnClickListener();
+
TrivialRecorder mAudioRecorder = new TrivialRecorder();
private class OnBtnClickListener implements OnClickListener {
@Override
public void onClick(View v) {
switch (v.getId()) {
- case R.id.audio_routingnotification_playBtn:
- mAudioPlayer.start();
- break;
-
- case R.id.audio_routingnotification_playStopBtn:
- mAudioPlayer.stop();
- break;
-
case R.id.audio_routingnotification_recordBtn:
mAudioRecorder.start();
break;
@@ -77,22 +66,6 @@
}
}
- private class AudioTrackRoutingChangeListener implements AudioTrack.OnRoutingChangedListener {
- public void onRoutingChanged(AudioTrack audioTrack) {
- mNumTrackNotifications++;
- TextView textView =
- (TextView)findViewById(R.id.audio_routingnotification_audioTrack_change);
- String msg = mContext.getResources().getString(
- R.string.audio_routingnotification_trackRoutingMsg);
- AudioDeviceInfo routedDevice = audioTrack.getRoutedDevice();
- CharSequence deviceName = routedDevice != null ? routedDevice.getProductName() : "none";
- int deviceType = routedDevice != null ? routedDevice.getType() : -1;
- textView.setText(msg + " - " +
- deviceName + " [0x" + Integer.toHexString(deviceType) + "]" +
- " - " + mNumTrackNotifications);
- }
- }
-
private class AudioRecordRoutingChangeListener implements AudioRecord.OnRoutingChangedListener {
public void onRoutingChanged(AudioRecord audioRecord) {
mNumRecordNotifications++;
@@ -112,13 +85,9 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.audio_routingnotifications_test);
+ setContentView(R.layout.audio_input_routingnotifications_test);
Button btn;
- btn = (Button)findViewById(R.id.audio_routingnotification_playBtn);
- btn.setOnClickListener(mBtnClickListener);
- btn = (Button)findViewById(R.id.audio_routingnotification_playStopBtn);
- btn.setOnClickListener(mBtnClickListener);
btn = (Button)findViewById(R.id.audio_routingnotification_recordBtn);
btn.setOnClickListener(mBtnClickListener);
btn = (Button)findViewById(R.id.audio_routingnotification_recordStopBtn);
@@ -126,10 +95,6 @@
mContext = this;
- AudioTrack audioTrack = mAudioPlayer.getAudioTrack();
- audioTrack.addOnRoutingChangedListener(
- new AudioTrackRoutingChangeListener(), new Handler());
-
AudioRecord audioRecord = mAudioRecorder.getAudioRecord();
audioRecord.addOnRoutingChangedListener(
new AudioRecordRoutingChangeListener(), new Handler());
@@ -139,7 +104,6 @@
@Override
public void onBackPressed () {
- mAudioPlayer.shutDown();
mAudioRecorder.shutDown();
super.onBackPressed();
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDeviceNotificationsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioOutputDeviceNotificationsActivity.java
similarity index 86%
rename from apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDeviceNotificationsActivity.java
rename to apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioOutputDeviceNotificationsActivity.java
index 93e0507..a64ddc4 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDeviceNotificationsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioOutputDeviceNotificationsActivity.java
@@ -34,10 +34,10 @@
import android.widget.TextView;
/**
- * Tests Audio Device Connection events by prompting the user to insert/remove a wired headset
- * and noting the presence (or absence) of notifictions.
+ * Tests Audio Device Connection events for output devices by prompting the user to
+ * insert/remove a wired headset and noting the presence (or absence) of notifications.
*/
-public class AudioDeviceNotificationsActivity extends PassFailButtons.Activity {
+public class AudioOutputDeviceNotificationsActivity extends PassFailButtons.Activity {
Context mContext;
TextView mConnectView;
@@ -71,6 +71,9 @@
mConnectView = (TextView)findViewById(R.id.audio_dev_notification_connect_msg);
mDisconnectView = (TextView)findViewById(R.id.audio_dev_notification_disconnect_msg);
+ ((TextView)findViewById(R.id.info_text)).setText(mContext.getResources().getString(
+ R.string.audio_out_devices_notification_instructions));
+
mClearMsgsBtn = (Button)findViewById(R.id.audio_dev_notification_connect_clearmsgs_btn);
mClearMsgsBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioRoutingNotificationsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioOutputRoutingNotificationsActivity.java
similarity index 63%
copy from apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioRoutingNotificationsActivity.java
copy to apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioOutputRoutingNotificationsActivity.java
index 47bc48a..bfc3d45 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioRoutingNotificationsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioOutputRoutingNotificationsActivity.java
@@ -24,7 +24,6 @@
import android.media.AudioDeviceCallback;
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
-import android.media.AudioRecord;
import android.media.AudioTrack;
import android.os.Bundle;
@@ -41,18 +40,16 @@
/**
* Tests AudioTrack and AudioRecord (re)Routing messages.
*/
-public class AudioRoutingNotificationsActivity extends PassFailButtons.Activity {
- private static final String TAG = "AudioRoutingNotificationsActivity";
+public class AudioOutputRoutingNotificationsActivity extends PassFailButtons.Activity {
+ private static final String TAG = "AudioOutputRoutingNotificationsActivity";
Context mContext;
OnBtnClickListener mBtnClickListener = new OnBtnClickListener();
int mNumTrackNotifications = 0;
- int mNumRecordNotifications = 0;
TrivialPlayer mAudioPlayer = new TrivialPlayer();
- TrivialRecorder mAudioRecorder = new TrivialRecorder();
private class OnBtnClickListener implements OnClickListener {
@Override
@@ -65,14 +62,6 @@
case R.id.audio_routingnotification_playStopBtn:
mAudioPlayer.stop();
break;
-
- case R.id.audio_routingnotification_recordBtn:
- mAudioRecorder.start();
- break;
-
- case R.id.audio_routingnotification_recordStopBtn:
- mAudioRecorder.stop();
- break;
}
}
}
@@ -93,36 +82,16 @@
}
}
- private class AudioRecordRoutingChangeListener implements AudioRecord.OnRoutingChangedListener {
- public void onRoutingChanged(AudioRecord audioRecord) {
- mNumRecordNotifications++;
- TextView textView =
- (TextView)findViewById(R.id.audio_routingnotification_audioRecord_change);
- String msg = mContext.getResources().getString(
- R.string.audio_routingnotification_recordRoutingMsg);
- AudioDeviceInfo routedDevice = audioRecord.getRoutedDevice();
- CharSequence deviceName = routedDevice != null ? routedDevice.getProductName() : "none";
- int deviceType = routedDevice != null ? routedDevice.getType() : -1;
- textView.setText(msg + " - " +
- deviceName + " [0x" + Integer.toHexString(deviceType) + "]" +
- " - " + mNumRecordNotifications);
- }
- }
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.audio_routingnotifications_test);
+ setContentView(R.layout.audio_output_routingnotifications_test);
Button btn;
btn = (Button)findViewById(R.id.audio_routingnotification_playBtn);
btn.setOnClickListener(mBtnClickListener);
btn = (Button)findViewById(R.id.audio_routingnotification_playStopBtn);
btn.setOnClickListener(mBtnClickListener);
- btn = (Button)findViewById(R.id.audio_routingnotification_recordBtn);
- btn.setOnClickListener(mBtnClickListener);
- btn = (Button)findViewById(R.id.audio_routingnotification_recordStopBtn);
- btn.setOnClickListener(mBtnClickListener);
mContext = this;
@@ -130,17 +99,12 @@
audioTrack.addOnRoutingChangedListener(
new AudioTrackRoutingChangeListener(), new Handler());
- AudioRecord audioRecord = mAudioRecorder.getAudioRecord();
- audioRecord.addOnRoutingChangedListener(
- new AudioRecordRoutingChangeListener(), new Handler());
-
setPassFailButtonClickListeners();
}
@Override
public void onBackPressed () {
mAudioPlayer.shutDown();
- mAudioRecorder.shutDown();
super.onBackPressed();
}
}