private static String processPackageUri(final Intent intent, final Function<Stream<String>, String> batch_dealer, final Predicate<String> dealer) {
		final Uri uri = intent.getData();
		final String ssp;
		if (uri == null || (ssp = uri.getSchemeSpecificPart()) == null) return "Invalid data in Intent: " + intent;
		final String scheme = uri.getScheme();
		final Stream<String> pkgs;
		final boolean single;
		if (single = "package".equals(scheme)) pkgs = Stream.of(ssp);
		else if ("packages".equals(scheme)) pkgs = Arrays.stream(ssp.split(",")).filter(Objects::nonNull).map(String::trim);
		else return "Unsupported intent data scheme: " + intent;	// Should never happen

		try {
			if (batch_dealer != null) return batch_dealer.apply(pkgs);

			final List<String> failed_pkgs = pkgs.filter(t -> ! dealer.test(t)).collect(Collectors.toList());
			if (failed_pkgs.isEmpty()) return null;
			if (single) return "Failed: " + ssp;
			return "Failed: " + failed_pkgs;
		} catch (final RuntimeException e) {
			return "Internal exception: " + e;		// Island might be have been deactivated or not set up yet.
		}
	}
@return null for success, or error message for debugging purpose (NOT part of the API protocol).
engine/src/main/java/com/oasisfeng/island/api/ApiDispatcher.java