Skip to content

Commit ca83047

Browse files
authored
fix(Pandora - Disable ads): Support latest app target (#5185)
1 parent 5cd6ad0 commit ca83047

File tree

5 files changed

+29
-42
lines changed

5 files changed

+29
-42
lines changed
Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
package app.revanced.patches.pandora.ads
22

3-
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
4-
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
53
import app.revanced.patcher.patch.bytecodePatch
6-
import app.revanced.patches.pandora.shared.constructUserDataFingerprint
7-
import app.revanced.util.indexOfFirstInstructionOrThrow
8-
import com.android.tools.smali.dexlib2.Opcode
9-
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
4+
import app.revanced.util.returnEarly
105

116
@Suppress("unused")
127
val disableAudioAdsPatch = bytecodePatch(
@@ -15,16 +10,7 @@ val disableAudioAdsPatch = bytecodePatch(
1510
compatibleWith("com.pandora.android")
1611

1712
execute {
18-
constructUserDataFingerprint.method.apply {
19-
// First match is "hasAudioAds".
20-
val hasAudioAdsStringIndex = constructUserDataFingerprint.stringMatches!!.first().index
21-
val moveResultIndex = indexOfFirstInstructionOrThrow(hasAudioAdsStringIndex, Opcode.MOVE_RESULT)
22-
val hasAudioAdsRegister = getInstruction<OneRegisterInstruction>(moveResultIndex).registerA
23-
24-
addInstruction(
25-
moveResultIndex + 1,
26-
"const/4 v$hasAudioAdsRegister, 0"
27-
)
28-
}
13+
getIsAdSupportedFingerprint.method.returnEarly(false)
14+
requestAudioAdFingerprint.method.returnEarly()
2915
}
3016
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package app.revanced.patches.pandora.ads
2+
3+
import app.revanced.patcher.fingerprint
4+
5+
internal val getIsAdSupportedFingerprint = fingerprint {
6+
custom { method, classDef ->
7+
method.name == "getIsAdSupported" && classDef.endsWith("UserData;")
8+
}
9+
}
10+
11+
internal val requestAudioAdFingerprint = fingerprint {
12+
custom { method, classDef ->
13+
method.name == "requestAudioAdFromAdSDK" && classDef.endsWith("ContentServiceOpsImpl;")
14+
}
15+
}
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
package app.revanced.patches.pandora.misc
22

3-
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
4-
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
53
import app.revanced.patcher.patch.bytecodePatch
6-
import app.revanced.patches.pandora.shared.constructUserDataFingerprint
7-
import app.revanced.util.indexOfFirstInstructionOrThrow
8-
import com.android.tools.smali.dexlib2.Opcode
9-
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
4+
import app.revanced.util.returnEarly
105

116
@Suppress("unused")
127
val enableUnlimitedSkipsPatch = bytecodePatch(
@@ -15,17 +10,6 @@ val enableUnlimitedSkipsPatch = bytecodePatch(
1510
compatibleWith("com.pandora.android")
1611

1712
execute {
18-
constructUserDataFingerprint.method.apply {
19-
// Last match is "skipLimitBehavior".
20-
val skipLimitBehaviorStringIndex = constructUserDataFingerprint.stringMatches!!.last().index
21-
val moveResultObjectIndex =
22-
indexOfFirstInstructionOrThrow(skipLimitBehaviorStringIndex, Opcode.MOVE_RESULT_OBJECT)
23-
val skipLimitBehaviorRegister = getInstruction<OneRegisterInstruction>(moveResultObjectIndex).registerA
24-
25-
addInstruction(
26-
moveResultObjectIndex + 1,
27-
"const-string v$skipLimitBehaviorRegister, \"unlimited\""
28-
)
29-
}
13+
skipLimitBehaviorFingerprint.method.returnEarly("unlimited")
3014
}
3115
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package app.revanced.patches.pandora.misc
2+
3+
import app.revanced.patcher.fingerprint
4+
5+
internal val skipLimitBehaviorFingerprint = fingerprint {
6+
custom { method, classDef ->
7+
method.name == "getSkipLimitBehavior" && classDef.endsWith("UserData;")
8+
}
9+
}

patches/src/main/kotlin/app/revanced/patches/pandora/shared/Fingerprints.kt

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)