Merge "Fix gestures summary text when there is no sensor for assit." into oc-mr1-dev

This commit is contained in:
TreeHugger Robot
2017-07-27 00:50:10 +00:00
committed by Android (Google) Code Review
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) {
if (!mFeatureProvider.isSensorAvailable(mContext)) {
preference.setSummary("");
return;
}
final ContentResolver contentResolver = mContext.getContentResolver();
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);
}
@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("");
}
}