當前位置: 首頁>>代碼示例>>Java>>正文


Java XposedHelpers.findClass方法代碼示例

本文整理匯總了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);
}
 
開發者ID:nijigenirubasho,項目名稱:mobiletailchanger,代碼行數:26,代碼來源:Xpo.java

示例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);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:19,代碼來源:MtkFixDevOptions.java

示例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);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:23,代碼來源:ModDownloadProvider.java

示例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());
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:21,代碼來源:ModHwKeys.java

示例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);
        }
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:19,代碼來源:Utils.java

示例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);
            }
        }
    });
}
 
開發者ID:EggUncle,項目名稱:XposedNavigationBar,代碼行數:22,代碼來源:PointerEventDispatcherHook.java

示例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());
}
 
開發者ID:drakeet,項目名稱:WeiboFixer,代碼行數:15,代碼來源:Fixer.java

示例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);
                }
            }
        }
    });
}
 
開發者ID:frowhy,項目名稱:Block,代碼行數:28,代碼來源:BlockPowerButton.java

示例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);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:15,代碼來源:ModStatusBar.java

示例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");
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:14,代碼來源:StatusbarSignalClusterMoto.java

示例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);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:38,代碼來源:MtkFixTtsSettings.java

示例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;
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:8,代碼來源:DoNotDisturbTile.java

示例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;
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:10,代碼來源:QsTile.java

示例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");
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:10,代碼來源:StatusbarSignalCluster.java

示例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);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:54,代碼來源:ModLedControl.java


注:本文中的de.robv.android.xposed.XposedHelpers.findClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。