Java Code Examples for de.robv.android.xposed.XposedHelpers#findAndHookMethod()

The following examples show how to use de.robv.android.xposed.XposedHelpers#findAndHookMethod() . 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: ModLedControl.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
private static void hookNotificationDelegate() {
    try {
        Object notifDel = XposedHelpers.getObjectField(mNotifManagerService, "mNotificationDelegate");
        XposedHelpers.findAndHookMethod(notifDel.getClass(), "clearEffects", new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(final MethodHookParam param) throws Throwable {
                if (mScreenOnDueToActiveScreen) {
                    if (DEBUG) log("clearEffects: suppressed due to ActiveScreen");
                    param.setResult(null);
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example 2
Source File: RemoveSensorModificationMethod.java    From Sensor-Disabler with MIT License 6 votes vote down vote up
@Override
public void modifySensor(final XC_LoadPackage.LoadPackageParam lpparam) {
    XposedHelpers.findAndHookMethod("android.hardware.SystemSensorManager", lpparam.classLoader, "getFullSensorList", new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            //Without this, you'd never be able to edit the values for a removed sensor! Aaah!
            if (!lpparam.packageName.equals(BuildConfig.APPLICATION_ID)) {
                //Create a new list so we don't modify the original list.
                @SuppressWarnings("unchecked") List<Sensor> fullSensorList = new ArrayList<>((Collection<? extends Sensor>) param.getResult());
                Iterator<Sensor> iterator = fullSensorList.iterator();
                Context context = AndroidAppHelper.currentApplication();
                while (iterator.hasNext()) {
                    Sensor sensor = iterator.next();
                    if (!isPackageAllowedToSeeTrueSensor(lpparam.processName, sensor, context) && getSensorStatus(sensor, context) == Constants.SENSOR_STATUS_REMOVE_SENSOR) {
                        iterator.remove();
                    }
                }
                param.setResult(fullSensorList);
            }
        }
    });
}
 
Example 3
Source File: ColorInversionTile.java    From GravityBox with Apache License 2.0 6 votes vote down vote up
private void createHooks() {
    if (Utils.isOxygenOs35Rom())
        return;

    try {
        mLongClickHook = XposedHelpers.findAndHookMethod(mTile.getClass().getName(), 
                mContext.getClassLoader(), "handleLongClick", new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                if (handleLongClick()) {
                    param.setResult(null);
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example 4
Source File: HookEntry.java    From QNotified with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
    if (R.string.res_inject_success >>> 24 == 0x7f) {
        XposedBridge.log("package id must NOT be 0x7f, reject loading...");
        return;
    }
    //dumpProcessInfo(lpparam.isFirstApplication);
    switch (lpparam.packageName) {
        case PACKAGE_NAME_SELF:
            XposedHelpers.findAndHookMethod("nil.nadph.qnotified.util.Utils", lpparam.classLoader, "getActiveModuleVersion", XC_MethodReplacement.returnConstant(Utils.QN_VERSION_NAME));
            break;
        case PACKAGE_NAME_QQ:
        case PACKAGE_NAME_TIM:
            StartupHook.getInstance().doInit(lpparam.classLoader);
            break;
        case PACKAGE_NAME_QQ_INTERNATIONAL:
        case PACKAGE_NAME_QQ_LITE:
            //coming...
    }
}
 
Example 5
Source File: AlipayHook.java    From renrenpay-android with Apache License 2.0 6 votes vote down vote up
private void hookMoney() {
    XposedHelpers.findAndHookMethod("com.alipay.mobile.framework.service.ext.dbhelper.SecurityDbHelper",
            mAppClassLoader, "addOrUpdateUserLogin",
            XposedHelpers.findClass("com.alipay.mobile.framework.service.ext.security.bean.UserInfo", mAppClassLoader),
            new XC_MethodHook() {
                @Override
                protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                    super.beforeHookedMethod(param);
                    if (param.args[0] == null) {
                        return;
                    }
                    try {
                        Intent broadCastIntent2 = new Intent(RECV_ACTION);
                        broadCastIntent2.putExtra(RECV_ACTION_TYPE, COOK_RECV);
                        broadCastIntent2.putExtra(RECV_ACTION_DATE, "ALIPAYJSESSIONID=" + XposedHelpers.getObjectField(param.args[0], "extern_token"));
                        mContext.sendBroadcast(broadCastIntent2);
                    } catch (Error | Exception e) {
                        Log.e(TAG, "hookMoney is error" + e);
                    }
                }
            });

}
 
Example 6
Source File: XposedHook.java    From XQuickEnergy with Apache License 2.0 6 votes vote down vote up
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable
{
 if("pansong291.xposed.quickenergy".equals(lpparam.packageName))
 {
  XposedHelpers.findAndHookMethod(MainActivity.class.getName(), lpparam.classLoader, "setModuleActive", boolean.class, new XC_MethodHook()
   {
    @Override
    protected void beforeHookedMethod(MethodHookParam param) throws Throwable
    {
     param.args[0] = true;
    }
   });
 }

 if(ClassMember.com_eg_android_AlipayGphone.equals(lpparam.packageName))
 {
  Log.i(TAG, lpparam.packageName);
  hookLauncherService(lpparam.classLoader);
  hookRpcCall(lpparam.classLoader);
 }
}
 
Example 7
Source File: ClearMainAdPlugin.java    From mhzs with MIT License 6 votes vote down vote up
@Override
    public void run(ClassLoader classLoader) throws Throwable {

        /**
         * 在com.mh.movie.core.mvp.ui.widget.MovieCardView中
         * 替换setShowBanner方法,去掉广告
         */
        // TODO: 2019/3/6 0006 VXP/EXP TOO SHORT METHOD
//        XposedHelpers.findAndHookMethod(movieCardViewClassName, classLoader, "setShowBanner", List.class, new XC_MethodReplacement() {
//            @Override
//            protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
//                LogUtil.e("hook setShowBanner method!");
//                return null;
//            }
//        });

        XposedHelpers.findAndHookMethod(movieCardViewClassName, classLoader, "c", new XC_MethodReplacement() {
            @Override
            protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
                LogUtil.e("hook setShowBanner2 method!");
                return null;
            }
        });

    }
 
Example 8
Source File: NoUpdatePlugin.java    From mhzs with MIT License 5 votes vote down vote up
@Override
    public void run(ClassLoader classLoader) throws Throwable {
        /**
         * 方法1:直接返回null
         */
        // TODO: 2019/2/27 0027 与 EXP/VXP 可能会冲突
//        XposedHelpers.findAndHookMethod(channelResponseClassName, classLoader, "getUrl", new XC_MethodHook() {
//            @Override
//            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
//                super.afterHookedMethod(param);
//                LogUtil.e("Hook ChannelResponse!");
//                param.setResult(null);
//            }
//        });

        /**
         * 方法2:另辟蹊径
         *
         * 此变量名版本更新可能会改变
         */
        final Class channelResponseClazz = classLoader.loadClass(channelResponseClassName);
        XposedHelpers.findAndHookMethod(Constant.act.$MainActivity, classLoader, "a", channelResponseClazz, new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                super.afterHookedMethod(param);
                LogUtil.e("Hook MainActivity No Update!");
                Object o = channelResponseClazz.cast(param.args[0]);
                XposedHelpers.findMethodBestMatch(channelResponseClazz, "setUrl", String.class);
                Method setUrlMethod = channelResponseClazz.getMethod("setUrl", String.class);
                setUrlMethod.invoke(o, "");
//                XposedBridge.invokeOriginalMethod(setUrlMethod, o, new Object[]{""});
            }
        });
    }
 
Example 9
Source File: ModMms.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
@Override
protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
    try {
        if (!prepareUnicodeFilter()) return;

        if (DEBUG) log("ComposeMessageActivity created. Hooking to TextEditorWatcher");

        final TextWatcher textEditorWatcher = (TextWatcher) XposedHelpers.getObjectField(
                param.thisObject, "mTextEditorWatcher");
        if (textEditorWatcher != null) {
            XposedHelpers.findAndHookMethod(textEditorWatcher.getClass(), "onTextChanged", 
                    CharSequence.class, int.class, int.class, int.class, new XC_MethodHook() {
                @Override
                protected void beforeHookedMethod(MethodHookParam param2) throws Throwable {
                    if (param2.thisObject != textEditorWatcher) return;

                    CharSequence s = (CharSequence) param2.args[0];
                    if (DEBUG) log("TextEditorWatcher.onTextChanged: original ='" + s + "'");
                    s = mUnicodeFilter.filter(s);
                    if (DEBUG) log("TextEditorWatcher.onTextChanged: stripped ='" + s + "'");
                    param2.args[0] = s;
                }
            });
        }
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example 10
Source File: ApiBlocking.java    From MinMinGuard with GNU General Public License v3.0 5 votes vote down vote up
public static boolean blockAdFunctionWithResult(final String packageName, final String adClass, final String adFunc, final Object result, final XC_LoadPackage.LoadPackageParam lpparam)
{
    try
    {
        XposedHelpers.findAndHookMethod(adClass, lpparam.classLoader, adFunc, new XC_MethodHook()
        {

            @Override
            protected void beforeHookedMethod(MethodHookParam param)
            {
                String debugMsg = String.format("blockAdFunctionWithResult: Detect %s %s in %s", adClass, adFunc, packageName);

                Util.log(packageName, debugMsg);

                Util.notifyRemoveAdView(null, packageName, 1);

                param.setResult(result);
            }
        });
    }
    catch (ClassNotFoundError | NoSuchMethodError e)
    {
        if (e instanceof NoSuchMethodError)
        {
            Util.log(packageName, String.format("blockAdFunctionWithResult: Method %s not found in %s.", adFunc, adClass));
        }

        return false;
    }

    return true;
}
 
Example 11
Source File: HookBase.java    From Tpay with GNU General Public License v3.0 5 votes vote down vote up
private void hookMainInOtherAppContext(final String processName) {
    XposedHelpers.findAndHookMethod(ContextWrapper.class, "attachBaseContext", Context.class, new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            mContext = (Context) param.args[0];
            mAppClassLoader = mContext.getClassLoader();
            if (getPackPageName().equals(processName)) {
                mHookCount = mHookCount + 1;
                if (mHookCount == mHookCountIndex) {
                    //注册广播
                    IntentFilter intentFilter = new IntentFilter();
                    intentFilter.addAction(getRemoteAction());//主动远程的主动广播Action
                    mContext.registerReceiver(new RemoteReceiver(), intentFilter);

                    try {
                        addRemoteTaskI();
                        hookFirst();
                        hookBill();
                        hookCreatQr();
                        LogUtils.show(getAppName() + "初始化成功");
                    } catch (Error | Exception e) {
                        e.printStackTrace();
                        LogUtils.show(e.getMessage());
                    }
                }
            }
        }
    });
}
 
Example 12
Source File: MtkFixTtsSettings.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        final Class<?> classVoiceIoSettings = XposedHelpers.findClass(CLASS_VOICEIO_SETTINGS, classLoader);

        if (DEBUG) log("replacing populateOrRemovePreferences method");
        XposedHelpers.findAndHookMethod(classVoiceIoSettings, "populateOrRemovePreferences", 
                new XC_MethodReplacement() {

                    @Override
                    protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
                        boolean hasRecognizer = (Boolean) XposedHelpers.callMethod(param.thisObject, 
                                        "populateOrRemoveRecognizerPrefs");
                        boolean hasTts = (Boolean) XposedHelpers.callMethod(param.thisObject,
                                        "populateOrRemoveTtsPrefs");
                        if (DEBUG) log("populateOrRemovePreferences: hasRecognizer=" + hasRecognizer + "; hasTts=" + hasTts);

                        if (hasRecognizer || hasTts) {
                            return null;
                        }

                        PreferenceFragment fragment = (PreferenceFragment) XposedHelpers.getObjectField(
                                param.thisObject, "mFragment");
                        PreferenceCategory prefCat = (PreferenceCategory) XposedHelpers.getObjectField(
                                param.thisObject, "mVoiceCategory");
                        if (fragment != null && prefCat != null) {
                            fragment.getPreferenceScreen().removePreference(prefCat);
                        }

                        return null;
                    }
            
        });
    }
    catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
