The purpose of these operations is to allow skipping the isolation layer checks defined by OSGi specification. This allows services such as configuration admin, metatype, scr, etc. to operate properly, ignoring the registered framework hooks. The functionality MUST enable listening to all bundle and service events and access all installed bundles and services by certain OSGi containers.
Hook agnostic operations are defined per bundle.
Provided solution
A Bundle is considered hook agnostic if it has Hook-Agnostic header in its manifest. The header value is currently ignored.
If security is enabled the bundle MUST have (org.osgi.framework.AdminPermission <system bundle name> context) permission.
If it has no such permission this header is ignored and the bundle is not considered hook agnostic.
It a bundle is hook agnostic the following rules apply:
No service registration hooks are called if a service is being registered by this bundle. Hence the bundle can register all kinds of services if it has permissions.
No service find hooks are called if a service is requested by this bundle. Hence the bundle can get all kinds of services if it has permissions.
No bundle find hooks are called if BundleContext#getBundles or BundleContext#getBundle(id) is invoked. Hence the bundle can have info about all installed bundles.
The bundle context of this bundle is not provided to bundle event and service event hooks. Hence no bundle and service events can be filtered and the bundle listens to all of them.
Usage
Simply add Hook-Agnostic: * to the bundle manifest header and (org.osgi.framework.AdminPermission "*" "listener") to its permissions file.