本文整理汇总了Java中de.robv.android.xposed.XposedHelpers.findClass方法的典型用法代码示例。如果您正苦于以下问题:Java XposedHelpers.findClass方法的具体用法?Java XposedHelpers.findClass怎么用?Java XposedHelpers.findClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.robv.android.xposed.XposedHelpers
的用法示例。
在下文中一共展示了XposedHelpers.findClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleLoadPackage
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam p1) throws Throwable
{
String pn=p1.packageName;
Log.d(tag, "PackageName:" + pn);
XSharedPreferences xsp=new XSharedPreferences(this.getClass().getPackage().getName(), "xposed_blacklist");
XSharedPreferences xsp2=new XSharedPreferences(this.getClass().getPackage().getName(), "config");
String manufacturer=xsp2.getString("manufacturer", null);
String model=xsp2.getString("model", null);
String brand=xsp2.getString("brand", null);
String product=xsp2.getString("product", null);
String device=xsp2.getString("device", null);
String blacklist=xsp.getString("main", null);
if (!blacklist.contains(pn))
{
Log.d(tag, pn + ":return_OutOfBlackList");
return;
}
Class<?> clz=XposedHelpers.findClass("android.os.Build", p1.classLoader);
XposedHelpers.setStaticObjectField(clz, "MANUFACTURER", manufacturer);
XposedHelpers.setStaticObjectField(clz, "BRAND", brand);
XposedHelpers.setStaticObjectField(clz, "PRODUCT", product);
XposedHelpers.setStaticObjectField(clz, "DEVICE", device);
XposedHelpers.setStaticObjectField(clz, "MODEL", model);
}
示例2: init
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
try {
final Class<?> classDevSettings = XposedHelpers.findClass(CLASS_DEV_SETTINGS, classLoader);
if (DEBUG) log("hooking DeveloperSettings.onCreate method");
XposedHelpers.findAndHookMethod(classDevSettings, "onCreate", Bundle.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(final MethodHookParam param) throws Throwable {
PreferenceFragment pf = (PreferenceFragment) param.thisObject;
mResId = pf.getResources().getIdentifier("development_prefs", "xml", PACKAGE_NAME);
if (DEBUG) log("mResId=" + mResId);
}
});
}
catch (Throwable t) {
XposedBridge.log(t);
}
}
示例3: 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);
}
}
示例4: changeAutoRotationState
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
private static void changeAutoRotationState(Intent intent) {
try {
final Class<?> rlPolicyClass = XposedHelpers.findClass(
"com.android.internal.view.RotationPolicy", null);
final boolean locked;
if (intent.hasExtra(AShortcut.EXTRA_ENABLE)) {
locked = !intent.getBooleanExtra(AShortcut.EXTRA_ENABLE, false);
} else {
locked = !(Boolean) XposedHelpers.callStaticMethod(
rlPolicyClass, "isRotationLocked", mContext);
}
XposedHelpers.callStaticMethod(rlPolicyClass, "setRotationLock", mContext, locked);
if (intent.getBooleanExtra(AShortcut.EXTRA_SHOW_TOAST, false)) {
Utils.postToast(mContext, locked ? R.string.hwkey_action_auto_rotation_disabled :
R.string.hwkey_action_auto_rotation_enabled);
}
} catch (Throwable t) {
log("Error toggling auto rotation: " + t.getMessage());
}
}
示例5: performSoftReboot
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
public static void performSoftReboot() {
try {
Class<?> classSm = XposedHelpers.findClass("android.os.ServiceManager", null);
Class<?> classIpm = XposedHelpers.findClass("android.os.IPowerManager.Stub", null);
IBinder b = (IBinder) XposedHelpers.callStaticMethod(
classSm, "getService", Context.POWER_SERVICE);
Object ipm = XposedHelpers.callStaticMethod(classIpm, "asInterface", b);
XposedHelpers.callMethod(ipm, "crash", "Hot reboot");
} catch (Throwable t) {
try {
SystemProp.set("ctl.restart", "surfaceflinger");
SystemProp.set("ctl.restart", "zygote");
} catch (Throwable t2) {
XposedBridge.log(t);
XposedBridge.log(t2);
}
}
}
示例6: 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);
}
}
});
}
示例7: 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());
}
示例8: handleLoadPackage
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
final Class<?> phoneWindowManager;
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
phoneWindowManager = XposedHelpers.findClass("com.android.server.policy.PhoneWindowManager", lpparam.classLoader);
} else {
phoneWindowManager = XposedHelpers.findClass("com.android.internal.policy.impl.PhoneWindowManager", lpparam.classLoader);
}
XposedBridge.hookAllMethods(phoneWindowManager, "interceptKeyBeforeQueueing", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
int keyCode = ((KeyEvent) param.args[0]).getKeyCode();
if (keyCode == KeyEvent.KEYCODE_POWER) {
XSharedPreferences mXsp = new XSharedPreferences(PACKAGE_NAME);
Log.d("isBlockPowerButton", "=================" + mXsp.getBoolean("isBlockPowerButton", true));
XposedBridge.log("isBlockPowerButton" + "=================" + mXsp.getBoolean("isBlockPowerButton", true));
if (mXsp.getBoolean("isBlockPowerButton", true)) {
param.setResult(0);
}
}
}
});
}
示例9: prepareBrightnessControl
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
private static void prepareBrightnessControl() {
try {
Class<?> powerManagerClass = XposedHelpers.findClass(CLASS_POWER_MANAGER,
mContext.getClassLoader());
Resources res = mContext.getResources();
mMinBrightness = res.getInteger(res.getIdentifier(
"config_screenBrightnessSettingMinimum", "integer", "android"));
mPeekHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 84,
res.getDisplayMetrics());
BRIGHTNESS_ON = XposedHelpers.getStaticIntField(powerManagerClass, "BRIGHTNESS_ON");
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例10: setNetworkController
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
@Override
protected void setNetworkController(Object networkController) {
final ClassLoader classLoader = mView.getClass().getClassLoader();
final Class<?> networkCtrlCbClass = XposedHelpers.findClass(
"com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback",
classLoader);
for (int i=0; i < PhoneWrapper.getPhoneCount(); i++) {
XposedHelpers.callMethod(networkController, "addNetworkSignalChangedCallback",
Proxy.newProxyInstance(classLoader, new Class<?>[] { networkCtrlCbClass },
new NetworkControllerCallbackMsim()), i);
}
if (DEBUG) log("setNetworkController: callback registered");
}
示例11: init
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
public static void init(final XSharedPreferences prefs, final ClassLoader classLoader) {
try {
final Class<?> classVoiceIoSettings = XposedHelpers.findClass(CLASS_VOICEIO_SETTINGS, classLoader);
if (DEBUG) log("replacing populateOrRemovePreferences method");
XposedHelpers.findAndHookMethod(classVoiceIoSettings, "populateOrRemovePreferences",
new XC_MethodReplacement() {
@Override
protected Object replaceHookedMethod(MethodHookParam param) throws Throwable {
boolean hasRecognizer = (Boolean) XposedHelpers.callMethod(param.thisObject,
"populateOrRemoveRecognizerPrefs");
boolean hasTts = (Boolean) XposedHelpers.callMethod(param.thisObject,
"populateOrRemoveTtsPrefs");
if (DEBUG) log("populateOrRemovePreferences: hasRecognizer=" + hasRecognizer + "; hasTts=" + hasTts);
if (hasRecognizer || hasTts) {
return null;
}
PreferenceFragment fragment = (PreferenceFragment) XposedHelpers.getObjectField(
param.thisObject, "mFragment");
PreferenceCategory prefCat = (PreferenceCategory) XposedHelpers.getObjectField(
param.thisObject, "mVoiceCategory");
if (fragment != null && prefCat != null) {
fragment.getPreferenceScreen().removePreference(prefCat);
}
return null;
}
});
}
catch (Throwable t) {
XposedBridge.log(t);
}
}
示例12: getZenModeConfigClass
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
private Class<?> getZenModeConfigClass() {
if (mZenModeConfigClass == null) {
mZenModeConfigClass = XposedHelpers.findClass(CLASS_ZEN_MODE_CONFIG,
mContext.getClassLoader());
}
return mZenModeConfigClass;
}
示例13: getResourceIconClass
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
private static Class<?> getResourceIconClass(ClassLoader cl) {
try {
return XposedHelpers.findClass(CLASS_BASE_TILE+".ResourceIcon", cl);
} catch (Throwable t) {
log("Error getting resource icon class:");
XposedBridge.log(t);
return null;
}
}
示例14: setNetworkController
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
protected void setNetworkController(Object networkController) {
final ClassLoader classLoader = mView.getClass().getClassLoader();
final Class<?> networkCtrlCbClass = XposedHelpers.findClass("com.android.systemui.statusbar.policy.NetworkController.SignalCallback", classLoader);
mNetworkControllerCallback = Proxy.newProxyInstance(classLoader,
new Class<?>[]{networkCtrlCbClass}, new NetworkControllerCallback());
XposedHelpers.callMethod(networkController, "addSignalCallback",
mNetworkControllerCallback);
if (DEBUG) log("setNetworkController: callback registered");
}
示例15: initAndroid
import de.robv.android.xposed.XposedHelpers; //导入方法依赖的package包/类
public static void initAndroid(final XSharedPreferences mainPrefs, final ClassLoader classLoader) {
mPrefs = new XSharedPreferences(GravityBox.PACKAGE_NAME, "ledcontrol");
mPrefs.makeWorldReadable();
mQhPrefs = new XSharedPreferences(GravityBox.PACKAGE_NAME, "quiet_hours");
mQhPrefs.makeWorldReadable();
mQuietHours = new QuietHours(mQhPrefs);
mProximityWakeUpEnabled = mainPrefs.getBoolean(GravityBoxSettings.PREF_KEY_POWER_PROXIMITY_WAKE, false);
try {
final Class<?> nmsClass = XposedHelpers.findClass(CLASS_NOTIFICATION_MANAGER_SERVICE, classLoader);
XposedBridge.hookAllConstructors(nmsClass, new XC_MethodHook() {
@Override
protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
if (mNotifManagerService == null) {
mNotifManagerService = param.thisObject;
mContext = (Context) XposedHelpers.callMethod(param.thisObject, "getContext");
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(LedSettings.ACTION_UNC_SETTINGS_CHANGED);
intentFilter.addAction(Intent.ACTION_USER_PRESENT);
intentFilter.addAction(QuietHoursActivity.ACTION_QUIET_HOURS_CHANGED);
intentFilter.addAction(Intent.ACTION_SCREEN_OFF);
intentFilter.addAction(ACTION_CLEAR_NOTIFICATIONS);
intentFilter.addAction(GravityBoxSettings.ACTION_PREF_POWER_CHANGED);
mContext.registerReceiver(mBroadcastReceiver, intentFilter);
toggleActiveScreenFeature(!mPrefs.getBoolean(LedSettings.PREF_KEY_LOCKED, false) &&
mPrefs.getBoolean(LedSettings.PREF_KEY_ACTIVE_SCREEN_ENABLED, false));
hookNotificationDelegate();
if (DEBUG) log("Notification manager service initialized");
}
}
});
XposedHelpers.findAndHookMethod(CLASS_NOTIFICATION_MANAGER_SERVICE, classLoader,
"enqueueNotificationInternal", String.class, String.class,
int.class, int.class, String.class,
int.class, Notification.class, int[].class, int.class, notifyHook);
XposedHelpers.findAndHookMethod(CLASS_NOTIFICATION_MANAGER_SERVICE, classLoader,
"applyZenModeLocked", CLASS_NOTIFICATION_RECORD, applyZenModeHook);
XposedHelpers.findAndHookMethod(CLASS_NOTIFICATION_MANAGER_SERVICE, classLoader,
"updateLightsLocked", updateLightsLockedHook);
XposedBridge.hookAllMethods(XposedHelpers.findClass(CLASS_VIBRATOR_SERVICE, classLoader),
"startVibrationLocked", startVibrationHook);
} catch (Throwable t) {
XposedBridge.log(t);
}
}