Example 13
Source File: InitInjector.java    From XposedHider with GNU General Public License v3.0 5 votes vote down vote up
@Override
@Keep
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam loadPackageParam) {
    if (loadPackageParam.packageName.equals(BuildConfig.APPLICATION_ID)) {
        XposedHelpers.findAndHookMethod(
                "com.yaerin.xposed.hider.ui.MainActivity", loadPackageParam.classLoader,
                "isEnabled", XC_MethodReplacement.returnConstant(true)
        );
    }
    XposedHelpers.findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            Context context = (Context) param.args[0];
            if (context != null) {
                loadPackageParam.classLoader = context.getClassLoader();
                try {
                    invokeHandleHookMethod(
                            context, BuildConfig.APPLICATION_ID,
                            BuildConfig.APPLICATION_ID + "r.XposedHook",
                            "handleLoadPackage", loadPackageParam);
                } catch (Throwable error) {
                    error.printStackTrace();
                }
            }
        }
    });
}
 
Example 14
Source File: ExtDeviceWXLoginUIHook.java    From XposedWechatHelper with GNU General Public License v2.0 5 votes vote down vote up
private void hook(final ClassLoader classLoader) {
    pcAutoLogin = Boolean.valueOf(PropertiesUtils.getValue(Constant.PRO_FILE, "pc_auto_login", "false"));

    if (!pcAutoLogin) {
        return;
    }

    try {
        final Class extDeviceWXLoginUIHookClazz = XposedHelpers.findClass("com.tencent.mm.plugin.webwx.ui.ExtDeviceWXLoginUI", classLoader);
        XposedHelpers.findAndHookMethod(extDeviceWXLoginUIHookClazz, "initView",
                new XC_MethodHook() {
                    @Override
                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                        Object object = param.thisObject;
                        Field[] fields = extDeviceWXLoginUIHookClazz.getDeclaredFields();
                        for (Field field : fields) {
                            Object objectField = XposedHelpers.getObjectField(object, field.getName());
                            if (objectField instanceof Button && ((Button) objectField).getText().toString().equals("登录")) {
                                ((Button) objectField).callOnClick();
                                break;
                            }
                        }
                        super.afterHookedMethod(param);
                    }
                });
    } catch (Error | Exception e) {
        XposedBridge.log(e);
    }
}
 
