diff --git a/README.md b/README.md index 18af2c6..0115636 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ - 允许所有应用使用强制深色模式 - 使用原生打开方式界面 - 使用原生截屏 +- 禁用高媒体音量安全警告 #### 系统界面 diff --git a/app/src/main/java/com/yifeplayte/wommo/activity/pages/MainPage.kt b/app/src/main/java/com/yifeplayte/wommo/activity/pages/MainPage.kt index 6e8fd8a..1c3fe61 100644 --- a/app/src/main/java/com/yifeplayte/wommo/activity/pages/MainPage.kt +++ b/app/src/main/java/com/yifeplayte/wommo/activity/pages/MainPage.kt @@ -36,6 +36,11 @@ class MainPage : BasePage() { textId = R.string.use_aosp_screenshot, ), SwitchV("use_aosp_screenshot", false) ) + TextSummaryWithSwitch( + TextSummaryV( + textId = R.string.disable_safe_media_volume, + ), SwitchV("disable_safe_media_volume", false) + ) Line() TitleText(textId = R.string.system_ui) if (!IS_INTERNATIONAL_BUILD) TextSummaryWithSwitch( diff --git a/app/src/main/java/com/yifeplayte/wommo/hook/hooks/singlepackage/android/DisableSafeMediaVolume.kt b/app/src/main/java/com/yifeplayte/wommo/hook/hooks/singlepackage/android/DisableSafeMediaVolume.kt new file mode 100644 index 0000000..58fc084 --- /dev/null +++ b/app/src/main/java/com/yifeplayte/wommo/hook/hooks/singlepackage/android/DisableSafeMediaVolume.kt @@ -0,0 +1,21 @@ +package com.yifeplayte.wommo.hook.hooks.singlepackage.android + +import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass +import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook +import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder +import com.yifeplayte.wommo.hook.hooks.BaseHook + +@Suppress("unused") +object DisableSafeMediaVolume : BaseHook() { + override val key = "disable_safe_media_volume" + override fun hook() { + loadClass("com.android.server.audio.SoundDoseHelperStubImpl").methodFinder() + .filterByName("updateSafeMediaVolumeIndex").filterNonAbstract().single().createHook { + returnConstant(0x7ffffffe) + } + loadClass("com.android.server.audio.SoundDoseHelper").methodFinder() + .filterByName("safeMediaVolumeIndex").filterNonAbstract().single().createHook { + returnConstant(0x7ffffffe) + } + } +} \ No newline at end of file diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index f712db1..771c932 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -17,6 +17,7 @@ 修改传送门使用的浏览器 修改小爱同学使用的浏览器 传送门 + 禁用高媒体音量安全警告 确定 下载管理程序 启用电池监控服务 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7d3b238..5808019 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -19,6 +19,7 @@ Change browser for Taplus Change browser for Mi Ai Taplus + Disable safe media volume warnings OK Downloads Enable battery monitor service