Skip to content

Commit

Permalink
feat(core/bypass_screenshot_detection): Android 14 support
Browse files Browse the repository at this point in the history
  • Loading branch information
rhunk committed Dec 10, 2023
1 parent 368d702 commit 37daae3
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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))
Expand Down

0 comments on commit 37daae3

Please sign in to comment.