Example 15
Source File: Hook.java    From Cracker with Apache License 2.0 5 votes vote down vote up
private void hookUncaughtException(final Application application) {
    Class<?> c = Thread.getDefaultUncaughtExceptionHandler().getClass();
    XposedHelpers.findAndHookMethod(c, "uncaughtException", Thread.class, Throwable.class, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);

            Intent intent = new Intent(INTENT_ACTION);
            intent.putExtra(INTENT_PACKAGE_NAME, application.getPackageName());
            intent.putExtra(INTENT_TIME, System.currentTimeMillis());
            intent.putExtra(INTENT_THROWABLE, (Throwable) param.args[1]);
            application.sendBroadcast(intent);
        }
    });
}
 
Example 16
Source File: HookLoader.java    From QNotified with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
    if (hostAppPackages.contains(loadPackageParam.packageName)) {
        //将loadPackageParam的classloader替换为宿主程序Application的classloader,解决宿主程序存在多个.dex文件时,有时候ClassNotFound的问题
        XposedHelpers.findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook(1250) {
            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                Context context = (Context) param.args[0];
                if ("com.bug.zqq".equals(context.getApplicationInfo().packageName)) return;
                loadPackageParam.classLoader = context.getClassLoader();
                invokeHandleHookMethod(context, modulePackage, handleHookClass, handleHookMethod, loadPackageParam);
            }
        });
    }
}
 
