2nd attempt handle BT is not supported on emulator
am: 59287d40d1
Change-Id: I843fc58484df106af09cae87dcb886ea49aa53ea
This commit is contained in:
@@ -170,12 +170,20 @@ public abstract class AudioSwitchPreferenceController extends BasePreferenceCont
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
|
if (mLocalBluetoothManager == null) {
|
||||||
|
Log.e(TAG, "Bluetooth is not supported on this device");
|
||||||
|
return;
|
||||||
|
}
|
||||||
mLocalBluetoothManager.setForegroundActivity(mContext);
|
mLocalBluetoothManager.setForegroundActivity(mContext);
|
||||||
register();
|
register();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
|
if (mLocalBluetoothManager == null) {
|
||||||
|
Log.e(TAG, "Bluetooth is not supported on this device");
|
||||||
|
return;
|
||||||
|
}
|
||||||
mLocalBluetoothManager.setForegroundActivity(null);
|
mLocalBluetoothManager.setForegroundActivity(null);
|
||||||
unregister();
|
unregister();
|
||||||
}
|
}
|
||||||
|
@@ -186,6 +186,8 @@ public class AudioOutputSwitchPreferenceControllerTest {
|
|||||||
|
|
||||||
AudioSwitchPreferenceController controller = new AudioSwitchPreferenceControllerTestable(
|
AudioSwitchPreferenceController controller = new AudioSwitchPreferenceControllerTestable(
|
||||||
mContext, TEST_KEY);
|
mContext, TEST_KEY);
|
||||||
|
controller.onStart();
|
||||||
|
controller.onStop();
|
||||||
|
|
||||||
assertThat(mLocalBluetoothManager).isNull();
|
assertThat(mLocalBluetoothManager).isNull();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user