Skip to content

Commit

Permalink
fix: android hidden api
Browse files Browse the repository at this point in the history
  • Loading branch information
rhunk committed Aug 19, 2024
1 parent 1d4cd7c commit 04c60ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ android {

dependencies {
compileOnly(files("libs/LSPosed-api-1.0-SNAPSHOT.jar"))
implementation("org.lsposed.hiddenapibypass:hiddenapibypass:4.3")
implementation(libs.coroutines)
implementation(libs.recyclerview)
implementation(libs.gson)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import me.rhunk.snapenhance.core.util.LSPatchUpdater
import me.rhunk.snapenhance.core.util.hook.HookAdapter
import me.rhunk.snapenhance.core.util.hook.HookStage
import me.rhunk.snapenhance.core.util.hook.hook
import org.lsposed.hiddenapibypass.HiddenApiBypass
import java.lang.reflect.Method
import kotlin.reflect.KClass
import kotlin.system.exitProcess
import kotlin.system.measureTimeMillis
Expand Down Expand Up @@ -240,7 +242,9 @@ class SnapEnhance {
appContext.log.warn("sif is disabled")
}

Runtime::class.java.declaredMethods.first {
HiddenApiBypass.getDeclaredMethods(Runtime::class.java).filterIsInstance<Method>().onEach {
appContext.log.verbose("found method $it")
}.first {
it.name == "loadLibrary0" && it.parameterTypes.contentEquals(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) arrayOf(Class::class.java, String::class.java)
else arrayOf(ClassLoader::class.java, String::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import me.rhunk.snapenhance.core.util.media.PreviewUtils
import me.rhunk.snapenhance.core.wrapper.impl.Message
import me.rhunk.snapenhance.core.wrapper.impl.SnapUUID
import okhttp3.RequestBody.Companion.toRequestBody
import org.lsposed.hiddenapibypass.HiddenApiBypass
import java.lang.reflect.Method
import kotlin.coroutines.suspendCoroutine

class Notifications : Feature("Notifications") {
Expand Down Expand Up @@ -509,7 +511,7 @@ class Notifications : Feature("Notifications") {
}
}

NotificationManager::class.java.declaredMethods.find {
HiddenApiBypass.getDeclaredMethods(NotificationManager::class.java).filterIsInstance<Method>().find {
it.name == "cancelAsUser"
}?.hook(HookStage.AFTER) { param ->
val notificationId = param.arg<Int>(1)
Expand Down

0 comments on commit 04c60ee

Please sign in to comment.