Skip to content

Commit

Permalink
Experimental: Improve hiding data disabled icon for android 14+
Browse files Browse the repository at this point in the history
Signed-off-by: DrDisagree <[email protected]>
  • Loading branch information
Mahmud0808 committed Mar 5, 2025
1 parent cffb8e5 commit 085f980
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ import com.drdisagree.iconify.xposed.modules.extras.utils.toolkit.XposedHook.Com
import com.drdisagree.iconify.xposed.modules.extras.utils.toolkit.callMethod
import com.drdisagree.iconify.xposed.modules.extras.utils.toolkit.getField
import com.drdisagree.iconify.xposed.modules.extras.utils.toolkit.getFieldSilently
import com.drdisagree.iconify.xposed.modules.extras.utils.toolkit.hookConstructor
import com.drdisagree.iconify.xposed.modules.extras.utils.toolkit.hookLayout
import com.drdisagree.iconify.xposed.modules.extras.utils.toolkit.hookMethod
import com.drdisagree.iconify.xposed.modules.extras.utils.toolkit.setField
import com.drdisagree.iconify.xposed.modules.extras.utils.toolkit.setFieldSilently
import com.drdisagree.iconify.xposed.utils.XPrefs.Xprefs
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam

Expand Down Expand Up @@ -62,28 +64,19 @@ class Miscellaneous(context: Context) : ModPack(context) {
getString(FABRICATED_SB_COLOR_SOURCE, "System") == "Custom"
}

if (key.isNotEmpty()) {
key[0].let {
if (it == QSPANEL_HIDE_CARRIER) {
hideQSCarrierGroup()
}
when (key.firstOrNull()) {
QSPANEL_HIDE_CARRIER -> hideQSCarrierGroup()

if (it == HIDE_STATUS_ICONS_SWITCH) {
hideStatusIcons()
}
HIDE_STATUS_ICONS_SWITCH -> hideStatusIcons()

if (it == FIXED_STATUS_ICONS_SWITCH ||
it == HIDE_STATUS_ICONS_SWITCH ||
it == FIXED_STATUS_ICONS_TOPMARGIN ||
it == FIXED_STATUS_ICONS_SIDEMARGIN
) {
fixedStatusIconsA12()
}
in setOf(
FIXED_STATUS_ICONS_SWITCH,
HIDE_STATUS_ICONS_SWITCH,
FIXED_STATUS_ICONS_TOPMARGIN,
FIXED_STATUS_ICONS_SIDEMARGIN
) -> fixedStatusIconsA12()

if (it == HIDE_DATA_DISABLED_ICON && mobileSignalControllerParam != null) {
mobileSignalControllerParam.callMethod("updateTelephony")
}
}
HIDE_DATA_DISABLED_ICON -> mobileSignalControllerParam.callMethod("updateTelephony")
}
}

Expand Down Expand Up @@ -163,12 +156,17 @@ class Miscellaneous(context: Context) : ModPack(context) {
}

private fun hideDataDisabledIcon() {
val mobileSignalController =
val mobileSignalControllerClass =
findClass("$SYSTEMUI_PACKAGE.statusbar.connectivity.MobileSignalController")
val alwaysShowDataRatIcon = booleanArrayOf(false)
val mDataDisabledIcon = booleanArrayOf(false)
val signalIconModelCellularClass = findClass(
"$SYSTEMUI_PACKAGE.statusbar.pipeline.mobile.domain.model.SignalIconModel\$Cellular",
suppressError = true
)

var alwaysShowDataRatIcon = false
var mDataDisabledIcon = false

mobileSignalController
mobileSignalControllerClass
.hookMethod("updateTelephony")
.runBefore { param ->
if (mobileSignalControllerParam == null) {
Expand All @@ -177,17 +175,16 @@ class Miscellaneous(context: Context) : ModPack(context) {

if (!hideDataDisabledIcon) return@runBefore

alwaysShowDataRatIcon[0] = param.thisObject
alwaysShowDataRatIcon = param.thisObject
.getField("mConfig")
.getField("alwaysShowDataRatIcon") as Boolean

param.thisObject.getField("mConfig").setField(
"alwaysShowDataRatIcon",
false
)
param.thisObject
.getField("mConfig")
.setField("alwaysShowDataRatIcon", true)

try {
mDataDisabledIcon[0] = param.thisObject.getField(
mDataDisabledIcon = param.thisObject.getField(
"mDataDisabledIcon"
) as Boolean

Expand All @@ -202,18 +199,19 @@ class Miscellaneous(context: Context) : ModPack(context) {

if (!hideDataDisabledIcon) return@runAfter

param.thisObject.getField("mConfig").setField(
"alwaysShowDataRatIcon",
alwaysShowDataRatIcon[0]
)
param.thisObject
.getField("mConfig")
.setField("alwaysShowDataRatIcon", alwaysShowDataRatIcon)

param.thisObject.setFieldSilently("mDataDisabledIcon", mDataDisabledIcon)
}

try {
param.thisObject.setField(
"mDataDisabledIcon",
mDataDisabledIcon[0]
)
} catch (ignored: Throwable) {
}
signalIconModelCellularClass
.hookConstructor()
.runAfter { param ->
if (!hideDataDisabledIcon) return@runAfter

param.thisObject.setField("showExclamationMark", false)
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@
<string name="unzoom_depth_wallpaper_title">Unzoom Depth Wallpaper</string>
<string name="unzoom_depth_wallpaper_desc">Remove the zoom effect on depth wallpaper</string>
<string name="hide_data_disabled_icon_title">Hide Data Disabled Icon</string>
<string name="hide_data_disabled_icon_desc">Hide data disabled indicator</string>
<string name="hide_data_disabled_icon_desc">Toggle mobile data off and on to see the effect</string>
<string name="colorize_notification_view_title">Colorize Notification View</string>
<string name="colorize_notification_view_desc">Make notification view same color as app icon</string>
<string name="colorize_notification_alternative_color_generation_title">Alternative Color Generation</string>
Expand Down

0 comments on commit 085f980

Please sign in to comment.