本文整理匯總了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;
}
});
}
示例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);
}
}
});
}
示例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);
}
}
示例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);
}
}
示例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());
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
});
}
示例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");
}
}
}
}
示例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);
}
}
示例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);
}
}
});
}
示例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);
}
}
示例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());
}
示例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);
}
}
示例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);
}
});
}