Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68d6c80a authored by Qi Cao's avatar Qi Cao Committed by Android (Google) Code Review
Browse files

Merge "Made following changes to Settings:"

parents a03b6695 17ff2b25
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4983,6 +4983,9 @@
    <!-- Summary text for keyboards when no layout has been selected. [CHAR LIMIT=35] -->
    <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] -->
    <string name="pointer_speed">Pointer speed</string>
+17 −11
Original line number Diff line number Diff line
@@ -38,8 +38,6 @@
                android:name="classname"
                android:value="com.android.settings.applications.appinfo.AppLocaleDetails" />
        </Preference>


    </PreferenceCategory>

    <PreferenceCategory
@@ -50,6 +48,7 @@
            android:title="@string/virtual_keyboard_category"
            android:fragment="com.android.settings.inputmethod.AvailableVirtualKeyboardFragment"
            settings:keywords="@string/keywords_virtual_keyboard"/>

        <Preference
            android:key="physical_keyboard_pref"
            android:title="@string/physical_keyboard_title"
@@ -57,6 +56,21 @@
            android:fragment="com.android.settings.inputmethod.PhysicalKeyboardFragment"/>
    </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
        android:key="input_assistance_category"
        android:title="@string/input_assistance">
@@ -79,20 +93,12 @@
    </PreferenceCategory>

    <PreferenceCategory
        android:key="pointer_and_tts_category"
        android:key="pointer_category"
        android:layout="@layout/preference_category_no_label">

        <com.android.settings.PointerSpeedPreference
            android:key="pointer_speed"
            android:title="@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>

    <SwitchPreference
+0 −5
Original line number Diff line number Diff line
@@ -49,11 +49,6 @@
        android:title="@string/assist_flash_title"
        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
        android:key="manage_assist_footer"
        android:title="@string/assist_footer"
+0 −1
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ public class ManageAssist extends DashboardFragment {
        controllers.add(new AssistContextPreferenceController(context, lifecycle));
        controllers.add(new AssistScreenshotPreferenceController(context, lifecycle));
        controllers.add(new AssistFlashScreenPreferenceController(context, lifecycle));
        controllers.add(new DefaultVoiceInputPreferenceController(context, lifecycle));
        return controllers;
    }

+12 −8
Original line number Diff line number Diff line
/*
 * 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");
 * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.settings.applications.assist;
package com.android.settings.language;

import android.app.settings.SettingsEnums;
import android.content.ComponentName;
@@ -31,6 +31,7 @@ import com.android.settingslib.applications.DefaultAppInfo;
import java.util.ArrayList;
import java.util.List;

/** Controls the Voice Input setting. */
public class DefaultVoiceInputPicker extends DefaultAppPickerFragment {

    private VoiceInputHelper mHelper;
@@ -76,7 +77,7 @@ public class DefaultVoiceInputPicker extends DefaultAppPickerFragment {
    @Override
    protected boolean setDefaultKey(String value) {
        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.VOICE_RECOGNITION_SERVICE, value);
                return true;
@@ -85,35 +86,38 @@ public class DefaultVoiceInputPicker extends DefaultAppPickerFragment {
        return true;
    }

    /** Gets the current recognition service component. */
    public static ComponentName getCurrentService(VoiceInputHelper helper) {
        return helper.mCurrentRecognizer;
    }

    /** Stores the info of the Voice Input provider. */
    public static class VoiceInputDefaultAppInfo extends DefaultAppInfo {

        public VoiceInputHelper.BaseInfo mInfo;

        public VoiceInputDefaultAppInfo(Context context, PackageManager pm, int userId,
                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;
        }

        @Override
        public String getKey() {
            return mInfo.key;
            return mInfo.mKey;
        }

        @Override
        public CharSequence loadLabel() {
            return mInfo.label;
            return mInfo.mLabel;
        }

        /** Gets the setting intent. */
        public Intent getSettingIntent() {
            if (mInfo.settings == null) {
            if (mInfo.mSettings == null) {
                return null;
            }
            return new Intent(Intent.ACTION_MAIN).setComponent(mInfo.settings);
            return new Intent(Intent.ACTION_MAIN).setComponent(mInfo.mSettings);
        }
    }
}
Loading