Skip to content

Commit

Permalink
Disable safe media volume warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
YifePlayte committed Aug 23, 2024
1 parent cf4fcec commit 4c57112
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- 允许所有应用使用强制深色模式
- 使用原生打开方式界面
- 使用原生截屏
- 禁用高媒体音量安全警告

#### 系统界面

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<string name="change_browser_for_content_extension">修改传送门使用的浏览器</string>
<string name="change_browser_for_mi_ai">修改小爱同学使用的浏览器</string>
<string name="content_extension">传送门</string>
<string name="disable_safe_media_volume">禁用高媒体音量安全警告</string>
<string name="done">确定</string>
<string name="download_provider">下载管理程序</string>
<string name="enable_battery_monitor_service">启用电池监控服务</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<string name="change_browser_for_content_extension">Change browser for Taplus</string>
<string name="change_browser_for_mi_ai">Change browser for Mi Ai</string>
<string name="content_extension">Taplus</string>
<string name="disable_safe_media_volume">Disable safe media volume warnings</string>
<string name="done">OK</string>
<string name="download_provider">Downloads</string>
<string name="enable_battery_monitor_service">Enable battery monitor service</string>
Expand Down

0 comments on commit 4c57112

Please sign in to comment.