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
This commit is contained in:
jasonwshsu
2021-04-24 16:00:09 +08:00
parent b4f59a75d5
commit 87b90dfc50
9 changed files with 134 additions and 13 deletions

View File

@@ -56,6 +56,7 @@ import com.android.settings.testutils.shadow.ShadowDeviceConfig;
import com.android.settings.testutils.shadow.ShadowFragment;
import com.android.settings.testutils.shadow.ShadowUserManager;
import com.android.settingslib.RestrictedPreference;
import com.android.settingslib.search.SearchIndexableRaw;
import org.junit.Before;
import org.junit.Rule;
@@ -77,12 +78,12 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/** Test for {@link AccessibilitySettings}. */
@RunWith(RobolectricTestRunner.class)
public class AccessibilitySettingsTest {
private static final String PACKAGE_NAME = "com.android.test";
private static final String CLASS_NAME = PACKAGE_NAME + ".test_a11y_service";
private static final ComponentName COMPONENT_NAME = new ComponentName(PACKAGE_NAME,
CLASS_NAME);
private static final ComponentName COMPONENT_NAME = new ComponentName(PACKAGE_NAME, CLASS_NAME);
private static final int ON = 1;
private static final int OFF = 0;
private static final String EMPTY_STRING = "";
@@ -132,6 +133,14 @@ public class AccessibilitySettingsTest {
assertThat(keys).containsAtLeastElementsIn(niks);
}
@Test
public void getRawDataToIndex_isNull() {
final List<SearchIndexableRaw> indexableRawList =
AccessibilitySettings.SEARCH_INDEX_DATA_PROVIDER.getRawDataToIndex(mContext, true);
assertThat(indexableRawList).isNull();
}
@Test
@Config(shadows = {ShadowDeviceConfig.class})
public void isRampingRingerEnabled_settingsFlagOn_Enabled() {
@@ -362,7 +371,7 @@ public class AccessibilitySettingsTest {
try {
final AccessibilityServiceInfo info = new AccessibilityServiceInfo(resolveInfo,
mContext);
info.setComponentName(new ComponentName(PACKAGE_NAME, CLASS_NAME));
info.setComponentName(new ComponentName(packageName, className));
return info;
} catch (XmlPullParserException | IOException e) {
// Do nothing