feat: disable telecom framework

Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
rhunk
2024-06-08 15:41:14 +02:00
parent 7f0f202439
commit c8819cf2c2
4 changed files with 23 additions and 0 deletions

View File

@@ -869,6 +869,10 @@
"name": "Default Volume Controls",
"description": "Forces Snapchat to use system volume controls"
},
"disable_telecom_framework": {
"name": "Disable Telecom Framework",
"description": "Prevents Snapchat from using the Android Telecom framework\nThis allows you to listen to music while on a call"
},
"hide_active_music": {
"name": "Hide Active Music",
"description": "Prevents Snapchat from knowing you're listening to music\nThis will allow you to take snaps using control volume buttons while listening to music"

View File

@@ -52,6 +52,7 @@ class Global : ConfigContainer() {
val videoPlaybackRateSlider = boolean("video_playback_rate_slider") { requireRestart() }
val disableGooglePlayDialogs = boolean("disable_google_play_dialogs") { requireRestart() }
val defaultVolumeControls = boolean("default_volume_controls") { requireRestart() }
val disableTelecomFramework = boolean("disable_telecom_framework") { requireRestart() }
val hideActiveMusic = boolean("hide_active_music") { requireRestart() }
val disableSnapSplitting = boolean("disable_snap_splitting") { addNotices(FeatureNotice.INTERNAL_BEHAVIOR) }
}

View File

@@ -129,6 +129,7 @@ class FeatureManager(
DisableCustomTabs(),
BestFriendPinning(),
ContextMenuFix(),
DisableTelecomFramework(),
)
initializeFeatures()
}

View File

@@ -0,0 +1,17 @@
package me.rhunk.snapenhance.core.features.impl.global
import android.content.ContextWrapper
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 DisableTelecomFramework: Feature("Disable Telecom Framework", loadParams = FeatureLoadParams.INIT_SYNC) {
override fun init() {
if (!context.config.global.disableTelecomFramework.get()) return
ContextWrapper::class.java.hook("getSystemService", HookStage.BEFORE) { param ->
if (param.arg<Any>(0).toString() == "telecom") param.setResult(null)
}
}
}