本文整理汇总了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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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());
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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");
}
}
示例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;
}
}
示例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;
}
示例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);
}
}
}
示例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;
}
}