当前位置: 首页>>代码示例>>Java>>正文


Java XposedBridge.hookAllMethods方法代码示例

本文整理汇总了Java中de.robv.android.xposed.XposedBridge.hookAllMethods方法的典型用法代码示例。如果您正苦于以下问题:Java XposedBridge.hookAllMethods方法的具体用法?Java XposedBridge.hookAllMethods怎么用?Java XposedBridge.hookAllMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.robv.android.xposed.XposedBridge的用法示例。


在下文中一共展示了XposedBridge.hookAllMethods方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initZygote

import de.robv.android.xposed.XposedBridge; //导入方法依赖的package包/类
@Override
public void initZygote(IXposedHookZygoteInit.StartupParam startupParam) throws Throwable {
    try {
        Class<?> c = findClass("android.media.MediaScanner$MyMediaScannerClient", null);

        XposedBridge.hookAllMethods(c, "endFile", new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                String mAlbumArtist = (String) XposedHelpers.getObjectField(param.thisObject, "mAlbumArtist");

                if (mAlbumArtist != null && mAlbumArtist.length() != 0)
                    XposedHelpers.setObjectField(param.thisObject, "mArtist", mAlbumArtist);
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:joserebelo,项目名称:xposed-album-artist,代码行数:19,代码来源:XposedMod.java

示例2: overwriteResults

import de.robv.android.xposed.XposedBridge; //导入方法依赖的package包/类
public void overwriteResults(String classname, String method, final Object result){
    try {
        Class<?> aClass = cloader.loadClass(classname);
        XposedBridge.hookAllMethods(aClass, method, new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                param.setResult(result);
            }
        });

    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}
 
开发者ID:mateuszk87,项目名称:BadIntent,代码行数:15,代码来源:BaseHook.java

示例3: hookLogs

import de.robv.android.xposed.XposedBridge; //导入方法依赖的package包/类
public void hookLogs(){
    XposedBridge.hookAllMethods(Log.class, "d", new XposedAndroidLogMethodHook("debug"));
    XposedBridge.hookAllMethods(Log.class, "v", new XposedAndroidLogMethodHook("verbose"));
    XposedBridge.hookAllMethods(Log.class, "i", new XposedAndroidLogMethodHook("info"));
    XposedBridge.hookAllMethods(Log.class, "w", new XposedAndroidLogMethodHook("warning"));
    XposedBridge.hookAllMethods(Log.class, "e", new XposedAndroidLogMethodHook("exception"));
    XposedBridge.hookAllMethods(Log.class, "wtf", new XposedAndroidLogMethodHook("wtf"));
}
 
开发者ID:mateuszk87,项目名称:BadIntent,代码行数:9,代码来源:LogHooks.java

示例4: handleLoadPackage

import de.robv.android.xposed.XposedBridge; //导入方法依赖的package包/类
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
    final Class<?> phoneWindowManager;
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
        phoneWindowManager = XposedHelpers.findClass("com.android.server.policy.PhoneWindowManager", lpparam.classLoader);
    } else {
        phoneWindowManager = XposedHelpers.findClass("com.android.internal.policy.impl.PhoneWindowManager", lpparam.classLoader);
    }

    XposedBridge.hookAllMethods(phoneWindowManager, "interceptKeyBeforeQueueing", new XC_MethodHook() {

        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            int keyCode = ((KeyEvent) param.args[0]).getKeyCode();
            if (keyCode == KeyEvent.KEYCODE_POWER) {
                XSharedPreferences mXsp = new XSharedPreferences(PACKAGE_NAME);

                Log.d("isBlockPowerButton", "=================" + mXsp.getBoolean("isBlockPowerButton", true));
                XposedBridge.log("isBlockPowerButton" + "=================" + mXsp.getBoolean("isBlockPowerButton", true));

                if (mXsp.getBoolean("isBlockPowerButton", true)) {
                    param.setResult(0);
                }
            }
        }
    });
}
 
开发者ID:frowhy,项目名称:Block,代码行数:28,代码来源:BlockPowerButton.java

示例5: initAndroid

