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

The following examples show how to use android.content.pm.PackageParser#ServiceIntentInfo . 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: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
void addService(PackageParser.Service s) {
    mServices.put(s.getComponentName(), s);
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  "
                + (s.info.nonLocalizedLabel != null
                ? s.info.nonLocalizedLabel : s.info.name) + ":");
        Log.v(TAG, "    Class=" + s.info.name);
    }
    final int intentsSize = s.intents.size();
    int j;
    for (j = 0; j < intentsSize; j++) {
        PackageParser.ServiceIntentInfo intent = s.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 Service " + s.info.name);
        }
        addFilter(intent);
    }
}
 
Example 2
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
void removeService(PackageParser.Service s) {
    mServices.remove(s.getComponentName());
    if (DEBUG_SHOW_INFO) {
        Log.v(TAG, "  " + (s.info.nonLocalizedLabel != null
                ? s.info.nonLocalizedLabel : s.info.name) + ":");
        Log.v(TAG, "    Class=" + s.info.name);
    }
    final int intentsSize = s.intents.size();
    int j;
    for (j = 0; j < intentsSize; j++) {
        PackageParser.ServiceIntentInfo intent = s.intents.get(j);
        if (DEBUG_SHOW_INFO) {
            Log.v(TAG, "    IntentFilter:");
            intent.dump(new LogPrinter(Log.VERBOSE, TAG), "      ");
        }
        removeFilter(intent);
    }
}
 
Example 3
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected ResolveInfo newResult(PackageParser.ServiceIntentInfo filter, int match) {
	final PackageParser.Service service = filter.service;
	ServiceInfo si = PackageParserCompat.generateServiceInfo(service, mFlags);
	if (si == null) {
		return null;
	}
	final ResolveInfo res = new ResolveInfo();
	res.serviceInfo = si;
	if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) {
		res.filter = filter;
	}
	res.priority = filter.getPriority();
	res.preferredOrder = service.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.ServiceIntentInfo filter, int userId) {
    if (!sUserManager.exists(userId)) return true;
    PackageParser.Package p = filter.service.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: VPackageManagerService.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.Service> packageServices) {
	if (packageServices == null) {
		return null;
	}
	mFlags = flags;
	final boolean defaultOnly = (flags & PackageManager.MATCH_DEFAULT_ONLY) != 0;
	final int N = packageServices.size();
	ArrayList<PackageParser.ServiceIntentInfo[]> listCut = new ArrayList<PackageParser.ServiceIntentInfo[]>(N);

	ArrayList<PackageParser.ServiceIntentInfo> intentFilters;
	for (int i = 0; i < N; ++i) {
		intentFilters = packageServices.get(i).intents;
		if (intentFilters != null && intentFilters.size() > 0) {
			PackageParser.ServiceIntentInfo[] array = new PackageParser.ServiceIntentInfo[intentFilters.size()];
			intentFilters.toArray(array);
			listCut.add(array);
		}
	}
	return super.queryIntentFromList(intent, resolvedType, defaultOnly, listCut);
}
 
Example 6
Source File: ServiceIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean allowFilterResult(
		PackageParser.ServiceIntentInfo filter, List<PackageParser.Service> dest) {
	for (int i = dest.size() - 1; i >= 0; i--) {
		PackageParser.Service destAi = dest.get(i);
		if (destAi == filter.service) {
			return false;
		}
	}
	return true;
}
 
Example 7
Source File: ServiceIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 5 votes vote down vote up
public final void removeService(PackageParser.Service s) {
	mServices.remove(s.getComponentName());
	int NI = s.intents.size();
	for (int j = 0; j < NI; j++) {
		PackageParser.ServiceIntentInfo intent = s.intents.get(j);
		removeFilter(intent);
	}
}
 
