Merge "Made following changes to Settings:"
This commit is contained in:
@@ -4983,6 +4983,9 @@
|
|||||||
<!-- Summary text for keyboards when no layout has been selected. [CHAR LIMIT=35] -->
|
<!-- Summary text for keyboards when no layout has been selected. [CHAR LIMIT=35] -->
|
||||||
<string name="default_keyboard_layout">Default</string>
|
<string name="default_keyboard_layout">Default</string>
|
||||||
|
|
||||||
|
<!-- Title for the 'Speech' preference category. [CHAR LIMIT=45] -->
|
||||||
|
<string name="speech_category_title">Speech</string>
|
||||||
|
|
||||||
<!-- On Languages & input settings screen, setting summary. Setting for mouse pointer speed. [CHAR LIMIT=35] -->
|
<!-- On Languages & input settings screen, setting summary. Setting for mouse pointer speed. [CHAR LIMIT=35] -->
|
||||||
<string name="pointer_speed">Pointer speed</string>
|
<string name="pointer_speed">Pointer speed</string>
|
||||||
|
|
||||||
|
@@ -38,8 +38,6 @@
|
|||||||
android:name="classname"
|
android:name="classname"
|
||||||
android:value="com.android.settings.applications.appinfo.AppLocaleDetails" />
|
android:value="com.android.settings.applications.appinfo.AppLocaleDetails" />
|
||||||
</Preference>
|
</Preference>
|
||||||
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
@@ -50,6 +48,7 @@
|
|||||||
android:title="@string/virtual_keyboard_category"
|
android:title="@string/virtual_keyboard_category"
|
||||||
android:fragment="com.android.settings.inputmethod.AvailableVirtualKeyboardFragment"
|
android:fragment="com.android.settings.inputmethod.AvailableVirtualKeyboardFragment"
|
||||||
settings:keywords="@string/keywords_virtual_keyboard"/>
|
settings:keywords="@string/keywords_virtual_keyboard"/>
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="physical_keyboard_pref"
|
android:key="physical_keyboard_pref"
|
||||||
android:title="@string/physical_keyboard_title"
|
android:title="@string/physical_keyboard_title"
|
||||||
@@ -57,6 +56,21 @@
|
|||||||
android:fragment="com.android.settings.inputmethod.PhysicalKeyboardFragment"/>
|
android:fragment="com.android.settings.inputmethod.PhysicalKeyboardFragment"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="speech_category"
|
||||||
|
android:title="@string/speech_category_title">
|
||||||
|
<com.android.settings.widget.GearPreference
|
||||||
|
android:key="voice_input_settings"
|
||||||
|
android:title="@string/voice_input_settings_title"
|
||||||
|
android:fragment="com.android.settings.language.DefaultVoiceInputPicker" />
|
||||||
|
|
||||||
|
<Preference
|
||||||
|
android:key="tts_settings_summary"
|
||||||
|
android:title="@string/tts_settings_title"
|
||||||
|
android:fragment="com.android.settings.tts.TextToSpeechSettings"
|
||||||
|
settings:searchable="false"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="input_assistance_category"
|
android:key="input_assistance_category"
|
||||||
android:title="@string/input_assistance">
|
android:title="@string/input_assistance">
|
||||||
@@ -79,20 +93,12 @@
|
|||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pointer_and_tts_category"
|
android:key="pointer_category"
|
||||||
android:layout="@layout/preference_category_no_label">
|
android:layout="@layout/preference_category_no_label">
|
||||||
|
|
||||||
<com.android.settings.PointerSpeedPreference
|
<com.android.settings.PointerSpeedPreference
|
||||||
android:key="pointer_speed"
|
android:key="pointer_speed"
|
||||||
android:title="@string/pointer_speed"
|
android:title="@string/pointer_speed"
|
||||||
android:dialogTitle="@string/pointer_speed" />
|
android:dialogTitle="@string/pointer_speed" />
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="tts_settings_summary"
|
|
||||||
android:title="@string/tts_settings_title"
|
|
||||||
android:fragment="com.android.settings.tts.TextToSpeechSettings"
|
|
||||||
settings:searchable="false"/>
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
@@ -49,11 +49,6 @@
|
|||||||
android:title="@string/assist_flash_title"
|
android:title="@string/assist_flash_title"
|
||||||
android:summary="@string/assist_flash_summary" />
|
android:summary="@string/assist_flash_summary" />
|
||||||
|
|
||||||
<com.android.settings.widget.GearPreference
|
|
||||||
android:key="voice_input_settings"
|
|
||||||
android:title="@string/voice_input_settings_title"
|
|
||||||
android:fragment="com.android.settings.applications.assist.DefaultVoiceInputPicker" />
|
|
||||||
|
|
||||||
<com.android.settingslib.widget.FooterPreference
|
<com.android.settingslib.widget.FooterPreference
|
||||||
android:key="manage_assist_footer"
|
android:key="manage_assist_footer"
|
||||||
android:title="@string/assist_footer"
|
android:title="@string/assist_footer"
|
||||||
|
@@ -73,7 +73,6 @@ public class ManageAssist extends DashboardFragment {
|
|||||||
controllers.add(new AssistContextPreferenceController(context, lifecycle));
|
controllers.add(new AssistContextPreferenceController(context, lifecycle));
|
||||||
controllers.add(new AssistScreenshotPreferenceController(context, lifecycle));
|
controllers.add(new AssistScreenshotPreferenceController(context, lifecycle));
|
||||||
controllers.add(new AssistFlashScreenPreferenceController(context, lifecycle));
|
controllers.add(new AssistFlashScreenPreferenceController(context, lifecycle));
|
||||||
controllers.add(new DefaultVoiceInputPreferenceController(context, lifecycle));
|
|
||||||
return controllers;
|
return controllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 The Android Open Source Project
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.settings.applications.assist;
|
package com.android.settings.language;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
@@ -31,6 +31,7 @@ import com.android.settingslib.applications.DefaultAppInfo;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/** Controls the Voice Input setting. */
|
||||||
public class DefaultVoiceInputPicker extends DefaultAppPickerFragment {
|
public class DefaultVoiceInputPicker extends DefaultAppPickerFragment {
|
||||||
|
|
||||||
private VoiceInputHelper mHelper;
|
private VoiceInputHelper mHelper;
|
||||||
@@ -76,7 +77,7 @@ public class DefaultVoiceInputPicker extends DefaultAppPickerFragment {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean setDefaultKey(String value) {
|
protected boolean setDefaultKey(String value) {
|
||||||
for (VoiceInputHelper.RecognizerInfo info : mHelper.mAvailableRecognizerInfos) {
|
for (VoiceInputHelper.RecognizerInfo info : mHelper.mAvailableRecognizerInfos) {
|
||||||
if (TextUtils.equals(value, info.key)) {
|
if (TextUtils.equals(value, info.mKey)) {
|
||||||
Settings.Secure.putString(getContext().getContentResolver(),
|
Settings.Secure.putString(getContext().getContentResolver(),
|
||||||
Settings.Secure.VOICE_RECOGNITION_SERVICE, value);
|
Settings.Secure.VOICE_RECOGNITION_SERVICE, value);
|
||||||
return true;
|
return true;
|
||||||
@@ -85,35 +86,38 @@ public class DefaultVoiceInputPicker extends DefaultAppPickerFragment {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Gets the current recognition service component. */
|
||||||
public static ComponentName getCurrentService(VoiceInputHelper helper) {
|
public static ComponentName getCurrentService(VoiceInputHelper helper) {
|
||||||
return helper.mCurrentRecognizer;
|
return helper.mCurrentRecognizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Stores the info of the Voice Input provider. */
|
||||||
public static class VoiceInputDefaultAppInfo extends DefaultAppInfo {
|
public static class VoiceInputDefaultAppInfo extends DefaultAppInfo {
|
||||||
|
|
||||||
public VoiceInputHelper.BaseInfo mInfo;
|
public VoiceInputHelper.BaseInfo mInfo;
|
||||||
|
|
||||||
public VoiceInputDefaultAppInfo(Context context, PackageManager pm, int userId,
|
public VoiceInputDefaultAppInfo(Context context, PackageManager pm, int userId,
|
||||||
VoiceInputHelper.BaseInfo info, boolean enabled) {
|
VoiceInputHelper.BaseInfo info, boolean enabled) {
|
||||||
super(context, pm, userId, info.componentName, null /* summary */, enabled);
|
super(context, pm, userId, info.mComponentName, null /* summary */, enabled);
|
||||||
mInfo = info;
|
mInfo = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return mInfo.key;
|
return mInfo.mKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CharSequence loadLabel() {
|
public CharSequence loadLabel() {
|
||||||
return mInfo.label;
|
return mInfo.mLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Gets the setting intent. */
|
||||||
public Intent getSettingIntent() {
|
public Intent getSettingIntent() {
|
||||||
if (mInfo.settings == null) {
|
if (mInfo.mSettings == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new Intent(Intent.ACTION_MAIN).setComponent(mInfo.settings);
|
return new Intent(Intent.ACTION_MAIN).setComponent(mInfo.mSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 The Android Open Source Project
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,13 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.settings.applications.assist;
|
package com.android.settings.language;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.net.Uri;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
@@ -33,8 +32,7 @@ import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
|||||||
import com.android.settingslib.core.lifecycle.events.OnPause;
|
import com.android.settingslib.core.lifecycle.events.OnPause;
|
||||||
import com.android.settingslib.core.lifecycle.events.OnResume;
|
import com.android.settingslib.core.lifecycle.events.OnResume;
|
||||||
|
|
||||||
import java.util.List;
|
/** Controller of the Voice Input preference. */
|
||||||
|
|
||||||
public class DefaultVoiceInputPreferenceController extends DefaultAppPreferenceController
|
public class DefaultVoiceInputPreferenceController extends DefaultAppPreferenceController
|
||||||
implements LifecycleObserver, OnResume, OnPause {
|
implements LifecycleObserver, OnResume, OnPause {
|
||||||
|
|
||||||
@@ -95,7 +93,7 @@ public class DefaultVoiceInputPreferenceController extends DefaultAppPreferenceC
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (VoiceInputHelper.RecognizerInfo info : mHelper.mAvailableRecognizerInfos) {
|
for (VoiceInputHelper.RecognizerInfo info : mHelper.mAvailableRecognizerInfos) {
|
||||||
if (TextUtils.equals(defaultKey, info.key)) {
|
if (TextUtils.equals(defaultKey, info.mKey)) {
|
||||||
return new DefaultVoiceInputPicker.VoiceInputDefaultAppInfo(mContext,
|
return new DefaultVoiceInputPicker.VoiceInputDefaultAppInfo(mContext,
|
||||||
mPackageManager, mUserId, info, true /* enabled */);
|
mPackageManager, mUserId, info, true /* enabled */);
|
||||||
}
|
}
|
@@ -47,8 +47,9 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
|||||||
private static final String TAG = "LangAndInputSettings";
|
private static final String TAG = "LangAndInputSettings";
|
||||||
|
|
||||||
private static final String KEY_KEYBOARDS_CATEGORY = "keyboards_category";
|
private static final String KEY_KEYBOARDS_CATEGORY = "keyboards_category";
|
||||||
|
private static final String KEY_SPEECH_CATEGORY = "speech_category";
|
||||||
private static final String KEY_TEXT_TO_SPEECH = "tts_settings_summary";
|
private static final String KEY_TEXT_TO_SPEECH = "tts_settings_summary";
|
||||||
private static final String KEY_POINTER_AND_TTS_CATEGORY = "pointer_and_tts_category";
|
private static final String KEY_POINTER_CATEGORY = "pointer_category";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
@@ -109,15 +110,22 @@ public class LanguageAndInputSettings extends DashboardFragment {
|
|||||||
Arrays.asList(virtualKeyboardPreferenceController,
|
Arrays.asList(virtualKeyboardPreferenceController,
|
||||||
physicalKeyboardPreferenceController)));
|
physicalKeyboardPreferenceController)));
|
||||||
|
|
||||||
// Pointer and Tts
|
// Speech
|
||||||
|
final DefaultVoiceInputPreferenceController defaultVoiceInputPreferenceController =
|
||||||
|
new DefaultVoiceInputPreferenceController(context, lifecycle);
|
||||||
final TtsPreferenceController ttsPreferenceController =
|
final TtsPreferenceController ttsPreferenceController =
|
||||||
new TtsPreferenceController(context, KEY_TEXT_TO_SPEECH);
|
new TtsPreferenceController(context, KEY_TEXT_TO_SPEECH);
|
||||||
|
controllers.add(defaultVoiceInputPreferenceController);
|
||||||
controllers.add(ttsPreferenceController);
|
controllers.add(ttsPreferenceController);
|
||||||
|
controllers.add(new PreferenceCategoryController(context,
|
||||||
|
KEY_SPEECH_CATEGORY).setChildren(
|
||||||
|
Arrays.asList(defaultVoiceInputPreferenceController, ttsPreferenceController)));
|
||||||
|
|
||||||
|
// Pointer
|
||||||
final PointerSpeedController pointerController = new PointerSpeedController(context);
|
final PointerSpeedController pointerController = new PointerSpeedController(context);
|
||||||
controllers.add(pointerController);
|
controllers.add(pointerController);
|
||||||
controllers.add(new PreferenceCategoryController(context,
|
controllers.add(new PreferenceCategoryController(context,
|
||||||
KEY_POINTER_AND_TTS_CATEGORY).setChildren(
|
KEY_POINTER_CATEGORY).setChildren(Arrays.asList(pointerController)));
|
||||||
Arrays.asList(pointerController, ttsPreferenceController)));
|
|
||||||
|
|
||||||
// Input Assistance
|
// Input Assistance
|
||||||
controllers.add(new SpellCheckerPreferenceController(context));
|
controllers.add(new SpellCheckerPreferenceController(context));
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2017 The Android Open Source Project
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.settings.applications.assist;
|
package com.android.settings.language;
|
||||||
|
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -39,40 +39,46 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/** Helper class of the Voice Input setting. */
|
||||||
public final class VoiceInputHelper {
|
public final class VoiceInputHelper {
|
||||||
static final String TAG = "VoiceInputHelper";
|
static final String TAG = "VoiceInputHelper";
|
||||||
final Context mContext;
|
final Context mContext;
|
||||||
|
|
||||||
final List<ResolveInfo> mAvailableRecognition;
|
final List<ResolveInfo> mAvailableRecognition;
|
||||||
|
|
||||||
// TODO: Remove this superclass as we only have 1 class now (RecognizerInfo).
|
/**
|
||||||
static public class BaseInfo implements Comparable {
|
* Base info of the Voice Input provider.
|
||||||
public final ServiceInfo service;
|
*
|
||||||
public final ComponentName componentName;
|
* TODO: Remove this superclass as we only have 1 class now (RecognizerInfo).
|
||||||
public final String key;
|
*/
|
||||||
public final ComponentName settings;
|
public static class BaseInfo implements Comparable<BaseInfo> {
|
||||||
public final CharSequence label;
|
public final ServiceInfo mService;
|
||||||
public final String labelStr;
|
public final ComponentName mComponentName;
|
||||||
public final CharSequence appLabel;
|
public final String mKey;
|
||||||
|
public final ComponentName mSettings;
|
||||||
|
public final CharSequence mLabel;
|
||||||
|
public final String mLabelStr;
|
||||||
|
public final CharSequence mAppLabel;
|
||||||
|
|
||||||
public BaseInfo(PackageManager pm, ServiceInfo _service, String _settings) {
|
public BaseInfo(PackageManager pm, ServiceInfo service, String settings) {
|
||||||
service = _service;
|
mService = service;
|
||||||
componentName = new ComponentName(_service.packageName, _service.name);
|
mComponentName = new ComponentName(service.packageName, service.name);
|
||||||
key = componentName.flattenToShortString();
|
mKey = mComponentName.flattenToShortString();
|
||||||
settings = _settings != null
|
mSettings = settings != null
|
||||||
? new ComponentName(_service.packageName, _settings) : null;
|
? new ComponentName(service.packageName, settings) : null;
|
||||||
label = _service.loadLabel(pm);
|
mLabel = service.loadLabel(pm);
|
||||||
labelStr = label.toString();
|
mLabelStr = mLabel.toString();
|
||||||
appLabel = _service.applicationInfo.loadLabel(pm);
|
mAppLabel = service.applicationInfo.loadLabel(pm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Object another) {
|
public int compareTo(BaseInfo another) {
|
||||||
return labelStr.compareTo(((BaseInfo) another).labelStr);
|
return mLabelStr.compareTo(another.mLabelStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public class RecognizerInfo extends BaseInfo {
|
/** Info of the speech recognizer (i.e. recognition service). */
|
||||||
|
public static class RecognizerInfo extends BaseInfo {
|
||||||
public final boolean mSelectableAsDefault;
|
public final boolean mSelectableAsDefault;
|
||||||
|
|
||||||
public RecognizerInfo(PackageManager pm,
|
public RecognizerInfo(PackageManager pm,
|
||||||
@@ -96,6 +102,7 @@ public final class VoiceInputHelper {
|
|||||||
PackageManager.GET_META_DATA);
|
PackageManager.GET_META_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Draws the UI of the Voice Input picker page. */
|
||||||
public void buildUi() {
|
public void buildUi() {
|
||||||
// Get the currently selected recognizer from the secure setting.
|
// Get the currently selected recognizer from the secure setting.
|
||||||
String currentSetting = Settings.Secure.getString(
|
String currentSetting = Settings.Secure.getString(
|
||||||
@@ -120,8 +127,8 @@ public final class VoiceInputHelper {
|
|||||||
try (XmlResourceParser parser = si.loadXmlMetaData(mContext.getPackageManager(),
|
try (XmlResourceParser parser = si.loadXmlMetaData(mContext.getPackageManager(),
|
||||||
RecognitionService.SERVICE_META_DATA)) {
|
RecognitionService.SERVICE_META_DATA)) {
|
||||||
if (parser == null) {
|
if (parser == null) {
|
||||||
throw new XmlPullParserException("No " + RecognitionService.SERVICE_META_DATA +
|
throw new XmlPullParserException("No " + RecognitionService.SERVICE_META_DATA
|
||||||
" meta-data for " + si.packageName);
|
+ " meta-data for " + si.packageName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Resources res = mContext.getPackageManager().getResourcesForApplication(
|
Resources res = mContext.getPackageManager().getResourcesForApplication(
|
||||||
@@ -132,6 +139,7 @@ public final class VoiceInputHelper {
|
|||||||
int type;
|
int type;
|
||||||
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
|
while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
|
||||||
&& type != XmlPullParser.START_TAG) {
|
&& type != XmlPullParser.START_TAG) {
|
||||||
|
// Intentionally do nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
String nodeName = parser.getName();
|
String nodeName = parser.getName();
|
Reference in New Issue
Block a user