Add intent-filter to SearchResultTrampoline
Bug: 64938328
Test: atest
Change-Id: I3ac6506a6af3af9ff2bd60354ba23617b700ace8
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 062ebdc..2268977 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -223,6 +223,10 @@
android:theme="@android:style/Theme.NoDisplay"
android:excludeFromRecents="true"
android:exported="true">
+ <intent-filter>
+ <action android:name="com.android.settings.SEARCH_RESULT_TRAMPOLINE" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
</activity>
<!-- Top-level settings -->
diff --git a/src/com/android/settings/search/DatabaseIndexingUtils.java b/src/com/android/settings/search/DatabaseIndexingUtils.java
index 8d63ea5..39bcdf84 100644
--- a/src/com/android/settings/search/DatabaseIndexingUtils.java
+++ b/src/com/android/settings/search/DatabaseIndexingUtils.java
@@ -60,8 +60,9 @@
args.putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, key);
final Intent searchDestination = Utils.onBuildStartFragmentIntent(context,
className, args, null, 0, screenTitle, false, sourceMetricsCategory);
- searchDestination.putExtra(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, key);
- searchDestination.setClass(context, SearchResultTrampoline.class);
+ searchDestination.putExtra(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, key)
+ .setAction("com.android.settings.SEARCH_RESULT_TRAMPOLINE")
+ .setComponent(null);
return searchDestination;
}
diff --git a/tests/unit/src/com/android/settings/search/SearchIndexablesContractTest.java b/tests/unit/src/com/android/settings/search/SearchIndexablesContractTest.java
index 4de5fb7..2e779e8 100644
--- a/tests/unit/src/com/android/settings/search/SearchIndexablesContractTest.java
+++ b/tests/unit/src/com/android/settings/search/SearchIndexablesContractTest.java
@@ -17,105 +17,52 @@
package com.android.settings.search;
+import static com.google.common.truth.Truth.assertThat;
+
import android.provider.SearchIndexablesContract;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-public class SearchIndexablesContractTest extends AndroidTestCase {
- @SmallTest
- public void testRawColumns_IncludesRank() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_RANK,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[0]);
- }
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class SearchIndexablesContractTest {
- @SmallTest
- public void testRawColumns_IncludesTitle() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_TITLE,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[1]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesSummaryOn() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_SUMMARY_ON,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[2]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesSummaryOff() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_SUMMARY_OFF,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[3]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesEntries() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_ENTRIES,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[4]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesKeywords() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_KEYWORDS,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[5]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesScreenTitle() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_SCREEN_TITLE,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[6]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesClassName() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_CLASS_NAME,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[7]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesIcon() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_ICON_RESID,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[8]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesIntentAction() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_INTENT_ACTION,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[9]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesIntentTargetPackage() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_INTENT_TARGET_PACKAGE,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[10]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesTargetClass() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_INTENT_TARGET_CLASS,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[11]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesKey() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_KEY,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[12]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesUserId() {
- assertEquals(SearchIndexablesContract.RawData.COLUMN_USER_ID,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[13]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesPayloadType() {
- assertEquals(SearchIndexablesContract.RawData.PAYLOAD_TYPE,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[14]);
- }
-
- @SmallTest
- public void testRawColumns_IncludesPayload() {
- assertEquals(SearchIndexablesContract.RawData.PAYLOAD,
- SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[15]);
- }
+ @Test
+ public void testRawColumns_matchContractIndexing() {
+ assertThat(SearchIndexablesContract.RawData.COLUMN_RANK)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[0]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_TITLE)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[1]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_SUMMARY_ON)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[2]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_SUMMARY_OFF)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[3]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_ENTRIES)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[4]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_KEYWORDS)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[5]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_SCREEN_TITLE)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[6]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_CLASS_NAME)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[7]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_ICON_RESID)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[8]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_INTENT_ACTION)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[9]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_INTENT_TARGET_PACKAGE)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[10]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_INTENT_TARGET_CLASS)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[11]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_KEY)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[12]);
+ assertThat(SearchIndexablesContract.RawData.COLUMN_USER_ID)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[13]);
+ assertThat(SearchIndexablesContract.RawData.PAYLOAD_TYPE)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[14]);
+ assertThat(SearchIndexablesContract.RawData.PAYLOAD)
+ .isEqualTo(SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[15]);
+ }
}