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


Java XposedHelpers.findAndHookMethod方法代码示例

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


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

示例1: findMethodGetInt

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
/**
* 劫持判断是否使用虚拟定位
* @param loadPackageParam
*/
public static void findMethodGetInt(XC_LoadPackage.LoadPackageParam loadPackageParam){
    // boolean isOpen = Settings.Secure.getInt(getContentResolver(),Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0;
    XposedHelpers.findAndHookMethod("android.provider.Settings$Secure", loadPackageParam.classLoader, "getInt", ContentResolver.class, String.class, int.class, new XC_MethodHook() {

        /**
         * 设置返回值类型:
         * 1、gpsEnabled && networkEnabled:LOCATION_MODE_HIGH_ACCURACY
         * 2、gpsEnabled:LOCATION_MODE_SENSORS_ONLY
         * 3、networkEnabled:LOCATION_MODE_BATTERY_SAVING
         * 4、disable:LOCATION_MODE_OFF
         */
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            param.setResult(LOCATION_MODE_SENSORS_ONLY);
        }
    });

    XposedHelpers.findAndHookMethod(Settings.Secure.class, "getInt", ContentResolver.class, String.class, int.class, new XC_MethodReplacement() {
        @Override
        protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable {
            return LOCATION_MODE_SENSORS_ONLY;
        }
    });
}
 
开发者ID:littleRich,项目名称:VirtualLocation,代码行数:30,代码来源:SdkHookManager.java

示例2: initRecentsTaskMask

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
private static void initRecentsTaskMask(XSharedPreferences prefs, ClassLoader classLoader) {
    if (!prefs.getBoolean(GravityBoxSettings.PREF_RECENT_TASK_MASK_ENABLE, false)) {
        return;
    }
    XposedHelpers.findAndHookMethod(CLASS_TASK_THUMB_NAIL, classLoader, "setThumbnail", Bitmap.class, "android.app.ActivityManager$TaskThumbnailInfo", new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            Bitmap bitmap = (Bitmap) param.args[0];
            if (bitmap != null && recentTaskAlpha != 100) {
                Bitmap b = GraphicUtils.getBackGroundBitmap(taskMaskColor, bitmap.getWidth(), bitmap.getHeight());
                b = GraphicUtils.getAlplaBitmap(b, 100 - recentTaskAlpha);
                param.args[0] = GraphicUtils.mergeBitmap(bitmap, b);
            }
        }
    });
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:17,代码来源:ModClearAllRecents.java

示例3: hookNotificationDelegate

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:17,代码来源:ModLedControl.java

