Java Code Examples for de.robv.android.xposed.XposedHelpers#setStaticObjectField()
The following examples show how to use
de.robv.android.xposed.XposedHelpers#setStaticObjectField() .
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: API18.java From VirtualSensor with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { super.afterHookedMethod(param); Object sSensorModuleLock = XposedHelpers.getStaticObjectField(param.thisObject.getClass(), "sSensorModuleLock"); synchronized (sSensorModuleLock) { ArrayList<Sensor> sFullSensorsList = (ArrayList<Sensor>) XposedHelpers.getStaticObjectField(param.thisObject.getClass(), "sFullSensorsList"); SparseArray<Sensor> sHandleToSensor = (SparseArray<Sensor>) XposedHelpers.getStaticObjectField(param.thisObject.getClass(), "sHandleToSensor"); XposedHelpers.findField(SystemSensorManagerHook.SYSTEM_SENSOR_MANAGER, "sFullSensorsList").setAccessible(true); XposedHelpers.findField(SystemSensorManagerHook.SYSTEM_SENSOR_MANAGER, "sHandleToSensor").setAccessible(true); this.mSystemSensorManagerHook.fillSensorLists(sFullSensorsList, sHandleToSensor); XposedHelpers.setStaticObjectField(param.thisObject.getClass(), "sHandleToSensor", sHandleToSensor.clone()); XposedHelpers.setStaticObjectField(param.thisObject.getClass(), "sFullSensorsList", sFullSensorsList.clone()); } }
Example 2
Source File: API16.java From VirtualSensor with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable { super.afterHookedMethod(param); ArrayList sListeners = (ArrayList) XposedHelpers.getStaticObjectField(param.thisObject.getClass(), "sListeners"); synchronized (sListeners) { ArrayList<Sensor> sFullSensorsList = (ArrayList<Sensor>) XposedHelpers.getStaticObjectField(param.thisObject.getClass(), "sFullSensorsList"); SparseArray<Sensor> sHandleToSensor = (SparseArray<Sensor>) XposedHelpers.getStaticObjectField(param.thisObject.getClass(), "sHandleToSensor"); XposedHelpers.findField(SystemSensorManagerHook.SYSTEM_SENSOR_MANAGER, "sFullSensorsList").setAccessible(true); XposedHelpers.findField(SystemSensorManagerHook.SYSTEM_SENSOR_MANAGER, "sHandleToSensor").setAccessible(true); this.mSystemSensorManagerHook.fillSensorLists(sFullSensorsList, sHandleToSensor); XposedHelpers.setStaticObjectField(param.thisObject.getClass(), "sHandleToSensor", sHandleToSensor.clone()); XposedHelpers.setStaticObjectField(param.thisObject.getClass(), "sFullSensorsList", sFullSensorsList.clone()); Object sPool = XposedHelpers.newInstance(this.SENSOR_EVENT_POOL, int.class, sHandleToSensor.size() * 2); XposedHelpers.setStaticObjectField(param.thisObject.getClass(), "sPool", sPool); } }
Example 3
Source File: XposedHelpersWraper.java From MIUIAnesthetist with MIT License | 5 votes |
public static void setStaticObjectField(Class<?> clazz, String fieldName, Object value) { try { XposedHelpers.setStaticObjectField(clazz, fieldName, value); } catch (Throwable t) { log(t); } }
Example 4
Source File: XInstaller.java From XInstaller with BSD 2-Clause "Simplified" License | 5 votes |
public void changeDeviceProperties() { prefs.reload(); for (String[] property : Common.DEVICE_PROPERTIES) { String propertyValue = prefs.getString(property[0], null); if (propertyValue != null) { String buildFieldName = property[0].replace("device_", ""); buildFieldName = buildFieldName.toUpperCase(Locale.ENGLISH); XposedHelpers.setStaticObjectField(Build.class, buildFieldName, propertyValue); } } }
Example 5
Source File: XInstaller.java From XInstaller with BSD 2-Clause "Simplified" License | 5 votes |
public void changeDeviceProperties() { prefs.reload(); for (String[] property : Common.DEVICE_PROPERTIES) { String propertyValue = prefs.getString(property[0], null); if (propertyValue != null) { String buildFieldName = property[0].replace("device_", ""); buildFieldName = buildFieldName.toUpperCase(Locale.ENGLISH); XposedHelpers.setStaticObjectField(Build.class, buildFieldName, propertyValue); } } }
Example 6
Source File: MiPushEnhanceHook.java From MiPushFramework with GNU General Public License v3.0 | 4 votes |
@Override public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { try { String packageName = lpparam.packageName; try { if (!new File(FAKE_CONFIGURATION_GLOBAL).exists()){ // TODO: Remove hidden api usage if (!new File(String.format(FAKE_CONFIGURATION_NAME_TEMPLATE, UserHandleOverride.getUserHandleForUid(lpparam.appInfo.uid).hashCode(), packageName)).exists()) // Skipped according user's settings return; } else { Log.d(TAG, "using global fake config for " + packageName); } } catch (Throwable e) { XposedBridge.log(TAG + ": get config: " + Log.getStackTraceString(e)); } if (inBlackList(packageName)) { Log.d(TAG, "hit blacklist when fake build for " + packageName); return; } XposedBridge.hookAllMethods(XposedHelpers.findClass("android.os.SystemProperties", lpparam.classLoader), "get", new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { if (FAKE_VARS.containsKey(param.args[0].toString())) { param.setResult(FAKE_VARS.get(param.args[0].toString())); } } }); XposedHelpers.setStaticObjectField(android.os.Build.class, "MANUFACTURER", BRAND); XposedHelpers.setStaticObjectField(android.os.Build.class, "BRAND", BRAND); XposedHelpers.setStaticObjectField(android.os.Build.class, "PRODUCT", BRAND); } catch (Throwable throwable) { Log.e(TAG, "hook meet exception : " + throwable.getLocalizedMessage(), throwable); XposedBridge.log(TAG + ": hook: " + throwable); } }