import de.robv.android.xposed.XposedBridge; //导入方法依赖的package包/类
public static void initAndroid(final XSharedPreferences mainPrefs, final ClassLoader classLoader) {
    mPrefs = new XSharedPreferences(GravityBox.PACKAGE_NAME, "ledcontrol");
    mPrefs.makeWorldReadable();
    mQhPrefs = new XSharedPreferences(GravityBox.PACKAGE_NAME, "quiet_hours");
    mQhPrefs.makeWorldReadable();
    mQuietHours = new QuietHours(mQhPrefs);

    mProximityWakeUpEnabled = mainPrefs.getBoolean(GravityBoxSettings.PREF_KEY_POWER_PROXIMITY_WAKE, false);

    try {
        final Class<?> nmsClass = XposedHelpers.findClass(CLASS_NOTIFICATION_MANAGER_SERVICE, classLoader);
        XposedBridge.hookAllConstructors(nmsClass, new XC_MethodHook() {
            @Override
            protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
                if (mNotifManagerService == null) {
                    mNotifManagerService = param.thisObject;
                    mContext = (Context) XposedHelpers.callMethod(param.thisObject, "getContext");

                    IntentFilter intentFilter = new IntentFilter();
                    intentFilter.addAction(LedSettings.ACTION_UNC_SETTINGS_CHANGED);
                    intentFilter.addAction(Intent.ACTION_USER_PRESENT);
                    intentFilter.addAction(QuietHoursActivity.ACTION_QUIET_HOURS_CHANGED);
                    intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
                    intentFilter.addAction(ACTION_CLEAR_NOTIFICATIONS);
                    intentFilter.addAction(GravityBoxSettings.ACTION_PREF_POWER_CHANGED);
                    mContext.registerReceiver(mBroadcastReceiver, intentFilter);

                    toggleActiveScreenFeature(!mPrefs.getBoolean(LedSettings.PREF_KEY_LOCKED, false) && 
                            mPrefs.getBoolean(LedSettings.PREF_KEY_ACTIVE_SCREEN_ENABLED, false));
                    hookNotificationDelegate();

                    if (DEBUG) log("Notification manager service initialized");
                }
            }
        });

        XposedHelpers.findAndHookMethod(CLASS_NOTIFICATION_MANAGER_SERVICE, classLoader,
                "enqueueNotificationInternal", String.class, String.class,
                int.class, int.class, String.class, 
                int.class, Notification.class, int[].class, int.class, notifyHook);

        XposedHelpers.findAndHookMethod(CLASS_NOTIFICATION_MANAGER_SERVICE, classLoader,
                "applyZenModeLocked", CLASS_NOTIFICATION_RECORD, applyZenModeHook);

        XposedHelpers.findAndHookMethod(CLASS_NOTIFICATION_MANAGER_SERVICE, classLoader,
                "updateLightsLocked", updateLightsLockedHook);

        XposedBridge.hookAllMethods(XposedHelpers.findClass(CLASS_VIBRATOR_SERVICE, classLoader),
                "startVibrationLocked", startVibrationHook);
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:54,代码来源:ModLedControl.java

示例6: init

import de.robv.android.xposed.XposedBridge; //导入方法依赖的package包/类
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        XposedBridge.hookAllMethods(
                XposedHelpers.findClass(CLASS_NOTIF_DATA, classLoader),
                "shouldFilterOut", new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                StatusBarNotification sbn = (StatusBarNotification)param.args[0];
                Notification n = sbn.getNotification();

                // whether to hide persistent everywhere
                if (!sbn.isClearable() && n.extras.getBoolean(NOTIF_EXTRA_HIDE_PERSISTENT)) {
                    param.setResult(true);
                    return;
                }

                // whether to hide during keyguard
                if (ModStatusBar.getStatusBarState() != StatusBarState.SHADE) {
                    VisibilityLs vls = n.extras.containsKey(NOTIF_EXTRA_VISIBILITY_LS) ?
                            VisibilityLs.valueOf(n.extras.getString(NOTIF_EXTRA_VISIBILITY_LS)) :
                                VisibilityLs.DEFAULT;
                    switch (vls) {
                        case CLEARABLE:
                            param.setResult(sbn.isClearable());
                            break;
                        case PERSISTENT:
                            param.setResult(!sbn.isClearable());
                            break;
                        case ALL:
                            param.setResult(true);
                            break;
                        case DEFAULT:
                        default: return;
                    }
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:42,代码来源:ModLedControl.java

示例7: hook

import de.robv.android.xposed.XposedBridge; //导入方法依赖的package包/类
public static void hook(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
    String pwmClassPath;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        pwmClassPath = PHONE_WINDOW_MANAGER_M;
    } else {
        pwmClassPath = PHONE_WINDOW_MANAGER_L;
    }

    Class<?> pwmClass = loadPackageParam.classLoader.loadClass(pwmClassPath);
    XposedBridge.hookAllMethods(pwmClass, "init", new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
            final Context mContext = (Context) XposedHelpers.getObjectField(param.thisObject, "mContext");
            WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
            screenH = wm.getDefaultDisplay().getHeight();
            final Resources resources = mContext.getResources();
            final int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
            navbarH = resources.getDimensionPixelSize(resourceId);
            if (navbarH == 0) {
                navbarH = 150;
            }

            BroadcastReceiver screenShotReceiver = new BroadcastReceiver() {
                @Override
                public void onReceive(Context context, Intent intent) {
                    try {
                        int type = intent.getIntExtra(ConstantStr.TYPE, -1);
                        switch (type) {
                            case ConstantStr.TAKE_SCREENSHOT:
                                if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
                                    XposedHelpers.callMethod(param.thisObject, "takeScreenshot", 1);
                                } else {
                                    XposedHelpers.callMethod(param.thisObject, "takeScreenshot");
                                }
                                break;
                            case ConstantStr.HIDE_NAVBAR: {
                                setNavBarDimensions(param.thisObject, 0);
                            }
                            break;
                            case ConstantStr.NAVBAR_H: {
                                navbarH = resources.getDimensionPixelSize(resourceId);
                                navbarH = (int) (navbarH * (((float) intent.getIntExtra(ConstantStr.NAVBAR_HEIGHT, 100) / 100)));
                                setNavBarDimensions(param.thisObject, navbarH);
                            }
                            break;
                        }
                    } catch (Exception e) {
                        XpLog.e(e);
                    }

                }
            };
            IntentFilter filter = new IntentFilter(XpNavBarAction.ACTION_PHONE_WINDOW_MANAGER);
            mContext.registerReceiver(screenShotReceiver, filter);

            gesturesListener = new GesturesListener(mContext, new GesturesListener.Callbacks() {
                @Override
                public void onSwipeFromTop() {

                }

                @Override
                public void onSwipeFromBottom() {
                    setNavBarDimensions(param.thisObject, navbarH);
                }

                @Override
                public void onSwipeFromRight() {

                }

                @Override
                public void onDebug() {

                }
            });
        }
    });
}
 
开发者ID:EggUncle,项目名称:XposedNavigationBar,代码行数:80,代码来源:PhoneWindowManagerHook.java


注:本文中的de.robv.android.xposed.XposedBridge.hookAllMethods方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。