getPlugins() {
+ return pluginIdToInfoMap.values();
+ }
+
+ public void uninstallPluginById(String pluginId) {
+ uninstallPlugin(pluginId, true);
+ }
+
+ public void uninstallPluginByPkg(String pkg) {
+ uninstallPlugin(pkg, false);
+ }
+
+ private void uninstallPlugin(String k, boolean isId) {
+ checkInit();
+ PlugInfo pl = isId ? removePlugById(k) : removePlugByPkg(k);
+ if (pl == null) {
+ return;
+ }
+ if (context instanceof Application) {
+ if (android.os.Build.VERSION.SDK_INT >= 14) {
+ try {
+ Application.class
+ .getMethod(
+ "unregisterComponentCallbacks",
+ Class.forName("android.content.ComponentCallbacks"))
+ .invoke(context, pl.getApplication());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private PlugInfo removePlugById(String pluginId) {
+ PlugInfo pl = null;
+ synchronized (this) {
+ pl = pluginIdToInfoMap.remove(pluginId);
+ if (pl == null) {
+ return null;
+ }
+ pluginPkgToInfoMap.remove(pl.getPackageName());
+ }
+ return pl;
+ }
+
+ private PlugInfo removePlugByPkg(String pkg) {
+ PlugInfo pl = null;
+ synchronized (this) {
+ pl = pluginPkgToInfoMap.remove(pkg);
+ if (pl == null) {
+ return null;
+ }
+ pluginIdToInfoMap.remove(pl.getId());
+ }
+ return pl;
+ }
+
+ /**
+ * 加载指定插件或指定目录下的所有插件
+ *
+ * 都使用文件名作为Id
+ *
+ * @param pluginSrcDirFile
+ * - apk或apk目录
+ * @return 插件集合
+ * @throws Exception
+ */
+ public Collection loadPlugin(final File pluginSrcDirFile)
+ throws Exception {
+ checkInit();
+ if (pluginSrcDirFile == null || !pluginSrcDirFile.exists()) {
+ Log.e(tag, "invalidate plugin file or Directory :"
+ + pluginSrcDirFile);
+ return null;
+ }
+ if (pluginSrcDirFile.isFile()) {
+ // 如果是文件则尝试加载单个插件,暂不检查文件类型,除apk外,以后可能支持加载其他类型文件,如jar
+ PlugInfo one = loadPluginWithId(pluginSrcDirFile, null, null);
+ return Collections.singletonList(one);
+ }
+ // clear all first
+ synchronized (this) {
+ pluginPkgToInfoMap.clear();
+ pluginIdToInfoMap.clear();
+ }
+ File[] pluginApks = pluginSrcDirFile.listFiles(this);
+ if (pluginApks == null || pluginApks.length < 1) {
+ throw new FileNotFoundException("could not find plugins in:"
+ + pluginSrcDirFile);
+ }
+ for (File pluginApk : pluginApks) {
+ PlugInfo plugInfo = buildPlugInfo(pluginApk, null, null);
+ if (plugInfo != null) {
+ savePluginToMap(plugInfo);
+ }
+ }
+ return pluginIdToInfoMap.values();
+ }
+
+ private synchronized void savePluginToMap(PlugInfo plugInfo) {
+ pluginPkgToInfoMap.put(plugInfo.getPackageName(), plugInfo);
+ pluginIdToInfoMap.put(plugInfo.getId(), plugInfo);
+ }
+
+ // /**
+ // * 单独加载一个apk
+ // * 使用文件名作为插件id
+ // * 目标文件也是与源文件同名
+ // *
+ // * @param pluginApk
+ // * @return
+ // * @throws Exception
+ // */
+ // public PlugInfo loadPlugin(File pluginApk) throws Exception {
+ // return loadPluginWithId(pluginApk, null, null);
+ // }
+
+ /**
+ * 单独加载一个apk
+ *
+ * @param pluginApk
+ * @param pluginId
+ * - 如果参数为null,则使用文件名作为插件id
+ * @return
+ * @throws Exception
+ */
+ public PlugInfo loadPluginWithId(File pluginApk, String pluginId)
+ throws Exception {
+ return loadPluginWithId(pluginApk, pluginId, null);
+ }
+
+ public PlugInfo loadPluginWithId(File pluginApk, String pluginId,
+ String targetFileName) throws Exception {
+ checkInit();
+ PlugInfo plugInfo = buildPlugInfo(pluginApk, pluginId, targetFileName);
+ if (plugInfo != null) {
+ savePluginToMap(plugInfo);
+ }
+ return plugInfo;
+ }
+
+ private PlugInfo buildPlugInfo(File pluginApk, String pluginId,
+ String targetFileName) throws Exception {
+ PlugInfo info = new PlugInfo();
+ info.setId(pluginId == null ? pluginApk.getName() : pluginId);
+
+ File privateFile = new File(dexInternalStoragePath,
+ targetFileName == null ? pluginApk.getName() : targetFileName);
+
+ info.setFilePath(privateFile.getAbsolutePath());
+
+ if (!pluginApk.getAbsolutePath().equals(privateFile.getAbsolutePath())) {
+ copyApkToPrivatePath(pluginApk, privateFile);
+ }
+ String dexPath = privateFile.getAbsolutePath();
+ PluginManifestUtil.setManifestInfo(context, dexPath, info);
+
+ PluginClassLoader loader = new PluginClassLoader(dexPath,
+ dexOutputPath, classLoader, info);
+ info.setClassLoader(loader);
+
+ try {
+ AssetManager am = AssetManager.class.newInstance();
+ am.getClass().getMethod("addAssetPath", String.class)
+ .invoke(am, dexPath);
+ info.setAssetManager(am);
+ Resources ctxres = context.getResources();
+ Resources res = new Resources(am, ctxres.getDisplayMetrics(),
+ ctxres.getConfiguration());
+ info.setResources(res);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (appAty != null) {
+ initPluginApplication(info, appAty, true);
+ }
+ // createPluginActivityProxyDexes(info);
+ Log.i(tag, "buildPlugInfo: " + info);
+ return info;
+ }
+
+ // private void createPluginActivityProxyDexes(PlugInfo plugin) {
+ // {
+ // ActInfo act = plugin.getApplicationInfo().getMainActivity();
+ // if (act != null) {
+ // ActivityOverider.createProxyDex(plugin, act.name, false);
+ // }
+ // }
+ // if (plugin.getApplicationInfo().getOtherActivities() != null) {
+ // for (ActInfo act : plugin.getApplicationInfo().getOtherActivities())
+ // {
+ // ActivityOverider.createProxyDex(plugin, act.name, false);
+ // }
+ // }
+ // }
+ void initPluginApplication(final PlugInfo info, Activity actFrom)
+ throws Exception {
+ initPluginApplication(info, actFrom, false);
+ }
+
+ private void initPluginApplication(final PlugInfo plugin, Activity actFrom,
+ boolean onLoad) throws Exception {
+ if (!onLoad && plugin.getApplication() != null) {
+ return;
+ }
+ final String className = plugin.getPackageInfo().applicationInfo.name;
+ if (className == null) {
+ if (onLoad) {
+ return;
+ }
+ Application application = new Application();
+ setApplicationBase(plugin, application);
+ return;
+ }
+ Log.d(tag, plugin.getId() + ", ApplicationClassName = " + className);
+
+ Runnable setApplicationTask = new Runnable() {
+ @Override
+ public void run() {
+ ClassLoader loader = plugin.getClassLoader();
+ try {
+ Class> applicationClass = loader.loadClass(className);
+ Application application = (Application) applicationClass
+ .newInstance();
+ setApplicationBase(plugin, application);
+ // invoke plugin application's onCreate()
+ application.onCreate();
+ } catch (Throwable e) {
+ Log.e(tag, Log.getStackTraceString(e));
+ }
+ }
+ };
+ // create Application instance for plugin
+ if (actFrom == null) {
+ if (onLoad)
+ return;
+ setApplicationTask.run();
+ } else {
+ actFrom.runOnUiThread(setApplicationTask);
+ }
+ }
+
+ private void setApplicationBase(PlugInfo plugin, Application application)
+ throws Exception {
+
+ synchronized (plugin) {
+ if (plugin.getApplication() != null) {
+ // set plugin's Application only once
+ return;
+ }
+ plugin.setApplication(application);
+ //
+ PluginContextWrapper ctxWrapper = new PluginContextWrapper(context,
+ plugin);
+ plugin.appWrapper = ctxWrapper;
+ // attach
+ Method attachMethod = android.app.Application.class
+ .getDeclaredMethod("attach", Context.class);
+ attachMethod.setAccessible(true);
+ attachMethod.invoke(application, ctxWrapper);
+ if (context instanceof Application) {
+ if (android.os.Build.VERSION.SDK_INT >= 14) {
+ Application.class
+ .getMethod(
+ "registerComponentCallbacks",
+ Class.forName("android.content.ComponentCallbacks"))
+ .invoke(context, application);
+ }
+ }
+
+ }
+ }
+
+ private void copyApkToPrivatePath(File pluginApk, File f) {
+ // if (f.exists() && pluginApk.length() == f.length()) {
+ // // 这里只是简单的判断如果两个文件长度相同则不拷贝,严格的做应该比较签名如 md5\sha-1
+ // return;
+ // }
+ FileUtil.copyFile(pluginApk, f);
+ }
+
+ File getDexInternalStoragePath() {
+ return dexInternalStoragePath;
+ }
+
+ Context getContext() {
+ return context;
+ }
+
+ public PluginActivityLifeCycleCallback getPluginActivityLifeCycleCallback() {
+ return pluginActivityLifeCycleCallback;
+ }
+
+ public void setPluginActivityLifeCycleCallback(
+ PluginActivityLifeCycleCallback pluginActivityLifeCycleCallback) {
+ this.pluginActivityLifeCycleCallback = pluginActivityLifeCycleCallback;
+ }
+
+ CJClassLoader getFrameworkClassLoader() {
+ return classLoader;
+ }
+
+ @Override
+ public boolean accept(File pathname) {
+ if (pathname.isDirectory()) {
+ return false;
+ }
+ String fname = pathname.getName();
+ return fname.endsWith(".apk");
+ }
+
+}
diff --git a/android-pluginmgr/src/main/java/androidx/pluginmgr/PluginManifestUtil.java b/PlugLoadMgr/src/androidx/pluginmgr/PluginManifestUtil.java
similarity index 100%
rename from android-pluginmgr/src/main/java/androidx/pluginmgr/PluginManifestUtil.java
rename to PlugLoadMgr/src/androidx/pluginmgr/PluginManifestUtil.java
diff --git a/PlugLoadMgr/src/androidx/pluginmgr/PluginPackageManager.java b/PlugLoadMgr/src/androidx/pluginmgr/PluginPackageManager.java
new file mode 100644
index 0000000..1368f41
--- /dev/null
+++ b/PlugLoadMgr/src/androidx/pluginmgr/PluginPackageManager.java
@@ -0,0 +1,784 @@
+/*
+ * Copyright (C) 2015 HouKx
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package androidx.pluginmgr;
+
+import java.util.List;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.FeatureInfo;
+import android.content.pm.InstrumentationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageInstaller;
+import android.content.pm.PackageManager;
+import android.content.pm.PermissionGroupInfo;
+import android.content.pm.PermissionInfo;
+import android.content.pm.ProviderInfo;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+import android.content.res.Resources;
+import android.content.res.XmlResourceParser;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.os.UserHandle;
+
+/**
+ * Customer PackageManager
+ *
+ *
+ * TODO unfinished, prepare use in
+ * {@link PluginContextWrapper#getPackageManager}
+ *
+ * @author HouKangxi
+ *
+ */
+public class PluginPackageManager extends PackageManager {
+ private final PackageManager orig;
+
+ public PluginPackageManager(PackageManager wrapper) {
+ this.orig = wrapper;
+ }
+
+ @Override
+ public PackageInfo getPackageInfo(String packageName, int flags)
+ throws NameNotFoundException {
+ PlugInfo plugin = PluginManager.getInstance().getPluginByPackageName(
+ packageName);
+ if (plugin != null) {
+ return plugin.getPackageInfo();
+ }
+ return orig.getPackageInfo(packageName, flags);
+ }
+
+ @Override
+ public String[] currentToCanonicalPackageNames(String[] names) {
+ return orig.currentToCanonicalPackageNames(names);
+ }
+
+ @Override
+ public String[] canonicalToCurrentPackageNames(String[] names) {
+ return orig.canonicalToCurrentPackageNames(names);
+ }
+
+ @Override
+ public Intent getLaunchIntentForPackage(String packageName) {
+ // PlugInfo plugin =
+ // PluginManager.getInstance().getPluginByPackageName(packageName);
+ // if (plugin != null) {
+ // //TODO
+ // }
+ return orig.getLaunchIntentForPackage(packageName);
+ }
+
+ @Override
+ public int[] getPackageGids(String packageName)
+ throws NameNotFoundException {
+ PlugInfo plugin = PluginManager.getInstance().getPluginByPackageName(
+ packageName);
+ if (plugin != null) {
+ return plugin.getPackageInfo().gids;
+ }
+ return orig.getPackageGids(packageName);
+ }
+
+ @Override
+ public PermissionInfo getPermissionInfo(String name, int flags)
+ throws NameNotFoundException {
+ // TODO
+ return orig.getPermissionInfo(name, flags);
+ }
+
+ @Override
+ public List queryPermissionsByGroup(String group, int flags)
+ throws NameNotFoundException {
+ // TODO
+ return orig.queryPermissionsByGroup(group, flags);
+ }
+
+ @Override
+ public PermissionGroupInfo getPermissionGroupInfo(String name, int flags)
+ throws NameNotFoundException {
+ // TODO
+ return orig.getPermissionGroupInfo(name, flags);
+ }
+
+ @Override
+ public List getAllPermissionGroups(int flags) {
+ // TODO
+ return orig.getAllPermissionGroups(flags);
+ }
+
+ @Override
+ public ApplicationInfo getApplicationInfo(String packageName, int flags)
+ throws NameNotFoundException {
+ PlugInfo plugin = PluginManager.getInstance().getPluginByPackageName(
+ packageName);
+ if (plugin != null) {
+ return plugin.getPackageInfo().applicationInfo;
+ }
+ return orig.getApplicationInfo(packageName, flags);
+ }
+
+ @Override
+ public ActivityInfo getActivityInfo(ComponentName component, int flags)
+ throws NameNotFoundException {
+ String packageName = component.getPackageName();
+ if (packageName != null) {
+ PlugInfo plugin = PluginManager.getInstance()
+ .getPluginByPackageName(packageName);
+ if (plugin != null) {
+ String actClassName = component.getClassName();
+ if (actClassName != null) {
+ return plugin.findActivityByClassName(actClassName);
+ }
+ }
+ }
+ return orig.getActivityInfo(component, flags);
+ }
+
+ @Override
+ public ActivityInfo getReceiverInfo(ComponentName component, int flags)
+ throws NameNotFoundException {
+ String packageName = component.getPackageName();
+ if (packageName != null) {
+ PlugInfo plugin = PluginManager.getInstance()
+ .getPluginByPackageName(packageName);
+ if (plugin != null) {
+ String className = component.getClassName();
+ if (className != null) {
+ return plugin.findReceiverByClassName(className);
+ }
+ }
+ }
+ return orig.getReceiverInfo(component, flags);
+ }
+
+ @Override
+ public ServiceInfo getServiceInfo(ComponentName component, int flags)
+ throws NameNotFoundException {
+ String packageName = component.getPackageName();
+ if (packageName != null) {
+ PlugInfo plugin = PluginManager.getInstance()
+ .getPluginByPackageName(packageName);
+ if (plugin != null) {
+ String className = component.getClassName();
+ if (className != null) {
+ return plugin.findServiceByClassName(className);
+ }
+ }
+ }
+ return orig.getServiceInfo(component, flags);
+ }
+
+ @Override
+ public ProviderInfo getProviderInfo(ComponentName component, int flags)
+ throws NameNotFoundException {
+ // TODO getProviderInfo
+ return orig.getProviderInfo(component, flags);
+ }
+
+ @Override
+ public List getInstalledPackages(int flags) {
+ return orig.getInstalledPackages(flags);
+ }
+
+ @Override
+ public int checkPermission(String permName, String pkgName) {
+ // TODO checkPermission
+ return orig.checkPermission(permName, pkgName);
+ }
+
+ @Override
+ public boolean addPermission(PermissionInfo info) {
+ // TODO addPermission
+ return orig.addPermission(info);
+ }
+
+ @Override
+ public boolean addPermissionAsync(PermissionInfo info) {
+ // TODO addPermissionAsync
+ return orig.addPermission(info);
+ }
+
+ @Override
+ public void removePermission(String name) {
+ // TODO removePermission
+ orig.removePermission(name);
+ }
+
+ @Override
+ public int checkSignatures(String pkg1, String pkg2) {
+ // TODO checkSignatures
+ return orig.checkSignatures(pkg1, pkg2);
+ }
+
+ @Override
+ public int checkSignatures(int uid1, int uid2) {
+ // TODO checkSignatures
+ return orig.checkSignatures(uid1, uid2);
+ }
+
+ @Override
+ public String[] getPackagesForUid(int uid) {
+ // TODO getPackagesForUid
+ return orig.getPackagesForUid(uid);
+ }
+
+ @Override
+ public String getNameForUid(int uid) {
+ // TODO getNameForUid
+ return orig.getNameForUid(uid);
+ }
+
+ @Override
+ public List getInstalledApplications(int flags) {
+ return orig.getInstalledApplications(flags);
+ }
+
+ @Override
+ public String[] getSystemSharedLibraryNames() {
+ // TODO getSystemSharedLibraryNames
+ return orig.getSystemSharedLibraryNames();
+ }
+
+ @Override
+ public FeatureInfo[] getSystemAvailableFeatures() {
+ // TODO getSystemAvailableFeatures
+ return orig.getSystemAvailableFeatures();
+ }
+
+ @Override
+ public boolean hasSystemFeature(String name) {
+ // TODO hasSystemFeature
+ return orig.hasSystemFeature(name);
+ }
+
+ @Override
+ public ResolveInfo resolveActivity(Intent intent, int flags) {
+ // TODO resolveActivity
+ // ComponentName compname = intent.getComponent();
+ // if(compname!=null){
+ // String packageName = compname.getPackageName();
+ // if(packageName!=null){
+ // PlugInfo plug =
+ // PluginManager.getInstance().getPluginByPackageName(packageName);
+ // if (plug != null) {
+ // String className = compname.getClassName();
+ // if(className!=null){
+ // return plug.resolveActivity()
+ // }
+ // }
+ // }
+ // }
+ return orig.resolveActivity(intent, flags);
+ }
+
+ @Override
+ public List queryIntentActivities(Intent intent, int flags) {
+ // TODO Auto-generated method stub
+ return orig.queryIntentActivities(intent, flags);
+ }
+
+ @Override
+ public List queryIntentActivityOptions(ComponentName caller,
+ Intent[] specifics, Intent intent, int flags) {
+ // TODO Auto-generated method stub
+ return orig
+ .queryIntentActivityOptions(caller, specifics, intent, flags);
+ }
+
+ @Override
+ public List queryBroadcastReceivers(Intent intent, int flags) {
+ // TODO Auto-generated method stub
+ return orig.queryBroadcastReceivers(intent, flags);
+ }
+
+ @Override
+ public ResolveInfo resolveService(Intent intent, int flags) {
+ // TODO Auto-generated method stub
+ return orig.resolveService(intent, flags);
+ }
+
+ @Override
+ public List queryIntentServices(Intent intent, int flags) {
+ // TODO Auto-generated method stub
+ return orig.queryIntentServices(intent, flags);
+ }
+
+ @Override
+ public ProviderInfo resolveContentProvider(String name, int flags) {
+ // TODO Auto-generated method stub
+ return orig.resolveContentProvider(name, flags);
+ }
+
+ @Override
+ public List queryContentProviders(String processName,
+ int uid, int flags) {
+ // TODO Auto-generated method stub
+ return orig.queryContentProviders(processName, uid, flags);
+ }
+
+ @Override
+ public InstrumentationInfo getInstrumentationInfo(ComponentName className,
+ int flags) throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return orig.getInstrumentationInfo(className, flags);
+ }
+
+ @Override
+ public List queryInstrumentation(String targetPackage,
+ int flags) {
+ // TODO Auto-generated method stub
+ return orig.queryInstrumentation(targetPackage, flags);
+ }
+
+ @Override
+ public Drawable getDrawable(String packageName, int resid,
+ ApplicationInfo appInfo) {
+ // TODO getDrawable
+ return orig.getDrawable(packageName, resid, appInfo);
+ }
+
+ @Override
+ public Drawable getActivityIcon(ComponentName activityName)
+ throws NameNotFoundException {
+ // TODO getActivityIcon
+ PlugInfo plug = PluginManager.getInstance().getPluginByPackageName(
+ activityName.getPackageName());
+ if (plug != null) {
+ ActivityInfo actInfo = plug.findActivityByClassName(activityName
+ .getClassName());
+ int icon = actInfo.icon;
+ if (icon != 0) {
+ return plug.getResources().getDrawable(icon);
+ }
+ }
+ return orig.getActivityIcon(activityName);
+ }
+
+ @Override
+ public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
+ // TODO getActivityIcon(Intent intent)
+ return orig.getActivityIcon(intent);
+ }
+
+ @Override
+ public Drawable getDefaultActivityIcon() {
+ // TODO getDefaultActivityIcon
+ return orig.getDefaultActivityIcon();
+ }
+
+ @Override
+ public Drawable getApplicationIcon(ApplicationInfo info) {
+ // TODO getApplicationIcon
+ return orig.getApplicationIcon(info);
+ }
+
+ @Override
+ public Drawable getApplicationIcon(String packageName)
+ throws NameNotFoundException {
+ // TODO getApplicationIcon
+ PlugInfo plug = PluginManager.getInstance().getPluginByPackageName(
+ packageName);
+ if (plug != null) {
+ int appIcon = plug.getPackageInfo().applicationInfo.icon;
+ if (appIcon != 0) {
+ return plug.getResources().getDrawable(appIcon);
+ } else {
+ return null;
+ }
+ }
+ return orig.getApplicationIcon(packageName);
+ }
+
+ @Override
+ public Drawable getActivityLogo(ComponentName activityName)
+ throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getActivityLogo(android.content.Intent)
+ */
+ @Override
+ public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getApplicationLogo(android.content.
+ * pm.ApplicationInfo)
+ */
+ @Override
+ public Drawable getApplicationLogo(ApplicationInfo info) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getApplicationLogo(java.lang.String)
+ */
+ @Override
+ public Drawable getApplicationLogo(String packageName)
+ throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.content.pm.PackageManager#getText(java.lang.String, int,
+ * android.content.pm.ApplicationInfo)
+ */
+ @Override
+ public CharSequence getText(String packageName, int resid,
+ ApplicationInfo appInfo) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.content.pm.PackageManager#getXml(java.lang.String, int,
+ * android.content.pm.ApplicationInfo)
+ */
+ @Override
+ public XmlResourceParser getXml(String packageName, int resid,
+ ApplicationInfo appInfo) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getApplicationLabel(android.content
+ * .pm.ApplicationInfo)
+ */
+ @Override
+ public CharSequence getApplicationLabel(ApplicationInfo info) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getResourcesForActivity(android.content
+ * .ComponentName)
+ */
+ @Override
+ public Resources getResourcesForActivity(ComponentName activityName)
+ throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getResourcesForApplication(android.
+ * content.pm.ApplicationInfo)
+ */
+ @Override
+ public Resources getResourcesForApplication(ApplicationInfo app)
+ throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getResourcesForApplication(java.lang
+ * .String)
+ */
+ @Override
+ public Resources getResourcesForApplication(String appPackageName)
+ throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getInstallerPackageName(java.lang.String
+ * )
+ */
+ @Override
+ public String getInstallerPackageName(String packageName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#addPackageToPreferred(java.lang.String)
+ */
+ @Override
+ public void addPackageToPreferred(String packageName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#removePackageFromPreferred(java.lang
+ * .String)
+ */
+ @Override
+ public void removePackageFromPreferred(String packageName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.content.pm.PackageManager#getPreferredPackages(int)
+ */
+ @Override
+ public List getPreferredPackages(int flags) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#addPreferredActivity(android.content
+ * .IntentFilter, int, android.content.ComponentName[],
+ * android.content.ComponentName)
+ */
+ @Override
+ public void addPreferredActivity(IntentFilter filter, int match,
+ ComponentName[] set, ComponentName activity) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#clearPackagePreferredActivities(java
+ * .lang.String)
+ */
+ @Override
+ public void clearPackagePreferredActivities(String packageName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getPreferredActivities(java.util.List,
+ * java.util.List, java.lang.String)
+ */
+ @Override
+ public int getPreferredActivities(List outFilters,
+ List outActivities, String packageName) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#setComponentEnabledSetting(android.
+ * content.ComponentName, int, int)
+ */
+ @Override
+ public void setComponentEnabledSetting(ComponentName componentName,
+ int newState, int flags) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getComponentEnabledSetting(android.
+ * content.ComponentName)
+ */
+ @Override
+ public int getComponentEnabledSetting(ComponentName componentName) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#setApplicationEnabledSetting(java.lang
+ * .String, int, int)
+ */
+ @Override
+ public void setApplicationEnabledSetting(String packageName, int newState,
+ int flags) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * android.content.pm.PackageManager#getApplicationEnabledSetting(java.lang
+ * .String)
+ */
+ @Override
+ public int getApplicationEnabledSetting(String packageName) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.content.pm.PackageManager#isSafeMode()
+ */
+ @Override
+ public boolean isSafeMode() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public Intent getLeanbackLaunchIntentForPackage(String packageName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List getPackagesHoldingPermissions(
+ String[] permissions, int flags) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List queryIntentContentProviders(Intent intent,
+ int flags) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Drawable getActivityBanner(ComponentName activityName)
+ throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Drawable getActivityBanner(Intent intent)
+ throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Drawable getApplicationBanner(ApplicationInfo info) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Drawable getApplicationBanner(String packageName)
+ throws NameNotFoundException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Drawable getUserBadgedIcon(Drawable icon, UserHandle user) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Drawable getUserBadgedDrawableForDensity(Drawable drawable,
+ UserHandle user, Rect badgeLocation, int badgeDensity) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CharSequence getUserBadgedLabel(CharSequence label, UserHandle user) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void verifyPendingInstall(int id, int verificationCode) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void extendVerificationTimeout(int id,
+ int verificationCodeAtTimeout, long millisecondsToDelay) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setInstallerPackageName(String targetPackage,
+ String installerPackageName) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public PackageInstaller getPackageInstaller() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/android-pluginmgr/src/main/java/androidx/pluginmgr/ReflectionUtils.java b/PlugLoadMgr/src/androidx/pluginmgr/ReflectionUtils.java
similarity index 100%
rename from android-pluginmgr/src/main/java/androidx/pluginmgr/ReflectionUtils.java
rename to PlugLoadMgr/src/androidx/pluginmgr/ReflectionUtils.java
diff --git a/android-pluginmgr/src/main/java/androidx/pluginmgr/XmlManifestReader.java b/PlugLoadMgr/src/androidx/pluginmgr/XmlManifestReader.java
similarity index 100%
rename from android-pluginmgr/src/main/java/androidx/pluginmgr/XmlManifestReader.java
rename to PlugLoadMgr/src/androidx/pluginmgr/XmlManifestReader.java
diff --git a/android-pluginmgr/.classpath b/android-pluginmgr/.classpath
deleted file mode 100644
index 4f18b0d..0000000
--- a/android-pluginmgr/.classpath
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android-pluginmgr/.gitignore b/android-pluginmgr/.gitignore
deleted file mode 100644
index 7f5128b..0000000
--- a/android-pluginmgr/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/target/*
-/.settings/
diff --git a/android-pluginmgr/.settings/org.eclipse.core.resources.prefs b/android-pluginmgr/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 1f887b6..0000000
--- a/android-pluginmgr/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-encoding//src/main/java=UTF-8
diff --git a/android-pluginmgr/.settings/org.eclipse.m2e.core.prefs b/android-pluginmgr/.settings/org.eclipse.m2e.core.prefs
deleted file mode 100644
index 14b697b..0000000
--- a/android-pluginmgr/.settings/org.eclipse.m2e.core.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
diff --git a/android-pluginmgr/TODO b/android-pluginmgr/TODO
deleted file mode 100644
index ce74eb2..0000000
--- a/android-pluginmgr/TODO
+++ /dev/null
@@ -1,6 +0,0 @@
-1 PackageManager , meta-data, provider
-2 inner & outer ClassLoader
-3 load class with extra parameter such as pluginId, think java.lang.String in android
-4 framework with android.support
-5 android ui thread init plug application
-6 service support
diff --git a/android-pluginmgr/pom.xml b/android-pluginmgr/pom.xml
deleted file mode 100644
index 5ddb651..0000000
--- a/android-pluginmgr/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
- 4.0.0
- com.android
- pluginmgr
- 0.1.4
- androidx.pluginmgr
- dynamic load uninstalled apk
-
-
- com.google.dexmaker
- dexmaker
- 1.0
-
-
- com.google.android
- android
- 2.3.3
-
-
- junit
- junit
- 4.11
-
-
-
-
-
-
-
- maven-compiler-plugin
- 3.1
-
-
- default-testCompile
- test-compile
-
- testCompile
-
-
- src/test/java
- 1.6
- 1.6
- UTF-8
-
-
-
- default-compile
- compile
-
- compile
-
-
- src/test/java
- 1.6
- 1.6
- UTF-8
-
-
-
-
- src/test/java
- 1.6
- 1.6
- UTF-8
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android-pluginmgr/src/main/java/androidx/pluginmgr/PlugInfo.java b/android-pluginmgr/src/main/java/androidx/pluginmgr/PlugInfo.java
deleted file mode 100644
index d69cf68..0000000
--- a/android-pluginmgr/src/main/java/androidx/pluginmgr/PlugInfo.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Copyright (C) 2015 HouKx
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package androidx.pluginmgr;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import android.app.Application;
-import android.content.pm.ActivityInfo;
-import android.content.pm.PackageInfo;
-import android.content.pm.ResolveInfo;
-import android.content.pm.ServiceInfo;
-import android.content.res.AssetManager;
-import android.content.res.Resources;
-
-/**
- * 插件Bean
- *
- * @author HouKangxi
- *
- */
-public class PlugInfo {
-
- //
- // ================== FLELDS ==================
- private String id;
- private String filePath;
- private PackageInfo packageInfo;
- private Map activities;
- private ResolveInfo mainActivity;
- private List services;
- private List receivers;
- private List providers;
- //
- private transient PluginClassLoader classLoader;
- private transient Application application;
- private transient AssetManager assetManager;
- private transient Resources resources;
- PluginContextWrapper appWrapper;
- //
- // private transient volatile String currentActivityClass;
-
- public String getPackageName() {
- return packageInfo.packageName;
- }
-
- // ================== FLAGS STARD ==================
- /**
- * 按下back键时是否 finish Activity
- */
- private static final int FLAG_FinishActivityOnbackPressed = 1;
- /**
- * 是否调用父类的onBackPressed()方法
- */
- private static final int FLAG_INVOKE_SUPER_ONBACKPRESSED = 2;
-
- // ================== FLAGS END ==================
- /**
- * 按Back键时是否销毁Activity
- */
- public boolean isFinishActivityOnbackPressed(ActivityInfo act) {
- if (act == null) {
- return false;
- }
- int flags = getFlags(act);
- return containsFlag(flags, FLAG_FinishActivityOnbackPressed);
- }
-
- public boolean isInvokeSuperOnbackPressed(ActivityInfo act) {
- if (act == null) {
- return true;
- }
- int flags = getFlags(act);
- if (flags == 0) {
- return true;//默认true
- }
- return containsFlag(flags, FLAG_INVOKE_SUPER_ONBACKPRESSED);
- }
-
- public void setInvokeSuperOnbackPressed(ActivityInfo act,
- boolean invokeSuperOnbackPressed) {
- if (act == null) {
- return;
- }
- if (invokeSuperOnbackPressed) {
- setFlag(act, FLAG_INVOKE_SUPER_ONBACKPRESSED);
- } else {
- unsetFlag(act, FLAG_INVOKE_SUPER_ONBACKPRESSED);
- }
- }
-
- public void setFinishActivityOnbackPressed(ActivityInfo act,
- boolean finishOnbackPressed) {
- if (act == null) {
- return;
- }
- if (finishOnbackPressed) {
- setFlag(act, FLAG_FinishActivityOnbackPressed);
- } else {
- unsetFlag(act, FLAG_FinishActivityOnbackPressed);
- }
- }
-
- ActivityInfo findActivityByClassNameFromPkg(String actName) {
- if (packageInfo.activities == null) {
- return null;
- }
- for (ActivityInfo act : packageInfo.activities) {
- if(act.name.equals(actName)){
- return act;
- }
- }
- return null;
- }
- public ActivityInfo findActivityByClassName(String actName) {
- if (packageInfo.activities == null) {
- return null;
- }
- ResolveInfo act = activities.get(actName);
- if (act == null) {
- return null;
- }
- return act.activityInfo;
- }
-
- public ActivityInfo findActivityByAction(String action) {
- if (activities == null || activities.isEmpty()) {
- return null;
- }
- for (ResolveInfo act : activities.values()) {
- if (act.filter != null && act.filter.hasAction(action)) {
- return act.activityInfo;
- }
- }
- return null;
- }
-
- public ActivityInfo findReceiverByClassName(String className) {
- if (packageInfo.receivers == null) {
- return null;
- }
- for (ActivityInfo receiver : packageInfo.receivers) {
- if (receiver.name.equals(className)) {
- return receiver;
- }
- }
- return null;
-
- }
- public ServiceInfo findServiceByClassName(String className) {
- if (packageInfo.services == null) {
- return null;
- }
- for (ServiceInfo service : packageInfo.services) {
- if (service.name.equals(className)) {
- return service;
- }
- }
- return null;
-
- }
- public ServiceInfo findServiceByAction(String action) {
- if (services == null || services.isEmpty()) {
- return null;
- }
- for (ResolveInfo ser : services) {
- if (ser.filter != null && ser.filter.hasAction(action)) {
- return ser.serviceInfo;
- }
- }
- return null;
- }
- public void addActivity(ResolveInfo activity) {
- if (activities == null) {
- activities = new HashMap(20);
- }
- activities.put(activity.activityInfo.name,activity);
- if (mainActivity == null && activity.filter != null
- && activity.filter.hasAction("android.intent.action.MAIN")
- && activity.filter.hasCategory("android.intent.category.LAUNCHER")
- ) {
- mainActivity = activity;
- }
- }
-
- public void addReceiver(ResolveInfo receiver) {
- if (receivers == null) {
- receivers = new ArrayList();
- }
- receivers.add(receiver);
- }
-
- public void addService(ResolveInfo service) {
- if (services == null) {
- services = new ArrayList();
- }
- services.add(service);
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getFilePath() {
- return filePath;
- }
-
- public void setFilePath(String filePath) {
- this.filePath = filePath;
- }
-
- public PackageInfo getPackageInfo() {
- return packageInfo;
- }
-
- public void setPackageInfo(PackageInfo packageInfo) {
- this.packageInfo = packageInfo;
- activities = new HashMap(packageInfo.activities.length);
- }
-
- public PluginClassLoader getClassLoader() {
- return classLoader;
- }
-
- public void setClassLoader(PluginClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-
- public Application getApplication() {
- return application;
- }
-
- public void setApplication(Application application) {
- this.application = application;
- }
-
- public AssetManager getAssetManager() {
- return assetManager;
- }
-
- public void setAssetManager(AssetManager assetManager) {
- this.assetManager = assetManager;
- }
-
- public Resources getResources() {
- return resources;
- }
-
- public void setResources(Resources resources) {
- this.resources = resources;
- }
-
- // public String getCurrentActivityClass() {
- // return currentActivityClass;
- // }
- //
- // public void setCurrentActivityClass(String currentActivityClass) {
- // this.currentActivityClass = currentActivityClass;
- // }
-
- public Collection getActivities() {
- if (activities == null) {
- return null;
- }
- return activities.values();
- }
-
- public List getServices() {
- return services;
- }
-
- public void setServices(List services) {
- this.services = services;
- }
-
- public List getProviders() {
- return providers;
- }
-
- public void setProviders(List providers) {
- this.providers = providers;
- }
-
- public ResolveInfo getMainActivity() {
- return mainActivity;
- }
-
- public List getReceivers() {
- return receivers;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- PlugInfo other = (PlugInfo) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return super.toString() + "[ id=" + id + ", pkg=" + getPackageName()
- + " ]";
- }
-
- private static synchronized int getFlags(ActivityInfo act) {
- return act.logo;
- }
-
- private static synchronized void setFlag(ActivityInfo act, int flag) {
- act.logo |= flag;
- }
-
- private static synchronized void unsetFlag(ActivityInfo act, int flag) {
- act.logo &= ~flag;
- }
-
- private static boolean containsFlag(int vFlags, int flag) {
- return (vFlags & flag) == flag;
- }
-}
diff --git a/android-pluginmgr/src/main/java/androidx/pluginmgr/PluginManager.java b/android-pluginmgr/src/main/java/androidx/pluginmgr/PluginManager.java
deleted file mode 100644
index bf6a3c8..0000000
--- a/android-pluginmgr/src/main/java/androidx/pluginmgr/PluginManager.java
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- * Copyright (C) 2015 HouKx
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package androidx.pluginmgr;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileNotFoundException;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import android.app.Activity;
-import android.app.Application;
-import android.app.Service;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.AssetManager;
-import android.content.res.Resources;
-import android.util.Log;
-
-/**
- * The Plug-in Manager
- *
- * @author HouKangxi
- */
-public class PluginManager implements FileFilter {
- private static final String tag = "plugmgr";
-
- private static final PluginManager instance = new PluginManager();
-
- private final Map pluginIdToInfoMap = new ConcurrentHashMap();
- private final Map pluginPkgToInfoMap = new ConcurrentHashMap();
- private Context context;
- private String dexOutputPath;
- private volatile boolean hasInit = false;
- private File dexInternalStoragePath;
- private FrameworkClassLoader frameworkClassLoader;
- private PluginActivityLifeCycleCallback pluginActivityLifeCycleCallback;
- private volatile Activity actFrom;
-
- private PluginManager() {
- }
-
-
- public static PluginManager getInstance(Context context) {
- if (instance.hasInit || context == null) {
- if (instance.actFrom == null && context instanceof Activity) {
- instance.actFrom = (Activity) context;
- }
- return instance;
- }
- Context ctx = context;
- if (context instanceof Activity) {
- instance.actFrom = (Activity) context;
- ctx = ((Activity) context).getApplication();
- } else if (context instanceof Service) {
- ctx = ((Service) context).getApplication();
- } else if (context instanceof Application) {
- ctx = (Application) context;
- } else {
- ctx = context.getApplicationContext();
- }
- synchronized (PluginManager.class) {
- instance.init(ctx);
- }
- return instance;
- }
-
- static PluginManager getInstance() {
- return instance;
- }
-
- public boolean startMainActivity(Context context, String pkgOrId) {
- Log.d(tag, "startMainActivity by:" + pkgOrId);
- PlugInfo plug = preparePlugForStartActivity(context, pkgOrId);
- if (frameworkClassLoader == null) {
- Log.e(tag, "startMainActivity: frameworkClassLoader == null!");
- return false;
- }
- if (plug.getMainActivity() == null) {
- Log.e(tag, "startMainActivity: plug.getMainActivity() == null!");
- return false;
- }
- if (plug.getMainActivity().activityInfo == null) {
- Log.e(tag,
- "startMainActivity: plug.getMainActivity().activityInfo == null!");
- return false;
- }
- String className = frameworkClassLoader.newActivityClassName(
- plug.getId(), plug.getMainActivity().activityInfo.name);
- context.startActivity(new Intent().setComponent(new ComponentName(
- context, className)));
- return true;
- }
-
- public void startActivity(Context context, Intent intent) {
- performStartActivity(context, intent);
- context.startActivity(intent);
- }
-
- public void startActivityForResult(Activity activity, Intent intent,
- int requestCode) {
- performStartActivity(context, intent);
- activity.startActivityForResult(intent, requestCode);
- }
-
- private PlugInfo preparePlugForStartActivity(Context context,
- String plugIdOrPkg) {
- PlugInfo plug = null;
- plug = getPluginByPackageName(plugIdOrPkg);
- if (plug == null) {
- plug = getPluginById(plugIdOrPkg);
- }
- if (plug == null) {
- throw new IllegalArgumentException("plug not found by:"
- + plugIdOrPkg);
- }
- return plug;
- }
-
- private void performStartActivity(Context context, Intent intent) {
- checkInit();
-
- String plugIdOrPkg;
- String actName;
- ComponentName origComp = intent.getComponent();
- if (origComp != null) {
- plugIdOrPkg = origComp.getPackageName();
- actName = origComp.getClassName();
- } else {
- throw new IllegalArgumentException(
- "plug intent must set the ComponentName!");
- }
- PlugInfo plug = preparePlugForStartActivity(context, plugIdOrPkg);
- String className = frameworkClassLoader.newActivityClassName(
- plug.getId(), actName);
- Log.i(tag, "performStartActivity: " + actName);
- ComponentName comp = new ComponentName(context, className);
- intent.setAction(null);
- intent.setComponent(comp);
- }
-
-
- private void init(Context ctx) {
- Log.i(tag, "init()...");
- context = ctx;
- File optimizedDexPath = ctx.getDir("plugsout", Context.MODE_PRIVATE);
- if (!optimizedDexPath.exists()) {
- optimizedDexPath.mkdirs();
- }
- dexOutputPath = optimizedDexPath.getAbsolutePath();
- dexInternalStoragePath = context
- .getDir("plugins", Context.MODE_PRIVATE);
- dexInternalStoragePath.mkdirs();
- // change ClassLoader
- try {
- Object mPackageInfo = ReflectionUtils.getFieldValue(ctx,
- "mBase.mPackageInfo", true);
- frameworkClassLoader = new FrameworkClassLoader(
- ctx.getClassLoader());
- // set Application's classLoader to FrameworkClassLoader
- ReflectionUtils.setFieldValue(mPackageInfo, "mClassLoader",
- frameworkClassLoader, true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- hasInit = true;
- }
-
- private void checkInit() {
- if (!hasInit) {
- throw new IllegalStateException("PluginManager has not init!");
- }
- }
-
- public PlugInfo getPluginById(String pluginId) {
- if (pluginId == null) {
- return null;
- }
- return pluginIdToInfoMap.get(pluginId);
- }
-
- public PlugInfo getPluginByPackageName(String packageName) {
- return pluginPkgToInfoMap.get(packageName);
- }
-
- public Collection getPlugins() {
- return pluginIdToInfoMap.values();
- }
-
- public void uninstallPluginById(String pluginId) {
- uninstallPlugin(pluginId, true);
- }
-
- public void uninstallPluginByPkg(String pkg) {
- uninstallPlugin(pkg, false);
- }
-
- private void uninstallPlugin(String k, boolean isId) {
- checkInit();
- PlugInfo pl = isId ? removePlugById(k) : removePlugByPkg(k);
- if (pl == null) {
- return;
- }
- if (context instanceof Application) {
- if (android.os.Build.VERSION.SDK_INT >= 14) {
- try {
- Application.class
- .getMethod(
- "unregisterComponentCallbacks",
- Class.forName("android.content.ComponentCallbacks"))
- .invoke(context, pl.getApplication());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- private PlugInfo removePlugById(String pluginId) {
- PlugInfo pl = null;
- synchronized (this) {
- pl = pluginIdToInfoMap.remove(pluginId);
- if (pl == null) {
- return null;
- }
- pluginPkgToInfoMap.remove(pl.getPackageName());
- }
- return pl;
- }
-
- private PlugInfo removePlugByPkg(String pkg) {
- PlugInfo pl = null;
- synchronized (this) {
- pl = pluginPkgToInfoMap.remove(pkg);
- if (pl == null) {
- return null;
- }
- pluginIdToInfoMap.remove(pl.getId());
- }
- return pl;
- }
-
- /**
- * 加载指定插件或指定目录下的所有插件
- *
- * 都使用文件名作为Id
- *
- * @param pluginSrcDirFile
- * - apk或apk目录
- * @return 插件集合
- * @throws Exception
- */
- public Collection loadPlugin(final File pluginSrcDirFile)
- throws Exception {
- checkInit();
- if (pluginSrcDirFile == null || !pluginSrcDirFile.exists()) {
- Log.e(tag, "invalidate plugin file or Directory :"
- + pluginSrcDirFile);
- return null;
- }
- if (pluginSrcDirFile.isFile()) {
- // 如果是文件则尝试加载单个插件,暂不检查文件类型,除apk外,以后可能支持加载其他类型文件,如jar
- PlugInfo one = loadPluginWithId(pluginSrcDirFile, null, null);
- return Collections.singletonList(one);
- }
- // clear all first
- synchronized (this) {
- pluginPkgToInfoMap.clear();
- pluginIdToInfoMap.clear();
- }
- File[] pluginApks = pluginSrcDirFile.listFiles(this);
- if (pluginApks == null || pluginApks.length < 1) {
- throw new FileNotFoundException("could not find plugins in:"
- + pluginSrcDirFile);
- }
- for (File pluginApk : pluginApks) {
- PlugInfo plugInfo = buildPlugInfo(pluginApk, null, null);
- if (plugInfo != null) {
- savePluginToMap(plugInfo);
- }
- }
- return pluginIdToInfoMap.values();
- }
-
- private synchronized void savePluginToMap(PlugInfo plugInfo) {
- pluginPkgToInfoMap.put(plugInfo.getPackageName(), plugInfo);
- pluginIdToInfoMap.put(plugInfo.getId(), plugInfo);
- }
-
- // /**
- // * 单独加载一个apk
- // * 使用文件名作为插件id
- // * 目标文件也是与源文件同名
- // *
- // * @param pluginApk
- // * @return
- // * @throws Exception
- // */
- // public PlugInfo loadPlugin(File pluginApk) throws Exception {
- // return loadPluginWithId(pluginApk, null, null);
- // }
-
- /**
- * 单独加载一个apk
- *
- * @param pluginApk
- * @param pluginId
- * - 如果参数为null,则使用文件名作为插件id
- * @return
- * @throws Exception
- */
- public PlugInfo loadPluginWithId(File pluginApk, String pluginId)
- throws Exception {
- return loadPluginWithId(pluginApk, pluginId, null);
- }
-
- public PlugInfo loadPluginWithId(File pluginApk, String pluginId,
- String targetFileName) throws Exception {
- checkInit();
- PlugInfo plugInfo = buildPlugInfo(pluginApk, pluginId, targetFileName);
- if (plugInfo != null) {
- savePluginToMap(plugInfo);
- }
- return plugInfo;
- }
-
- private PlugInfo buildPlugInfo(File pluginApk, String pluginId,
- String targetFileName) throws Exception {
- PlugInfo info = new PlugInfo();
- info.setId(pluginId == null ? pluginApk.getName() : pluginId);
-
- File privateFile = new File(dexInternalStoragePath,
- targetFileName == null ? pluginApk.getName() : targetFileName);
-
- info.setFilePath(privateFile.getAbsolutePath());
-
- if (!pluginApk.getAbsolutePath().equals(privateFile.getAbsolutePath())) {
- copyApkToPrivatePath(pluginApk, privateFile);
- }
- String dexPath = privateFile.getAbsolutePath();
- PluginManifestUtil.setManifestInfo(context, dexPath, info);
-
- PluginClassLoader loader = new PluginClassLoader(dexPath,
- dexOutputPath, frameworkClassLoader, info);
- info.setClassLoader(loader);
-
- try {
- AssetManager am = (AssetManager) AssetManager.class.newInstance();
- am.getClass().getMethod("addAssetPath", String.class)
- .invoke(am, dexPath);
- info.setAssetManager(am);
- Resources ctxres = context.getResources();
- Resources res = new Resources(am, ctxres.getDisplayMetrics(),
- ctxres.getConfiguration());
- info.setResources(res);
- } catch (Exception e) {
- e.printStackTrace();
- }
- if (actFrom != null) {
- initPluginApplication(info, actFrom, true);
- }
- // createPluginActivityProxyDexes(info);
- Log.i(tag, "buildPlugInfo: " + info);
- return info;
- }
-
- // private void createPluginActivityProxyDexes(PlugInfo plugin) {
- // {
- // ActInfo act = plugin.getApplicationInfo().getMainActivity();
- // if (act != null) {
- // ActivityOverider.createProxyDex(plugin, act.name, false);
- // }
- // }
- // if (plugin.getApplicationInfo().getOtherActivities() != null) {
- // for (ActInfo act : plugin.getApplicationInfo().getOtherActivities())
- // {
- // ActivityOverider.createProxyDex(plugin, act.name, false);
- // }
- // }
- // }
- void initPluginApplication(final PlugInfo info, Activity actFrom)
- throws Exception {
- initPluginApplication(info, actFrom, false);
- }
-
- private void initPluginApplication(final PlugInfo plugin, Activity actFrom, boolean onLoad) throws Exception {
- if (!onLoad && plugin.getApplication() != null) {
- return;
- }
- final String className = plugin.getPackageInfo().applicationInfo.name;
- if (className == null) {
- if (onLoad) {
- return;
- }
- Application application = new Application();
- setApplicationBase(plugin, application);
- return;
- }
- Log.d(tag, plugin.getId() + ", ApplicationClassName = " + className);
-
- Runnable setApplicationTask = new Runnable() {
- public void run() {
- ClassLoader loader = plugin.getClassLoader();
- try {
- Class> applicationClass = loader.loadClass(className);
- Application application = (Application) applicationClass
- .newInstance();
- setApplicationBase(plugin, application);
- // invoke plugin application's onCreate()
- application.onCreate();
- } catch (Throwable e) {
- Log.e(tag, Log.getStackTraceString(e));
- }
- }
- };
- // create Application instance for plugin
- if (actFrom == null) {
- if(onLoad)
- return;
- setApplicationTask.run();
- }else{
- actFrom.runOnUiThread(setApplicationTask);
- }
- }
-
- private void setApplicationBase(PlugInfo plugin, Application application)
- throws Exception {
-
- synchronized (plugin) {
- if (plugin.getApplication() != null) {
- // set plugin's Application only once
- return;
- }
- plugin.setApplication(application);
- //
- PluginContextWrapper ctxWrapper = new PluginContextWrapper(context,
- plugin);
- plugin.appWrapper = ctxWrapper;
- // attach
- Method attachMethod = android.app.Application.class.getDeclaredMethod(
- "attach", Context.class);
- attachMethod.setAccessible(true);
- attachMethod.invoke(application, ctxWrapper);
- if (context instanceof Application) {
- if (android.os.Build.VERSION.SDK_INT >= 14) {
- Application.class.getMethod("registerComponentCallbacks",
- Class.forName("android.content.ComponentCallbacks"))
- .invoke(context, application);
- }
- }
-
- }
- }
-
- private void copyApkToPrivatePath(File pluginApk, File f) {
- // if (f.exists() && pluginApk.length() == f.length()) {
- // // 这里只是简单的判断如果两个文件长度相同则不拷贝,严格的做应该比较签名如 md5\sha-1
- // return;
- // }
- FileUtil.copyFile(pluginApk, f);
- }
-
- File getDexInternalStoragePath() {
- return dexInternalStoragePath;
- }
-
- Context getContext() {
- return context;
- }
-
- public PluginActivityLifeCycleCallback getPluginActivityLifeCycleCallback() {
- return pluginActivityLifeCycleCallback;
- }
-
- public void setPluginActivityLifeCycleCallback(
- PluginActivityLifeCycleCallback pluginActivityLifeCycleCallback) {
- this.pluginActivityLifeCycleCallback = pluginActivityLifeCycleCallback;
- }
-
- FrameworkClassLoader getFrameworkClassLoader() {
- return frameworkClassLoader;
- }
-
- @Override
- public boolean accept(File pathname) {
- if (pathname.isDirectory()) {
- return false;
- }
- String fname = pathname.getName();
- return fname.endsWith(".apk");
- }
-
-}
diff --git a/android-pluginmgr/src/main/java/androidx/pluginmgr/PluginPackageManager.java b/android-pluginmgr/src/main/java/androidx/pluginmgr/PluginPackageManager.java
deleted file mode 100644
index 6c49d59..0000000
--- a/android-pluginmgr/src/main/java/androidx/pluginmgr/PluginPackageManager.java
+++ /dev/null
@@ -1,688 +0,0 @@
-/*
- * Copyright (C) 2015 HouKx
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package androidx.pluginmgr;
-
-import java.util.List;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.ActivityInfo;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.FeatureInfo;
-import android.content.pm.InstrumentationInfo;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PermissionGroupInfo;
-import android.content.pm.PermissionInfo;
-import android.content.pm.ProviderInfo;
-import android.content.pm.ResolveInfo;
-import android.content.pm.ServiceInfo;
-import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
-import android.graphics.drawable.Drawable;
-
-/**
- * Customer PackageManager
- *
- *
- * TODO unfinished, prepare use in {@link PluginContextWrapper#getPackageManager}
- *
- * @author HouKangxi
- *
- */
-public class PluginPackageManager extends PackageManager {
- private PackageManager orig;
-
- public PluginPackageManager(PackageManager wrapper) {
- this.orig = wrapper;
- }
-
- @Override
- public PackageInfo getPackageInfo(String packageName, int flags)
- throws NameNotFoundException {
- PlugInfo plugin = PluginManager.getInstance().getPluginByPackageName(
- packageName);
- if (plugin != null) {
- return plugin.getPackageInfo();
- }
- return orig.getPackageInfo(packageName, flags);
- }
-
- @Override
- public String[] currentToCanonicalPackageNames(String[] names) {
- return orig.currentToCanonicalPackageNames(names);
- }
-
- @Override
- public String[] canonicalToCurrentPackageNames(String[] names) {
- return orig.canonicalToCurrentPackageNames(names);
- }
-
- @Override
- public Intent getLaunchIntentForPackage(String packageName) {
- // PlugInfo plugin =
- // PluginManager.getInstance().getPluginByPackageName(packageName);
- // if (plugin != null) {
- // //TODO
- // }
- return orig.getLaunchIntentForPackage(packageName);
- }
-
- @Override
- public int[] getPackageGids(String packageName)
- throws NameNotFoundException {
- PlugInfo plugin = PluginManager.getInstance().getPluginByPackageName(
- packageName);
- if (plugin != null) {
- return plugin.getPackageInfo().gids;
- }
- return orig.getPackageGids(packageName);
- }
-
- @Override
- public PermissionInfo getPermissionInfo(String name, int flags)
- throws NameNotFoundException {
- // TODO
- return orig.getPermissionInfo(name, flags);
- }
-
- @Override
- public List queryPermissionsByGroup(String group, int flags)
- throws NameNotFoundException {
- // TODO
- return orig.queryPermissionsByGroup(group, flags);
- }
-
- @Override
- public PermissionGroupInfo getPermissionGroupInfo(String name, int flags)
- throws NameNotFoundException {
- // TODO
- return orig.getPermissionGroupInfo(name, flags);
- }
-
- @Override
- public List getAllPermissionGroups(int flags) {
- // TODO
- return orig.getAllPermissionGroups(flags);
- }
-
- @Override
- public ApplicationInfo getApplicationInfo(String packageName, int flags)
- throws NameNotFoundException {
- PlugInfo plugin = PluginManager.getInstance().getPluginByPackageName(
- packageName);
- if (plugin != null) {
- return plugin.getPackageInfo().applicationInfo;
- }
- return orig.getApplicationInfo(packageName, flags);
- }
-
- @Override
- public ActivityInfo getActivityInfo(ComponentName component, int flags)
- throws NameNotFoundException {
- String packageName = component.getPackageName();
- if (packageName != null) {
- PlugInfo plugin = PluginManager.getInstance()
- .getPluginByPackageName(packageName);
- if (plugin != null) {
- String actClassName = component.getClassName();
- if (actClassName != null) {
- return plugin.findActivityByClassName(actClassName);
- }
- }
- }
- return orig.getActivityInfo(component, flags);
- }
-
- @Override
- public ActivityInfo getReceiverInfo(ComponentName component, int flags)
- throws NameNotFoundException {
- String packageName = component.getPackageName();
- if (packageName != null) {
- PlugInfo plugin = PluginManager.getInstance()
- .getPluginByPackageName(packageName);
- if (plugin != null) {
- String className = component.getClassName();
- if (className != null) {
- return plugin.findReceiverByClassName(className);
- }
- }
- }
- return orig.getReceiverInfo(component, flags);
- }
-
- @Override
- public ServiceInfo getServiceInfo(ComponentName component, int flags)
- throws NameNotFoundException {
- String packageName = component.getPackageName();
- if (packageName != null) {
- PlugInfo plugin = PluginManager.getInstance()
- .getPluginByPackageName(packageName);
- if (plugin != null) {
- String className = component.getClassName();
- if (className != null) {
- return plugin.findServiceByClassName(className);
- }
- }
- }
- return orig.getServiceInfo(component, flags);
- }
-
- @Override
- public ProviderInfo getProviderInfo(ComponentName component, int flags)
- throws NameNotFoundException {
- // TODO getProviderInfo
- return orig.getProviderInfo(component, flags);
- }
-
- @Override
- public List getInstalledPackages(int flags) {
- return orig.getInstalledPackages(flags);
- }
-
- @Override
- public int checkPermission(String permName, String pkgName) {
- // TODO checkPermission
- return orig.checkPermission(permName, pkgName);
- }
-
- @Override
- public boolean addPermission(PermissionInfo info) {
- // TODO addPermission
- return orig.addPermission(info);
- }
-
- @Override
- public boolean addPermissionAsync(PermissionInfo info) {
- // TODO addPermissionAsync
- return orig.addPermission(info);
- }
-
- @Override
- public void removePermission(String name) {
- // TODO removePermission
- orig.removePermission(name);
- }
-
- @Override
- public int checkSignatures(String pkg1, String pkg2) {
- // TODO checkSignatures
- return orig.checkSignatures(pkg1, pkg2);
- }
-
- @Override
- public int checkSignatures(int uid1, int uid2) {
- // TODO checkSignatures
- return orig.checkSignatures(uid1, uid2);
- }
-
- @Override
- public String[] getPackagesForUid(int uid) {
- // TODO getPackagesForUid
- return orig.getPackagesForUid(uid);
- }
-
- @Override
- public String getNameForUid(int uid) {
- // TODO getNameForUid
- return orig.getNameForUid(uid);
- }
-
- @Override
- public List getInstalledApplications(int flags) {
- return orig.getInstalledApplications(flags);
- }
-
- @Override
- public String[] getSystemSharedLibraryNames() {
- // TODO getSystemSharedLibraryNames
- return orig.getSystemSharedLibraryNames();
- }
-
- @Override
- public FeatureInfo[] getSystemAvailableFeatures() {
- // TODO getSystemAvailableFeatures
- return orig.getSystemAvailableFeatures();
- }
-
- @Override
- public boolean hasSystemFeature(String name) {
- // TODO hasSystemFeature
- return orig.hasSystemFeature(name);
- }
-
- @Override
- public ResolveInfo resolveActivity(Intent intent, int flags) {
- // TODO resolveActivity
- // ComponentName compname = intent.getComponent();
- // if(compname!=null){
- // String packageName = compname.getPackageName();
- // if(packageName!=null){
- // PlugInfo plug =
- // PluginManager.getInstance().getPluginByPackageName(packageName);
- // if (plug != null) {
- // String className = compname.getClassName();
- // if(className!=null){
- // return plug.resolveActivity()
- // }
- // }
- // }
- // }
- return orig.resolveActivity(intent, flags);
- }
-
- @Override
- public List queryIntentActivities(Intent intent, int flags) {
- // TODO Auto-generated method stub
- return orig.queryIntentActivities(intent, flags);
- }
-
- @Override
- public List queryIntentActivityOptions(ComponentName caller,
- Intent[] specifics, Intent intent, int flags) {
- // TODO Auto-generated method stub
- return orig
- .queryIntentActivityOptions(caller, specifics, intent, flags);
- }
-
- @Override
- public List queryBroadcastReceivers(Intent intent, int flags) {
- // TODO Auto-generated method stub
- return orig.queryBroadcastReceivers(intent, flags);
- }
-
- @Override
- public ResolveInfo resolveService(Intent intent, int flags) {
- // TODO Auto-generated method stub
- return orig.resolveService(intent, flags);
- }
-
- @Override
- public List queryIntentServices(Intent intent, int flags) {
- // TODO Auto-generated method stub
- return orig.queryIntentServices(intent, flags);
- }
-
- @Override
- public ProviderInfo resolveContentProvider(String name, int flags) {
- // TODO Auto-generated method stub
- return orig.resolveContentProvider(name, flags);
- }
-
- @Override
- public List queryContentProviders(String processName,
- int uid, int flags) {
- // TODO Auto-generated method stub
- return orig.queryContentProviders(processName, uid, flags);
- }
-
- @Override
- public InstrumentationInfo getInstrumentationInfo(ComponentName className,
- int flags) throws NameNotFoundException {
- // TODO Auto-generated method stub
- return orig.getInstrumentationInfo(className, flags);
- }
-
- @Override
- public List queryInstrumentation(String targetPackage,
- int flags) {
- // TODO Auto-generated method stub
- return orig.queryInstrumentation(targetPackage, flags);
- }
-
- @Override
- public Drawable getDrawable(String packageName, int resid,
- ApplicationInfo appInfo) {
- // TODO getDrawable
- return orig.getDrawable(packageName, resid, appInfo);
- }
-
- @Override
- public Drawable getActivityIcon(ComponentName activityName)
- throws NameNotFoundException {
- // TODO getActivityIcon
- PlugInfo plug = PluginManager.getInstance().getPluginByPackageName(
- activityName.getPackageName());
- if (plug != null) {
- ActivityInfo actInfo = plug.findActivityByClassName(activityName
- .getClassName());
- int icon = actInfo.icon;
- if (icon != 0) {
- return plug.getResources().getDrawable(icon);
- }
- }
- return orig.getActivityIcon(activityName);
- }
-
- @Override
- public Drawable getActivityIcon(Intent intent) throws NameNotFoundException {
- // TODO getActivityIcon(Intent intent)
- return orig.getActivityIcon(intent);
- }
-
- @Override
- public Drawable getDefaultActivityIcon() {
- // TODO getDefaultActivityIcon
- return orig.getDefaultActivityIcon();
- }
-
- @Override
- public Drawable getApplicationIcon(ApplicationInfo info) {
- // TODO getApplicationIcon
- return orig.getApplicationIcon(info);
- }
-
- @Override
- public Drawable getApplicationIcon(String packageName)
- throws NameNotFoundException {
- // TODO getApplicationIcon
- PlugInfo plug = PluginManager.getInstance().getPluginByPackageName(
- packageName);
- if (plug != null) {
- int appIcon = plug.getPackageInfo().applicationInfo.icon;
- if (appIcon != 0) {
- return plug.getResources().getDrawable(appIcon);
- } else {
- return null;
- }
- }
- return orig.getApplicationIcon(packageName);
- }
-
- @Override
- public Drawable getActivityLogo(ComponentName activityName)
- throws NameNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getActivityLogo(android.content.Intent)
- */
- @Override
- public Drawable getActivityLogo(Intent intent) throws NameNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getApplicationLogo(android.content.
- * pm.ApplicationInfo)
- */
- @Override
- public Drawable getApplicationLogo(ApplicationInfo info) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getApplicationLogo(java.lang.String)
- */
- @Override
- public Drawable getApplicationLogo(String packageName)
- throws NameNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see android.content.pm.PackageManager#getText(java.lang.String, int,
- * android.content.pm.ApplicationInfo)
- */
- @Override
- public CharSequence getText(String packageName, int resid,
- ApplicationInfo appInfo) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see android.content.pm.PackageManager#getXml(java.lang.String, int,
- * android.content.pm.ApplicationInfo)
- */
- @Override
- public XmlResourceParser getXml(String packageName, int resid,
- ApplicationInfo appInfo) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getApplicationLabel(android.content
- * .pm.ApplicationInfo)
- */
- @Override
- public CharSequence getApplicationLabel(ApplicationInfo info) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getResourcesForActivity(android.content
- * .ComponentName)
- */
- @Override
- public Resources getResourcesForActivity(ComponentName activityName)
- throws NameNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getResourcesForApplication(android.
- * content.pm.ApplicationInfo)
- */
- @Override
- public Resources getResourcesForApplication(ApplicationInfo app)
- throws NameNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getResourcesForApplication(java.lang
- * .String)
- */
- @Override
- public Resources getResourcesForApplication(String appPackageName)
- throws NameNotFoundException {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getInstallerPackageName(java.lang.String
- * )
- */
- @Override
- public String getInstallerPackageName(String packageName) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#addPackageToPreferred(java.lang.String)
- */
- @Override
- public void addPackageToPreferred(String packageName) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#removePackageFromPreferred(java.lang
- * .String)
- */
- @Override
- public void removePackageFromPreferred(String packageName) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see android.content.pm.PackageManager#getPreferredPackages(int)
- */
- @Override
- public List getPreferredPackages(int flags) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#addPreferredActivity(android.content
- * .IntentFilter, int, android.content.ComponentName[],
- * android.content.ComponentName)
- */
- @Override
- public void addPreferredActivity(IntentFilter filter, int match,
- ComponentName[] set, ComponentName activity) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#clearPackagePreferredActivities(java
- * .lang.String)
- */
- @Override
- public void clearPackagePreferredActivities(String packageName) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getPreferredActivities(java.util.List,
- * java.util.List, java.lang.String)
- */
- @Override
- public int getPreferredActivities(List outFilters,
- List outActivities, String packageName) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#setComponentEnabledSetting(android.
- * content.ComponentName, int, int)
- */
- @Override
- public void setComponentEnabledSetting(ComponentName componentName,
- int newState, int flags) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getComponentEnabledSetting(android.
- * content.ComponentName)
- */
- @Override
- public int getComponentEnabledSetting(ComponentName componentName) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#setApplicationEnabledSetting(java.lang
- * .String, int, int)
- */
- @Override
- public void setApplicationEnabledSetting(String packageName, int newState,
- int flags) {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * android.content.pm.PackageManager#getApplicationEnabledSetting(java.lang
- * .String)
- */
- @Override
- public int getApplicationEnabledSetting(String packageName) {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see android.content.pm.PackageManager#isSafeMode()
- */
- @Override
- public boolean isSafeMode() {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
diff --git a/android-pluginmgr/target/.gitignore b/android-pluginmgr/target/.gitignore
deleted file mode 100644
index 840e7d3..0000000
--- a/android-pluginmgr/target/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/classes/