/** * Adds or updates given activity in the system. * * If activity with the same {@link ComponentInfo#name} and {@code ComponentInfo#packageName} * exists it will be updated. Its {@link ComponentInfo#applicationInfo} is always set to {@link * ApplicationInfo} already existing in the system, but if no application exists a new one will * be created using {@link ComponentInfo#applicationInfo} in this component. */ public void addOrUpdateActivity(ActivityInfo activityInfo) { addComponent( activityFilters, p -> p.activities, (p, a) -> p.activities = a, new ActivityInfo(activityInfo), true); }
/** * Adds or updates given service in the system. * * If service with the same {@link ComponentInfo#name} and {@code ComponentInfo#packageName} * exists it will be updated. Its {@link ComponentInfo#applicationInfo} is always set to {@link * ApplicationInfo} already existing in the system, but if no application exists a new one will be * created using {@link ComponentInfo#applicationInfo} in this component. */ public void addOrUpdateService(ServiceInfo serviceInfo) { addComponent( serviceFilters, p -> p.services, (p, a) -> p.services = a, new ServiceInfo(serviceInfo), true); }
/** * Adds or updates given broadcast receiver in the system. * * If broadcast receiver with the same {@link ComponentInfo#name} and {@code * ComponentInfo#packageName} exists it will be updated. Its {@link ComponentInfo#applicationInfo} * is always set to {@link ApplicationInfo} already existing in the system, but if no * application exists a new one will be created using {@link ComponentInfo#applicationInfo} in * this component. */ public void addOrUpdateReceiver(ActivityInfo receiverInfo) { addComponent( receiverFilters, p -> p.receivers, (p, a) -> p.receivers = a, new ActivityInfo(receiverInfo), true); }
/** * Adds or updates given content provider in the system. * * If content provider with the same {@link ComponentInfo#name} and {@code * ComponentInfo#packageName} exists it will be updated. Its {@link ComponentInfo#applicationInfo} * is always set to {@link ApplicationInfo} already existing in the system, but if no * application exists a new one will be created using {@link ComponentInfo#applicationInfo} in * this component. */ public void addOrUpdateProvider(ProviderInfo providerInfo) { addComponent( providerFilters, p -> p.providers, (p, a) -> p.providers = a, new ProviderInfo(providerInfo), true); }
/** * Makes sure that given activity exists. * * If the activity doesn't exist yet, it will be created with {@code applicationInfo} set to an * existing application, or if it doesn't exist, a new package will be created. * * @return existing or newly created activity info. */ public ActivityInfo addActivityIfNotPresent(ComponentName componentName) { return addComponent( activityFilters, p -> p.activities, (p, a) -> p.activities = a, updateName(componentName, new ActivityInfo()), false); }
/** * Makes sure that given service exists. * * If the service doesn't exist yet, it will be created with {@code applicationInfo} set to an * existing application, or if it doesn't exist, a new package will be created. * * @return existing or newly created service info. */ public ServiceInfo addServiceIfNotPresent(ComponentName componentName) { return addComponent( serviceFilters, p -> p.services, (p, a) -> p.services = a, updateName(componentName, new ServiceInfo()), false); }
/** * Makes sure that given receiver exists. * * If the receiver doesn't exist yet, it will be created with {@code applicationInfo} set to an * existing application, or if it doesn't exist, a new package will be created. * * @return existing or newly created receiver info. */ public ActivityInfo addReceiverIfNotPresent(ComponentName componentName) { return addComponent( receiverFilters, p -> p.receivers, (p, a) -> p.receivers = a, updateName(componentName, new ActivityInfo()), false); }
/** * Makes sure that given provider exists. * * If the provider doesn't exist yet, it will be created with {@code applicationInfo} set to an * existing application, or if it doesn't exist, a new package will be created. * * @return existing or newly created provider info. */ public ProviderInfo addProviderIfNotPresent(ComponentName componentName) { return addComponent( providerFilters, p -> p.providers, (p, a) -> p.providers = a, updateName(componentName, new ProviderInfo()), false); }