private static void doValidateProcessNames(final Application app, final String[] process_names) { try { final PackageInfo info = app.getPackageManager().getPackageInfo(app.getPackageName(), GET_ACTIVITIES | GET_SERVICES | GET_RECEIVERS | GET_PROVIDERS); final Set<String> defined_process_names = new HashSet<>(); if (info.activities != null) for (final ActivityInfo activity : info.activities) defined_process_names.add(activity.processName); if (info.services != null) for (final ServiceInfo service : info.services) defined_process_names.add(service.processName); if (info.receivers != null) for (final ActivityInfo receiver : info.receivers) defined_process_names.add(receiver.processName); if (info.providers != null) for (final ProviderInfo provider : info.providers) defined_process_names.add(provider.processName); for (final String process_name : process_names) if (! defined_process_names.contains(getFullProcessName(app, process_name))) throw new IllegalArgumentException("Process name \"" + process_name + "\" is not used by any component in AndroidManifest.xml"); } catch (final PackageManager.NameNotFoundException ignored) {} // Should never happen }
/** * Install the condom protection for current process if its process name matches. This method should be called in {@link Application#onCreate()}. * * @param process_names list of processes where Condom process should NOT be installed, in the form exactly as defined * by <code>"android:process"</code> attribute of components in <code>AndroidManifest.xml</code>. * <b>BEWARE: Default process must be explicitly listed here if it is expected to be excluded.</b> */ public static void installExcept(final Application app, final CondomOptions options, final String... process_names) { if (process_names.length == 0) throw new IllegalArgumentException("At lease one process name must be specified"); validateCondomOptions(options); final String current_process_name = getProcessName(app); if (current_process_name == null) return; for (final String process_name : process_names) if (! current_process_name.equals(getFullProcessName(app, process_name))) { install(app, current_process_name, options); return; } if ((app.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) validateProcessNames(app, process_names); }
private static void doValidateProcessNames(final Application app, final String[] process_names) { try { final PackageInfo info = app.getPackageManager().getPackageInfo(app.getPackageName(), GET_ACTIVITIES | GET_SERVICES | GET_RECEIVERS | GET_PROVIDERS); final Set<String> defined_process_names = new HashSet<>(); if (info.activities != null) for (final ActivityInfo activity : info.activities) defined_process_names.add(activity.processName); if (info.services != null) for (final ServiceInfo service : info.services) defined_process_names.add(service.processName); if (info.receivers != null) for (final ActivityInfo receiver : info.receivers) defined_process_names.add(receiver.processName); if (info.providers != null) for (final ProviderInfo provider : info.providers) defined_process_names.add(provider.processName); for (final String process_name : process_names) if (! defined_process_names.contains(getFullProcessName(app, process_name))) throw new IllegalArgumentException("Process name \"" + process_name + "\" is not used by any component in AndroidManifest.xml"); } catch (final PackageManager.NameNotFoundException ignored) {} // Should never happen }
/** * Install the condom protection for current process if its process name matches. This method should be called in {@link Application#onCreate()}. * * @param process_names list of processes where Condom process should NOT be installed, in the form exactly as defined * by <code>"android:process"</code> attribute of components in <code>AndroidManifest.xml</code>. * <b>BEWARE: Default process must be explicitly listed here if it is expected to be excluded.</b> */ public static void installExcept(final Application app, final CondomOptions options, final String... process_names) { if (process_names.length == 0) throw new IllegalArgumentException("At lease one process name must be specified"); validateCondomOptions(options); final String current_process_name = getProcessName(app); if (current_process_name == null) return; for (final String process_name : process_names) if (! current_process_name.equals(getFullProcessName(app, process_name))) { install(app, current_process_name, options); return; } if ((app.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) validateProcessNames(app, process_names); }