generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(remove-screen-capture-restriction): remove app constraint (#2260)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
- Loading branch information
1 parent
6570290
commit 49ce47c
Showing
5 changed files
with
70 additions
and
92 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
...tches/all/screencapture/removerestriction/bytecode/patch/RemoveCaptureRestrictionPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package app.revanced.patches.all.screencapture.removerestriction.bytecode.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.patch.annotations.DependsOn | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patcher.patch.annotations.RequiresIntegrations | ||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod | ||
import app.revanced.patches.all.screencapture.removerestriction.resource.patch.RemoveCaptureRestrictionResourcePatch | ||
import app.revanced.util.patch.* | ||
import org.jf.dexlib2.iface.ClassDef | ||
import org.jf.dexlib2.iface.Method | ||
import org.jf.dexlib2.iface.instruction.Instruction | ||
|
||
@Patch(false) | ||
@Name("remove-screen-capture-restriction") | ||
@Description("Removes the restriction of capturing audio from apps that normally wouldn't allow it.") | ||
@Version("0.0.1") | ||
@DependsOn([RemoveCaptureRestrictionResourcePatch::class]) | ||
@RequiresIntegrations | ||
internal class RemoveCaptureRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() { | ||
// Information about method calls we want to replace | ||
enum class MethodCall( | ||
override val definedClassName: String, | ||
override val methodName: String, | ||
override val methodParams: Array<String>, | ||
override val returnType: String | ||
): IMethodCall { | ||
SetAllowedCapturePolicySingle( | ||
"Landroid/media/AudioAttributes\$Builder;", | ||
"setAllowedCapturePolicy", | ||
arrayOf("I"), | ||
"Landroid/media/AudioAttributes\$Builder;", | ||
), | ||
SetAllowedCapturePolicyGlobal( | ||
"Landroid/media/AudioManager;", | ||
"setAllowedCapturePolicy", | ||
arrayOf("I"), | ||
"V", | ||
); | ||
} | ||
|
||
override fun filterMap( | ||
classDef: ClassDef, | ||
method: Method, | ||
instruction: Instruction, | ||
instructionIndex: Int | ||
) = filterMapInstruction35c<MethodCall>( | ||
INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX, | ||
classDef, | ||
instruction, | ||
instructionIndex | ||
) | ||
|
||
override fun transform(mutableMethod: MutableMethod, entry: Instruction35cInfo) { | ||
val (methodType, instruction, instructionIndex) = entry | ||
methodType.replaceInvokeVirtualWithIntegrations(INTEGRATIONS_CLASS_DESCRIPTOR, mutableMethod, instruction, instructionIndex) | ||
} | ||
|
||
private companion object { | ||
const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = | ||
"Lapp/revanced/all/screencapture/removerestriction/RemoveScreencaptureRestrictionPatch" | ||
const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
...n/app/revanced/patches/spotify/audio/annotation/DisableCaptureRestrictionCompatibility.kt
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
...p/revanced/patches/spotify/audio/bytecode/patch/DisableCaptureRestrictionBytecodePatch.kt
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
...ced/patches/spotify/audio/fingerprints/DisableCaptureRestrictionAudioDriverFingerprint.kt
This file was deleted.
Oops, something went wrong.