diff --git a/app/src/main/java/me/iacn/biliroaming/SettingDialog.kt b/app/src/main/java/me/iacn/biliroaming/SettingDialog.kt
index b0c164c956..f049470df9 100644
--- a/app/src/main/java/me/iacn/biliroaming/SettingDialog.kt
+++ b/app/src/main/java/me/iacn/biliroaming/SettingDialog.kt
@@ -242,6 +242,9 @@ class SettingDialog(context: Context) : AlertDialog.Builder(context) {
private fun checkCompatibleVersion() {
val versionCode = getVersionCode(packageName)
+ var supportMusicNotificationHook = versionCode >= 7500300 &&
+ // from bilibili
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && !Build.MANUFACTURER.lowercase().equals("huawei")
var supportCustomizeTab = true
val supportFullSplash = try {
instance.splashInfoClass?.getMethod("getMode") != null
@@ -275,6 +278,15 @@ class SettingDialog(context: Context) : AlertDialog.Builder(context) {
if (!supportFullSplash) {
disablePreference("full_splash")
}
+ if (!supportMusicNotificationHook) {
+ if (versionCode >= 7500300) {
+ disablePreference(
+ "music_notification",
+ context.getString(R.string.os_not_support))
+ } else {
+ disablePreference("music_notification")
+ }
+ }
if (!supportMain) {
disablePreference("main_func", "Android O以下系统不支持64位Xpatch版,请使用32位版")
}
diff --git a/app/src/main/java/me/iacn/biliroaming/XposedInit.kt b/app/src/main/java/me/iacn/biliroaming/XposedInit.kt
index 54ede5f28f..9e2739253f 100644
--- a/app/src/main/java/me/iacn/biliroaming/XposedInit.kt
+++ b/app/src/main/java/me/iacn/biliroaming/XposedInit.kt
@@ -100,6 +100,7 @@ class XposedInit : IXposedHookLoadPackage, IXposedHookZygoteInit {
startHook(SplashHook(lpparam.classLoader))
startHook(EnvHook(lpparam.classLoader))
startHook(DownloadThreadHook(lpparam.classLoader))
+ startHook(MusicNotificationHook(lpparam.classLoader))
startHook(DrawerHook(lpparam.classLoader))
startHook(CoverHook(lpparam.classLoader))
startHook(SubtitleHook(lpparam.classLoader))
diff --git a/app/src/main/java/me/iacn/biliroaming/hook/MusicNotificationHook.kt b/app/src/main/java/me/iacn/biliroaming/hook/MusicNotificationHook.kt
new file mode 100644
index 0000000000..ffb97114c6
--- /dev/null
+++ b/app/src/main/java/me/iacn/biliroaming/hook/MusicNotificationHook.kt
@@ -0,0 +1,28 @@
+package me.iacn.biliroaming.hook
+
+import me.iacn.biliroaming.utils.Log
+import me.iacn.biliroaming.utils.findClassOrNull
+import me.iacn.biliroaming.utils.hookBeforeMethod
+import me.iacn.biliroaming.utils.sPrefs
+
+class MusicNotificationHook(classLoader: ClassLoader) : BaseHook(classLoader) {
+ override fun startHook() {
+ if (!sPrefs.getBoolean("music_notification", false)) return
+
+ Log.d("startHook: MusicNotification")
+
+ "com.bilibili.lib.blconfig.ConfigManager\$Companion".findClassOrNull(mClassLoader)?.run {
+ hookBeforeMethod(
+ "isHitFF",
+ String::class.java
+ ) { param ->
+ (param.args[0] as String).run {
+ if (this == "ff_background_use_system_media_controls") {
+ param.result = true
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1d14586a1b..82c00bf0b8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -71,6 +71,8 @@
提高版权番剧的下载速度,但是会导致音视频分离
净化首页标签
请勿全部选择,会使用之前的的标签
+ 原生音乐通知样式
+ 强制音乐通知栏为原生样式
设置解析服务器
使用设置的服务器解析区域限制番剧的播放地址;如不知如何设置,请查看帮助文档
移动我的页面到侧边栏
diff --git a/app/src/main/res/xml/prefs_setting.xml b/app/src/main/res/xml/prefs_setting.xml
index cfd3d486ed..fab7ee11a3 100644
--- a/app/src/main/res/xml/prefs_setting.xml
+++ b/app/src/main/res/xml/prefs_setting.xml
@@ -79,6 +79,10 @@
android:key="full_splash"
android:summary="@string/full_splash_summary"
android:title="@string/full_splash_title" />
+