Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
package com.lt2333.simplicitytools.hooks.rules.t.systemui

import android.telephony.SubscriptionManager
import com.github.kyuubiran.ezxhelper.utils.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.github.kyuubiran.ezxhelper.utils.putObject
import com.lt2333.simplicitytools.utils.getObjectField
import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister

object HideSimIconForT : HookRegister() {

override fun init() {
findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy") {
name == "hasCorrectSubs" && parameterTypes[0] == MutableList::class.java
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "applyMobileState"
}.hookBefore {
val list = it.args[0] as MutableList<*>
val size = list.size
hasEnable("hide_sim_two_icon", extraCondition = { size == 2 }) {
list.removeAt(1)
val mobileIconState = it.args[0]
val subId = mobileIconState.getObjectField("subId") as Int
val slotId = SubscriptionManager.getSlotIndex(subId)
hasEnable("hide_sim_one_icon", extraCondition = { slotId == 0 }) {
mobileIconState.putObject("visible", false)
}
hasEnable("hide_sim_one_icon", extraCondition = { size >= 1 }) {
list.removeAt(0)
hasEnable("hide_sim_two_icon", extraCondition = { slotId == 1 }) {
mobileIconState.putObject("visible", false)
}
}
}
Expand Down