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

Commit 87b90dfc authored by jasonwshsu's avatar jasonwshsu
Browse files

Improve search by adding the settings keywords for supported downloaded services

* Use FeatureFactory to improve the search only for google overlay

Bug: 184171842
Test: atest AccessibilitySettingsTest
Change-Id: I93ed52d2579b7da35dba59f9562b6715d13dd80d
parent b4f59a75
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -5853,29 +5853,29 @@
    <!-- List of synonyms used in the settings search bar to find the “Magnification”. [CHAR LIMIT=NONE] -->
    <string name="keywords_magnification">Window Magnifier, Zoom, Magnification, Low vision, Enlarge, make bigger</string>
    <!-- List of synonyms used in the settings search bar to find the “TalkBack”. [CHAR LIMIT=NONE] -->
    <string name="keywords_talkback">Screen reader, Voice Over, VoiceOver, Voice Assistance, Blind, Low Vision, TTS, text to speech, spoken feedback</string>
    <string name="keywords_talkback"></string>
    <!-- List of synonyms used in the settings search bar to find the “Live Caption”. [CHAR LIMIT=NONE] -->
    <string name="keywords_live_caption">Captions, closed captions, CC, Live Transcribe, hard of hearing, hearing loss, CART, speech to text, subtitle</string>
    <!-- List of synonyms used in the settings search bar to find the “Live Transcribe”. [CHAR LIMIT=NONE] -->
    <string name="keywords_live_transcribe">Captions, closed captions, CC, Live Caption, hard of hearing, hearing loss, CART, speech to text, subtitle</string>
    <string name="keywords_live_transcribe"></string>
    <!-- List of synonyms used in the settings search bar to find the “Sound Notifications”. [CHAR LIMIT=NONE] -->
    <string name="keywords_sound_notifications">Notifications, hard of hearing, hearing loss, notify</string>
    <string name="keywords_sound_notifications"></string>
    <!-- List of synonyms used in the settings search bar to find the “Sound Amplifier”. [CHAR LIMIT=NONE] -->
    <string name="keywords_sound_amplifier">PSAP, amplify, sound amplification, hard of hearing, hearing loss, amplification</string>
    <string name="keywords_sound_amplifier"></string>
    <!-- List of synonyms used in the settings search bar to find the “Display size”. [CHAR LIMIT=NONE] -->
    <string name="keywords_display_size">screen size, large screen</string>
    <!-- List of synonyms used in the settings search bar to find the “Bold text”. [CHAR LIMIT=NONE] -->
    <string name="keywords_bold_text">High contrast, low vision, bold font, bold face</string>
    <!-- List of synonyms used in the settings search bar to find the “Select to Speak”. [CHAR LIMIT=NONE] -->
    <string name="keywords_select_to_speak">Hear text, read aloud, speak screen, screen reader</string>
    <string name="keywords_select_to_speak"></string>
    <!-- List of synonyms used in the settings search bar to find the “Color correction”. [CHAR LIMIT=NONE] -->
    <string name="keywords_color_correction">adjust color </string>
    <!-- List of synonyms used in the settings search bar to find the “Color inversion”. [CHAR LIMIT=NONE] -->
    <string name="keywords_color_inversion">turn screen dark, turn screen light</string>
    <!-- List of synonyms used in the settings search bar to find the “Accessibility Menu”. [CHAR LIMIT=NONE] -->
    <string name="keywords_accessibility_menu">motor, quick menu, assistive menu, touch, dexterity</string>
    <string name="keywords_accessibility_menu"></string>
    <!-- List of synonyms used in the settings search bar to find the “Switch Access”. [CHAR LIMIT=NONE] -->
    <string name="keywords_switch_access">motor, switch, hand, AT, assistive technology, paralysis, ALS, scanning, step scanning</string>
    <string name="keywords_switch_access"></string>
    <!-- List of synonyms used in the settings search bar to find the “Autoclick(dwell timing)”. [CHAR LIMIT=NONE] -->
    <string name="keywords_auto_click">motor, mouse</string>
    <!-- List of synonyms used in the settings search bar to find the “Hearing aids”. [CHAR LIMIT=NONE] -->
