diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockCustomPhotoFrames.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockCustomPhotoFrames.kt index a03069ea14..45aa314622 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockCustomPhotoFrames.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/mediaeditor/UnlockCustomPhotoFrames.kt @@ -137,7 +137,7 @@ object UnlockCustomPhotoFrames : BaseHook() { other(method) } - if (isOpenSpring) { + if (isOpenSpring && orderedPublicC.isNotEmpty()) { orderedPublicC.forEach { method -> logI(TAG, "Public Spring name is $method") // debug 用 other(method) // 1.6.0.5.2 新增限时新春定制画框 diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/RemoveOpenAppConfirmationPopup.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/RemoveOpenAppConfirmationPopup.kt index ffc8444278..3437aaac54 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/RemoveOpenAppConfirmationPopup.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/RemoveOpenAppConfirmationPopup.kt @@ -32,7 +32,7 @@ class RemoveOpenAppConfirmationPopup : BaseHook() { .filterByName("setText") .filterByParamTypes { it[0] == CharSequence::class.java - }.single().createHook { + }.first().createHook { after { val textView = it.thisObject as TextView if (it.args.isNotEmpty() && it.args[0]?.toString().equals( diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPrivacy.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPrivacy.kt index 123d6a31d8..8c9ec9cbae 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPrivacy.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/securitycenter/beauty/BeautyPrivacy.kt @@ -28,7 +28,7 @@ object BeautyPrivacy : BaseHook() { private val R0 by lazy { dexKitBridge.findMethod { matcher { - addUsingString("persist.sys.privacy_camera") + addUsingStringsEquals("persist.sys.privacy_camera") } }.single().getMethodInstance(EzXHelper.safeClassLoader) } diff --git a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/lockscreen/ChargingCVP.kt b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/lockscreen/ChargingCVP.kt index e31c2dc6a7..ff343767d3 100644 --- a/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/lockscreen/ChargingCVP.kt +++ b/app/src/main/java/com/sevtinge/hyperceiler/module/hook/systemui/lockscreen/ChargingCVP.kt @@ -44,6 +44,7 @@ import com.sevtinge.hyperceiler.module.base.BaseHook import com.sevtinge.hyperceiler.utils.api.IS_HYPER_OS import com.sevtinge.hyperceiler.utils.devicesdk.getAndroidVersion import com.sevtinge.hyperceiler.utils.devicesdk.isAndroidVersion +import de.robv.android.xposed.XC_MethodHook import de.robv.android.xposed.XposedHelpers import java.io.BufferedReader import java.io.FileReader @@ -55,6 +56,12 @@ object ChargingCVP : BaseHook() { private val showSpacingValue by lazy { mPrefsMap.getBoolean("system_ui_lock_screen_show_spacing_value") } + private val isShowTemp by lazy { + mPrefsMap.getBoolean("system_ui_show_battery_temperature") + } + private val isShowMoreC by lazy { + mPrefsMap.getBoolean("system_ui_show_charging_c_more") + } @SuppressLint("SetTextI18n") override fun init() { @@ -63,133 +70,26 @@ object ChargingCVP : BaseHook() { val clazzDependency = loadClass("com.android.systemui.Dependency") val clazzKeyguardIndicationController = loadClass("com.android.systemui.statusbar.KeyguardIndicationController") + loadClassOrNull("com.android.systemui.statusbar.phone.KeyguardIndicationTextView")?.constructors?.createHooks { after { param -> - (param.thisObject as TextView).isSingleLine = false + (param.thisObject as TextView).let { + it.isSingleLine = false + it.textSize = 8.2f + } if (showSpacingValue) { - val screenOnOffReceiver = object : BroadcastReceiver() { - val keyguardIndicationController = runCatching { - invokeStaticMethodBestMatch( - clazzDependency, "get", null, clazzKeyguardIndicationController - )!! - }.getOrElse { - val clazzMiuiStub = loadClass("miui.stub.MiuiStub") - val instanceMiuiStub = - getStaticObjectOrNull(clazzMiuiStub, "INSTANCE")!! - val mSysUIProvider = - getObjectOrNull(instanceMiuiStub, "mSysUIProvider")!! - val mKeyguardIndicationController = - getObjectOrNull( - mSysUIProvider, - "mKeyguardIndicationController" - )!! - invokeMethodBestMatch(mKeyguardIndicationController, "get")!! - } - val handler = Handler((param.thisObject as TextView).context.mainLooper) - val runnable = object : Runnable { - val clazzMiuiDependency = - loadClass("com.miui.systemui.MiuiDependency") - val clazzMiuiChargeController = - loadClass("com.miui.charge.MiuiChargeController") - val sDependency = - getStaticObjectOrNull(clazzMiuiDependency, "sDependency")!! - val mProviders = - getObjectOrNull(sDependency, "mProviders") as ArrayMap<*, *> - val mMiuiChargeControllerProvider = - mProviders[clazzMiuiChargeController]!! - val instanceMiuiChargeController = invokeMethodBestMatch( - mMiuiChargeControllerProvider, "createDependency" - )!! - - override fun run() { - if (IS_HYPER_OS) { - doUpdateForHyperOS() - } else if (!IS_HYPER_OS && isAndroidVersion(34)) { - XposedHelpers.callStaticMethod( - loadClass("com.android.systemui.statusbar.KeyguardIndicationController"), - "updatePowerIndication" - ) - } else { - invokeMethodBestMatch( - keyguardIndicationController, - "updatePowerIndication" - ) - } - handler.postDelayed( - this, - mPrefsMap.getInt( - "system_ui_statusbar_lock_screen_show_spacing", - 6 - ) / 2 * 1000L - ) - } - - fun doUpdateForHyperOS() { - val mBatteryStatus = getObjectOrNull( - instanceMiuiChargeController, "mBatteryStatus" - )!! - val level = getObjectOrNull(mBatteryStatus, "level") - val isPluggedIn = - invokeMethodBestMatch(mBatteryStatus, "isPluggedIn") - val mContext = - getObjectOrNull(instanceMiuiChargeController, "mContext") - val clazzChargeUtils = loadClass("com.miui.charge.ChargeUtils", lpparam.classLoader) - val chargingHintText = - invokeStaticMethodBestMatch( - clazzChargeUtils, - "getChargingHintText", - null, - level, - isPluggedIn, - mContext - ) - setObject( - keyguardIndicationController, - "mComputePowerIndication", - chargingHintText - ) - invokeMethodBestMatch( - keyguardIndicationController, - "updateDeviceEntryIndication", - null, - false - ) - } - } - - init { - if (((param.thisObject as TextView).context.getSystemService(Context.POWER_SERVICE) as PowerManager).isInteractive) { - handler.post(runnable) - } - } - - override fun onReceive(context: Context, intent: Intent) { - when (intent.action) { - Intent.ACTION_SCREEN_ON -> { - handler.post(runnable) - } - - Intent.ACTION_SCREEN_OFF -> { - handler.removeCallbacks(runnable) - } - } - } - } - - val filter = IntentFilter().apply { - addAction(Intent.ACTION_SCREEN_ON) - addAction(Intent.ACTION_SCREEN_OFF) - } - (param.thisObject as TextView).context.registerReceiver( - screenOnOffReceiver, filter - ) + // 是否更改刷新频率 + setShowSpacing(clazzDependency, clazzKeyguardIndicationController, param) } } } } else { loadClassOrNull("com.android.systemui.statusbar.phone.KeyguardIndicationTextView")!!.constructors.createHooks { - after { - (it.thisObject as TextView).isSingleLine = false + after { param -> + (param.thisObject as TextView).let { + it.isSingleLine = false + it.textSize = 8.2f + } } } } @@ -200,10 +100,153 @@ object ChargingCVP : BaseHook() { ).methodFinder().filterByName("getChargingHintText").filterByParamCount(3).first() .createHook { after { param -> - param.result = param.result?.let { "$it${getCVP()}" } + param.result = param.result?.let { + "${getTemp()}$it\n${getCVP()}" + } + } + } + + } + + private fun setShowSpacing( + clazzDependency: Class<*>, + clazzKeyguardIndicationController: Class<*>, + param: XC_MethodHook.MethodHookParam + ) { + val screenOnOffReceiver = object : BroadcastReceiver() { + val keyguardIndicationController = runCatching { + invokeStaticMethodBestMatch( + clazzDependency, "get", null, clazzKeyguardIndicationController + )!! + }.getOrElse { + val clazzMiuiStub = loadClass("miui.stub.MiuiStub") + val instanceMiuiStub = + getStaticObjectOrNull(clazzMiuiStub, "INSTANCE")!! + val mSysUIProvider = + getObjectOrNull(instanceMiuiStub, "mSysUIProvider")!! + val mKeyguardIndicationController = + getObjectOrNull( + mSysUIProvider, + "mKeyguardIndicationController" + )!! + invokeMethodBestMatch(mKeyguardIndicationController, "get")!! + } + val handler = Handler((param.thisObject as TextView).context.mainLooper) + val runnable = object : Runnable { + val clazzMiuiDependency = + loadClass("com.miui.systemui.MiuiDependency") + val clazzMiuiChargeController = + loadClass("com.miui.charge.MiuiChargeController") + val sDependency = + getStaticObjectOrNull(clazzMiuiDependency, "sDependency")!! + val mProviders = + getObjectOrNull(sDependency, "mProviders") as ArrayMap<*, *> + val mMiuiChargeControllerProvider = + mProviders[clazzMiuiChargeController]!! + val instanceMiuiChargeController = invokeMethodBestMatch( + mMiuiChargeControllerProvider, "createDependency" + )!! + + override fun run() { + if (IS_HYPER_OS) { + doUpdateForHyperOS() + } else if (!IS_HYPER_OS && isAndroidVersion(34)) { + XposedHelpers.callStaticMethod( + loadClass("com.android.systemui.statusbar.KeyguardIndicationController"), + "updatePowerIndication" + ) + } else { + invokeMethodBestMatch( + keyguardIndicationController, + "updatePowerIndication" + ) + } + handler.postDelayed( + this, + mPrefsMap.getInt( + "system_ui_statusbar_lock_screen_show_spacing", + 6 + ) / 2 * 1000L + ) + } + + fun doUpdateForHyperOS() { + val mBatteryStatus = getObjectOrNull( + instanceMiuiChargeController, "mBatteryStatus" + )!! + val level = getObjectOrNull(mBatteryStatus, "level") + val isPluggedIn = + invokeMethodBestMatch(mBatteryStatus, "isPluggedIn") + val mContext = + getObjectOrNull(instanceMiuiChargeController, "mContext") + val clazzChargeUtils = + loadClass("com.miui.charge.ChargeUtils", lpparam.classLoader) + val chargingHintText = + invokeStaticMethodBestMatch( + clazzChargeUtils, + "getChargingHintText", + null, + level, + isPluggedIn, + mContext + ) + setObject( + keyguardIndicationController, + "mComputePowerIndication", + chargingHintText + ) + invokeMethodBestMatch( + keyguardIndicationController, + "updateDeviceEntryIndication", + null, + false + ) + } + } + + init { + if (((param.thisObject as TextView).context.getSystemService(Context.POWER_SERVICE) as PowerManager).isInteractive) { + handler.post(runnable) + } + } + + override fun onReceive(context: Context, intent: Intent) { + when (intent.action) { + Intent.ACTION_SCREEN_ON -> { + handler.post(runnable) + } + + Intent.ACTION_SCREEN_OFF -> { + handler.removeCallbacks(runnable) + } } } + } + val filter = IntentFilter().apply { + addAction(Intent.ACTION_SCREEN_ON) + addAction(Intent.ACTION_SCREEN_OFF) + } + (param.thisObject as TextView).context.registerReceiver( + screenOnOffReceiver, filter + ) + } + + private fun getTemp(): String { + var temp = 0.0 + + runCatching { + // 获取电池温度信息 + val temNow = + BufferedReader(FileReader("/sys/class/power_supply/battery/temp")) + temp = + BigDecimal(temNow.readLine().toDouble() / 10.0).setScale(1, RoundingMode.HALF_UP).toDouble() + } + + // 电池温度是否展示 + val mTemp = if (isShowTemp) "$temp ℃ · " else "" + + return mTemp } @SuppressLint("DefaultLocale") @@ -215,19 +258,13 @@ object ChargingCVP : BaseHook() { val current = abs(batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW) / 1000) var voltage = 0.0 - var temp = 0.0 - kotlin.runCatching { + runCatching { // 获取电压信息 val voltageNow = BufferedReader(FileReader("/sys/class/power_supply/battery/voltage_now")) voltage = BigDecimal(voltageNow.readLine().toDouble() / 1000.0).setScale(1, RoundingMode.HALF_UP).toDouble() - // 获取电池温度信息 - val temNow = - BufferedReader(FileReader("/sys/class/power_supply/battery/temp")) - temp = - BigDecimal(temNow.readLine().toDouble() / 10.0).setScale(1, RoundingMode.HALF_UP).toDouble() } // 计算功率信息 @@ -235,20 +272,18 @@ object ChargingCVP : BaseHook() { val power = String.format("%.2f", powerAll) // 电流展示逻辑设置 - val mCurrent = if (mPrefsMap.getBoolean("system_ui_show_charging_c_more")) { + val mCurrent = if (isShowMoreC) { "$current mA" } else { "${String.format("%.1f", abs(current / 1000f))} A" } val mVoltage = "${String.format("%.1f", abs(voltage / 1000f))} V" - // 电池温度是否展示 - val mTemp = if (mPrefsMap.getBoolean("system_ui_show_battery_temperature")) " · $temp ℃" else "" // 判断充满信息是否归零 val showBattery = if (current == 0) { - mTemp + "" } else { - "$mTemp\n$mCurrent · $mVoltage · $power W" + "$mCurrent · $mVoltage · $power W" } // 输出展示信息 diff --git a/app/src/main/res/values-in-rID/strings.xml b/app/src/main/res/values-in-rID/strings.xml index 3c95b9fdff..ac82afb926 100644 --- a/app/src/main/res/values-in-rID/strings.xml +++ b/app/src/main/res/values-in-rID/strings.xml @@ -559,7 +559,7 @@ Ikon HD besar Tidak ada ikon kartu SIM Sembunyikan ikon sinyal kartu SIM 1 - Sembunyikan ikon sinyal kartu SIM 1 + Sembunyikan ikon sinyal kartu SIM 2 Logika tampilan Ikon Tipe Jaringan Besar Lokasi diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1e57f24581..109041ea3a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -601,7 +601,7 @@ Big HD icon No SIM card icon Hide SIM card 1 signal icon - Hide SIM card 1 signal icon + Hide SIM card 2 signal icon Display logic Big Network Type Icon Location diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2c269a7b60..b0d88f1803 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "8.2.2" +agp = "8.3.0" kotlinAndroid = "1.9.22" core = "1.12.0"