Java Code Examples for de.robv.android.xposed.XposedHelpers#callMethod()
The following examples show how to use
de.robv.android.xposed.XposedHelpers#callMethod() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModLockscreen.java From GravityBox with Apache License 2.0 | 6 votes |
private static boolean canTriggerUnlock(UnlockPolicy policy) { if (policy == UnlockPolicy.DEFAULT) return true; try { ViewGroup stack = (ViewGroup) XposedHelpers.getObjectField(mPhoneStatusBar, "mStackScroller"); int childCount = stack.getChildCount(); int notifCount = 0; int notifClearableCount = 0; for (int i = 0; i < childCount; i++) { View v = stack.getChildAt(i); if (v.getVisibility() != View.VISIBLE || !v.getClass().getName().equals(CLASS_NOTIF_ROW)) continue; notifCount++; if ((boolean) XposedHelpers.callMethod(v, "isClearable")) { notifClearableCount++; } } return (policy == UnlockPolicy.NOTIF_NONE) ? notifCount == 0 : notifClearableCount == 0; } catch (Throwable t) { XposedBridge.log(t); return true; } }
Example 2
Source File: PhoneWindowManagerHook.java From XposedNavigationBar with GNU General Public License v3.0 | 6 votes |
public static void setNavBarDimensions(Object sPhoneWindowManager, int hp, int defaultNavbarH) { if (hp == -1) { hp = defaultNavbarH; } int[] navigationBarHeightForRotation; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) { navigationBarHeightForRotation = (int[]) XposedHelpers.getObjectField( sPhoneWindowManager, "mNavigationBarHeightForRotation"); } else { navigationBarHeightForRotation = (int[]) XposedHelpers.getObjectField( sPhoneWindowManager, "mNavigationBarHeightForRotationDefault"); } final int portraitRotation = XposedHelpers.getIntField(sPhoneWindowManager, "mPortraitRotation"); final int upsideDownRotation = XposedHelpers.getIntField(sPhoneWindowManager, "mUpsideDownRotation"); if (navigationBarHeightForRotation[portraitRotation] == hp) return; navigationBarHeightForRotation[portraitRotation] = navigationBarHeightForRotation[upsideDownRotation] = hp; XposedHelpers.callMethod(sPhoneWindowManager, "updateRotation", false); }
Example 3
Source File: ModDisplay.java From GravityBox with Apache License 2.0 | 5 votes |
@Override public void run() { if (mLight == null) return; try { Object ls = XposedHelpers.getSurroundingThis(mLight); long np = XposedHelpers.getLongField(ls, "mNativePointer"); if (!mPendingNotif) { mHandler.removeCallbacks(this); mPendingNotifColor = mButtonBacklightMode.equals(GravityBoxSettings.BB_MODE_ALWAYS_ON) && mPm.isInteractive() ? 0xff6e6e6e : 0; XposedHelpers.callMethod(ls, "setLight_native", np, LIGHT_ID_BUTTONS, mPendingNotifColor, 0, 0, 0, 0); } else { if (mPendingNotifColor == 0) { mPendingNotifColor = 0xff6e6e6e; XposedHelpers.callMethod(ls, "setLight_native", np, LIGHT_ID_BUTTONS, mPendingNotifColor, 0, 0, 0, 0); mHandler.postDelayed(mPendingNotifRunnable, 500); } else { mPendingNotifColor = 0; XposedHelpers.callMethod(ls, "setLight_native", np, LIGHT_ID_BUTTONS, mPendingNotifColor, 0, 0, 0, 0); mHandler.postDelayed(mPendingNotifRunnable, mPulseNotifDelay); } } } catch (Exception e) { XposedBridge.log(e); } }
Example 4
Source File: DoNotDisturbTile.java From GravityBox with Apache License 2.0 | 5 votes |
@Override public boolean handleLongClick() { if (mQuickMode) { if (getZenMode() == ZEN_MODE_OFF) { mClickOverrideBlocked = true; XposedHelpers.callMethod(mTile, "handleClick"); } else { setZenMode(ZEN_MODE_OFF); } } else { startSettingsActivity(Settings.ACTION_SOUND_SETTINGS); } return true; }
Example 5
Source File: BaseTile.java From GravityBox with Apache License 2.0 | 5 votes |
public BaseTile(Object host, String key, XSharedPreferences prefs, QsTileEventDistributor eventDistributor) throws Throwable { mHost = host; mKey = key; mPrefs = prefs; mEventDistributor = eventDistributor; mKgMonitor = SysUiManagers.KeyguardMonitor; mContext = (Context) XposedHelpers.callMethod(mHost, "getContext"); mGbContext = Utils.getGbContext(mContext); mEventDistributor.registerListener(this); initPreferences(); }
Example 6
Source File: XposedHelpersWraper.java From MIUIAnesthetist with MIT License | 5 votes |
public static Object callMethod(Object obj, String methodName, Object... args) { try { return XposedHelpers.callMethod(obj, methodName, args); } catch (Throwable t) { log(t); } return null; }
Example 7
Source File: WifiTile.java From GravityBox with Apache License 2.0 | 5 votes |
@Override public boolean handleLongClick() { if (!mDualMode) { XposedHelpers.callMethod(mTile, "handleSecondaryClick"); } else { startSettingsActivity(Settings.ACTION_WIFI_SETTINGS); } return true; }
Example 8
Source File: ConnectivityServiceWrapper.java From GravityBox with Apache License 2.0 | 5 votes |
private static void setMobileDataEnabled(boolean enabled) { if (mTelephonyManager == null) return; try { XposedHelpers.callMethod(mTelephonyManager, "setDataEnabled", enabled); if (DEBUG) log("setDataEnabled called"); } catch (Throwable t) { XposedBridge.log(t); } }
Example 9
Source File: MiuiKeyguardVerticalClockHook.java From XMiTools with GNU General Public License v3.0 | 5 votes |
@Override public void onTimeTick() { for (View keyguardClock : mKeyguardClockList) { if (keyguardClock != null) { XposedHelpers.callMethod(keyguardClock, "updateTime"); } } }
Example 10
Source File: StatusBarClockHook.java From XMiTools with GNU General Public License v3.0 | 5 votes |
@Override public void onTimeTick() { for (Object clockView : mClockViewSet) { if (clockView != null) { XposedHelpers.callMethod(clockView, "updateClock"); } } }
Example 11
Source File: BaseTile.java From GravityBox with Apache License 2.0 | 5 votes |
public void collapsePanels() { try { XposedHelpers.callMethod(mHost, "collapsePanels"); } catch (Throwable t) { log("Error in collapsePanels: "); XposedBridge.log(t); } }
Example 12
Source File: DingDingHandler.java From xposed-rimet with Apache License 2.0 | 5 votes |
/** * 设置消息文本信息 * @param message * @param text */ private void setMsgText(Object message, String text) { Object messageContent = XposedHelpers.callMethod(message, getXString(M.method.method_wukong_im_message_MessageImpl_messageContent)); if (messageContent != null) { // 重新设置字符串 XposedHelpers.callMethod(messageContent, getXString(M.method.method_wukong_im_message_MessageContentImpl_TextContentImpl_setText), text); } }
Example 13
Source File: RevokeMsgHook.java From XposedWechatHelper with GNU General Public License v2.0 | 5 votes |
private static void handleMessageRecall(ContentValues contentValues) { long msgId = contentValues.getAsLong("msgId"); Object msg = msgCacheMap.get(msgId); if (msg != null) { long createTime = XposedHelpers.getLongField(msg, "field_createTime"); XposedHelpers.setIntField(msg, "field_type", contentValues.getAsInteger("type")); XposedHelpers.setObjectField(msg, "field_content", contentValues.getAsString("content") + "(已被阻止)"); XposedHelpers.setLongField(msg, "field_createTime", createTime + 1L); XposedHelpers.callMethod(storageInsertObject, ApiFactory.getCurrent().storage_MsgInfoStorage_insert_method, msg, false); } }
Example 14
Source File: DingDingHandler.java From xposed-rimet with Apache License 2.0 | 5 votes |
/** * 处理撤回的消息 * @param message */ private void handlerRecallMessage(String cid, Object message) { Object conversation = getObjectField(message, M.field.field_android_dingtalkim_base_model_DingtalkMessage_mConversation); if (conversation == null) return; // 获取撤回的消息 Object recallMessage = XposedHelpers.callMethod(conversation, getXString(M.method.method_wukong_im_conversation_ConversationImpl_latestMessage)); if (recallMessage == null) return; // 获取消息类型 int msgType = getMsgType(recallMessage); if (10 != msgType) return; // 只处理文本消息 try { Class classIMDatabase = findClass(M.classz.class_wukong_im_base_IMDatabase); String dbName = (String) XposedHelpers.callStaticMethod(classIMDatabase, getXString(M.method.method_wukong_im_base_IMDatabase_getWritableDatabase)); Method methodMessageUpdate = findMatcherMethod( M.classz.class_defpackage_MessageDs, M.method.method_defpackage_MessageDs_update, String.class, String.class, List.class); setMsgText(recallMessage, getMsgText(recallMessage) + " [已撤回]"); // 更新消息信息 methodMessageUpdate.invoke(null, dbName, cid, Collections.singletonList(recallMessage)); } catch (Throwable tr) { Alog.e("异常了", tr); } }
Example 15
Source File: WifiManagerWrapper.java From GravityBox with Apache License 2.0 | 4 votes |
public int getWifiApState() { return (Integer) XposedHelpers.callMethod(mWifiManager, "getWifiApState"); }
Example 16
Source File: BatteryStyleController.java From GravityBox with Apache License 2.0 | 4 votes |
private void updateBatteryStyle() { try { if (mStockBattery != null) { if (mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_STOCK || mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_STOCK_PERCENT) { mStockBattery.getView().setVisibility(View.VISIBLE); mStockBattery.setShowPercentage(mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_STOCK_PERCENT); } else { mStockBattery.getView().setVisibility(View.GONE); } } if (mCircleBattery != null) { mCircleBattery.setVisibility((mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_CIRCLE || mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_CIRCLE_PERCENT || mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_CIRCLE_DASHED || mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_CIRCLE_DASHED_PERCENT) ? View.VISIBLE : View.GONE); mCircleBattery.setPercentage( mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_CIRCLE_PERCENT || mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_CIRCLE_DASHED_PERCENT); mCircleBattery.setStyle( mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_CIRCLE_DASHED || mBatteryStyle == GravityBoxSettings.BATTERY_STYLE_CIRCLE_DASHED_PERCENT ? CmCircleBattery.Style.DASHED : CmCircleBattery.Style.SOLID); } if (mPercentText != null) { switch (mContainerType) { case STATUSBAR: if (mBatteryPercentTextEnabledSb || mMtkPercentTextEnabled) { mPercentText.setVisibility(View.VISIBLE); mPercentText.updateText(); } else { mPercentText.setVisibility(View.GONE); } break; case KEYGUARD: case HEADER: XposedHelpers.callMethod(mContainer, "updateVisibilities"); break; } } } catch (Throwable t) { XposedBridge.log(t); } }
Example 17
Source File: ModStatusBar.java From GravityBox with Apache License 2.0 | 4 votes |
private static void collapseNotificationPanel() { XposedHelpers.callMethod(mPhoneStatusBar, "postAnimateCollapsePanels"); }
Example 18
Source File: AliPayeePlugin.java From Hook with Apache License 2.0 | 4 votes |
@Override public void load(XC_LoadPackage.LoadPackageParam loadPackageParam, final Context context) { final ClassLoader clazzLoader = loadPackageParam.classLoader; // XposedBridge.hookAllMethods(XposedHelpers.findClass("com.alipay.android.phone.messageboxstatic.biz.dao.ServiceDao", clazzLoader), "insertMessageInfo", new XC_MethodHook() { protected void beforeHookedMethod(XC_MethodHook.MethodHookParam paramAnonymousMethodHookParam) throws Throwable { try { XposedBridge.log("======商户服务start========="); String str = StringUtils.getTextCenter((String)XposedHelpers.callMethod(paramAnonymousMethodHookParam.args[0], "toString", new Object[0]), "extraInfo='", "'").replace("\\", ""); Log.i("tag", "http: "+str); if ((str.contains("收钱到账")) || (str.contains("收款到账"))) { Log.i("tag","http1"); str = PayHelperUtils.getCookieStr(clazzLoader); Log.i("tag","http2"+str); PayHelperUtils.getTradeInfo(context, str); Log.i("tag","http3"); } XposedBridge.log("======商户服务end========="); } catch (Exception localException) { Log.i("tag","ServiceDao:error"); } super.beforeHookedMethod(paramAnonymousMethodHookParam); } }); Object[] payeeArr = new Object[2]; payeeArr[0] = Bundle.class; payeeArr[1] = new XC_MethodHook() { protected void afterHookedMethod(XC_MethodHook.MethodHookParam hookParam) { Log.i("tag","1"); Activity ctx = (Activity) hookParam.thisObject; try { Object tvMoney = XposedHelpers.findField(ctx.getClass(), "b").get(ctx); Object tvMark = XposedHelpers.findField(ctx.getClass(), "c").get(ctx); Intent intent = ctx.getIntent(); XposedHelpers.callMethod(tvMoney, "setText", intent.getStringExtra(Constans.MONEY)); XposedHelpers.callMethod(tvMark, "setText", intent.getStringExtra(Constans.MARK)); XposedHelpers.callMethod(tvMark, "setVisibility", View.VISIBLE); Button btn = ((Button) XposedHelpers.findField(ctx.getClass(), "e").get(ctx)); btn.performClick(); } catch (Exception e) { e.printStackTrace(); } } }; XposedHelpers.findAndHookMethod(Constans.SETMONEYACTIVITY, clazzLoader, "onCreate", payeeArr); Object[] payResArr = new Object[2]; payResArr[0] = XposedHelpers.findClass(Constans.SETAMOUNTRES, clazzLoader); payResArr[1] = new XC_MethodHook() { protected void afterHookedMethod(XC_MethodHook.MethodHookParam hookParam) { Log.i("tag","2"); Activity ctx = (Activity) hookParam.thisObject; try { String money = (String) XposedHelpers.findField(ctx.getClass(), "g").get(ctx); String mark = (String) XposedHelpers.callMethod(XposedHelpers.findField(ctx.getClass(), "c").get(ctx), "getUbbStr"); Object localObject = hookParam.args[0]; String qrCodeUrl = (String) XposedHelpers.findField(localObject.getClass(), "qrCodeUrl").get(localObject); if (money != null) { Intent intent = new Intent(); intent.putExtra(Constans.MONEY, money); intent.putExtra(Constans.MARK, mark); intent.putExtra(Constans.TYPE, Constans.ALIPAY); intent.putExtra(Constans.PAY_URL, qrCodeUrl); intent.setAction(Constans.QRCODE_RESULT); PayHelperUtils.sendmsg(ctx,"生成付款码"+ Constans.ALIPAY+":"+qrCodeUrl); ctx.sendBroadcast(intent); } } catch (Exception e) { e.printStackTrace(); } } }; XposedHelpers.findAndHookMethod(Constans.SETMONEYACTIVITY, clazzLoader, "a", payResArr); }
Example 19
Source File: ModExpandedDesktop.java From GravityBox with Apache License 2.0 | 4 votes |
private static void updateSettings() { if (mContext == null || mPhoneWindowManager == null) return; try { final boolean expandedDesktop = Settings.Global.getInt(mContext.getContentResolver(), SETTING_EXPANDED_DESKTOP_STATE, 0) == 1; if (mExpandedDesktopMode == GravityBoxSettings.ED_DISABLED && expandedDesktop) { Settings.Global.putInt(mContext.getContentResolver(), SETTING_EXPANDED_DESKTOP_STATE, 0); return; } if (mExpandedDesktop != expandedDesktop) { mExpandedDesktop = expandedDesktop; } XposedHelpers.callMethod(mPhoneWindowManager, "updateSettings"); int[] navigationBarWidthForRotation = (int[]) XposedHelpers.getObjectField( mPhoneWindowManager, "mNavigationBarWidthForRotationDefault"); int[] navigationBarHeightForRotation = (int[]) XposedHelpers.getObjectField( mPhoneWindowManager, "mNavigationBarHeightForRotationDefault"); final int portraitRotation = XposedHelpers.getIntField(mPhoneWindowManager, "mPortraitRotation"); final int upsideDownRotation = XposedHelpers.getIntField(mPhoneWindowManager, "mUpsideDownRotation"); final int landscapeRotation = XposedHelpers.getIntField(mPhoneWindowManager, "mLandscapeRotation"); final int seascapeRotation = XposedHelpers.getIntField(mPhoneWindowManager, "mSeascapeRotation"); if (isNavbarHidden()) { navigationBarWidthForRotation[portraitRotation] = navigationBarWidthForRotation[upsideDownRotation] = navigationBarWidthForRotation[landscapeRotation] = navigationBarWidthForRotation[seascapeRotation] = navigationBarHeightForRotation[portraitRotation] = navigationBarHeightForRotation[upsideDownRotation] = navigationBarHeightForRotation[landscapeRotation] = navigationBarHeightForRotation[seascapeRotation] = 0; } else if (mNavbarDimensions != null) { navigationBarHeightForRotation[portraitRotation] = navigationBarHeightForRotation[upsideDownRotation] = mNavbarDimensions.hPort; navigationBarHeightForRotation[landscapeRotation] = navigationBarHeightForRotation[seascapeRotation] = mNavbarDimensions.hLand; navigationBarWidthForRotation[portraitRotation] = navigationBarWidthForRotation[upsideDownRotation] = navigationBarWidthForRotation[landscapeRotation] = navigationBarWidthForRotation[seascapeRotation] = mNavbarDimensions.wPort; } XposedHelpers.callMethod(mPhoneWindowManager, "updateRotation", false); } catch (Throwable t) { XposedBridge.log(t); } }
Example 20
Source File: Global.java From OneTapVideoDownload with GNU General Public License v3.0 | 4 votes |
public static Context getContext() { Class activityThreadClass = XposedHelpers.findClass("android.app.ActivityThread", null); Object activityThread = XposedHelpers.callStaticMethod(activityThreadClass, "currentActivityThread"); return (Context) XposedHelpers.callMethod(activityThread, "getSystemContext"); }