@@ -5883,7 +5883,7 @@
    <!-- List of synonyms used in the settings search bar to find the “Real-time text (RTT)”. [CHAR LIMIT=NONE] -->
    <string name="keywords_rtt">hard of hearing, hearing loss, captions, Teletype, tty</string>
    <!-- List of synonyms used in the settings search bar to find the “Voice Access”. [CHAR LIMIT=NONE] -->
    <string name="keywords_voice_access">voice, voice control, motor, hand, mic, microphone, dictation, talk, control</string>
    <string name="keywords_voice_access"></string>
    <!-- Printing settings -->
    <skip />
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.accessibility;

import android.content.Context;

import com.android.settingslib.search.SearchIndexableRaw;

import java.util.List;

/**
 * Provider for Accessibility Search related features.
 */
public interface AccessibilitySearchFeatureProvider {

    /**
     * Returns a list of raw data for indexing. See {@link SearchIndexableRaw}
     *
     * @param context a valid context {@link Context} instance
     * @return a list of {@link SearchIndexableRaw} references. Can be null.
     */
    List<SearchIndexableRaw> getSearchIndexableRawData(Context context);
}
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.settings.accessibility;

import android.content.Context;

import com.android.settingslib.search.SearchIndexableRaw;

import java.util.List;

/**
 * Provider implementation for Accessibility Search related features.
 */
public class AccessibilitySearchFeatureProviderImpl implements AccessibilitySearchFeatureProvider {

    @Override
    public List<SearchIndexableRaw> getSearchIndexableRawData(Context context) {
        return null;
    }
}
+11 −2
Original line number Diff line number Diff line
@@ -50,12 +50,14 @@ import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.accessibility.AccessibilityUtil.AccessibilityServiceFragmentType;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.RestrictedLockUtils.EnforcedAdmin;
import com.android.settingslib.RestrictedLockUtilsInternal;
import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.accessibility.AccessibilityUtils;
import com.android.settingslib.search.SearchIndexable;
import com.android.settingslib.search.SearchIndexableRaw;

import java.util.ArrayList;
import java.util.Collection;
@@ -494,7 +496,15 @@ public class AccessibilitySettings extends DashboardFragment {
    }

    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
            new BaseSearchIndexProvider(R.xml.accessibility_settings);
            new BaseSearchIndexProvider(R.xml.accessibility_settings) {
                @Override
                public List<SearchIndexableRaw> getRawDataToIndex(Context context,
                        boolean enabled) {
                    return FeatureFactory.getFactory(context)
                            .getAccessibilitySearchFeatureProvider().getSearchIndexableRawData(
                                    context);
                }
            };

    /**
     * This class helps setup RestrictedPreference.
@@ -559,7 +569,6 @@ public class AccessibilitySettings extends DashboardFragment {

                setRestrictedPreferenceEnabled(preference, packageName, serviceAllowed,
                        serviceEnabled);

                final String prefKey = preference.getKey();
                final int imageRes = info.getAnimatedImageRes();
                final CharSequence description = getServiceDescription(mContext, info,
+6 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.util.Log;
import androidx.annotation.Nullable;

import com.android.settings.R;
import com.android.settings.accessibility.AccessibilitySearchFeatureProvider;
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.applications.GameSettingsFeatureProvider;
@@ -174,6 +175,11 @@ public abstract class FeatureFactory {
     */
    public abstract GameSettingsFeatureProvider getGameSettingsFeatureProvider();

    /**
     * Retrieve implementation for Accessibility search index feature.
     */
    public abstract AccessibilitySearchFeatureProvider getAccessibilitySearchFeatureProvider();

    public static final class FactoryNotFoundException extends RuntimeException {
        public FactoryNotFoundException(Throwable throwable) {
            super("Unable to create factory. Did you misconfigure Proguard?", throwable);
Loading