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

The following examples show how to use de.robv.android.xposed.XposedHelpers#setStaticBooleanField() . 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: SensorModificationMethod.java    From Sensor-Disabler with MIT License 6 votes vote down vote up
protected float[] getSensorValues(Sensor sensor, Context context) {
    XposedHelpers.setStaticBooleanField(Environment.class, "sUserRequired", false);
    String mockValuesKey = SensorUtil.generateUniqueSensorMockValuesKey(sensor);
    String[] mockValuesStrings;
    SharedPreferences sharedPreferences = getSharedPreferences(context);
    if (sharedPreferences.contains(mockValuesKey)) {
        mockValuesStrings = sharedPreferences.getString(mockValuesKey, "").split(":", 0);
    } else {
        return new float[0];
    }

    float[] mockValuesFloats = new float[mockValuesStrings.length];
    for (int i = 0; i < mockValuesStrings.length; i++) {
        mockValuesFloats[i] = Float.parseFloat(mockValuesStrings[i]);
    }
    return mockValuesFloats;
}
 
Example 2
Source File: XposedHelpersWraper.java    From MIUIAnesthetist with MIT License 5 votes vote down vote up
public static void setStaticBooleanField(Class<?> clazz, String fieldName, boolean value) {
    try {
        XposedHelpers.setStaticBooleanField(clazz, fieldName, value);
    } catch (Throwable t) {
        log(t);
    }
}
 
Example 3
Source File: XposedMain.java    From rebootmenu with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) {
    if (lpparam.packageName.equals(BuildConfig.APPLICATION_ID)) {
        Class<?> utilsClass = XposedHelpers.findClass(BuildConfig.APPLICATION_ID + ".util.hook.XposedUtils", lpparam.classLoader);
        XposedHelpers.setStaticBooleanField(utilsClass, "isActive", true);
    }
}
 
Example 4
Source File: SensorModificationMethod.java    From Sensor-Disabler with MIT License 5 votes vote down vote up
protected int getSensorStatus(Sensor sensor, Context context) {
    //Always assume that the user wants the app to do nothing, since this accesses every sensor.
    XposedHelpers.setStaticBooleanField(Environment.class, "sUserRequired", false);
    String enabledStatusKey = SensorUtil.generateUniqueSensorKey(sensor);
    SharedPreferences sharedPreferences = getSharedPreferences(context);
    return sharedPreferences.getInt(enabledStatusKey, Constants.SENSOR_STATUS_DO_NOTHING);
}
 
Example 5
Source File: SelfHook.java    From AdBlocker_Reborn with GNU General Public License v3.0 4 votes vote down vote up
public void hook(final XC_LoadPackage.LoadPackageParam lpparam) {
    if (lpparam.packageName.equals(BuildConfig.APPLICATION_ID)) {
        Class<?> SettingsActivity = XposedHelpers.findClass(BuildConfig.APPLICATION_ID + ".ui.SettingsActivity", lpparam.classLoader);
        XposedHelpers.setStaticBooleanField(SettingsActivity, "isActivated", true);
    }
}