Search in sources :

Example 11 with UriMatcher

use of android.content.UriMatcher in project android_frameworks_base by ParanoidAndroid.

the class UriMatcherTest method testContentUris.

@SmallTest
public void testContentUris() {
    UriMatcher matcher = new UriMatcher(ROOT);
    matcher.addURI("people", null, PEOPLE);
    matcher.addURI("people", "#", PEOPLE_ID);
    matcher.addURI("people", "#/phones", PEOPLE_PHONES);
    matcher.addURI("people", "#/phones/blah", PEOPLE_PHONES_ID);
    matcher.addURI("people", "#/phones/#", PEOPLE_PHONES_ID);
    matcher.addURI("people", "#/addresses", PEOPLE_ADDRESSES);
    matcher.addURI("people", "#/addresses/#", PEOPLE_ADDRESSES_ID);
    matcher.addURI("people", "#/contact-methods", PEOPLE_CONTACTMETH);
    matcher.addURI("people", "#/contact-methods/#", PEOPLE_CONTACTMETH_ID);
    matcher.addURI("calls", null, CALLS);
    matcher.addURI("calls", "#", CALLS_ID);
    matcher.addURI("caller-id", null, CALLERID);
    matcher.addURI("caller-id", "*", CALLERID_TEXT);
    matcher.addURI("filter-recent", null, FILTERRECENT);
    matcher.addURI("auth", "another/path/segment", ANOTHER_PATH_SEGMENT);
    checkAll(matcher);
}
Also used : UriMatcher(android.content.UriMatcher) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 12 with UriMatcher

use of android.content.UriMatcher in project android_frameworks_base by ResurrectionRemix.

the class SearchIndexablesProvider method attachInfo.

/**
     * Implementation is provided by the parent class.
     */
@Override
public void attachInfo(Context context, ProviderInfo info) {
    mAuthority = info.authority;
    mMatcher = new UriMatcher(UriMatcher.NO_MATCH);
    mMatcher.addURI(mAuthority, SearchIndexablesContract.INDEXABLES_XML_RES_PATH, MATCH_RES_CODE);
    mMatcher.addURI(mAuthority, SearchIndexablesContract.INDEXABLES_RAW_PATH, MATCH_RAW_CODE);
    mMatcher.addURI(mAuthority, SearchIndexablesContract.NON_INDEXABLES_KEYS_PATH, MATCH_NON_INDEXABLE_KEYS_CODE);
    // Sanity check our setup
    if (!info.exported) {
        throw new SecurityException("Provider must be exported");
    }
    if (!info.grantUriPermissions) {
        throw new SecurityException("Provider must grantUriPermissions");
    }
    if (!android.Manifest.permission.READ_SEARCH_INDEXABLES.equals(info.readPermission)) {
        throw new SecurityException("Provider must be protected by READ_SEARCH_INDEXABLES");
    }
    super.attachInfo(context, info);
}
Also used : UriMatcher(android.content.UriMatcher)

Example 13 with UriMatcher

use of android.content.UriMatcher in project newsrob by marianokamp.

the class SearchProvider method buildUriMatcher.

/**
	 * Sets up a uri matcher.
	 */
private static UriMatcher buildUriMatcher() {
    UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
    matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY, SEARCH_SUGGEST);
    matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGEST);
    return matcher;
}
Also used : UriMatcher(android.content.UriMatcher)

Example 14 with UriMatcher

use of android.content.UriMatcher in project AndroidChromium by JackyAndroid.

the class ChromeBrowserProvider method ensureUriMatcherInitialized.

