de.robv.android.xposed.IXposedHookZygoteInit Java Examples

The following examples show how to use de.robv.android.xposed.IXposedHookZygoteInit. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlocklistInitUtils.java    From AdBlocker_Reborn with GNU General Public License v3.0 5 votes vote down vote up
public void init(IXposedHookZygoteInit.StartupParam startupParam, String resName, HashSet blocklistName) throws IOException {
    String MODULE_PATH = startupParam.modulePath;
    Resources res = XModuleResources.createInstance(MODULE_PATH, null);
    byte[] array = XposedHelpers.assetAsByteArray(res, resName);
    String decoded = decodeString(resName, array);
    String[] sUrls = decoded.split("\n");
    Collections.addAll(blocklistName, sUrls);
}
 
Example #2
Source File: BaseHook.java    From XMiTools with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
}
 
Example #3
Source File: RetalDriverApplication.java    From ratel with Apache License 2.0 4 votes vote down vote up
public static boolean loadModule(final String moduleApkPath,
                                 final ApplicationInfo currentApplicationInfo, ClassLoader appClassLoader) {


    //dexposed这里,会读取xposedinstaller,但是我们并没有xposed installer,所以忽略掉xposed installers的过滤
    log("Loading modules from " + moduleApkPath);

    if (!new File(moduleApkPath).exists()) {
        log(moduleApkPath + " does not exist");
        return false;
    }

    ClassLoader hostClassLoader = ExposedBridge.class.getClassLoader();
    ClassLoader appClassLoaderWithXposed = ExposedBridge.getAppClassLoaderWithXposed(appClassLoader);

    //ClassLoader mcl = new DexClassLoader(moduleApkPath, moduleOdexDir, moduleLibPath, hostClassLoader);
    ClassLoader mcl = new PathClassLoader(moduleApkPath, hostClassLoader);
    InputStream is = mcl.getResourceAsStream("assets/xposed_init");
    if (is == null) {
        log("assets/xposed_init not found in the APK");
        return false;
    }

    BufferedReader moduleClassesReader = new BufferedReader(new InputStreamReader(is));
    try {
        String moduleClassName;
        while ((moduleClassName = moduleClassesReader.readLine()) != null) {
            moduleClassName = moduleClassName.trim();
            if (moduleClassName.isEmpty() || moduleClassName.startsWith("#"))
                continue;

            try {
                log("  Loading class " + moduleClassName);
                Class<?> moduleClass = mcl.loadClass(moduleClassName);

                if (!ExposedHelper.isIXposedMod(moduleClass)) {
                    log("    This class doesn't implement any sub-interface of IXposedMod, skipping it");
                    continue;
                } else if (IXposedHookInitPackageResources.class.isAssignableFrom(moduleClass)) {
                    log("    This class requires resource-related hooks (which are disabled), skipping it.");
                    continue;
                }

                final Object moduleInstance = moduleClass.newInstance();
                if (moduleInstance instanceof IXposedHookZygoteInit) {
                    ExposedHelper.callInitZygote(moduleApkPath, moduleInstance);
                }

                if (moduleInstance instanceof IXposedHookLoadPackage) {
                    // hookLoadPackage(new IXposedHookLoadPackage.Wrapper((IXposedHookLoadPackage) moduleInstance));
                    IXposedHookLoadPackage.Wrapper wrapper = new IXposedHookLoadPackage.Wrapper((IXposedHookLoadPackage) moduleInstance);
                    XposedBridge.CopyOnWriteSortedSet<XC_LoadPackage> xc_loadPackageCopyOnWriteSortedSet = new XposedBridge.CopyOnWriteSortedSet<>();
                    xc_loadPackageCopyOnWriteSortedSet.add(wrapper);
                    XC_LoadPackage.LoadPackageParam lpparam = new XC_LoadPackage.LoadPackageParam(xc_loadPackageCopyOnWriteSortedSet);
                    lpparam.packageName = currentApplicationInfo.packageName;
                    lpparam.processName = currentApplicationInfo.processName;
                    lpparam.classLoader = appClassLoaderWithXposed;
                    lpparam.appInfo = currentApplicationInfo;
                    lpparam.isFirstApplication = true;
                    XC_LoadPackage.callAll(lpparam);
                }

                if (moduleInstance instanceof IXposedHookInitPackageResources) {
                    // hookInitPackageResources(new IXposedHookInitPackageResources.Wrapper((IXposedHookInitPackageResources) moduleInstance));
                    // TODO: 17/12/1 Support Resource hook
                    log("not support hook resource,the hook" + moduleInstance.getClass() + " will be ignore");
                }

                return true;
            } catch (Throwable t) {
                log(t);
            }
        }
    } catch (IOException e) {
        log(e);
    } finally {
        try {
            is.close();
        } catch (IOException ignored) {
        }
    }
    return false;
}
 
