}
}
private static void installBundles(InitialBundle[] initialBundles, Bundle[] curInitBundles, ArrayList startBundles, ArrayList lazyActivationBundles, List toRefresh) {
ServiceReference reference = context.getServiceReference(StartLevel.class.getName());
StartLevel startService = null;
if (reference != null)
startService = (StartLevel) context.getService(reference);
try {
for (int i = 0; i < initialBundles.length; i++) {
Bundle osgiBundle = getBundleByLocation(initialBundles[i].locationString, curInitBundles);
try {
// don't need to install if it is already installed
if (osgiBundle == null) {
InputStream in = initialBundles[i].location.openStream();
try {
osgiBundle = context.installBundle(initialBundles[i].locationString, in);
} catch (BundleException e) {
StatusException status = e instanceof StatusException ? (StatusException) e : null;
if (status != null && status.getStatusCode() == StatusException.CODE_OK && status.getStatus() instanceof Bundle) {
osgiBundle = (Bundle) status.getStatus();
} else
throw e;
}
// only check for lazy activation header if this is a newly installed bundle and is not marked for persistent start
if (!initialBundles[i].start && hasLazyActivationPolicy(osgiBundle))
lazyActivationBundles.add(osgiBundle);
}
// always set the startlevel incase it has changed (bug 111549)
// this is a no-op if the level is the same as previous launch.
if ((osgiBundle.getState() & Bundle.UNINSTALLED) == 0 && initialBundles[i].level >= 0 && startService != null)
startService.setBundleStartLevel(osgiBundle, initialBundles[i].level);
// if this bundle is supposed to be started then add it to the start list
if (initialBundles[i].start)
startBundles.add(osgiBundle);
// include basic bundles in case they were not resolved before
if ((osgiBundle.getState() & Bundle.INSTALLED) != 0)