forked from yujincheng08/BiliRoaming
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: force system media controls (yujincheng08#1292)
fixes yujincheng08#1285
- Loading branch information
Showing
5 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/src/main/java/me/iacn/biliroaming/hook/MusicNotificationHook.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters