Skip to content

Commit 500afb8

Browse files
Eric RoweAndroid (Google) Code Review
authored andcommitted
Merge "Fix SCO start stop tests." into ics-mr1
2 parents a6f8ebc + fca8e9d commit 500afb8

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

core/tests/bluetoothtests/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
<uses-permission android:name="android.permission.BLUETOOTH" />
2121
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
22+
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
23+
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
2224
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
2325
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
2426
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />

core/tests/bluetoothtests/src/android/bluetooth/BluetoothStressTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
public class BluetoothStressTest extends InstrumentationTestCase {
3333
private static final String TAG = "BluetoothStressTest";
3434
private static final String OUTPUT_FILE = "BluetoothStressTestOutput.txt";
35+
/** The amount of time to sleep between issuing start/stop SCO in ms. */
36+
private static final long SCO_SLEEP_TIME = 2 * 1000;
3537

3638
private BluetoothTestUtils mTestUtils;
3739

@@ -380,11 +382,20 @@ public void testStartStopSco() {
380382
for (int i = 0; i < iterations; i++) {
381383
mTestUtils.writeOutput("startStopSco iteration " + (i + 1) + " of " + iterations);
382384
mTestUtils.startSco(adapter, device);
385+
sleep(SCO_SLEEP_TIME);
383386
mTestUtils.stopSco(adapter, device);
387+
sleep(SCO_SLEEP_TIME);
384388
}
385389

386390
mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.HEADSET, null);
387391
mTestUtils.unpair(adapter, device);
388392
mTestUtils.disable(adapter);
389393
}
394+
395+
private void sleep(long time) {
396+
try {
397+
Thread.sleep(time);
398+
} catch (InterruptedException e) {
399+
}
400+
}
390401
}

core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ private ConnectPanReceiver getConnectPanReceiver(BluetoothDevice device, int rol
14251425
}
14261426

14271427
private StartStopScoReceiver getStartStopScoReceiver(int expectedFlags) {
1428-
String[] actions = {AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED};
1428+
String[] actions = {AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED};
14291429
StartStopScoReceiver receiver = new StartStopScoReceiver(expectedFlags);
14301430
addReceiver(receiver, actions);
14311431
return receiver;

0 commit comments

Comments
 (0)