Example 17
Source File: TimHook.java    From XposedManyMoney with GNU General Public License v2.0 5 votes vote down vote up
private static void handleHook(final Class clazz) {
    try {
        XposedHelpers.findAndHookMethod(clazz, "onResume", new XC_MethodHook() {

            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                reload();
                super.beforeHookedMethod(param);
            }
        });
    } catch (Error | Exception e) {
        e.printStackTrace();
    }
}
 
Example 18
Source File: HookWechat.java    From Tpay with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void hookBill() throws Error, Exception {
    XposedHelpers.findAndHookMethod("com.tencent.wcdb.database.SQLiteDatabase",
            mAppClassLoader, "insert", String.class, String.class, ContentValues.class,
            new XC_MethodHook() {
                @Override
                protected void beforeHookedMethod(MethodHookParam param)
                        throws Throwable {
                    try {
                        ContentValues contentValues = (ContentValues) param.args[2];
                        String tableName = (String) param.args[0];
                        if (TextUtils.isEmpty(tableName) || !tableName.equals("message")) {
                            return;
                        }
                        Integer type = contentValues.getAsInteger("type");
                        if (type != null && type == 318767153) {
                            JSONObject msg = XmlToJson.documentToJSONObject(contentValues.getAsString("content"))
                                    .getJSONObject("appmsg");
                            if (!msg.getString("type").equals("5")) {
                                //首款类型type为5
                                return;
                            }
                            QrBean qrBean = new QrBean();
                            qrBean.setChannel(QrBean.WECHAT);
                            qrBean.setMoney((int) (Float.valueOf(msg.getJSONObject("mmreader")
                                    .getJSONObject("template_detail")
                                    .getJSONObject("line_content")
                                    .getJSONObject("topline")
                                    .getJSONObject("value")
                                    .getString("word")
                                    .replace("¥", "")) * 100));

                            qrBean.setOrder_id(msg.getString("template_id"));
                            JSONArray lines = msg.getJSONObject("mmreader")
                                    .getJSONObject("template_detail")
                                    .getJSONObject("line_content")
                                    .getJSONObject("lines")
                                    .getJSONArray("line");

                            for (int i = 0; i < 2; i++) {
                                if (lines.size() < i + 1 && lines.getJSONObject(i) == null) {
                                    break;
                                }
                                if (lines.getJSONObject(i)
                                        .getJSONObject("key")
                                        .getString("word").contains("付款方")) {
                                    qrBean.setMark_buy(lines.getJSONObject(i)
                                            .getJSONObject("value")
                                            .getString("word"));
                                } else if (lines.getJSONObject(i)
                                        .getJSONObject("key")
                                        .getString("word").contains("收款方")) {
                                    qrBean.setMark_sell(lines.getJSONObject(i)
                                            .getJSONObject("value")
                                            .getString("word"));
                                }
                            }
                            if (TextUtils.isEmpty(qrBean.getMark_sell())) {
                                return;
                            }

                            LogUtils.show("微信收到支付订单:" + qrBean.getMoney() + "|" + qrBean.getMark_sell() + "|" + qrBean.getMark_buy());

                            Intent broadCastIntent = new Intent(RECV_ACTION);
                            broadCastIntent.putExtra(RECV_ACTION_DATE, qrBean.toString());
                            broadCastIntent.putExtra(RECV_ACTION_TYPE, getLocalBillActionType());
                            mContext.sendBroadcast(broadCastIntent);
                        }
                    } catch (Error | Exception e) {

                    }
                }
            });
}
 
