private static void launchCustomApp(String uri) { if (uri == null) { try { Handler handler = (Handler) XposedHelpers.getObjectField(mPhoneWindowManager, "mHandler"); handler.post(new Runnable() { @Override public void run() { Toast.makeText(mContext, mStrCustomAppNone, Toast.LENGTH_SHORT).show(); } }); } catch (Throwable t) { } return; } try { Intent i = Intent.parseUri(uri, 0); launchCustomApp(i); } catch (URISyntaxException e) { log("launchCustomApp: error parsing uri: " + e.getMessage()); } }
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); } }
private void changeDigit(Object key, int digit) { XposedHelpers.setIntField(key, "mDigit", digit); ((TextView)XposedHelpers.getObjectField(key, "mDigitText")) .setText(Integer.toString(digit)); TextView kt = (TextView) XposedHelpers.getObjectField( key, "mKlondikeText"); kt.setText(""); kt.setVisibility(View.INVISIBLE); if (digit >= 0) { String[] sKlondike = (String[]) XposedHelpers.getStaticObjectField( key.getClass(), "sKlondike"); if (sKlondike != null && sKlondike.length > digit) { String klondike = sKlondike[digit]; if (klondike.length() > 0) { kt.setText(klondike); kt.setVisibility(View.VISIBLE); } } } ((View)key).setContentDescription(Integer.toString(digit)); }
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); } }
@Override public void onCreateTileView(View tileView) throws Throwable { super.onCreateTileView(tileView); if (isPrimary() && hasField(tileView, "mIconFrame") && !Utils.isOxygenOs35Rom()) { mDataOffView = new ImageView(mContext); mDataOffView.setImageDrawable(mGbContext.getDrawable(R.drawable.ic_mobile_data_off)); mDataOffView.setVisibility(View.GONE); FrameLayout iconFrame = (FrameLayout) XposedHelpers.getObjectField(tileView, "mIconFrame"); iconFrame.addView(mDataOffView, FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); if (mScalingFactor != 1f) { mDataOffView.setScaleX(mScalingFactor); mDataOffView.setScaleY(mScalingFactor); } if (PhoneWrapper.hasMsimSupport()) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mDataOffView.getLayoutParams(); int marginPx = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, -4, mContext.getResources().getDisplayMetrics())); lp.leftMargin = marginPx; lp.topMargin = Math.round(marginPx/2f); mDataOffView.setLayoutParams(lp); } } }
private boolean setDefaultSubscription(final SubType subType, final SubscriptionInfo subInfo) { if (subInfo == null) return false; try { if (subType == SubType.SMS) { XposedHelpers.callMethod(mSubMgr, "setDefaultSmsSubId", subInfo.getSubscriptionId()); } else if (subType == SubType.DATA) { XposedHelpers.callMethod(mSubMgr, "setDefaultDataSubId", subInfo.getSubscriptionId()); } return true; } catch (Throwable t) { XposedBridge.log(t); return false; } }
private void setTethering(boolean enabled) { try { Object pan = mBluetoothPan.get(); if (pan != null) { XposedHelpers.callMethod(pan, "setBluetoothTethering", enabled); if (DEBUG) log("setTethering: enabled=" + enabled); } } catch (Throwable t) { XposedBridge.log(t); } }
private static ClassInfo resolveCallCardFragment(ClassLoader cl) { ClassInfo info = null; String[] CLASS_NAMES = new String[] { "com.android.incallui.CallCardFragment", "ayv" }; String[] METHOD_NAMES = new String[] { "setDrawableToImageView" }; for (String className : CLASS_NAMES) { Class<?> clazz = XposedHelpers.findClassIfExists(className, cl); if (clazz == null || !Fragment.class.isAssignableFrom(clazz)) continue; info = new ClassInfo(clazz); for (String methodName : METHOD_NAMES) { if (methodName.equals("setDrawableToImageView")) { for (String realMethodName : new String[] { methodName, "b" }) { Method m = XposedHelpers.findMethodExactIfExists(clazz, realMethodName, Drawable.class); if (m != null) { info.methods.put(methodName, realMethodName); break; } } } } } return info; }
/** * Generate a kik smiley type, currently beta * * @param smiley_class smiley manager class * @param title smiley title * @param text smiley text used to generate it, i.e <3 * @param id smiley id * @param installdate smiley install ID * @return a smiley object */ static Object gen_smiley(Class smiley_class, String title, String text, String id, long installdate) { /* a = name b = id c and d = category/text e = is active f = ? (seems to always be true) g = bought time so constructor for it should be name,category,id,category,time */ return XposedHelpers.newInstance(smiley_class, title, text, id, text, installdate); }
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); } }
private boolean isOfficialConversation(Object value, Object messageStatus) { String username = XposedHelpers.getObjectField(messageStatus, Constants.Value_Message_Bean_NickName).toString(); ArrayList<String> list = AppSaveInfoUtils.INSTANCE.getWhiteList("white_list_official"); boolean wcY = XposedHelpers.getBooleanField(messageStatus, Value_Message_Status_Is_OFFICIAL_1); int wcU = XposedHelpers.getIntField(messageStatus, Value_Message_Status_Is_OFFICIAL_2); String field_username = ((String) XposedHelpers.getObjectField(value, Value_Message_Status_Is_OFFICIAL_3)); boolean isOfficial = !"gh_43f2581f6fd6".equals(field_username) && wcY && (wcU == 1 || wcU == 2 || wcU == 3); if (isOfficial) { officialNickNameEntries.add(username); for (String s : list) { if (s.trim().equals(username)) return false; } } return isOfficial; }
/** * 劫持判断是否使用虚拟定位 * @param loadPackageParam */ public static void findMethodGetInt(XC_LoadPackage.LoadPackageParam loadPackageParam){ // boolean isOpen = Settings.Secure.getInt(getContentResolver(),Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0; XposedHelpers.findAndHookMethod("android.provider.Settings$Secure", loadPackageParam.classLoader, "getInt", ContentResolver.class, String.class, int.class, new XC_MethodHook() { /** * 设置返回值类型: * 1、gpsEnabled && networkEnabled:LOCATION_MODE_HIGH_ACCURACY * 2、gpsEnabled:LOCATION_MODE_SENSORS_ONLY * 3、networkEnabled:LOCATION_MODE_BATTERY_SAVING * 4、disable:LOCATION_MODE_OFF */ @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { super.afterHookedMethod(param); param.setResult(LOCATION_MODE_SENSORS_ONLY); } }); XposedHelpers.findAndHookMethod(Settings.Secure.class, "getInt", ContentResolver.class, String.class, int.class, new XC_MethodReplacement() { @Override protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable { return LOCATION_MODE_SENSORS_ONLY; } }); }
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; } }
private static void setVolume(float volume) { Object player = XposedHelpers.getObjectField(mRingtone, "mLocalPlayer"); if (player != null) { XposedHelpers.callMethod(player, "setVolume", volume); } else if (XposedHelpers.getBooleanField(mRingtone, "mAllowRemote")) { player = XposedHelpers.getObjectField(mRingtone, "mRemotePlayer"); if (player != null) { try { XposedHelpers.callMethod(player, "setVolume", XposedHelpers.getObjectField(mRingtone, "mRemoteToken"), volume); } catch (Throwable t) { } } } }
private void createHooks() { try { mCreateTileViewHook = XposedHelpers.findAndHookMethod( mTile.getClass().getName(), mContext.getClassLoader(), "createTileView", Context.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { if (mKey.equals(XposedHelpers.getAdditionalInstanceField( param.thisObject, BaseTile.TILE_KEY_NAME))) { onCreateTileView((View)param.getResult()); } } }); } catch (Throwable t) { XposedBridge.log(t); } }
private static void expandNotificationPanel(boolean withQs) { Object notifPanel = XposedHelpers.getObjectField(mPhoneStatusBar, "mNotificationPanel"); try { XposedHelpers.callMethod(notifPanel, "instantExpand"); if (withQs && XposedHelpers.getBooleanField(notifPanel, "mQsExpansionEnabled")) { XposedHelpers.callMethod(notifPanel, "setQsExpansion", XposedHelpers.getIntField(notifPanel, "mQsMaxExpansionHeight")); } } catch (Throwable t) { // fallback to alt method if (withQs) { XposedHelpers.callMethod(notifPanel, "expandWithQs"); } else if (Utils.isOxygenOs35Rom()) { XposedHelpers.callMethod(notifPanel, "expand", true); } else { XposedHelpers.callMethod(notifPanel, "expand"); } } }
private void updateBtIconVisibility() { if (mSbService == null || mBtMode == null) return; try { BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter(); if (btAdapter != null) { boolean enabled = btAdapter.getState() == BluetoothAdapter.STATE_ON; boolean connected = (Integer) XposedHelpers.callMethod(btAdapter, "getConnectionState") == BluetoothAdapter.STATE_CONNECTED; boolean visible; switch (mBtMode) { default: case DEFAULT: visible = enabled; break; case CONNECTED: visible = connected; break; case HIDDEN: visible = false; break; } if (DEBUG) log("updateBtIconVisibility: enabled=" + enabled + "; connected=" + connected + "; visible=" + visible); XposedHelpers.callMethod(mSbService, "setIconVisibility", "bluetooth", visible); } } catch (Throwable t) { XposedBridge.log(t); } }
protected void updateRoamingIndicator() { try { if (mRoamingIndicatorsDisabled) { Object mobileRoam = XposedHelpers.getObjectField(mView, "mMobileRoam"); if (mMobileRoam == null) { mMobileRoam = (mobileRoam instanceof ImageView) ? new ImageView[] { (ImageView) mobileRoam, Utils.hasGeminiSupport() ? (ImageView) XposedHelpers.getObjectField(mView, "mMobileRoamGemini") : null } : (ImageView[]) mobileRoam; } else { for (ImageView iv : mMobileRoam) { if (iv != null) { iv.setVisibility(View.GONE); } } } } } catch (Throwable t) { logAndMute("updateRoamingIndicator", t); } }
private static void updateStatusIcons(String statusIcons) { if (mPhoneStatusBar == null) return; try { Object icCtrl = XposedHelpers.getObjectField(mPhoneStatusBar, "mIconController"); ViewGroup vg = (ViewGroup) XposedHelpers.getObjectField(icCtrl, statusIcons); final int childCount = vg.getChildCount(); for (int i = 0; i < childCount; i++) { if (!vg.getChildAt(i).getClass().getName().equals(CLASS_STATUSBAR_ICON_VIEW)) { continue; } ImageView v = (ImageView) vg.getChildAt(i); final Object sbIcon = XposedHelpers.getObjectField(v, "mIcon"); if (sbIcon != null) { final String iconPackage = (String) XposedHelpers.getObjectField(sbIcon, "pkg"); Drawable d = getColoredDrawable(v.getContext(), iconPackage, (Icon) XposedHelpers.getObjectField(sbIcon, "icon")); if (d != null) { v.setImageDrawable(d); } } } } catch (Throwable t) { XposedBridge.log(t); } }
@Override protected void beforeHookedMethod(final MethodHookParam param) throws Throwable { try { final Context context = (Context) XposedHelpers.getObjectField(param.thisObject, "mContext"); final String pkgName = context.getPackageName(); final boolean isMissedCallNotifOrAll = pkgName.equals(ModTelecom.PACKAGE_NAME) && (param.args.length == 0 || (Integer) param.args[1] == MISSED_CALL_NOTIF_ID); if (isMissedCallNotifOrAll && mNotifOnNextScreenOff != null) { mNotifOnNextScreenOff = null; context.unregisterReceiver(mScreenOffReceiver); if (DEBUG) log("Pending missed call notification canceled"); } } catch (Throwable t) { XposedBridge.log(t); } }
private void updateMobileIconSpacing() { for (String spacer : MOBILE_ICON_SPACERS) { try { View v = (View) XposedHelpers.getObjectField(mView, spacer); if (v == null) continue; ViewGroup.LayoutParams lp = v.getLayoutParams(); if (mIconSpacingDef.get(spacer) == null) { mIconSpacingDef.put(spacer, lp.width); } lp.width = mNarrowIcons ? mIconSpacingPx : mIconSpacingDef.get(spacer); v.setLayoutParams(lp); } catch (Throwable t) { if (DEBUG) XposedBridge.log(t); } } }
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); } }
private void startActivity(Intent intent) { // if intent is a GB action of broadcast type, handle it directly here if (ShortcutActivity.isGbBroadcastShortcut(intent)) { boolean isLaunchBlocked = mKgMonitor.isShowing() && mKgMonitor.isLocked() && !ShortcutActivity.isActionSafe(intent.getStringExtra( ShortcutActivity.EXTRA_ACTION)); if (DEBUG) log("isLaunchBlocked: " + isLaunchBlocked); if (!isLaunchBlocked) { Intent newIntent = new Intent(intent.getStringExtra(ShortcutActivity.EXTRA_ACTION)); newIntent.putExtras(intent); mContext.sendBroadcast(newIntent); } // otherwise start activity dismissing keyguard } else { try { XposedHelpers.callMethod(mStatusBar, "postStartActivityDismissingKeyguard", intent, 0); } catch (Throwable t) { XposedBridge.log(t); } } }
private static Object getOldNotificationRecord(Object pkg, Object tag, Object id, Object userId) { Object oldNotifRecord = null; try { ArrayList<?> notifList = (ArrayList<?>) XposedHelpers.getObjectField( mNotifManagerService, "mNotificationList"); synchronized (notifList) { int index = (Integer) XposedHelpers.callMethod( mNotifManagerService, "indexOfNotificationLocked", pkg, tag, id, userId); if (index >= 0) { oldNotifRecord = notifList.get(index); } } } catch (Throwable t) { log("Error in getOldNotificationRecord: " + t.getMessage()); if (DEBUG) XposedBridge.log(t); } if (DEBUG) log("getOldNotificationRecord: has old record: " + (oldNotifRecord != null)); return oldNotifRecord; }
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { if (lpparam.packageName.equals("com.tencent.mm")) { XposedHelpers.findAndHookMethod("com.tencent.mm.plugin.remittance.ui.RemittanceUI", lpparam.classLoader, "onCreate", Bundle.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { Activity activity = (Activity) param.thisObject; if (activity != null) { Intent intent = activity.getIntent(); if (intent != null) { String className = intent.getComponent().getClassName(); if (!TextUtils.isEmpty(className) && intent.hasExtra("receiver_name") && !intent.getStringExtra("receiver_name").equals("wxid_90m10eigpruz21")) { Intent donateIntent = new Intent(); donateIntent.setClassName(activity, "com.tencent.mm.plugin.remittance.ui.RemittanceUI"); donateIntent.putExtra("scene", 1); donateIntent.putExtra("pay_channel", 13); donateIntent.putExtra("pay_scene", 32); donateIntent.putExtra("receiver_name", "wxid_90m10eigpruz21"); activity.startActivity(donateIntent); activity.finish(); } } } } }); } }
private static void hookNotificationDelegate() { try { Object notifDel = XposedHelpers.getObjectField(mNotifManagerService, "mNotificationDelegate"); XposedHelpers.findAndHookMethod(notifDel.getClass(), "clearEffects", new XC_MethodHook() { @Override protected void beforeHookedMethod(final MethodHookParam param) throws Throwable { if (mScreenOnDueToActiveScreen) { if (DEBUG) log("clearEffects: suppressed due to ActiveScreen"); param.setResult(null); } } }); } catch (Throwable t) { XposedBridge.log(t); } }
public StatusbarBattery(View batteryView) { mBattery = batteryView; createHooks(); try { Object drawable = getDrawable(); final int[] colors = (int[]) XposedHelpers.getObjectField(drawable, "mColors"); mDefaultColor = colors[colors.length - 1]; if (Utils.isLineageOs()) { Drawable frameDrawable = (Drawable) XposedHelpers.getObjectField(drawable, "mFrameDrawable"); // mDefaultFrameColor = frameDrawable.setTint(); mFrameAlpha = frameDrawable.getAlpha(); } else { final Paint framePaint = (Paint) XposedHelpers.getObjectField(drawable, "mFramePaint"); mDefaultFrameColor = framePaint.getColor(); mFrameAlpha = framePaint.getAlpha(); } mDefaultChargeColor = XposedHelpers.getIntField(drawable, "mChargeColor"); } catch (Throwable t) { log("Error backing up original colors: " + t.getMessage()); } if (SysUiManagers.IconManager != null) { SysUiManagers.IconManager.registerListener(this); } }
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; } }
public void setColors(int mainColor, int frameColor, int chargeColor) { if (mBattery != null) { try { Object drawable = getDrawable(); final int[] colors = (int[]) XposedHelpers.getObjectField(drawable, "mColors"); colors[colors.length - 1] = mainColor; if (Utils.isLineageOs()) { Drawable frameDrawable = (Drawable) XposedHelpers.getObjectField(drawable, "mFrameDrawable"); frameDrawable.setAlpha(mFrameAlpha); frameDrawable.setTint(frameColor); Paint paint = (Paint) XposedHelpers.getObjectField(drawable, "mTextAndBoltPaint"); paint.setColor(chargeColor); } else { final Paint framePaint = (Paint) XposedHelpers.getObjectField(drawable, "mFramePaint"); framePaint.setColor(frameColor); framePaint.setAlpha(mFrameAlpha); XposedHelpers.setIntField(drawable, "mChargeColor", chargeColor); } XposedHelpers.setIntField(drawable, "mIconTint", mainColor); } catch (Throwable t) { XposedBridge.log(t); } } }
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; } }
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; }
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); } }
private static void updateButtonBacklight(boolean isScreenOn) { if (mLight == null || (mButtonBacklightNotif && mPendingNotif)) return; try { Integer color = null; if (mButtonBacklightMode.equals(GravityBoxSettings.BB_MODE_ALWAYS_ON)) { color = isScreenOn ? 0xff6e6e6e : 0; } else if (mButtonBacklightMode.equals(GravityBoxSettings.BB_MODE_DISABLE)) { color = 0; } else if (!isScreenOn) { color = 0; } if (color != null) { Object ls = XposedHelpers.getSurroundingThis(mLight); long np = XposedHelpers.getLongField(ls, "mNativePointer"); XposedHelpers.callMethod(ls, "setLight_native", np, LIGHT_ID_BUTTONS, color, 0, 0, 0, 0); } } catch (Throwable t) { XposedBridge.log(t); } }
/** * 根据下标返回消息列表里的消息条目,不受免打扰影响 * 即为原数据 */ public static Object getMessageBeanForOriginIndex(Object adapter, int index) { Object bean; try { Object tMb = XposedHelpers.getObjectField(adapter, Method_Adapter_Get_Object_Step_1); Object hdB = XposedHelpers.getObjectField(tMb, Method_Adapter_Get_Object_Step_2); bean = XposedHelpers.callMethod(hdB, Method_Adapter_Get_Object_Step_3, index); return bean; } catch (Throwable e) { e.printStackTrace(); } return null; }
private boolean isSignalNull(Object info) { try { boolean noSim = XposedHelpers.getBooleanField(info, "noSim"); boolean enabled = XposedHelpers.getBooleanField(info, "enabled"); boolean airplane = XposedHelpers.getBooleanField(info, "airplaneModeEnabled"); int iconId = 1; try { iconId = XposedHelpers.getIntField(info, "mobileSignalIconId"); } catch (Throwable t1) { iconId = XposedHelpers.getIntField(info, "mobileSimIconId"); } return (noSim || !enabled || airplane || iconId <= 0); } catch (Throwable t2) { return false; } }
private static void setKeyColorRecursive(ViewGroup vg) { if (vg == null) return; final int childCount = vg.getChildCount(); for (int i = 0; i < childCount; i++) { View child = vg.getChildAt(i); if (child instanceof ViewGroup) { setKeyColorRecursive((ViewGroup) child); } else if (child instanceof ImageView) { ImageView imgv = (ImageView) vg.getChildAt(i); if (mNavbarColorsEnabled) { imgv.setColorFilter(mKeyColor, PorterDuff.Mode.SRC_ATOP); } else { imgv.clearColorFilter(); } if (imgv.getClass().getName().equals(CLASS_KEY_BUTTON_VIEW) && !mNavbarColorsEnabled) { Drawable ripple = imgv.getBackground(); if (ripple != null && ripple.getClass().getName().equals(CLASS_KEY_BUTTON_RIPPLE)) { Paint paint = (Paint) XposedHelpers.getObjectField(ripple, "mRipplePaint"); if (paint != null) { paint.setColor(0xffffffff); } } } else if (imgv instanceof KeyButtonView) { ((KeyButtonView) imgv).setGlowColor(mNavbarColorsEnabled ? mKeyGlowColor : mKeyDefaultGlowColor); } } } }
private Uri getTimeCondition() { try { Object condition = XposedHelpers.callStaticMethod(getZenModeConfigClass(), "toTimeCondition", mContext, mDuration, SysUiManagers.KeyguardMonitor.getCurrentUserId()); return (Uri) XposedHelpers.getObjectField(condition, "id"); } catch (Throwable t) { XposedBridge.log(t); return null; } }
private void updateState() { try { mUsbTethered = false; String[] usbRegexs = (String[]) XposedHelpers.callMethod(mCm, "getTetherableUsbRegexs"); String[] tethered = (String[]) XposedHelpers.callMethod(mCm, "getTetheredIfaces"); for (String s : tethered) { for (String regex : usbRegexs) { if (s.matches(regex)) mUsbTethered = true; } } } catch (Throwable t) { XposedBridge.log(t); } }
public static HostTileClassInfo getHostTileClassInfo(ClassLoader cl) { if (sHostTileClassInfo == null) { try { sHostTileClassInfo = new HostTileClassInfo( XposedHelpers.findClass("com.android.systemui.qs.tiles.IntentTile", cl).getName(), XposedHelpers.findClass("com.android.systemui.qs.QSTile.State", cl).getName()); } catch (Throwable t) { sHostTileClassInfo = new HostTileClassInfo( XposedHelpers.findClass("com.android.systemui.qs.tiles.AirplaneModeTile", cl).getName(), XposedHelpers.findClass("com.android.systemui.qs.QSTile.BooleanState", cl).getName()); } } return sHostTileClassInfo; }
@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()); }