Example #4
Source File: XLua.java    From XPrivacyLua with GNU General Public License v3.0 4 votes vote down vote up
public void initZygote(final IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
    Log.i(TAG, "initZygote system=" + startupParam.startsSystemServer + " debug=" + BuildConfig.DEBUG);
}
 
Example #5
Source File: BaseHook.java    From XposedSmsCode with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
}
 
Example #6
Source File: DataHook.java    From XposedNavigationBar with GNU General Public License v3.0 4 votes vote down vote up
public static void init(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
    XSharedPreferences pre = new XSharedPreferences(BuildConfig.APPLICATION_ID, "xpnavbar");
    pre.makeWorldReadable();

    String json = pre.getString(ConstantStr.SHORT_CUT_DATA, "");
    XpLog.i("short_cut_data " + json);
    expandStatusBarWithRoot = pre.getBoolean(SPUtil.ROOT_DOWN, false);
    clearMenLevel = pre.getInt(SPUtil.CLEAR_MEM_LEVEL, 200);
    //获取主导行栏小点的位置
    homePointPosition = pre.getInt(ConstantStr.HOME_POINT, 0);
    chameleonNavbar = pre.getBoolean(SPUtil.CHAMELEON_NAVBAR, false);
    rootDown = pre.getBoolean(SPUtil.ROOT_DOWN, false);
    vibrate = pre.getBoolean(SPUtil.NAVBAR_VIBRATE, false);
    //获取快捷按钮设置数据
    Gson gson = new Gson();
    //在第一次激活重新启动的时候,可能因为没有设置任何快捷按钮,导致这里报错
    try {
        shortCutList = gson.fromJson(json, ShortCutData.class).getData();
    } catch (Exception e) {
        shortCutList = new ArrayList<>();
    }

    //获取图片缩放大小
    iconScale = pre.getInt(ConstantStr.ICON_SIZE, 40);

    navbarHeight = pre.getInt(SPUtil.NAVBAR_HEIGHT, 100);

    navbarOpt = pre.getBoolean(SPUtil.NAVBAR_HEIGHT_OPT, false);

    goHomeAfterClick = pre.getBoolean(SPUtil.GO_HOME_AFTER_CLICK, false);

    //加载图片资源文件
    Resources res = XModuleResources.createInstance(startupParam.modulePath, null);
    byte[] backImg = XposedHelpers.assetAsByteArray(res, "back.png");
    byte[] clearMenImg = XposedHelpers.assetAsByteArray(res, "clear_mem.png");
    byte[] clearNotificationImg = XposedHelpers.assetAsByteArray(res, "clear_notification.png");
    byte[] downImg = XposedHelpers.assetAsByteArray(res, "down.png");
    byte[] lightImg = XposedHelpers.assetAsByteArray(res, "light.png");
    byte[] quickNoticesImg = XposedHelpers.assetAsByteArray(res, "quick_notices.png");
    byte[] screenOffImg = XposedHelpers.assetAsByteArray(res, "screenoff.png");
    //  byte[] upImg = XposedHelpers.assetAsByteArray(res, "up.png");
    byte[] volume = XposedHelpers.assetAsByteArray(res, "volume.png");
    byte[] smallPonit = XposedHelpers.assetAsByteArray(res, "small_point.png");
    byte[] home = XposedHelpers.assetAsByteArray(res, "ic_home.png");
    byte[] startActs = XposedHelpers.assetAsByteArray(res, "start_acts.png");
    byte[] playMusic = XposedHelpers.assetAsByteArray(res, "ic_music.png");
    byte[] pauseMusic = XposedHelpers.assetAsByteArray(res, "ic_pause.png");
    byte[] previousMusic = XposedHelpers.assetAsByteArray(res, "ic_previous.png");
    byte[] nextMusic = XposedHelpers.assetAsByteArray(res, "ic_next.png");
    byte[] scanWeChat = XposedHelpers.assetAsByteArray(res, "wechat_qr.png");
    byte[] scanAlipay = XposedHelpers.assetAsByteArray(res, "alipay_qr.png");
    byte[] screenshot = XposedHelpers.assetAsByteArray(res, "ic_image.png");
    byte[] navBack = XposedHelpers.assetAsByteArray(res, "ic_sysbar_back.png");
    byte[] navHome = XposedHelpers.assetAsByteArray(res, "ic_sysbar_home.png");
    byte[] navRecent = XposedHelpers.assetAsByteArray(res, "ic_sysbar_recent.png");
    byte[] clipBoard = XposedHelpers.assetAsByteArray(res, "ic_clipboard.png");
    byte[] command = XposedHelpers.assetAsByteArray(res, "ic_command.png");
    byte[] navHide = XposedHelpers.assetAsByteArray(res, "ic_nav_down.png");

    mapImgRes.put(ConstantStr.FUNC_BACK_CODE, backImg);
    mapImgRes.put(ConstantStr.FUNC_CLEAR_MEM_CODE, clearMenImg);
    mapImgRes.put(ConstantStr.FUNC_CLEAR_NOTIFICATION_CODE, clearNotificationImg);
    mapImgRes.put(ConstantStr.FUNC_DOWN_CODE, downImg);
    mapImgRes.put(ConstantStr.FUNC_LIGHT_CODE, lightImg);
    mapImgRes.put(ConstantStr.FUNC_QUICK_NOTICE_CODE, quickNoticesImg);
    mapImgRes.put(ConstantStr.FUNC_SCREEN_OFF_CODE, screenOffImg);
    //  mapImgRes.put(ConstantStr.UP, upImg);
    mapImgRes.put(ConstantStr.FUNC_VOLUME_CODE, volume);
    mapImgRes.put(ConstantStr.FUNC_SMALL_POINT_CODE, smallPonit);
    mapImgRes.put(ConstantStr.FUNC_HOME_CODE, home);
    mapImgRes.put(ConstantStr.FUNC_START_ACTS_CODE, startActs);
    mapImgRes.put(ConstantStr.FUNC_PLAY_MUSIC_CODE, playMusic);
    mapImgRes.put(ConstantStr.FUNC_NEXT_PLAY_CODE, nextMusic);
    mapImgRes.put(ConstantStr.FUNC_PREVIOUS_PLAY_CODE, previousMusic);
    mapImgRes.put(ConstantStr.FUNC_WECHAT_SACNNER_CODE, scanWeChat);
    mapImgRes.put(ConstantStr.FUNC_ALIPAY_SACNNER_CODE, scanAlipay);
    mapImgRes.put(ConstantStr.FUNC_SCREEN_SHOT_CODE, screenshot);
    mapImgRes.put(ConstantStr.FUNC_NAV_BACK_CODE, navBack);
    mapImgRes.put(ConstantStr.FUNC_NAV_HOME_CODE, navHome);
    mapImgRes.put(ConstantStr.FUNC_NAV_RECENT_CODE, navRecent);
    mapImgRes.put(ConstantStr.FUNC_CLIPBOARD_CODE, clipBoard);
    mapImgRes.put(ConstantStr.FUNC_COMMAND_CODE, command);
    mapImgRes.put(ConstantStr.FUNC_NAV_HIDE_CODE, navHide);
}
 
Example #7
Source File: XposedModule.java    From ForceDoze with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
    XResources.setSystemWideReplacement("android", "bool", "config_enableAutoPowerModes", true);
}
 
Example #8
Source File: Module.java    From SSLUnpinning_Xposed with GNU General Public License v2.0 4 votes vote down vote up
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
    sPrefs = new XSharedPreferences(MY_PACKAGE_NAME, PREFS);
    sPrefs.makeWorldReadable();
}
 
Example #9
Source File: PackageNameServiceHook.java    From FakeGApps with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
    PackageNameService.inject();
}
 
Example #10
Source File: IHook.java    From XMiTools with GNU General Public License v3.0 votes vote down vote up
void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable; 
Example #11
Source File: IHook.java    From XposedSmsCode with GNU General Public License v3.0 votes vote down vote up
void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable;