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


Java XposedHelpers.callStaticMethod方法代碼示例

本文整理匯總了Java中de.robv.android.xposed.XposedHelpers.callStaticMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java XposedHelpers.callStaticMethod方法的具體用法?Java XposedHelpers.callStaticMethod怎麽用?Java XposedHelpers.callStaticMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在de.robv.android.xposed.XposedHelpers的用法示例。


在下文中一共展示了XposedHelpers.callStaticMethod方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCurrentNetworkType

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
private static int getCurrentNetworkType(int phoneId) {
    try {
        int networkType = getDefaultNetworkType();
        Object[] phones = (Object[]) XposedHelpers.callStaticMethod(mClsPhoneFactory, "getPhones");
        if (phoneId < phones.length) {
            int subId = (int) XposedHelpers.callMethod(phones[phoneId], "getSubId");
            if (DEBUG)
                log("getCurrentNetworkType: calculating network type for subId=" + subId);
            networkType = (int) XposedHelpers.callStaticMethod(mClsPhoneFactory,
                    "calculatePreferredNetworkType", mContext, subId);
        }
        if (DEBUG) log("getCurrentNetworkType: phoneId=" + phoneId +
                "; networkType=" + getNetworkModeNameFromValue(networkType));
        return networkType;
    } catch (Throwable t) {
        XposedBridge.log(t);
        return NT_WCDMA_PREFERRED;
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:20,代碼來源:PhoneWrapper.java

示例2: hasMsimSupport

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
public static boolean hasMsimSupport() {
    if (mHasMsimSupport != null) return mHasMsimSupport;

    try {
        Object mtm = XposedHelpers.callStaticMethod(getTelephonyManagerClass(), "getDefault");
        mHasMsimSupport = (Boolean) XposedHelpers.callMethod(mtm, "isMultiSimEnabled") &&
                getPhoneCount() > 1;
        if (DEBUG) log("isMultiSimEnabled: " +
                (Boolean) XposedHelpers.callMethod(mtm, "isMultiSimEnabled"));
        if (DEBUG) log("getPhoneCount: " + getPhoneCount());
    } catch (Throwable t) {
        if (DEBUG) XposedBridge.log(t);
        mHasMsimSupport = false;
    }

    if (DEBUG) log("hasMsimSupport: " + mHasMsimSupport);
    return mHasMsimSupport;
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:19,代碼來源:PhoneWrapper.java

示例3: getTimeUntilNextAlarmCondition

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
private Uri getTimeUntilNextAlarmCondition() {
    try {
        GregorianCalendar weekRange = new GregorianCalendar();
        final long now = weekRange.getTimeInMillis();
        setToMidnight(weekRange);
        weekRange.roll(Calendar.DATE, 6);
        final long nextAlarmMs = (long) XposedHelpers.callMethod(mZenCtrl, "getNextAlarm");
        if (nextAlarmMs > 0) {
            GregorianCalendar nextAlarm = new GregorianCalendar();
            nextAlarm.setTimeInMillis(nextAlarmMs);
            setToMidnight(nextAlarm);
            if (weekRange.compareTo(nextAlarm) >= 0) {
                Object condition = XposedHelpers.callStaticMethod(getZenModeConfigClass(), "toNextAlarmCondition",
                        mContext, now, nextAlarmMs, SysUiManagers.KeyguardMonitor.getCurrentUserId());
                return (Uri) XposedHelpers.getObjectField(condition, "id");
            }
        }
        return null;
    } catch (Throwable t) {
        XposedBridge.log(t);
        return null;
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:24,代碼來源:DoNotDisturbTile.java

示例4: getResourceIcon

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
private Object getResourceIcon() {
    if (sResourceIconClass == null || icon == null)
        return null;

    try {
        Object resourceIcon = XposedHelpers.callStaticMethod(
                sResourceIconClass, "get", icon.hashCode());
        XposedHelpers.setAdditionalInstanceField(resourceIcon, TILE_KEY_NAME, mKey);
        if (DEBUG) log("getting resource icon for " + mKey);
        return resourceIcon;
    } catch (Throwable t) {
        log("Error creating resource icon:");
        XposedBridge.log(t);
        return null;
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:17,代碼來源:QsTile.java

示例5: handleMessage

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
public void handleMessage(Message m) {
    switch (m.what) {
        case MSG_INJECT_KEY:
            final long eventTime = SystemClock.uptimeMillis();
            final InputManager inputManager = (InputManager)
                    XposedHelpers.callStaticMethod(InputManager.class, "getInstance");

            int flags = KeyEvent.FLAG_FROM_SYSTEM;
            XposedHelpers.callMethod(inputManager, "injectInputEvent",
                    new KeyEvent(eventTime - 50, eventTime - 50, KeyEvent.ACTION_DOWN, m.arg1, 0,
                            0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags, InputDevice.SOURCE_UNKNOWN), 0);
            XposedHelpers.callMethod(inputManager, "injectInputEvent",
                    new KeyEvent(eventTime - 50, eventTime - 25, KeyEvent.ACTION_UP, m.arg1, 0,
                            0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags, InputDevice.SOURCE_UNKNOWN), 0);

            break;
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:19,代碼來源:PieController.java

示例6: 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

示例7: 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

示例8: update

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
public void update() {
    try {
        ContentResolver resolver = mContext.getContentResolver();
        int brightnessMode = (Integer) XposedHelpers.callStaticMethod(Settings.System.class,
                "getIntForUser", resolver,
                Settings.System.SCREEN_BRIGHTNESS_MODE, 0, -2);
        mAutomaticBrightness = brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:12,代碼來源:ModStatusBar.java

示例9: playSoundEffect

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
public void playSoundEffect(int soundConstant) {
    try {
        int currentUser = (Integer) XposedHelpers.callStaticMethod(
                ActivityManager.class, "getCurrentUser");
        XposedHelpers.callMethod(mAudioManager, "playSoundEffect",
                soundConstant, currentUser);
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:11,代碼來源:KeyButtonView.java

示例10: sendEvent

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
void sendEvent(int action, int flags, long when, boolean applyDefaultFlags) {
    try {
        final int repeatCount = (flags & KeyEvent.FLAG_LONG_PRESS) != 0 ? 1 : 0;
        if (applyDefaultFlags) {
            flags |= KeyEvent.FLAG_FROM_SYSTEM | KeyEvent.FLAG_VIRTUAL_HARD_KEY;
        }
        final KeyEvent ev = new KeyEvent(mDownTime, when, action, mCode, repeatCount,
                0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0, flags,
                InputDevice.SOURCE_KEYBOARD);
        final Object inputManager = XposedHelpers.callStaticMethod(InputManager.class, "getInstance");
        XposedHelpers.callMethod(inputManager, "injectInputEvent", ev, 0);
    } catch (Throwable t) {
        XposedBridge.log(t);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:16,代碼來源:KeyButtonView.java

示例11: getPhone

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
private static Object getPhone() {
    if (mClsPhoneFactory == null) {
        return null;
    } else if (hasMsimSupport()) {
        return XposedHelpers.callStaticMethod(mClsPhoneFactory, "getPhone", mSimSlot);
    } else {
        return XposedHelpers.callStaticMethod(mClsPhoneFactory, "getDefaultPhone");
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:10,代碼來源:PhoneWrapper.java

示例12: getDefaultNetworkType

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
public static int getDefaultNetworkType() {
    try {
        int mode = (Integer) XposedHelpers.callStaticMethod(mSystemProperties,
                "getInt", "ro.telephony.default_network", NT_WCDMA_PREFERRED);
        if (DEBUG) log("getDefaultNetworkMode: mode=" + mode);
        return mode;
    } catch (Throwable t) {
        XposedBridge.log(t);
        return NT_WCDMA_PREFERRED;
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:12,代碼來源:PhoneWrapper.java

示例13: getPhoneCount

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
public static int getPhoneCount() {
    if (mPhoneCount != -1) return mPhoneCount;

    try {
        Object mtm = XposedHelpers.callStaticMethod(getTelephonyManagerClass(), "getDefault");
        mPhoneCount = (int) XposedHelpers.callMethod(mtm, "getPhoneCount");
    } catch (Throwable t) {
        if (DEBUG) XposedBridge.log(t);
        mPhoneCount = -1;
    }

    if (DEBUG) log("getPhoneCount: " + mPhoneCount);
    return mPhoneCount;
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:15,代碼來源:PhoneWrapper.java

示例14: setLocationMode

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
public void setLocationMode(int mode) {
    final int currentUserId = Utils.getCurrentUser();
    if (!isUserLocationRestricted(currentUserId)) {
        try {
            final ContentResolver cr = mContext.getContentResolver();
            XposedHelpers.callStaticMethod(Settings.Secure.class, "putIntForUser",
                    cr, Settings.Secure.LOCATION_MODE, mode, currentUserId);
        } catch (Throwable t) {
            XposedBridge.log(t);
        }
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:13,代碼來源:GpsStatusMonitor.java

示例15: getLocationModeFromSettings

import de.robv.android.xposed.XposedHelpers; //導入方法依賴的package包/類
private int getLocationModeFromSettings() {
    try {
        final int currentUserId = Utils.getCurrentUser();
        final ContentResolver cr = mContext.getContentResolver();
        final int mode = (int) XposedHelpers.callStaticMethod(Settings.Secure.class, "getIntForUser",
                cr, Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF, currentUserId);
        if (DEBUG) log("getLocationMode: mode=" + mode);
        return mode;
    } catch (Throwable t) {
        XposedBridge.log(t);
        return Settings.Secure.LOCATION_MODE_OFF;
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:14,代碼來源:GpsStatusMonitor.java


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