示例4: initAndroid

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

    try {
        XposedHelpers.findAndHookMethod(CLASS_FP_SERVICE_WRAPPER, classLoader,
                "isRestricted", new XC_MethodHook() {
            @Override
            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                Object service = XposedHelpers.getSurroundingThis(param.thisObject);
                Context ctx = (Context) XposedHelpers.getObjectField(service, "mContext");
                String pkg = ctx.getPackageManager().getNameForUid(Binder.getCallingUid());
                if (pkg != null) {
                    if (pkg.contains(":")) {
                        pkg = pkg.split(":")[0];
                    }
                    if (DEBUG) log("service: isRestricted: pkg=" + pkg);
                    if (UID_SYSTEM_UI.equals(pkg)) {
                        param.setResult(false);
                    }
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:27,代码来源:FingerprintLauncher.java

示例5: createHooks

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
private void createHooks() {
    if (!Utils.isXperiaDevice()) {
        try {
            XposedHelpers.findAndHookMethod(getDrawable().getClass(), "getFillColor",
                    float.class, new XC_MethodHook() {
                        @Override
                        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                            if (SysUiManagers.IconManager != null &&
                                    SysUiManagers.IconManager.isColoringEnabled()) {
                                param.setResult(SysUiManagers.IconManager.getIconColor());
                            }
                        }
                    });
        } catch (Throwable t) {
            log("Error hooking getFillColor(): " + t.getMessage());
        }
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:19,代码来源:StatusbarBattery.java

示例6: init

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        final Class<?> classDownloadService = XposedHelpers.findClass(CLASS_DOWNLOAD_SERVICE, classLoader);

        XposedHelpers.findAndHookMethod(classDownloadService, "updateLocked", new XC_MethodHook() {
            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                final boolean isActive = (Boolean) param.getResult();
                if (mIsActive != isActive) { 
                    mIsActive = isActive;
                    if (DEBUG) log("Download state changed; active=" + mIsActive);
                    final Context context = (Context) param.thisObject;
                    Intent intent = new Intent(ACTION_DOWNLOAD_STATE_CHANGED);
                    intent.putExtra(EXTRA_ACTIVE, mIsActive);
                    context.sendBroadcast(intent);
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:23,代码来源:ModDownloadProvider.java

示例7: createHooks

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:19,代码来源:HotspotTile.java

示例8: hookNavBarBeforeNougat

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
/**
 * hook android 7.0以下的导航栏
 */
private static void hookNavBarBeforeNougat(ClassLoader classLoader) throws Throwable {
    final Class<?> navigationBarInflaterViewClass = classLoader.loadClass("com.android.systemui.statusbar.phone.NavigationBarView");
    XposedHelpers.findAndHookMethod(navigationBarInflaterViewClass, "onFinishInflate", new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            View navBarView = (View) param.thisObject;
            View[] mRotatedViews = (View[]) XposedHelpers.getObjectField(navBarView, "mRotatedViews");
            Resources res = navBarView.getResources();
            ViewGroup rootView = (ViewGroup) mRotatedViews[Surface.ROTATION_0];
            ViewGroup navBtnsRot0 = (ViewGroup) mRotatedViews[Surface.ROTATION_0]
                    .findViewById(res.getIdentifier("nav_buttons", "id", "com.android.systemui"));
            hookNavBar(rootView, navBtnsRot0);
        }
    });
}
 
开发者ID:EggUncle,项目名称:XposedNavigationBar,代码行数:20,代码来源:NavBarHook.java

示例9: createHooks

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
private void createHooks() {
    // this seems to be unsupported on some custom ROMs. Log one line and continue.
    XC_MethodHook dtHook = new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            param.setResult(mDualMode);
        }
    };
    try {
        mSupportsDualTargetsHook = XposedHelpers.findAndHookMethod(mTile.getClass().getName(), 
                mContext.getClassLoader(), "supportsDualTargets", dtHook);
    } catch (Throwable t) {
        try {
            mSupportsDualTargetsHook = XposedHelpers.findAndHookMethod(mTile.getClass().getName(), 
                    mContext.getClassLoader(), "hasDualTargetsDetails", dtHook);
        } catch (Throwable t2) {
            if (!Utils.isOxygenOs35Rom()) {
                log(getKey() + ": Your system does not seem to support standard AOSP tile dual mode");
            }
        }
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:23,代码来源:BluetoothTile.java

示例10: createHooks

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
private void createHooks() {
    try {
        mCreateTileViewHook = XposedHelpers.findAndHookMethod(
                mTile.getClass().getName(), mContext.getClassLoader(),
                "createTileView", Context.class, new XC_MethodHook() {
            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                if (mKey.equals(XposedHelpers.getAdditionalInstanceField(
                        param.thisObject, BaseTile.TILE_KEY_NAME))) {
                    onCreateTileView((View)param.getResult());
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:18,代码来源:CellularTile.java

示例11: hook

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
public static void hook(ClassLoader loader) {
    final Class<?> CLASS_POINTER_EVENT_DISPATCHER = XposedHelpers.findClass(POINTER_EVENT_DISPATCHER_PATH, loader);
    XposedHelpers.findAndHookMethod(CLASS_POINTER_EVENT_DISPATCHER, "onInputEvent", InputEvent.class, new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            try {
                if (param.args[0] instanceof MotionEvent) {
                    MotionEvent event = (MotionEvent) param.args[0];
                    //XpLog.i("input x "+event.getX());
                    //XpLog.i("input y "+event.getY());
                    if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
                        PhoneWindowManagerHook.gesturesListener.onPointerEvent(event);
                    }
                }
            } catch (Exception e) {
                XpLog.e(e);
            }
        }
    });
}
 
开发者ID:EggUncle,项目名称:XposedNavigationBar,代码行数:22,代码来源:PointerEventDispatcherHook.java

示例12: init

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
    try {
        final Class<?> classSystemUIService = XposedHelpers.findClass(
                "com.android.systemui.SystemUIService", classLoader);

        mNormalMode = prefs.getInt(GravityBoxSettings.PREF_KEY_SMART_RADIO_NORMAL_MODE, -1);
        mPowerSavingMode = prefs.getInt(GravityBoxSettings.PREF_KEY_SMART_RADIO_POWER_SAVING_MODE, -1);
        mPowerSaveWhenScreenOff = prefs.getBoolean(GravityBoxSettings.PREF_KEY_SMART_RADIO_SCREEN_OFF, false);
        mIgnoreWhileLocked = prefs.getBoolean(GravityBoxSettings.PREF_KEY_SMART_RADIO_IGNORE_LOCKED, true);
        mModeChangeDelay = prefs.getInt(GravityBoxSettings.PREF_KEY_SMART_RADIO_MODE_CHANGE_DELAY, 5);
        mScreenOffDelay = prefs.getInt(GravityBoxSettings.PREF_KEY_SMART_RADIO_SCREEN_OFF_DELAY, 0);
        mIgnoreMobileDataAvailability = prefs.getBoolean(GravityBoxSettings.PREF_KEY_SMART_RADIO_MDA_IGNORE, false);
        mAdaptiveDelayThreshold = prefs.getInt(GravityBoxSettings.PREF_KEY_SMART_RADIO_ADAPTIVE_DELAY, 0);

        XposedHelpers.findAndHookMethod(classSystemUIService, "onCreate", new XC_MethodHook() {
            @Override
            protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
                mContext = (Context) param.thisObject;
                if (mContext != null) {
                    if (DEBUG) log("Initializing SmartRadio");

                    mSmartRadioEnabled = Settings.System.getInt(mContext.getContentResolver(),
                            SETTING_SMART_RADIO_ENABLED, 1) == 1;
                    mConnManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
                    mKeyguardManager = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
                    mNetworkModeChanger = new NetworkModeChanger(mContext, new Handler());
                    Settings.System.putString(mContext.getContentResolver(), 
                            SETTING_SMART_RADIO_STATE, mCurrentState.toString());

                    IntentFilter intentFilter = new IntentFilter();
                    intentFilter.addAction(GravityBoxSettings.ACTION_PREF_SMART_RADIO_CHANGED);
                    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
                    intentFilter.addAction(Intent.ACTION_SCREEN_ON);
                    intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
                    intentFilter.addAction(Intent.ACTION_USER_PRESENT);
                    intentFilter.addAction(NetworkModeChanger.ACTION_CHANGE_MODE_ALARM);
                    intentFilter.addAction(ACTION_TOGGLE_SMART_RADIO);
                    intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
                    intentFilter.addAction(PhoneWrapper.ACTION_NETWORK_TYPE_CHANGED);
                    mContext.registerReceiver(mBroadcastReceiver, intentFilter);
                }
            }
        });
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:48,代码来源:ModSmartRadio.java

示例13: handleLoadPackage

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam param) throws Throwable {
    if (!param.packageName.equals("com.sina.weibo")) {
        return;
    }
    log("Fixer handleLoadPackage: " + param.packageName);

    Class<?> instrumentation = XposedHelpers.findClass("android.app.Instrumentation", param.classLoader);
    Method method = instrumentation.getMethod("newActivity", ClassLoader.class, String.class, Intent.class);
    XposedBridge.hookMethod(method, new ActivityHook());

    XposedHelpers.findAndHookMethod("android.content.ClipboardManager",
        param.classLoader, "setPrimaryClip", ClipData.class, new ClipboardHook());
}
 
开发者ID:drakeet,项目名称:WeiboFixer,代码行数:15,代码来源:Fixer.java

示例14: findAndHookMethod

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
private static void findAndHookMethod(String p1, ClassLoader lpparam, String p2, Object... parameterTypesAndCallback){
	try{
		XposedHelpers.findAndHookMethod(p1, lpparam, p2, parameterTypesAndCallback);
	}catch(Throwable localString3){
		//XposedBridge.log(localString3);
	}
}
 
开发者ID:zpp0196,项目名称:Flyme6Helper,代码行数:8,代码来源:ThemePatch.java

示例15: findMethodIsFromMockProvider

import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
/**
* 判断是否开启允许ADB模拟定位功能
*/
public static void findMethodIsFromMockProvider(){
    XposedHelpers.findAndHookMethod(Location.class, "isFromMockProvider", new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            param.setResult(false);
        }
    });
}
 
开发者ID:littleRich,项目名称:VirtualLocation,代码行数:13,代码来源:SdkHookManager.java


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