From 59287d40d1f4668de1beadb684d34e8509edded3 Mon Sep 17 00:00:00 2001 From: ryanywlin Date: Fri, 8 Jun 2018 14:36:34 +0800 Subject: [PATCH 1/2] 2nd attempt handle BT is not supported on emulator Error handle before using LocalBluetoothManager in the onStart and onStop Bug: 80491267 Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j42 Change-Id: I47f7d3b7cddc2fbbafb8fb5cf0fb6adb2d0d2d55 --- .../settings/sound/AudioSwitchPreferenceController.java | 8 ++++++++ .../sound/AudioOutputSwitchPreferenceControllerTest.java | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/com/android/settings/sound/AudioSwitchPreferenceController.java b/src/com/android/settings/sound/AudioSwitchPreferenceController.java index 67236608df8..11caf45fc77 100644 --- a/src/com/android/settings/sound/AudioSwitchPreferenceController.java +++ b/src/com/android/settings/sound/AudioSwitchPreferenceController.java @@ -170,12 +170,20 @@ public abstract class AudioSwitchPreferenceController extends BasePreferenceCont @Override public void onStart() { + if (mLocalBluetoothManager == null) { + Log.e(TAG, "Bluetooth is not supported on this device"); + return; + } mLocalBluetoothManager.setForegroundActivity(mContext); register(); } @Override public void onStop() { + if (mLocalBluetoothManager == null) { + Log.e(TAG, "Bluetooth is not supported on this device"); + return; + } mLocalBluetoothManager.setForegroundActivity(null); unregister(); } diff --git a/tests/robotests/src/com/android/settings/sound/AudioOutputSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/sound/AudioOutputSwitchPreferenceControllerTest.java index 1140aee98fb..bd11a159ba0 100644 --- a/tests/robotests/src/com/android/settings/sound/AudioOutputSwitchPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/sound/AudioOutputSwitchPreferenceControllerTest.java @@ -186,6 +186,8 @@ public class AudioOutputSwitchPreferenceControllerTest { AudioSwitchPreferenceController controller = new AudioSwitchPreferenceControllerTestable( mContext, TEST_KEY); + controller.onStart(); + controller.onStop(); assertThat(mLocalBluetoothManager).isNull(); } From 78f0f781fabe22f8dc8bdc61abc79aee41291524 Mon Sep 17 00:00:00 2001 From: Beverly Date: Fri, 8 Jun 2018 10:44:05 -0400 Subject: [PATCH 2/2] Fix typo Test: manual Bug: 109925028 Change-Id: I87ec517249567123df1a8eace17109ed7e0bae2b --- res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 22ae939225b..1b5f12571da 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7421,7 +7421,7 @@ Messages, events & reminders - When Do Not Disturb is on, messages, reminders, and events will muted, except for the items you allow above. You can adjust messages settings to allow your friends, family, or other contacts to reach you. + When Do Not Disturb is on, messages, reminders, and events will be muted, except for the items you allow above. You can adjust messages settings to allow your friends, family, or other contacts to reach you. Done