Loading core/tests/bluetoothtests/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BROADCAST_STICKY" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> Loading core/tests/bluetoothtests/src/android/bluetooth/BluetoothStressTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ import android.test.InstrumentationTestCase; public class BluetoothStressTest extends InstrumentationTestCase { private static final String TAG = "BluetoothStressTest"; private static final String OUTPUT_FILE = "BluetoothStressTestOutput.txt"; /** The amount of time to sleep between issuing start/stop SCO in ms. */ private static final long SCO_SLEEP_TIME = 2 * 1000; private BluetoothTestUtils mTestUtils; Loading Loading @@ -380,11 +382,20 @@ public class BluetoothStressTest extends InstrumentationTestCase { for (int i = 0; i < iterations; i++) { mTestUtils.writeOutput("startStopSco iteration " + (i + 1) + " of " + iterations); mTestUtils.startSco(adapter, device); sleep(SCO_SLEEP_TIME); mTestUtils.stopSco(adapter, device); sleep(SCO_SLEEP_TIME); } mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.HEADSET, null); mTestUtils.unpair(adapter, device); mTestUtils.disable(adapter); } private void sleep(long time) { try { Thread.sleep(time); } catch (InterruptedException e) { } } } core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -1425,7 +1425,7 @@ public class BluetoothTestUtils extends Assert { } private StartStopScoReceiver getStartStopScoReceiver(int expectedFlags) { String[] actions = {AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED}; String[] actions = {AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED}; StartStopScoReceiver receiver = new StartStopScoReceiver(expectedFlags); addReceiver(receiver, actions); return receiver; Loading Loading
core/tests/bluetoothtests/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BROADCAST_STICKY" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> Loading
core/tests/bluetoothtests/src/android/bluetooth/BluetoothStressTest.java +11 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ import android.test.InstrumentationTestCase; public class BluetoothStressTest extends InstrumentationTestCase { private static final String TAG = "BluetoothStressTest"; private static final String OUTPUT_FILE = "BluetoothStressTestOutput.txt"; /** The amount of time to sleep between issuing start/stop SCO in ms. */ private static final long SCO_SLEEP_TIME = 2 * 1000; private BluetoothTestUtils mTestUtils; Loading Loading @@ -380,11 +382,20 @@ public class BluetoothStressTest extends InstrumentationTestCase { for (int i = 0; i < iterations; i++) { mTestUtils.writeOutput("startStopSco iteration " + (i + 1) + " of " + iterations); mTestUtils.startSco(adapter, device); sleep(SCO_SLEEP_TIME); mTestUtils.stopSco(adapter, device); sleep(SCO_SLEEP_TIME); } mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.HEADSET, null); mTestUtils.unpair(adapter, device); mTestUtils.disable(adapter); } private void sleep(long time) { try { Thread.sleep(time); } catch (InterruptedException e) { } } }
core/tests/bluetoothtests/src/android/bluetooth/BluetoothTestUtils.java +1 −1 Original line number Diff line number Diff line Loading @@ -1425,7 +1425,7 @@ public class BluetoothTestUtils extends Assert { } private StartStopScoReceiver getStartStopScoReceiver(int expectedFlags) { String[] actions = {AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED}; String[] actions = {AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED}; StartStopScoReceiver receiver = new StartStopScoReceiver(expectedFlags); addReceiver(receiver, actions); return receiver; Loading