mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-09 10:53:55 +01:00
Compare commits
2 Commits
v2.196.1-d
...
v2.196.1-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7236dee006 | ||
|
|
f9b7c31ba9 |
@@ -1,3 +1,10 @@
|
|||||||
|
## [2.196.1-dev.5](https://github.com/ReVanced/revanced-patches/compare/v2.196.1-dev.4...v2.196.1-dev.5) (2023-11-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Remove screenshot restriction:** Improve reliability ([#2938](https://github.com/ReVanced/revanced-patches/issues/2938)) ([6b7cb7b](https://github.com/ReVanced/revanced-patches/commit/6b7cb7bd38348dbe4a56385356df6ed97e81c319))
|
||||||
|
|
||||||
## [2.196.1-dev.4](https://github.com/ReVanced/revanced-patches/compare/v2.196.1-dev.3...v2.196.1-dev.4) (2023-11-09)
|
## [2.196.1-dev.4](https://github.com/ReVanced/revanced-patches/compare/v2.196.1-dev.3...v2.196.1-dev.4) (2023-11-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.196.1-dev.4
|
version = 2.196.1-dev.5
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
package app.revanced.patches.all.screenshot.removerestriction
|
package app.revanced.patches.all.screenshot.removerestriction
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.util.patch.AbstractTransformInstructionsPatch
|
import app.revanced.util.patch.AbstractTransformInstructionsPatch
|
||||||
import app.revanced.util.patch.IMethodCall
|
import app.revanced.util.patch.IMethodCall
|
||||||
import app.revanced.util.patch.Instruction35cInfo
|
import app.revanced.util.patch.Instruction35cInfo
|
||||||
import app.revanced.util.patch.filterMapInstruction35c
|
import app.revanced.util.patch.filterMapInstruction35c
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Remove screenshot restriction",
|
name = "Remove screenshot restriction",
|
||||||
@@ -22,6 +27,11 @@ object RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Ins
|
|||||||
"Lapp/revanced/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch"
|
"Lapp/revanced/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch"
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
|
||||||
|
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
super.execute(context)
|
||||||
|
ModifyLayoutParamsFlags().execute(context)
|
||||||
|
}
|
||||||
|
|
||||||
override fun filterMap(
|
override fun filterMap(
|
||||||
classDef: ClassDef,
|
classDef: ClassDef,
|
||||||
method: Method,
|
method: Method,
|
||||||
@@ -46,6 +56,12 @@ object RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Ins
|
|||||||
override val methodParams: Array<String>,
|
override val methodParams: Array<String>,
|
||||||
override val returnType: String
|
override val returnType: String
|
||||||
): IMethodCall {
|
): IMethodCall {
|
||||||
|
AddFlags(
|
||||||
|
"Landroid/view/Window;",
|
||||||
|
"addFlags",
|
||||||
|
arrayOf("I"),
|
||||||
|
"V",
|
||||||
|
),
|
||||||
SetFlags(
|
SetFlags(
|
||||||
"Landroid/view/Window;",
|
"Landroid/view/Window;",
|
||||||
"setFlags",
|
"setFlags",
|
||||||
@@ -54,3 +70,37 @@ object RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Ins
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ModifyLayoutParamsFlags : AbstractTransformInstructionsPatch<Pair<Instruction22c, Int>>() {
|
||||||
|
override fun filterMap(
|
||||||
|
classDef: ClassDef,
|
||||||
|
method: Method,
|
||||||
|
instruction: Instruction,
|
||||||
|
instructionIndex: Int
|
||||||
|
): Pair<Instruction22c, Int>? {
|
||||||
|
if (instruction.opcode != Opcode.IPUT) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
val instruction22c = instruction as Instruction22c
|
||||||
|
val fieldReference = instruction22c.reference as FieldReference
|
||||||
|
|
||||||
|
if (fieldReference.definingClass != "Landroid/view/WindowManager\$LayoutParams;"
|
||||||
|
|| fieldReference.name != "flags"
|
||||||
|
|| fieldReference.type != "I") {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return Pair(instruction22c, instructionIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun transform(mutableMethod: MutableMethod, entry: Pair<Instruction22c, Int>) {
|
||||||
|
val (instruction, index) = entry
|
||||||
|
val register = instruction.registerA
|
||||||
|
|
||||||
|
mutableMethod.addInstructions(
|
||||||
|
index,
|
||||||
|
"and-int/lit16 v$register, v$register, -0x2001"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ inline fun <reified E> fromMethodReference(methodReference: MethodReference)
|
|||||||
search.definedClassName == methodReference.definingClass
|
search.definedClassName == methodReference.definingClass
|
||||||
&& search.methodName == methodReference.name
|
&& search.methodName == methodReference.name
|
||||||
&& methodReference.parameterTypes.toTypedArray().contentEquals(search.methodParams)
|
&& methodReference.parameterTypes.toTypedArray().contentEquals(search.methodParams)
|
||||||
|
&& search.returnType == methodReference.returnType
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fun <reified E> filterMapInstruction35c(
|
inline fun <reified E> filterMapInstruction35c(
|
||||||
|
|||||||
Reference in New Issue
Block a user