Example 8
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected boolean allowFilterResult(PackageParser.ServiceIntentInfo filter, List<ResolveInfo> dest) {
	ServiceInfo filterSi = filter.service.info;
	for (int i = dest.size() - 1; i >= 0; i--) {
		ServiceInfo destAi = dest.get(i).serviceInfo;
		if (ObjectsCompat.equals(destAi.name, filterSi.name)
				&& ObjectsCompat.equals(destAi.packageName, filterSi.packageName)) {
			return false;
		}
	}
	return true;
}
 
Example 9
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 5 votes vote down vote up
public final void removeService(PackageParser.Service s) {
	mServices.remove(s.getComponentName());
	if (DEBUG_SHOW_INFO) {
		Log.v(TAG, "  " + (s.info.nonLocalizedLabel != null ? s.info.nonLocalizedLabel : s.info.name) + ":");
		Log.v(TAG, "    Class=" + s.info.name);
	}
	final int NI = s.intents.size();
	int j;
	for (j = 0; j < NI; j++) {
		PackageParser.ServiceIntentInfo intent = s.intents.get(j);
		removeFilter(intent);
	}
}
 
Example 10
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 5 votes vote down vote up
public final void addService(PackageParser.Service s) {
	mServices.put(s.getComponentName(), s);
	if (DEBUG_SHOW_INFO) {
		Log.v(TAG, "  " + (s.info.nonLocalizedLabel != null ? s.info.nonLocalizedLabel : s.info.name) + ":");
		Log.v(TAG, "    Class=" + s.info.name);
	}
	final int NI = s.intents.size();
	int j;
	for (j = 0; j < NI; j++) {
		PackageParser.ServiceIntentInfo intent = s.intents.get(j);
		addFilter(intent);
	}
}
 
Example 11
Source File: ServiceIntentResolver.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.ServiceIntentInfo filter) {
	out.print(prefix);
	out.print(Integer.toHexString(System.identityHashCode(filter.service)));
	out.print(' ');
	out.print(filter.service.getComponentName());
	out.print(" filter ");
	out.println(Integer.toHexString(System.identityHashCode(filter)));
}
 
Example 12
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean allowFilterResult(
        PackageParser.ServiceIntentInfo filter, List<ResolveInfo> dest) {
    ServiceInfo filterSi = filter.service.info;
    for (int i = dest.size() - 1; i >= 0; --i) {
        ServiceInfo destAi = dest.get(i).serviceInfo;
        if (destAi.name == filterSi.name
                && destAi.packageName == filterSi.packageName) {
            return false;
        }
    }
    return true;
}
 
Example 13
Source File: ServiceIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 4 votes vote down vote up
@Override
protected PackageParser.Service newResult(PackageParser.ServiceIntentInfo info,
		int match) {
	return info.service;
}
 
Example 14
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean isPackageForFilter(String packageName,
        PackageParser.ServiceIntentInfo info) {
    return packageName.equals(info.service.owner.packageName);
}
 
Example 15
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected PackageParser.ServiceIntentInfo[] newArray(int size) {
	return new PackageParser.ServiceIntentInfo[size];
}
 
Example 16
Source File: ServiceIntentResolver.java    From koala--Android-Plugin-Runtime- with Apache License 2.0 4 votes vote down vote up
@Override
protected String packageForFilter(PackageParser.ServiceIntentInfo info) {
	return info.service.owner.packageName;
}
 
Example 17
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected boolean isPackageForFilter(String packageName, PackageParser.ServiceIntentInfo info) {
	return packageName.equals(info.service.owner.packageName);
}
 
Example 18
Source File: ComponentResolver.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
@Override
protected PackageParser.ServiceIntentInfo[] newArray(int size) {
    return new PackageParser.ServiceIntentInfo[size];
}
 
Example 19
Source File: VPackageManagerService.java    From container with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Object filterToLabel(PackageParser.ServiceIntentInfo filter) {
	return filter.service;
}
 
Example 20
Source File: VPackageManagerService.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.ServiceIntentInfo filter) {

}