Fix gestures summary text when there is no sensor for assit.

Should exit the summary handling if sensor is not available.

Change-Id: I5918fa5ac614db48fc2c41e1de555d1ba6928bd4
Fix: 64039312
Test: make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2017-07-26 11:07:19 -07:00
parent bd429f42cb
commit 9042f822a6
2 changed files with 13 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ public class GesturesSettingPreferenceController extends AbstractPreferenceContr
public void updateState(Preference preference) { public void updateState(Preference preference) {
if (!mFeatureProvider.isSensorAvailable(mContext)) { if (!mFeatureProvider.isSensorAvailable(mContext)) {
preference.setSummary(""); preference.setSummary("");
return;
} }
final ContentResolver contentResolver = mContext.getContentResolver(); final ContentResolver contentResolver = mContext.getContentResolver();
final boolean assistGestureEnabled = Settings.Secure.getInt( final boolean assistGestureEnabled = Settings.Secure.getInt(

View File

@@ -119,4 +119,16 @@ public class GesturesSettingsPreferenceControllerTest {
verify(mActivity).getString(R.string.language_input_gesture_summary_on_non_assist); verify(mActivity).getString(R.string.language_input_gesture_summary_on_non_assist);
} }
@Test
@Config(shadows = {ShadowSecureSettings.class})
public void updateState_sensorNotAvailable_shouldSetToEmptyStatus() {
final FakeFeatureFactory featureFactory =
(FakeFeatureFactory) FakeFeatureFactory.getFactory(mActivity);
when(featureFactory.assistGestureFeatureProvider.isSensorAvailable(any(Context.class)))
.thenReturn(false);
mController.updateState(mPreference);
verify(mPreference).setSummary("");
}
} }