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


Java XposedBridge.hookAllConstructors方法代码示例

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


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

示例1: initAndroid

import de.robv.android.xposed.XposedBridge; //导入方法依赖的package包/类
static void initAndroid(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        if (DEBUG) log("init");

        updatePreference(prefs);

        Class<?> classPhoneWindowManager = findClass("com.android.server.policy.PhoneWindowManager", classLoader);
        XposedBridge.hookAllConstructors(classPhoneWindowManager, handleConstructPhoneWindowManager);

        // take advantage of screenTurnedOff method for refreshing state of allowSkipTrack preference
        findAndHookMethod(classPhoneWindowManager, "screenTurnedOff", new XC_MethodHook() {

            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                if (DEBUG) log("screenTurnedOff");
                updatePreference(prefs);
            }
        });

        findAndHookMethod(classPhoneWindowManager, "interceptKeyBeforeQueueing",
                KeyEvent.class, int.class, handleInterceptKeyBeforeQueueing);
    } catch (Throwable t) { XposedBridge.log(t); }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:24,代码来源:ModVolumeKeySkipTrack.java

示例2: 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


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