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

The following examples show how to use de.robv.android.xposed.XposedHelpers#findField() . 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: HookAlipay.java    From WearPay with GNU General Public License v2.0 6 votes vote down vote up
private void hookCode(final Activity activity) {
    if (hasHooked) return;
    hasHooked = true;

    Class<?> classTarget = XposedHelpers.findClass("com.alipay.mobile.onsitepay9.payer.fragments.BarcodePayFragment", activity.getClassLoader());
    final Field codeField = XposedHelpers.findField(classTarget, "v");

    XposedHelpers.findAndHookMethod(classTarget, "a", boolean.class, boolean.class, new XC_MethodHook() {
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            String code = (String) codeField.get(param.thisObject);

            Intent intent = new Intent(ACTION_SEND_CODE);
            intent.setPackage(THIS_PACKAGE_NAME);
            intent.putExtra(EXTRA_CODE, code);

            activity.sendBroadcast(intent);
        }
    });
}
 
Example 2
Source File: XposedHelpersWraper.java    From MIUIAnesthetist with MIT License 5 votes vote down vote up
public static Field findField(Class<?> clazz, String fieldName) {
    try {
        return XposedHelpers.findField(clazz, fieldName);
    } catch (Throwable t) {
        log(t);
    }
    return null;
}
 
Example 3
Source File: ModTrustManager.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private static boolean hasStrongAuthTracker() {
    try {
        XposedHelpers.findField(mTrustManager.getClass(), "mStrongAuthTracker");
        return true;
    } catch (NoSuchFieldError nfe) {
        return false;
    }
}
 
Example 4
Source File: CellularTile.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private boolean hasField(Object o, String fieldName) {
    try {
        XposedHelpers.findField(o.getClass(), fieldName);
        return true;
    } catch (NoSuchFieldError e) {
        return false;
    }
}
 
Example 5
Source File: StatusbarSignalCluster.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
private Field resolveField(String... fieldNames) {
    Field field = null;
    for (String fieldName : fieldNames) {
        try {
            field = XposedHelpers.findField(mView.getClass(), fieldName);
            if (DEBUG) log(fieldName + " field found");
            break;
        } catch (NoSuchFieldError nfe) {
            if (DEBUG) log(fieldName + " field NOT found");
        }
    }
    return field;
}