speech: Add on-device speech recognition settings entry
Currently under `Settings > System > Languages & input > Speech` there is a `Voice input` entry with a cog which starts the SSBG model manager settings activity. Under the same preference group another entry labeled `On-device recognition` is added which would open a similar model manager settings activity, but for the on-device recognizer. That settings activity is yet to be implemented. The new entry should appear only under the following conditions: - An on-device speech recognition service must be available in the system. - A speech recognition service with a proper settings activity meta-data must exist in the same package as the default on-device speech recognition service. Bug: 235457391 Test: Manual, already existing robotests Change-Id: I17208c8725500ccb3dd2fa51a12b003d32073c4e
This commit is contained in:
committed by
Aleksandar Kiridžić
parent
652e9ef651
commit
31473663f5
@@ -50,6 +50,7 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
|
||||
private static final String KEY_KEYBOARDS_CATEGORY = "keyboards_category";
|
||||
private static final String KEY_SPEECH_CATEGORY = "speech_category";
|
||||
private static final String KEY_ON_DEVICE_RECOGNITION = "odsr_settings";
|
||||
private static final String KEY_TEXT_TO_SPEECH = "tts_settings_summary";
|
||||
private static final String KEY_POINTER_CATEGORY = "pointer_category";
|
||||
|
||||
@@ -123,11 +124,21 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
||||
new DefaultVoiceInputPreferenceController(context, lifecycle);
|
||||
final TtsPreferenceController ttsPreferenceController =
|
||||
new TtsPreferenceController(context, KEY_TEXT_TO_SPEECH);
|
||||
final OnDeviceRecognitionPreferenceController onDeviceRecognitionPreferenceController =
|
||||
new OnDeviceRecognitionPreferenceController(context, KEY_ON_DEVICE_RECOGNITION);
|
||||
|
||||
controllers.add(defaultVoiceInputPreferenceController);
|
||||
controllers.add(ttsPreferenceController);
|
||||
controllers.add(new PreferenceCategoryController(context,
|
||||
KEY_SPEECH_CATEGORY).setChildren(
|
||||
Arrays.asList(defaultVoiceInputPreferenceController, ttsPreferenceController)));
|
||||
List<AbstractPreferenceController> speechCategoryChildren = new ArrayList<>(
|
||||
List.of(defaultVoiceInputPreferenceController, ttsPreferenceController));
|
||||
|
||||
if (onDeviceRecognitionPreferenceController.isAvailable()) {
|
||||
controllers.add(onDeviceRecognitionPreferenceController);
|
||||
speechCategoryChildren.add(onDeviceRecognitionPreferenceController);
|
||||
}
|
||||
|
||||
controllers.add(new PreferenceCategoryController(context, KEY_SPEECH_CATEGORY)
|
||||
.setChildren(speechCategoryChildren));
|
||||
|
||||
// Pointer
|
||||
final PointerSpeedController pointerController = new PointerSpeedController(context);
|
||||
|
Reference in New Issue
Block a user