Example usage for android.content.pm PackageManager GET_URI_PERMISSION_PATTERNS

List of usage examples for android.content.pm PackageManager GET_URI_PERMISSION_PATTERNS

Introduction

In this page you can find the example usage for android.content.pm PackageManager GET_URI_PERMISSION_PATTERNS.

Prototype

int GET_URI_PERMISSION_PATTERNS

To view the source code for android.content.pm PackageManager GET_URI_PERMISSION_PATTERNS.

Click Source Link

Document

ProviderInfo flag: return the ProviderInfo#uriPermissionPatterns URI permission patterns that are associated with a content provider.

Usage

From source file:com.github.michalbednarski.intentslab.providerlab.ProviderInfoFragment.java

@TargetApi(Build.VERSION_CODES.GINGERBREAD)
private void fillProviderInfo() throws PackageManager.NameNotFoundException {
    mProviderInfo = getActivity().getPackageManager().getProviderInfo(
            new ComponentName(mPackageName, mComponentName), PackageManager.GET_DISABLED_COMPONENTS
                    | PackageManager.GET_META_DATA | PackageManager.GET_URI_PERMISSION_PATTERNS);
}

From source file:com.github.michalbednarski.intentslab.providerlab.ProviderInfoFragment.java

private void fillProviderInfoLegacy() throws PackageManager.NameNotFoundException {
    PackageInfo packageInfo = getActivity().getPackageManager().getPackageInfo(mPackageName,
            PackageManager.GET_PROVIDERS | PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_META_DATA
                    | PackageManager.GET_URI_PERMISSION_PATTERNS);
    for (ProviderInfo provider : packageInfo.providers) {
        if (provider.name.equals(mComponentName)) {
            mProviderInfo = provider;//from   ww w  .j a  v a2s . c o  m
            return;
        }
    }
    throw new PackageManager.NameNotFoundException("No such provider (manual search in PackageInfo)");
}

From source file:android.content.pm.PackageParser.java

public static final ProviderInfo generateProviderInfo(Provider p, int flags, PackageUserState state,
        int userId) {
    if (p == null)
        return null;
    if (!checkUseInstalledOrHidden(flags, state)) {
        return null;
    }/*from  w w w .  j  a  va  2s  .  c o m*/
    if (!copyNeeded(flags, p.owner, state, p.metaData, userId)
            && ((flags & PackageManager.GET_URI_PERMISSION_PATTERNS) != 0
                    || p.info.uriPermissionPatterns == null)) {
        return p.info;
    }
    // Make shallow copies so we can store the metadata safely
    ProviderInfo pi = new ProviderInfo(p.info);
    pi.metaData = p.metaData;
    if ((flags & PackageManager.GET_URI_PERMISSION_PATTERNS) == 0) {
        pi.uriPermissionPatterns = null;
    }
    pi.applicationInfo = generateApplicationInfo(p.owner, flags, state, userId);
    return pi;
}