2023-09-20 05:33:02 +02:00
|
|
|
package app.revanced.patches.all.misc.debugging
|
2023-04-13 19:36:42 +02:00
|
|
|
|
|
|
|
import app.revanced.patcher.data.ResourceContext
|
2023-09-20 05:33:02 +02:00
|
|
|
import app.revanced.patcher.patch.ResourcePatch
|
|
|
|
import app.revanced.patcher.patch.annotation.Patch
|
2023-04-13 19:36:42 +02:00
|
|
|
import org.w3c.dom.Element
|
|
|
|
|
2023-09-20 05:33:02 +02:00
|
|
|
@Patch(
|
|
|
|
name = "Enable Android debugging",
|
|
|
|
description = "Enables Android debugging capabilities. This can slow down the app.",
|
2024-02-13 03:29:21 +01:00
|
|
|
use = false,
|
2023-09-20 05:33:02 +02:00
|
|
|
)
|
|
|
|
@Suppress("unused")
|
|
|
|
object EnableAndroidDebuggingPatch : ResourcePatch() {
|
2023-08-27 21:40:49 +02:00
|
|
|
override fun execute(context: ResourceContext) {
|
2024-02-22 00:05:41 +01:00
|
|
|
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
|
|
|
val document = editor.file
|
|
|
|
|
2024-02-13 03:29:21 +01:00
|
|
|
val applicationNode =
|
|
|
|
document
|
|
|
|
.getElementsByTagName("application")
|
|
|
|
.item(0) as Element
|
2023-04-13 19:36:42 +02:00
|
|
|
|
2023-06-26 21:01:34 +02:00
|
|
|
// set application as debuggable
|
|
|
|
applicationNode.setAttribute("android:debuggable", "true")
|
2023-04-13 19:36:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|