Example 19
Source File: XInternalSD.java    From XInternalSD with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable {

    if ("android".equals(lpparam.packageName)
            && "android".equals(lpparam.processName)) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            XposedHelpers.findAndHookMethod(XposedHelpers.findClass(
                    "com.android.server.pm.PackageManagerService",
                    lpparam.classLoader), "grantPermissionsLPw",
                    Common.CLASS_PACKAGE_PARSER_PACKAGE, boolean.class, String.class, externalSdCardAccessHook2);
        } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP || Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1) {
            XposedHelpers.findAndHookMethod(
                    XposedHelpers.findClass(
                            "com.android.server.SystemConfig",
                            lpparam.classLoader), "readPermission",
                    XmlPullParser.class, String.class,
                    externalSdCardAccessHook);
        } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
            XposedHelpers.findAndHookMethod(XposedHelpers.findClass(
                    "com.android.server.pm.PackageManagerService",
                    lpparam.classLoader), "readPermission",
                    XmlPullParser.class, String.class,
                    externalSdCardAccessHook);
        }
    }

    if (!detectedSdPath) {
        try {
            File internalSdPath = Environment.getExternalStorageDirectory();
            internalSd = internalSdPath.getPath();
            detectedSdPath = true;
        } catch (Exception e) {
            // nothing
        }
    }

    if (!isEnabledApp(lpparam)) {
        return;

    }

    XposedHelpers.findAndHookMethod(Environment.class,
            "getExternalStorageDirectory", getExternalStorageDirectoryHook);
    XposedHelpers.findAndHookMethod(XposedHelpers.findClass(
            "android.app.ContextImpl", lpparam.classLoader),
            "getExternalFilesDir", String.class, getExternalFilesDirHook);
    XposedHelpers.findAndHookMethod(XposedHelpers.findClass(
            "android.app.ContextImpl", lpparam.classLoader), "getObbDir",
            getObbDirHook);
    XposedHelpers.findAndHookMethod(Environment.class,
            "getExternalStoragePublicDirectory", String.class,
            getExternalStoragePublicDirectoryHook);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        XposedHelpers.findAndHookMethod(XposedHelpers.findClass(
                "android.app.ContextImpl", lpparam.classLoader),
                "getExternalFilesDirs", String.class,
                getExternalFilesDirsHook);
        XposedHelpers.findAndHookMethod(XposedHelpers.findClass(
                "android.app.ContextImpl", lpparam.classLoader),
                "getObbDirs", getObbDirsHook);
    }
}
 
Example 20
Source File: Injecter.java    From ConfessTalkKiller with GNU General Public License v3.0 3 votes vote down vote up
@Override
    public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
        if (loadPackageParam.packageName.equals("com.tencent.mobileqq")) {

            XposedBridge.log("confesstalk Found QQ!!!!!!!!!!!!!!!!!!!!!!");

            final XC_MethodHook.Unhook[] unhook = new XC_MethodHook.Unhook[1];

            unhook[0] = XposedHelpers.findAndHookMethod("com.tencent.mobileqq.qfix.QFixApplication", loadPackageParam.classLoader, "onCreate", new XC_MethodHook() {

                @Override
                protected void afterHookedMethod(MethodHookParam param) throws Throwable {

                    Context context = ((Application) param.thisObject).getBaseContext();

                    XposedBridge.log("confesstalk clasloader: " + context.getClassLoader().getClass().getName());


                    if (HookHelper.isMainProcess(context)) {

//                        Debug.waitForDebugger();

                        XposedBridge.log("confesstalk isMainProcess!!");

                        loadPackageParam.classLoader = context.getClassLoader();

                        unhook[0].unhook();

                        performHook_QQ(loadPackageParam);

                    }
                }
            });


        }

    }