本文整理汇总了Java中de.robv.android.xposed.XposedBridge类的典型用法代码示例。如果您正苦于以下问题:Java XposedBridge类的具体用法?Java XposedBridge怎么用?Java XposedBridge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XposedBridge类属于de.robv.android.xposed包,在下文中一共展示了XposedBridge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLollipopRecentTask
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
private String getLollipopRecentTask() {
/** @hide Process is hosting the current top activities. Note that this covers
* all activities that are visible to the user. */
final int PROCESS_STATE_TOP = 2;
try {
Field processStateField = ActivityManager.RunningAppProcessInfo.class.getDeclaredField("processState");
List<ActivityManager.RunningAppProcessInfo> processes = ((ActivityManager) AndroidAppHelper.currentApplication().getSystemService(Context.ACTIVITY_SERVICE)).getRunningAppProcesses();
for (ActivityManager.RunningAppProcessInfo process : processes) {
if (process.importance <= ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND && process.importanceReasonCode == 0) {
int state = processStateField.getInt(process);
if (state == PROCESS_STATE_TOP) {
String[] packname = process.pkgList;
return packname[0];
}
}
}
} catch (Exception e) {
XposedBridge.log(e);
}
return "";
}
示例2: getNotifCountFor
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
public int getNotifCountFor(String pkg) {
if (pkg == null) return 0;
int count = 0;
try {
Map<?,?> entries = (Map<?,?>) XposedHelpers.getObjectField(mNotifData, "mEntries");
for (Object entry : entries.values()) {
StatusBarNotification sbn = (StatusBarNotification)
XposedHelpers.getObjectField(entry, "notification");
if (pkg.equals(sbn.getPackageName())) {
final Notification n = sbn.getNotification();
count += (n.number > 0 ? n.number : 1);
}
}
} catch (Throwable t) {
XposedBridge.log(t);
}
if (DEBUG) log("getNotifCountFor: " + pkg + "=" + count);
return count;
}
示例3: launchClockAction
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
private static void launchClockAction(String uri) {
if (mContext == null) return;
try {
final Intent intent = Intent.parseUri(uri, 0);
if (intent != null) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
mContext.startActivity(intent);
if (mPhoneStatusBar != null) {
XposedHelpers.callMethod(mPhoneStatusBar, "animateCollapsePanels");
}
}
} catch (ActivityNotFoundException e) {
log("Error launching assigned app for long-press on clock: " + e.getMessage());
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例4: updateSettingsButton
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
private static void updateSettingsButton() {
if (mPhoneStatusBar == null || SysUiManagers.IconManager == null) return;
try {
Object header = XposedHelpers.getObjectField(mPhoneStatusBar, "mHeader");
ImageView settingsButton = (ImageView) XposedHelpers.getObjectField(
header, Utils.isSamsungRom() ? "mSettingButton" : "mSettingsButton");
if (SysUiManagers.IconManager.isColoringEnabled()) {
settingsButton.setColorFilter(SysUiManagers.IconManager.getIconColor(),
PorterDuff.Mode.SRC_IN);
} else {
settingsButton.clearColorFilter();
}
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例5: changeSmartRadioState
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
private static void changeSmartRadioState(Intent intent) {
try {
if (intent.hasExtra(AShortcut.EXTRA_ENABLE)) {
mSmartRadioEnabled = intent.getBooleanExtra(AShortcut.EXTRA_ENABLE, false);
} else {
mSmartRadioEnabled = !mSmartRadioEnabled;
}
Settings.System.putInt(mContext.getContentResolver(),
SETTING_SMART_RADIO_ENABLED, mSmartRadioEnabled ? 1 : 0);
if (mSmartRadioEnabled) {
if (shouldSwitchToNormalState()) {
switchToState(State.NORMAL);
} else {
switchToState(State.POWER_SAVING);
}
}
if (intent.getBooleanExtra(AShortcut.EXTRA_SHOW_TOAST, false)) {
Utils.postToast(mContext, mSmartRadioEnabled ? R.string.smart_radio_on :
R.string.smart_radio_off);
}
if (DEBUG) log("mSmartRadioEnabled=" + mSmartRadioEnabled);
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例6: printDeclaredFields
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
/**
* Prints all declared fields of a object
*
* @param start Object to analyze
*/
public static void printDeclaredFields(Object start) {
int lenlen = start.getClass().getDeclaredFields().length;
for (int i = 0; i < lenlen; i++) {
try {
String name = start.getClass().getDeclaredFields()[i].getName();
Object found = getObjField(start, name);
if (found != null) {
XposedBridge.log("Declared field " + i + "(" + name + "): " + found.toString());
}
} catch (Exception ignored) {
}
}
}
示例7: handleLoadPackage
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals("com.tencent.tmgp.sgame")) return;
if (BuildConfig.DEBUG) {
XposedBridge.log("dreamtobe in king of glory!");
}
final Class<?> crashNotifyHandler = findClass("com.tsf4g.apollo.report.CrashNotifyHandler", lpparam.classLoader);
findAndHookMethod(crashNotifyHandler, "Instance", new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
param.setResult(null);
}
});
}
示例8: init
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
private static void init() {
Context sysContext = (Context) XposedHelpers.callMethod(
XposedHelpers.callStaticMethod(
XposedHelpers.findClass("android.app.ActivityThread", null),
"currentActivityThread"),
"getSystemContext");
try {
PackageInfo pkgInfo = sysContext.getPackageManager().getPackageInfo(PKG_NAME, 0);
XposedBridge.log(String.format(Locale.getDefault(), "WCFP: Found WeChat version : %s (%d)", pkgInfo.versionName, pkgInfo.versionCode));
if ((isVersionSupported = VersionInfo.checkVersion(pkgInfo.versionCode))) {
VersionInfo.initMinify(pkgInfo.versionCode);
}
} catch (PackageManager.NameNotFoundException e) {
XposedBridge.log(e);
}
}
示例9: initReflections
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
private static void initReflections(Class<?> classPhoneWindowManager) {
try {
if (mLaunchAssistAction == null) {
mLaunchAssistAction = classPhoneWindowManager.getDeclaredMethod(
"launchAssistAction", String.class, int.class);
mLaunchAssistAction.setAccessible(true);
}
if (mLaunchAssistLongPressAction == null) {
mLaunchAssistLongPressAction = classPhoneWindowManager.getDeclaredMethod(
"launchAssistLongPressAction");
mLaunchAssistLongPressAction.setAccessible(true);
}
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例10: initResources
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
public static void initResources(final XSharedPreferences prefs, final InitPackageResourcesParam resparam) {
try {
// Lockscreen: disable menu key in lock screen
Utils.TriState triState = Utils.TriState.valueOf(prefs.getString(
GravityBoxSettings.PREF_KEY_LOCKSCREEN_MENU_KEY, "DEFAULT"));
if (DEBUG) log(GravityBoxSettings.PREF_KEY_LOCKSCREEN_MENU_KEY + ": " + triState);
if (triState != Utils.TriState.DEFAULT) {
resparam.res.setReplacement(PACKAGE_NAME, "bool", "config_disableMenuKeyInLockScreen",
triState == Utils.TriState.DISABLED);
if (DEBUG)
log("config_disableMenuKeyInLockScreen: " + (triState == Utils.TriState.DISABLED));
}
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例11: createHooks
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
private void createHooks() {
if (Utils.isOxygenOs35Rom())
return;
try {
mLongClickHook = XposedHelpers.findAndHookMethod(mTile.getClass().getName(),
mContext.getClassLoader(), "handleLongClick", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (handleLongClick()) {
param.setResult(null);
}
}
});
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例12: setNotificationPanelState
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
private static void setNotificationPanelState(Intent intent, boolean withQs) {
try {
if (!intent.hasExtra(AShortcut.EXTRA_ENABLE)) {
Object notifPanel = XposedHelpers.getObjectField(mPhoneStatusBar, "mNotificationPanel");
if ((boolean) XposedHelpers.callMethod(notifPanel, "isFullyCollapsed")) {
expandNotificationPanel(withQs);
} else {
collapseNotificationPanel();
}
} else {
if (intent.getBooleanExtra(AShortcut.EXTRA_ENABLE, false)) {
expandNotificationPanel(withQs);
} else {
collapseNotificationPanel();
}
}
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例13: init
import de.robv.android.xposed.XposedBridge; //导入依赖的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);
}
}
示例14: clearAll
import de.robv.android.xposed.XposedBridge; //导入依赖的package包/类
private static synchronized final void clearAll() {
if (mRecentsView == null) return;
try {
int childCount = mRecentsView.getChildCount();
for (int i = 0; i < childCount; i++) {
final View child = mRecentsView.getChildAt(i);
if (child.getClass().getName().equals(CLASS_TASK_STACK_VIEW)) {
clearStack((ViewGroup) child);
}
}
updateRamBarMemoryUsage();
} catch (Throwable t) {
XposedBridge.log(t);
}
}
示例15: getResourceIcon
import de.robv.android.xposed.XposedBridge; //导入依赖的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;
}
}