feat: Appy upstream

This commit is contained in:
oSumAtrIX
2025-11-22 23:20:33 +01:00
parent e2c781f12c
commit 8653d8304b
7 changed files with 686 additions and 493 deletions

View File

@@ -4,15 +4,15 @@ public final class app/revanced/patcher/AnyInstruction : app/revanced/patcher/In
}
public final class app/revanced/patcher/CheckCastFilter : app/revanced/patcher/OpcodeFilter {
public final fun getComparison ()Lapp/revanced/patcher/StringComparisonType;
public final fun getType ()Lkotlin/jvm/functions/Function0;
public fun matches (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Z
public final fun setType (Lkotlin/jvm/functions/Function0;)V
}
public final class app/revanced/patcher/FieldAccessFilter : app/revanced/patcher/OpcodesFilter {
public final fun getDefiningClass ()Lkotlin/jvm/functions/Function0;
public final fun getName ()Lkotlin/jvm/functions/Function0;
public final fun getType ()Lkotlin/jvm/functions/Function0;
public final fun getDefiningClass ()Ljava/lang/String;
public final fun getName ()Ljava/lang/String;
public final fun getType ()Ljava/lang/String;
public fun matches (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Z
}
@@ -93,19 +93,21 @@ public final class app/revanced/patcher/InstructionFilterKt {
public static final fun anyInstruction ([Lapp/revanced/patcher/InstructionFilter;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/AnyInstruction;
public static synthetic fun anyInstruction$default ([Lapp/revanced/patcher/InstructionFilter;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/AnyInstruction;
public static final fun checkCast (Ljava/lang/String;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/CheckCastFilter;
public static final fun checkCast (Ljava/lang/String;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/CheckCastFilter;
public static final fun checkCast (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/CheckCastFilter;
public static final fun checkCast (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/CheckCastFilter;
public static synthetic fun checkCast$default (Ljava/lang/String;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/CheckCastFilter;
public static synthetic fun checkCast$default (Ljava/lang/String;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/CheckCastFilter;
public static synthetic fun checkCast$default (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/CheckCastFilter;
public static synthetic fun checkCast$default (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/CheckCastFilter;
public static final fun fieldAccess (Ljava/lang/String;Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/FieldAccessFilter;
public static final fun fieldAccess (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/FieldAccessFilter;
public static final fun fieldAccess (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/FieldAccessFilter;
public static final fun fieldAccess (Ljava/lang/String;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/FieldAccessFilter;
public static final fun fieldAccess (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/FieldAccessFilter;
public static synthetic fun fieldAccess$default (Ljava/lang/String;Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/FieldAccessFilter;
public static synthetic fun fieldAccess$default (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/FieldAccessFilter;
public static synthetic fun fieldAccess$default (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/FieldAccessFilter;
public static synthetic fun fieldAccess$default (Ljava/lang/String;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/FieldAccessFilter;
public static synthetic fun fieldAccess$default (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/FieldAccessFilter;
public static final fun literal (DLjava/util/List;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/LiteralFilter;
public static final fun literal (FLjava/util/List;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/LiteralFilter;
public static final fun literal (ILjava/util/List;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/LiteralFilter;
@@ -120,22 +122,28 @@ public final class app/revanced/patcher/InstructionFilterKt {
public static final fun methodCall (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/MethodCallFilter;
public static final fun methodCall (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/MethodCallFilter;
public static final fun methodCall (Ljava/lang/String;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/MethodCallFilter;
public static final fun methodCall (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/MethodCallFilter;
public static synthetic fun methodCall$default (Ljava/lang/String;Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/MethodCallFilter;
public static synthetic fun methodCall$default (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/MethodCallFilter;
public static synthetic fun methodCall$default (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/MethodCallFilter;
public static synthetic fun methodCall$default (Ljava/lang/String;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/MethodCallFilter;
public static synthetic fun methodCall$default (Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function0;Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/MethodCallFilter;
public static final fun newInstance (Ljava/lang/String;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/NewInstanceFilter;
public static final fun newInstance (Ljava/lang/String;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/NewInstanceFilter;
public static final fun newInstance (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/NewInstanceFilter;
public static final fun newInstance (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/NewInstanceFilter;
public static synthetic fun newInstance$default (Ljava/lang/String;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/NewInstanceFilter;
public static final fun newInstancetype (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/NewInstanceFilter;
public static synthetic fun newInstancetype$default (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/NewInstanceFilter;
public static synthetic fun newInstance$default (Ljava/lang/String;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/NewInstanceFilter;
public static synthetic fun newInstance$default (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/NewInstanceFilter;
public static synthetic fun newInstance$default (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/NewInstanceFilter;
public static final fun opcode (Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/OpcodeFilter;
public static synthetic fun opcode$default (Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/OpcodeFilter;
public static final fun string (Ljava/lang/String;Lapp/revanced/patcher/StringMatchType;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/StringFilter;
public static final fun string (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/StringMatchType;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/StringFilter;
public static synthetic fun string$default (Ljava/lang/String;Lapp/revanced/patcher/StringMatchType;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/StringFilter;
public static synthetic fun string$default (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/StringMatchType;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/StringFilter;
public static final fun string (Ljava/lang/String;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/StringFilter;
public static final fun string (Ljava/lang/String;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/StringFilter;
public static final fun string (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/StringFilter;
public static final fun string (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;)Lapp/revanced/patcher/StringFilter;
public static synthetic fun string$default (Ljava/lang/String;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/StringFilter;
public static synthetic fun string$default (Ljava/lang/String;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/StringFilter;
public static synthetic fun string$default (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/StringFilter;
public static synthetic fun string$default (Lkotlin/jvm/functions/Function0;Lapp/revanced/patcher/StringComparisonType;Lapp/revanced/patcher/InstructionLocation;ILjava/lang/Object;)Lapp/revanced/patcher/StringFilter;
}
public abstract interface class app/revanced/patcher/InstructionLocation {
@@ -147,16 +155,29 @@ public final class app/revanced/patcher/InstructionLocation$MatchAfterAnywhere :
public fun indexIsValidForMatching (II)Z
}
public final class app/revanced/patcher/InstructionLocation$MatchAfterAtLeast : app/revanced/patcher/InstructionLocation {
public fun <init> (I)V
public final fun getMinimumDistanceFromLastInstruction ()I
public fun indexIsValidForMatching (II)Z
public final fun setMinimumDistanceFromLastInstruction (I)V
}
public final class app/revanced/patcher/InstructionLocation$MatchAfterImmediately : app/revanced/patcher/InstructionLocation {
public fun <init> ()V
public fun indexIsValidForMatching (II)Z
}
public final class app/revanced/patcher/InstructionLocation$MatchAfterRange : app/revanced/patcher/InstructionLocation {
public fun <init> (II)V
public final fun getMaximumDistanceFromLastInstruction ()I
public final fun getMinimumDistanceFromLastInstruction ()I
public fun indexIsValidForMatching (II)Z
}
public final class app/revanced/patcher/InstructionLocation$MatchAfterWithin : app/revanced/patcher/InstructionLocation {
public fun <init> (I)V
public final fun getMatchDistance ()I
public fun indexIsValidForMatching (II)Z
public final fun setMatchDistance (I)V
}
public final class app/revanced/patcher/InstructionLocation$MatchFirst : app/revanced/patcher/InstructionLocation {
@@ -170,7 +191,6 @@ public abstract interface annotation class app/revanced/patcher/InternalApi : ja
public final class app/revanced/patcher/LiteralFilter : app/revanced/patcher/OpcodesFilter {
public final fun getLiteral ()Lkotlin/jvm/functions/Function0;
public fun matches (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Z
public final fun setLiteral (Lkotlin/jvm/functions/Function0;)V
}
public final class app/revanced/patcher/Match {
@@ -339,41 +359,36 @@ public final class app/revanced/patcher/MatchingKt {
}
public final class app/revanced/patcher/MethodCallFilter : app/revanced/patcher/OpcodesFilter {
public static final field Companion Lapp/revanced/patcher/MethodCallFilter$Companion;
public final fun getDefiningClass ()Lkotlin/jvm/functions/Function0;
public final fun getName ()Lkotlin/jvm/functions/Function0;
public final fun getParameters ()Lkotlin/jvm/functions/Function0;
public final fun getReturnType ()Lkotlin/jvm/functions/Function0;
public final fun getDefiningClass ()Ljava/lang/String;
public final fun getName ()Ljava/lang/String;
public final fun getParameters ()Ljava/util/List;
public final fun getReturnType ()Ljava/lang/String;
public fun matches (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Z
}
public final class app/revanced/patcher/MethodCallFilter$Companion {
}
public final class app/revanced/patcher/NewInstanceFilter : app/revanced/patcher/OpcodesFilter {
public final fun getComparison ()Lapp/revanced/patcher/StringComparisonType;
public final fun getType ()Lkotlin/jvm/functions/Function0;
public fun matches (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Z
public final fun setType (Lkotlin/jvm/functions/Function0;)V
}
public class app/revanced/patcher/OpcodeFilter : app/revanced/patcher/InstructionFilter {
public fun <init> (Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;)V
public synthetic fun <init> (Lcom/android/tools/smali/dexlib2/Opcode;Lapp/revanced/patcher/InstructionLocation;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun getLocation ()Lapp/revanced/patcher/InstructionLocation;
public final fun getOpcode ()Lcom/android/tools/smali/dexlib2/Opcode;
public fun matches (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Z
}
public class app/revanced/patcher/OpcodesFilter : app/revanced/patcher/InstructionFilter {
public static final field Companion Lapp/revanced/patcher/OpcodesFilter$Companion;
protected fun <init> (Ljava/util/EnumSet;Lapp/revanced/patcher/InstructionLocation;)V
public synthetic fun <init> (Ljava/util/EnumSet;Lapp/revanced/patcher/InstructionLocation;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
protected fun <init> (Ljava/util/List;Lapp/revanced/patcher/InstructionLocation;)V
public fun getLocation ()Lapp/revanced/patcher/InstructionLocation;
public final fun getOpcodes ()Ljava/util/EnumSet;
public fun matches (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Z
}
public final class app/revanced/patcher/OpcodesFilter$Companion {
}
public final class app/revanced/patcher/PackageMetadata {
public final fun getPackageName ()Ljava/lang/String;
public final fun getPackageVersion ()Ljava/lang/String;
@@ -417,22 +432,21 @@ public final class app/revanced/patcher/PatcherResult$PatchedResources {
public final fun getResourcesApk ()Ljava/io/File;
}
public final class app/revanced/patcher/StringFilter : app/revanced/patcher/OpcodesFilter {
public final fun getMatchType ()Lapp/revanced/patcher/StringMatchType;
public final fun getString ()Lkotlin/jvm/functions/Function0;
public fun matches (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Z
public final fun setMatchType (Lapp/revanced/patcher/StringMatchType;)V
public final fun setString (Lkotlin/jvm/functions/Function0;)V
public final class app/revanced/patcher/StringComparisonType : java/lang/Enum {
public static final field CONTAINS Lapp/revanced/patcher/StringComparisonType;
public static final field ENDS_WITH Lapp/revanced/patcher/StringComparisonType;
public static final field EQUALS Lapp/revanced/patcher/StringComparisonType;
public static final field STARTS_WITH Lapp/revanced/patcher/StringComparisonType;
public final fun compare (Ljava/lang/String;Ljava/lang/String;)Z
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lapp/revanced/patcher/StringComparisonType;
public static fun values ()[Lapp/revanced/patcher/StringComparisonType;
}
public final class app/revanced/patcher/StringMatchType : java/lang/Enum {
public static final field CONTAINS Lapp/revanced/patcher/StringMatchType;
public static final field ENDS_WITH Lapp/revanced/patcher/StringMatchType;
public static final field EQUALS Lapp/revanced/patcher/StringMatchType;
public static final field STARTS_WITH Lapp/revanced/patcher/StringMatchType;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public static fun valueOf (Ljava/lang/String;)Lapp/revanced/patcher/StringMatchType;
public static fun values ()[Lapp/revanced/patcher/StringMatchType;
public final class app/revanced/patcher/StringFilter : app/revanced/patcher/OpcodesFilter {
public final fun getComparison ()Lapp/revanced/patcher/StringComparisonType;
public final fun getString ()Lkotlin/jvm/functions/Function0;
public fun matches (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;)Z
}
public final class app/revanced/patcher/dex/mutable/MutableAnnotation : com/android/tools/smali/dexlib2/base/BaseAnnotation {
@@ -794,6 +808,10 @@ public final class app/revanced/patcher/extensions/InstructionKt {
public final class app/revanced/patcher/extensions/MethodKt {
public static final fun accessFlags (Lcom/android/tools/smali/dexlib2/iface/Method;[Lcom/android/tools/smali/dexlib2/AccessFlags;)Z
public static final fun addInstruction (Lapp/revanced/patcher/dex/mutable/MutableMethod;ILcom/android/tools/smali/dexlib2/builder/BuilderInstruction;)V
public static final fun addInstruction (Lapp/revanced/patcher/dex/mutable/MutableMethod;ILjava/lang/String;)V
public static final fun addInstruction (Lapp/revanced/patcher/dex/mutable/MutableMethod;Lcom/android/tools/smali/dexlib2/builder/BuilderInstruction;)V
public static final fun addInstruction (Lapp/revanced/patcher/dex/mutable/MutableMethod;Ljava/lang/String;)V
public static final fun addInstructions (Lapp/revanced/patcher/dex/mutable/MutableMethod;ILjava/lang/String;)V
public static final fun addInstructions (Lapp/revanced/patcher/dex/mutable/MutableMethod;ILjava/util/List;)V
public static final fun addInstructions (Lapp/revanced/patcher/dex/mutable/MutableMethod;Ljava/lang/String;)V
@@ -818,10 +836,13 @@ public final class app/revanced/patcher/extensions/MethodKt {
public static final fun getInstructionsOrNull (Lapp/revanced/patcher/dex/mutable/MutableMethod;)Ljava/util/List;
public static final fun getInstructionsOrNull (Lcom/android/tools/smali/dexlib2/iface/Method;)Ljava/lang/Iterable;
public static final fun newLabel (Lapp/revanced/patcher/dex/mutable/MutableMethod;I)Lcom/android/tools/smali/dexlib2/builder/Label;
public static final fun removeInstruction (Lapp/revanced/patcher/dex/mutable/MutableMethod;I)V
public static final fun removeInstructions (Lapp/revanced/patcher/dex/mutable/MutableMethod;I)V
public static final fun removeInstructions (Lapp/revanced/patcher/dex/mutable/MutableMethod;II)V
public static final fun removeInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;I)V
public static final fun removeInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;II)V
public static final fun replaceInstruction (Lapp/revanced/patcher/dex/mutable/MutableMethod;ILcom/android/tools/smali/dexlib2/builder/BuilderInstruction;)V
public static final fun replaceInstruction (Lapp/revanced/patcher/dex/mutable/MutableMethod;ILjava/lang/String;)V
public static final fun replaceInstructions (Lapp/revanced/patcher/dex/mutable/MutableMethod;ILjava/lang/String;)V
public static final fun replaceInstructions (Lapp/revanced/patcher/dex/mutable/MutableMethod;ILjava/util/List;)V
public static final fun replaceInstructions (Lcom/android/tools/smali/dexlib2/builder/MutableMethodImplementation;ILjava/util/List;)V

View File

@@ -108,13 +108,11 @@ class Fingerprint internal constructor(
is FieldAccessFilter -> {
val reference = instruction.fieldReference ?: return false
if (name != null && reference.name != name()) return false
if (name != null && reference.name != name) return false
if (type != null && !reference.type.startsWith(type())) return false
if (type != null && !reference.type.startsWith(type)) return false
if (definingClass != null) {
val definingClass = definingClass()
if (!reference.definingClass.endsWith(definingClass))
// else, the method call is for 'this' class.
if (!(definingClass == "this" && reference.definingClass == method.definingClass)) return false
@@ -132,18 +130,17 @@ class Fingerprint internal constructor(
is MethodCallFilter -> {
val reference = instruction.methodReference ?: return false
if (name != null && reference.name != name()) return false
if (name != null && reference.name != name) return false
if (returnType != null && !reference.returnType.startsWith(returnType())) return false
if (returnType != null && !reference.returnType.startsWith(returnType)) return false
if (parameters != null && !parametersStartsWith(
reference.parameterTypes, parameters()
reference.parameterTypes,
parameters
)
) return false
if (definingClass != null) {
val definingClass = definingClass()
if (!reference.definingClass.endsWith(definingClass)) {
// Check if 'this' defining class is used.
// Would be nice if this also checked all super classes,
@@ -168,11 +165,11 @@ class Fingerprint internal constructor(
val string = instruction.stringReference?.string ?: return false
val filterString = string()
when (matchType) {
StringMatchType.EQUALS -> string == filterString
StringMatchType.CONTAINS -> string.contains(filterString)
StringMatchType.STARTS_WITH -> string.startsWith(filterString)
StringMatchType.ENDS_WITH -> string.endsWith(filterString)
when (comparison) {
StringComparisonType.EQUALS -> string == filterString
StringComparisonType.CONTAINS -> string.contains(filterString)
StringComparisonType.STARTS_WITH -> string.startsWith(filterString)
StringComparisonType.ENDS_WITH -> string.endsWith(filterString)
}
}
@@ -187,11 +184,19 @@ class Fingerprint internal constructor(
is MatchAfterImmediately -> after { filter.evaluate(this) }
is MatchAfterAnywhere -> add { filter.evaluate(this) }
is MatchAfterWithin -> after(atLeast = 1, atMost = location.matchDistance) {
filter.evaluate(
this
)
filter.evaluate(this)
}
is MatchAfterAtLeast -> after(
atLeast = location.minimumDistanceFromLastInstruction,
atMost = Int.MAX_VALUE
) { filter.evaluate(this) }
is MatchAfterRange -> after(
atLeast = location.minimumDistanceFromLastInstruction,
atMost = location.maximumDistanceFromLastInstruction
) { filter.evaluate(this) }
is MatchFirst -> first { filter.evaluate(this) }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -73,6 +73,42 @@ fun MutableMethodImplementation.replaceInstructions(
addInstructions(index, instructions)
}
/**
* Add an instruction to a method at the given index.
*
* @param index The index to add the instruction at.
* @param instruction The instruction to add.
*/
fun MutableMethod.addInstruction(
index: Int,
instruction: BuilderInstruction,
) = implementation!!.addInstruction(index, instruction)
/**
* Add an instruction to a method.
*
* @param instruction The instructions to add.
*/
fun MutableMethod.addInstruction(instruction: BuilderInstruction) = implementation!!.addInstruction(instruction)
/**
* Add an instruction to a method at the given index.
*
* @param index The index to add the instruction at.
* @param smaliInstructions The instruction to add.
*/
fun MutableMethod.addInstruction(
index: Int,
smaliInstructions: String,
) = implementation!!.addInstructions(index, smaliInstructions.toInstructions(this))
/**
* Add an instruction to a method.
*
* @param smaliInstructions The instruction to add.
*/
fun MutableMethod.addInstruction(smaliInstructions: String) = implementation!!.addInstructions(smaliInstructions.toInstructions(this))
/**
* Add instructions to a method at the given index.
*
@@ -89,8 +125,7 @@ fun MutableMethod.addInstructions(
*
* @param instructions The instructions to add.
*/
fun MutableMethod.addInstructions(instructions: List<BuilderInstruction>) =
implementation!!.addInstructions(instructions)
fun MutableMethod.addInstructions(instructions: List<BuilderInstruction>) = implementation!!.addInstructions(instructions)
/**
* Add instructions to a method.
@@ -107,8 +142,7 @@ fun MutableMethod.addInstructions(
*
* @param smaliInstructions The instructions to add.
*/
fun MutableMethod.addInstructions(smaliInstructions: String) =
implementation!!.addInstructions(smaliInstructions.toInstructions(this))
fun MutableMethod.addInstructions(smaliInstructions: String) = implementation!!.addInstructions(smaliInstructions.toInstructions(this))
/**
* Add instructions to a method at the given index.
@@ -166,7 +200,6 @@ fun MutableMethod.addInstructionsWithLabels(
i.registerB,
label,
)
is BuilderInstruction30t -> BuilderInstruction30t(i.opcode, label)
is BuilderInstruction31t -> BuilderInstruction31t(i.opcode, i.registerA, label)
else -> throw IllegalStateException(
@@ -211,6 +244,13 @@ fun MutableMethod.addInstructionsWithLabels(
}
}
/**
* Remove an instruction at the given index.
*
* @param index The index to remove the instruction at.
*/
fun MutableMethod.removeInstruction(index: Int) = implementation!!.removeInstruction(index)
/**
* Remove instructions at the given index.
*
@@ -229,6 +269,28 @@ fun MutableMethod.removeInstructions(
*/
fun MutableMethod.removeInstructions(count: Int) = implementation!!.removeInstructions(count)
/**
* Replace an instruction at the given index.
*
* @param index The index to replace the instruction at.
* @param instruction The instruction to replace the instruction with.
*/
fun MutableMethod.replaceInstruction(
index: Int,
instruction: BuilderInstruction,
) = implementation!!.replaceInstruction(index, instruction)
/**
* Replace an instruction at the given index.
*
* @param index The index to replace the instruction at.
* @param smaliInstruction The smali instruction to replace the instruction with.
*/
fun MutableMethod.replaceInstruction(
index: Int,
smaliInstruction: String,
) = implementation!!.replaceInstructions(index, smaliInstruction.toInstructions(this))
/**
* Replace instructions at the given index.
*

View File

@@ -21,6 +21,7 @@ import lanchon.multidexlib2.MultiDexIO
import lanchon.multidexlib2.RawDexIO
import java.io.Closeable
import java.io.IOException
import java.util.LinkedHashMap
import java.util.logging.Logger
@@ -140,8 +141,12 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
this,
BasicDexFileNamer(),
object : DexFile {
override fun getClasses() =
this@BytecodePatchContext.classDefs.toSet()
override fun getClasses() = this@BytecodePatchContext.classDefs.let {
// More performant according to
// https://github.com/LisoUseInAIKyrios/revanced-patcher/commit/8c26ad08457fb1565ea5794b7930da42a1c81cf1#diff-be698366d9868784ecf7da3fd4ac9d2b335b0bb637f9f618fbe067dbd6830b8fR197
// TODO: Benchmark, if actually faster.
HashSet<ClassDef>(it.size * 3 / 2).apply { addAll(it) }
}
override fun getOpcodes() = this@BytecodePatchContext.opcodes
},
@@ -166,10 +171,17 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
}
internal inner class LookupMaps {
// No custom HashMap needed here, according to
// https://github.com/LisoUseInAIKyrios/revanced-patcher/commit/9b6d95d4f414a35ed68da37b0ecd8549df1ef63a
// TODO: Benchmark, if actually faster.
private val _classDefsByType = mutableMapOf<String, ClassDef>()
val classDefsByType: Map<String, ClassDef> = _classDefsByType
private val _methodsByStrings = mutableMapOf<String, MutableList<Method>>()
// Better performance according to
// https://github.com/LisoUseInAIKyrios/revanced-patcher/commit/9b6d95d4f414a35ed68da37b0ecd8549df1ef63a
private val _methodsByStrings =
LinkedHashMap<String, MutableList<Method>>(2 * classDefs.size, 0.5f)
val methodsByStrings: Map<String, List<Method>> = _methodsByStrings
private val _methodsWithString = methodsByStrings.values.flatten().toMutableSet()
@@ -195,7 +207,9 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
classDef.forEachString { method, string ->
_methodsWithString += method
_methodsByStrings.getOrPut(string) { mutableListOf() } += method
_methodsByStrings.getOrPut(string) {
mutableListOf()
} += method
}
}

View File

@@ -1,5 +1,6 @@
package app.revanced.patcher.util
import app.revanced.patcher.dex.mutable.MutableClassDef
import app.revanced.patcher.patch.BytecodePatchContext
import app.revanced.patcher.util.ClassMerger.Utils.asMutableClass
import app.revanced.patcher.util.ClassMerger.Utils.filterAny
@@ -7,7 +8,6 @@ import app.revanced.patcher.util.ClassMerger.Utils.filterNotAny
import app.revanced.patcher.util.ClassMerger.Utils.isPublic
import app.revanced.patcher.util.ClassMerger.Utils.toPublic
import app.revanced.patcher.util.ClassMerger.Utils.traverseClassHierarchy
import app.revanced.patcher.dex.mutable.MutableClassDef
import app.revanced.patcher.dex.mutable.MutableClassDef.Companion.toMutable
import app.revanced.patcher.dex.mutable.MutableField
import app.revanced.patcher.dex.mutable.MutableField.Companion.toMutable

View File

@@ -2,7 +2,6 @@ package app.revanced.patcher.extensions
import app.revanced.patcher.dex.mutable.MutableMethod
import app.revanced.patcher.dex.mutable.MutableMethod.Companion.toMutable
import app.revanced.patcher.util.smali.ExternalLabel
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.builder.BuilderOffsetInstruction