From 37daae3799c45cd6ce0cd8f715e63ad3771c67ab Mon Sep 17 00:00:00 2001 From: rhunk <101876869+rhunk@users.noreply.github.com> Date: Sun, 10 Dec 2023 12:13:34 +0100 Subject: [PATCH] feat(core/bypass_screenshot_detection): Android 14 support --- .../core/features/impl/tweaks/BypassScreenshotDetection.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/BypassScreenshotDetection.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/BypassScreenshotDetection.kt index f0d98d2e..7acc7489 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/BypassScreenshotDetection.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/BypassScreenshotDetection.kt @@ -1,5 +1,6 @@ package me.rhunk.snapenhance.core.features.impl.tweaks +import android.app.Activity import android.content.ContentResolver import android.database.ContentObserver import android.net.Uri @@ -11,6 +12,9 @@ import me.rhunk.snapenhance.core.util.hook.hook class BypassScreenshotDetection : Feature("BypassScreenshotDetection", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) { override fun onActivityCreate() { if (!context.config.messaging.bypassScreenshotDetection.get()) return + Activity::class.java.hook("registerScreenCaptureCallback", HookStage.BEFORE) { param -> + param.setResult(null) + } ContentResolver::class.java.methods.first { it.name == "registerContentObserver" && it.parameterTypes.contentEquals(arrayOf(android.net.Uri::class.java, Boolean::class.javaPrimitiveType, ContentObserver::class.java))