Merge "Add searchable metadata attribute for injected tiles." into udc-qpr-dev am: 5bc1e9b38f
am: 68fede37a0
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/24792152 Change-Id: Iffe2d746713a2b7f03261ba02ecbce2713546e7b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -454,7 +454,7 @@ public class SettingsSearchIndexablesProvider extends SearchIndexablesProvider {
|
|||||||
// Skip Settings injected items because they should be indexed in the sub-pages.
|
// Skip Settings injected items because they should be indexed in the sub-pages.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return tile.isSearchable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object[] createIndexableRawColumnObjects(SearchIndexableRaw raw) {
|
private static Object[] createIndexableRawColumnObjects(SearchIndexableRaw raw) {
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.android.settings.search;
|
package com.android.settings.search;
|
||||||
|
|
||||||
|
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SEARCHABLE;
|
||||||
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_TITLE;
|
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_TITLE;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
@@ -205,6 +206,19 @@ public class SettingsSearchIndexablesProviderTest {
|
|||||||
assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isTrue();
|
assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isEligibleForIndexing_disabledByMetadata_shouldReturnFalse() {
|
||||||
|
final ActivityInfo activityInfo = new ActivityInfo();
|
||||||
|
activityInfo.packageName = PACKAGE_NAME;
|
||||||
|
activityInfo.name = "class";
|
||||||
|
activityInfo.metaData = new Bundle();
|
||||||
|
activityInfo.metaData.putBoolean(META_DATA_PREFERENCE_SEARCHABLE, false);
|
||||||
|
final ActivityTile activityTile = new ActivityTile(activityInfo,
|
||||||
|
CategoryKey.CATEGORY_CONNECT);
|
||||||
|
|
||||||
|
assertThat(mProvider.isEligibleForIndexing(PACKAGE_NAME, activityTile)).isFalse();
|
||||||
|
}
|
||||||
|
|
||||||
@Implements(CategoryManager.class)
|
@Implements(CategoryManager.class)
|
||||||
public static class ShadowCategoryManager {
|
public static class ShadowCategoryManager {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user