Java Code Examples for android.content.pm.PackageParser#ProviderIntentInfo

The following examples show how to use android.content.pm.PackageParser#ProviderIntentInfo . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProviderIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 6 votes vote down vote up
public List queryIntentForPackage(Intent intent, String resolvedType,
		int flags, ArrayList<PackageParser.Provider> packageProviders) {
	if (packageProviders == null) {
		return null;
	}
	mFlags = flags;
	final boolean defaultOnly = (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0;
	int N = packageProviders.size();
	ArrayList<ArrayList<PackageParser.ProviderIntentInfo>> listCut = new ArrayList<ArrayList<PackageParser.ProviderIntentInfo>>(
			N);

	ArrayList<PackageParser.ProviderIntentInfo> intentFilters;
	for (int i = 0; i < N; ++i) {
		intentFilters = packageProviders.get(i).intents;
		if (intentFilters != null && intentFilters.size() > 0) {
			listCut.add(intentFilters);
		}
	}
	return super.queryIntentFromList(intent, resolvedType, defaultOnly,
			listCut);
}
 
Example 2
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
void removeProvider(PackageParser.Provider p) {
    mProviders.remove(p.getComponentName());
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  " + (p.info.nonLocalizedLabel != null
                ? p.info.nonLocalizedLabel
                : p.info.name) + ":");
        Log.v(TAG, "    Class=" + p.info.name);
    }
    final int intentsSize = p.intents.size();
    int j;
    for (j = 0; j < intentsSize; j++) {
        PackageParser.ProviderIntentInfo intent = p.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
        removeFilter(intent);
    }
}
 
Example 3
Source File: ProviderIntentResolver.java    From container with GNU General Public License v3.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
protected ResolveInfo newResult(PackageParser.ProviderIntentInfo filter, int match) {
	final PackageParser.Provider provider = filter.provider;
	ProviderInfo pi = PackageParserCompat.generateProviderInfo(provider, mFlags);
	if (pi == null) {
		return null;
	}
	final ResolveInfo res = new ResolveInfo();
	res.providerInfo = pi;
	if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) {
		res.filter = filter;
	}
	res.priority = filter.getPriority();
	res.preferredOrder = provider.owner.mPreferredOrder;
	res.match = match;
	res.isDefault = filter.hasDefault;
	res.labelRes = filter.labelRes;
	res.nonLocalizedLabel = filter.nonLocalizedLabel;
	res.icon = filter.icon;
	return res;
}
 
Example 4
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
@Override
protected boolean isFilterStopped(PackageParser.ProviderIntentInfo filter, int userId) {
    if (!sUserManager.exists(userId)) {
        return true;
    }
    PackageParser.Package p = filter.provider.owner;
    if (p != null) {
        PackageSetting ps = (PackageSetting) p.mExtras;
        if (ps != null) {
            // System apps are never considered stopped for purposes of
            // filtering, because there may be no way for the user to
            // actually re-launch them.
            return (ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) == 0
                    && ps.getStopped(userId);
        }
    }
    return false;
}
 
