commit c8819cf2c2fd2776d17069e53f47e4f6662601d5 parent 7f0f202439b027abf9dd5cad73d849508a71b4ef Author: rhunk <101876869+rhunk@users.noreply.github.com> Date: Sat, 8 Jun 2024 15:41:14 +0200 feat: disable telecom framework Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com> Diffstat:
4 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json @@ -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" diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/Global.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/Global.kt @@ -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) } } \ No newline at end of file diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt @@ -129,6 +129,7 @@ class FeatureManager( DisableCustomTabs(), BestFriendPinning(), ContextMenuFix(), + DisableTelecomFramework(), ) initializeFeatures() } diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/global/DisableTelecomFramework.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/global/DisableTelecomFramework.kt @@ -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) + } + } +}+ \ No newline at end of file