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

Commit 8068fda0 authored by Fan Zhang's avatar Fan Zhang
Browse files

Add intent-filter to SearchResultTrampoline

Bug: 64938328
Test: atest
Change-Id: I3ac6506a6af3af9ff2bd60354ba23617b700ace8
parent ff4da23a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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 -->
+3 −2
Original line number Diff line number Diff line
@@ -60,8 +60,9 @@ public class DatabaseIndexingUtils {
        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;
    }

+47 −100
Original line number Diff line number Diff line
@@ -17,105 +17,52 @@

package com.android.settings.search;

import android.provider.SearchIndexablesContract;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;

import static com.google.common.truth.Truth.assertThat;

public class SearchIndexablesContractTest extends AndroidTestCase {
        @SmallTest
        public void testRawColumns_IncludesRank() {
            assertEquals(SearchIndexablesContract.RawData.COLUMN_RANK,
                    SearchIndexablesContract.INDEXABLES_RAW_COLUMNS[0]);
        }

        @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]);
import android.provider.SearchIndexablesContract;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

@SmallTest
@RunWith(AndroidJUnit4.class)
public class SearchIndexablesContractTest {

    @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]);
    }
}