2nd attempt handle BT is not supported on emulator am: 59287d40d1

am: de3d9a0a73

Change-Id: I27c16d76f25480a36b5b73cdcb3042cee7754a5f
This commit is contained in:
ryanywlin
2018-06-08 11:33:53 -07:00
committed by android-build-merger
2 changed files with 10 additions and 0 deletions

View File

@@ -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();
} }

View File

@@ -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();
} }