Skip to content

Commit

Permalink
feat: disable audio focus request
Browse files Browse the repository at this point in the history
  • Loading branch information
rhunk committed Jun 2, 2024
1 parent 6d3e5ed commit 5f509d8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class FeatureManager(
ComposerHooks(),
DisableCustomTabs(),
BestFriendPinning(),
DisableAudioFocusRequest(),
)
initializeFeatures()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package me.rhunk.snapenhance.core.features.impl.global

import android.media.AudioManager
import me.rhunk.snapenhance.core.features.Feature
import me.rhunk.snapenhance.core.features.FeatureLoadParams
import me.rhunk.snapenhance.core.util.hook.HookStage
import me.rhunk.snapenhance.core.util.hook.hook

class DisableAudioFocusRequest: Feature("Disable Audio Focus Request", loadParams = FeatureLoadParams.INIT_SYNC) {
override fun init() {
AudioManager::class.java.hook("requestAudioFocus", HookStage.BEFORE) { param ->
param.setResult(AudioManager.AUDIOFOCUS_REQUEST_GRANTED)
}
}
}

0 comments on commit 5f509d8

Please sign in to comment.