Example 5
Source File: ProviderIntentResolver.java    From container with GNU General Public License v3.0 6 votes vote down vote up
public List<ResolveInfo> queryIntentForPackage(Intent intent, String resolvedType, int flags,
		ArrayList<PackageParser.Provider> packageProviders) {
	if (packageProviders == null) {
		return null;
	}
	mFlags = flags;
	final boolean defaultOnly = (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0;
	final int N = packageProviders.size();
	ArrayList<PackageParser.ProviderIntentInfo[]> listCut = new ArrayList<>(N);

	ArrayList<PackageParser.ProviderIntentInfo> intentFilters;
	for (int i = 0; i < N; ++i) {
		intentFilters = packageProviders.get(i).intents;
		if (intentFilters != null && intentFilters.size() > 0) {
			PackageParser.ProviderIntentInfo[] array = new PackageParser.ProviderIntentInfo[intentFilters
					.size()];
			intentFilters.toArray(array);
			listCut.add(array);
		}
	}
	return super.queryIntentFromList(intent, resolvedType, defaultOnly, listCut);
}
 
Example 6
Source File: ProviderIntentResolver.java    From container with GNU General Public License v3.0 5 votes vote down vote up
public final void addProvider(PackageParser.Provider p) {
	if (mProviders.containsKey(p.getComponentName())) {
		VLog.w(TAG, "Provider " + p.getComponentName() + " already defined; ignoring");
		return;
	}

	mProviders.put(p.getComponentName(), p);
	final int NI = p.intents.size();
	int j;
	for (j = 0; j < NI; j++) {
		PackageParser.ProviderIntentInfo intent = p.intents.get(j);
		addFilter(intent);
	}
}
 
Example 7
Source File: ProviderIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 5 votes vote down vote up
@Override
protected void dumpFilter(PrintWriter out, String prefix,
		PackageParser.ProviderIntentInfo filter) {
	out.print(prefix);
	out.print(Integer.toHexString(System.identityHashCode(filter.provider)));
	out.print(' ');
	out.print(filter.provider.getComponentName());
	out.print(" filter ");
	out.println(Integer.toHexString(System.identityHashCode(filter)));
}
 
Example 8
Source File: ProviderIntentResolver.java    From container with GNU General Public License v3.0 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
protected boolean allowFilterResult(PackageParser.ProviderIntentInfo filter, List<ResolveInfo> dest) {
	ProviderInfo filterPi = filter.provider.info;
	for (int i = dest.size() - 1; i >= 0; i--) {
		ProviderInfo destPi = dest.get(i).providerInfo;
		if (ObjectsCompat.equals(destPi.name, filterPi.name)
				&& ObjectsCompat.equals(destPi.packageName, filterPi.packageName)) {
			return false;
		}
	}
	return true;
}
 
Example 9
Source File: ProviderIntentResolver.java    From container with GNU General Public License v3.0 5 votes vote down vote up
public final void removeProvider(PackageParser.Provider p) {
	mProviders.remove(p.getComponentName());
	final int NI = p.intents.size();
	int j;
	for (j = 0; j < NI; j++) {
		PackageParser.ProviderIntentInfo intent = p.intents.get(j);
		removeFilter(intent);
	}
}
 
Example 10
Source File: ProviderIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 5 votes vote down vote up
public final void addProvider(PackageParser.Provider p) {
    mProviders.put(p.getComponentName(), p);
	int NI = p.intents.size();
	for (int j = 0; j < NI; j++) {
		PackageParser.ProviderIntentInfo intent = p.intents.get(j);
		addFilter(intent);
	}
}
 
Example 11
Source File: ProviderIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean allowFilterResult(
		PackageParser.ProviderIntentInfo filter, List<PackageParser.Provider> dest) {
	for (int i = dest.size() - 1; i >= 0; i--) {
		PackageParser.Provider destAi = dest.get(i);
		if (destAi == filter.provider) {
			return false;
		}
	}
	return true;
}
 
Example 12
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
void addProvider(PackageParser.Provider p) {
    if (mProviders.containsKey(p.getComponentName())) {
        Slog.w(TAG, "Provider " + p.getComponentName() + " already defined; ignoring");
        return;
    }

    mProviders.put(p.getComponentName(), p);
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  "
                + (p.info.nonLocalizedLabel != null
                        ? p.info.nonLocalizedLabel
                        : p.info.name)
                + ":");
        Log.v(TAG, "    Class=" + p.info.name);
    }
    final int intentsSize = p.intents.size();
    int j;
    for (j = 0; j < intentsSize; j++) {
        PackageParser.ProviderIntentInfo intent = p.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
        if (!intent.debugCheck()) {
            Log.w(TAG, "==> For Provider " + p.info.name);
        }
        addFilter(intent);
    }
}
 
Example 13
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
@Override
protected Object filterToLabel(PackageParser.ProviderIntentInfo filter) {
    return filter.provider;
}
 
Example 14
Source File: ProviderIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 4 votes vote down vote up
@Override
protected PackageParser.Provider newResult(PackageParser.ProviderIntentInfo info,
		int match) {
	return info.provider;
}
 
Example 15
Source File: ProviderIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 4 votes vote down vote up
@Override
protected String packageForFilter(PackageParser.ProviderIntentInfo info) {
	return info.provider.owner.packageName;
}
 
Example 16
Source File: ProviderIntentResolver.java    From container with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected PackageParser.ProviderIntentInfo[] newArray(int size) {
	return new PackageParser.ProviderIntentInfo[size];
}
 
Example 17
Source File: ProviderIntentResolver.java    From container with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected boolean isFilterStopped(PackageParser.ProviderIntentInfo filter) {
	return false;
}
 
Example 18
Source File: ProviderIntentResolver.java    From container with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected boolean isPackageForFilter(String packageName, PackageParser.ProviderIntentInfo info) {
	return packageName.equals(info.provider.owner.packageName);
}
 
Example 19
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
@Override
protected PackageParser.ProviderIntentInfo[] newArray(int size) {
    return new PackageParser.ProviderIntentInfo[size];
}
 
Example 20
Source File: ProviderIntentResolver.java    From container with GNU General Public License v3.0 2 votes vote down vote up
@Override
protected void dumpFilter(PrintWriter out, String prefix, PackageParser.ProviderIntentInfo filter) {

}