插件化技术选型

Shadow(腾讯)

Qigsaw(爱奇艺)

https://developer.android.google.cn/guide/app-bundle


VirtualAPK(滴滴)

https://github.com/didi/VirtualAPK

https://blog.csdn.net/u012124438/article/details/74118905

我们可以先启动一个已经在AndroidManifest.xml里面声明过的替身Activity,让这个Activity进入AMS进程接受检验;最后在换成我们真正需要启动的Activity;这样就成功欺骗了AMS进程

Atlas(阿里)

https://blog.csdn.net/M075097/article/details/79225030

;//-----2.3.3替换系统原生ClassLoader为DelegateClassLoad
AndroidHack.injectClassLoader(packageName, newClassLoaderer)

//-----2.3.4 替换系统的Instrumentation为InstrumentationHook,该类是一个系统与用户之间交互的介质层,大部分调用的功能操作都会流过此类之后再进一步调
    AndroidHack.injectInstrumentationHook(new InstrumentationHook(AndroidHack.getInstrumentation(), application.getBaseContext()
    
    ActivityManagerDelegate activityManagerProxy = new ActivityManagerDelegate();

    Object gDefault = null;
    if(Build.VERSION.SDK_INT>25 || (Build.VERSION.SDK_INT==25&&Build.VERSION.PREVIEW_SDK_INT>0)){
        gDefault=AtlasHacks.ActivityManager_IActivityManagerSingleton.get(AtlasHacks.ActivityManager.getmClass());
    }else{
        gDefault=AtlasHacks.ActivityManagerNative_gDefault.get(AtlasHacks.ActivityManagerNative.getmClass());
    }
    AtlasHacks.Singleton_mInstance.hijack(gDefault, activityManagerProxy);

RePlugin(360)

Replugin与DroidPlugin框架比较

虽然唯一Hook点为宿主Application#LoadedApk中的classLoader对象,但源码中依然存在着众多的invoke反射,和google禁止使用非公开api的策略相违背

Neptune(爱奇艺)

  • 插件的安装与加载

https://github.com/iqiyi/Neptune/blob/master/docs/SDK%E5%8E%9F%E7%90%86/%E6%8F%92%E4%BB%B6%E7%9A%84%E5%AE%89%E8%A3%85%E4%B8%8E%E5%8A%A0%E8%BD%BD.md

  • Neptune/docs/SDK原理/插件的代理实现机制.md

https://github.com/iqiyi/Neptune/blob/master/docs/SDK%E5%8E%9F%E7%90%86/%E6%8F%92%E4%BB%B6%E7%9A%84%E4%BB%A3%E7%90%86%E5%AE%9E%E7%8E%B0%E6%9C%BA%E5%88%B6.md

Hydra(美团-未开源)