private void ensureUriMatcherInitialized() {
    synchronized (mInitializeUriMatcherLock) {
        if (mUriMatcher != null)
            return;
        mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
        // The internal URIs
        String authority = getContext().getPackageName() + AUTHORITY_SUFFIX;
        mUriMatcher.addURI(authority, BOOKMARKS_PATH, URI_MATCH_BOOKMARKS);
        mUriMatcher.addURI(authority, BOOKMARKS_PATH + "/#", URI_MATCH_BOOKMARKS_ID);
        // The internal authority for public APIs
        String apiAuthority = getContext().getPackageName() + API_AUTHORITY_SUFFIX;
        mUriMatcher.addURI(apiAuthority, BOOKMARKS_PATH, URL_MATCH_API_BOOKMARK);
        mUriMatcher.addURI(apiAuthority, BOOKMARKS_PATH + "/#", URL_MATCH_API_BOOKMARK_ID);
        mUriMatcher.addURI(apiAuthority, SEARCHES_PATH, URL_MATCH_API_SEARCHES);
        mUriMatcher.addURI(apiAuthority, SEARCHES_PATH + "/#", URL_MATCH_API_SEARCHES_ID);
        mUriMatcher.addURI(apiAuthority, HISTORY_PATH, URL_MATCH_API_HISTORY_CONTENT);
        mUriMatcher.addURI(apiAuthority, HISTORY_PATH + "/#", URL_MATCH_API_HISTORY_CONTENT_ID);
        mUriMatcher.addURI(apiAuthority, COMBINED_PATH, URL_MATCH_API_BOOKMARK);
        mUriMatcher.addURI(apiAuthority, COMBINED_PATH + "/#", URL_MATCH_API_BOOKMARK_ID);
        // The internal authority for BrowserContracts
        mUriMatcher.addURI(BROWSER_CONTRACT_API_AUTHORITY, HISTORY_PATH, URL_MATCH_API_HISTORY_CONTENT);
        mUriMatcher.addURI(BROWSER_CONTRACT_API_AUTHORITY, HISTORY_PATH + "/#", URL_MATCH_API_HISTORY_CONTENT_ID);
        mUriMatcher.addURI(BROWSER_CONTRACT_API_AUTHORITY, COMBINED_PATH, URL_MATCH_API_BOOKMARK);
        mUriMatcher.addURI(BROWSER_CONTRACT_API_AUTHORITY, COMBINED_PATH + "/#", URL_MATCH_API_BOOKMARK_ID);
        mUriMatcher.addURI(BROWSER_CONTRACT_API_AUTHORITY, SEARCHES_PATH, URL_MATCH_API_SEARCHES);
        mUriMatcher.addURI(BROWSER_CONTRACT_API_AUTHORITY, SEARCHES_PATH + "/#", URL_MATCH_API_SEARCHES_ID);
        mUriMatcher.addURI(BROWSER_CONTRACT_API_AUTHORITY, BOOKMARKS_PATH, URL_MATCH_API_BOOKMARK_CONTENT);
        mUriMatcher.addURI(BROWSER_CONTRACT_API_AUTHORITY, BOOKMARKS_PATH + "/#", URL_MATCH_API_BOOKMARK_CONTENT_ID);
        // Added the Android Framework URIs, so the provider can easily switched
        // by adding 'browser' and 'com.android.browser' in manifest.
        // The Android's BrowserContract
        mUriMatcher.addURI(BROWSER_CONTRACT_AUTHORITY, HISTORY_PATH, URL_MATCH_API_HISTORY_CONTENT);
        mUriMatcher.addURI(BROWSER_CONTRACT_AUTHORITY, HISTORY_PATH + "/#", URL_MATCH_API_HISTORY_CONTENT_ID);
        mUriMatcher.addURI(BROWSER_CONTRACT_AUTHORITY, "combined", URL_MATCH_API_BOOKMARK);
        mUriMatcher.addURI(BROWSER_CONTRACT_AUTHORITY, "combined/#", URL_MATCH_API_BOOKMARK_ID);
        mUriMatcher.addURI(BROWSER_CONTRACT_AUTHORITY, SEARCHES_PATH, URL_MATCH_API_SEARCHES);
        mUriMatcher.addURI(BROWSER_CONTRACT_AUTHORITY, SEARCHES_PATH + "/#", URL_MATCH_API_SEARCHES_ID);
        mUriMatcher.addURI(BROWSER_CONTRACT_AUTHORITY, BOOKMARKS_PATH, URL_MATCH_API_BOOKMARK_CONTENT);
        mUriMatcher.addURI(BROWSER_CONTRACT_AUTHORITY, BOOKMARKS_PATH + "/#", URL_MATCH_API_BOOKMARK_CONTENT_ID);
        // For supporting android.provider.browser.BookmarkColumns and
        // SearchColumns
        mUriMatcher.addURI("browser", BOOKMARKS_PATH, URL_MATCH_API_BOOKMARK);
        mUriMatcher.addURI("browser", BOOKMARKS_PATH + "/#", URL_MATCH_API_BOOKMARK_ID);
        mUriMatcher.addURI("browser", SEARCHES_PATH, URL_MATCH_API_SEARCHES);
        mUriMatcher.addURI("browser", SEARCHES_PATH + "/#", URL_MATCH_API_SEARCHES_ID);
        mUriMatcher.addURI(apiAuthority, BOOKMARKS_PATH + "/" + SearchManager.SUGGEST_URI_PATH_QUERY, URL_MATCH_BOOKMARK_SUGGESTIONS_ID);
        mUriMatcher.addURI(apiAuthority, SearchManager.SUGGEST_URI_PATH_QUERY, URL_MATCH_BOOKMARK_HISTORY_SUGGESTIONS_ID);
    }
}
Also used : UriMatcher(android.content.UriMatcher)

Example 15 with UriMatcher

use of android.content.UriMatcher in project android_frameworks_base by DirtyUnicorns.

the class UriMatcherTest method testContentUris.

@SmallTest
public void testContentUris() {
    UriMatcher matcher = new UriMatcher(ROOT);
    matcher.addURI("people", null, PEOPLE);
    matcher.addURI("people", "#", PEOPLE_ID);
    matcher.addURI("people", "#/phones", PEOPLE_PHONES);
    matcher.addURI("people", "#/phones/blah", PEOPLE_PHONES_ID);
    matcher.addURI("people", "#/phones/#", PEOPLE_PHONES_ID);
    matcher.addURI("people", "#/addresses", PEOPLE_ADDRESSES);
    matcher.addURI("people", "#/addresses/#", PEOPLE_ADDRESSES_ID);
    matcher.addURI("people", "#/contact-methods", PEOPLE_CONTACTMETH);
    matcher.addURI("people", "#/contact-methods/#", PEOPLE_CONTACTMETH_ID);
    matcher.addURI("calls", null, CALLS);
    matcher.addURI("calls", "#", CALLS_ID);
    matcher.addURI("caller-id", null, CALLERID);
    matcher.addURI("caller-id", "*", CALLERID_TEXT);
    matcher.addURI("filter-recent", null, FILTERRECENT);
    matcher.addURI("auth", "another/path/segment", ANOTHER_PATH_SEGMENT);
    checkAll(matcher);
}
Also used : UriMatcher(android.content.UriMatcher) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

UriMatcher (android.content.UriMatcher)69 SmallTest (android.test.suitebuilder.annotation.SmallTest)13 TableDetails (me.himanshusoni.quantumflux.model.generate.TableDetails)1