private boolean installBundle(ZipFile zipFile, String location, Application application) { log.info("processLibsBundle entryName " + location); this.bundleDebug.installExternalBundle(location); String fileNameFromEntryName = Utils.getFileNameFromEntryName(location); String packageNameFromEntryName = Utils.getPackageNameFromEntryName(location); if (packageNameFromEntryName == null || packageNameFromEntryName.length() <= 0) { return false; } File archvieFile = new File(new File(application.getFilesDir().getParentFile(), "lib"), fileNameFromEntryName); if (OpenAtlas.getInstance().getBundle(packageNameFromEntryName) != null) { return false; } try { if (archvieFile.exists()) { OpenAtlas.getInstance().installBundle(packageNameFromEntryName, archvieFile); } else { OpenAtlas.getInstance() .installBundle( packageNameFromEntryName, zipFile.getInputStream(zipFile.getEntry(location))); } log.info("Succeed to install bundle " + packageNameFromEntryName); return true; } catch (Throwable e) { Log.e("BundlesInstaller", "Could not install bundle.", e); return false; } }
private void installBundle(ZipFile zipFile, List<String> bundles, Application application) { for (String location : AtlasConfig.DELAY) { String mLocation = contains(bundles, location.replace(".", "_")); if (mLocation != null && mLocation.length() > 0) { installBundle(zipFile, mLocation, application); bundles.remove(mLocation); } } for (String location : bundles) { installBundle(zipFile, location, application); } if (isTargetApp) { String[] auto = AtlasConfig.AUTO; for (String location : auto) { Bundle bundle = OpenAtlas.getInstance().getBundle(location); if (bundle != null) { try { bundle.start(); } catch (Throwable e) { Log.e("BundlesInstaller", "Could not auto start bundle: " + bundle.getLocation(), e); } } } } }
public void processAutoStartBundles( ZipFile zipFile, List<String> bundles, Application application) { for (String location : bundles) { installBundle(zipFile, location, application); } if (isTargetApp) { for (String location : AtlasConfig.AUTO) { Bundle bundle = OpenAtlas.getInstance().getBundle(location); if (bundle != null) { try { bundle.start(); } catch (Throwable e) { Log.e("BundlesInstaller", "Could not auto start bundle: " + bundle.getLocation(), e); } } } } }