fix(Pandora - Disable ads): Support latest app target (#5185)
This commit is contained in:
@ -1,12 +1,7 @@
|
|||||||
package app.revanced.patches.pandora.ads
|
package app.revanced.patches.pandora.ads
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.pandora.shared.constructUserDataFingerprint
|
import app.revanced.util.returnEarly
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val disableAudioAdsPatch = bytecodePatch(
|
val disableAudioAdsPatch = bytecodePatch(
|
||||||
@ -15,16 +10,7 @@ val disableAudioAdsPatch = bytecodePatch(
|
|||||||
compatibleWith("com.pandora.android")
|
compatibleWith("com.pandora.android")
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
constructUserDataFingerprint.method.apply {
|
getIsAdSupportedFingerprint.method.returnEarly(false)
|
||||||
// First match is "hasAudioAds".
|
requestAudioAdFingerprint.method.returnEarly()
|
||||||
val hasAudioAdsStringIndex = constructUserDataFingerprint.stringMatches!!.first().index
|
|
||||||
val moveResultIndex = indexOfFirstInstructionOrThrow(hasAudioAdsStringIndex, Opcode.MOVE_RESULT)
|
|
||||||
val hasAudioAdsRegister = getInstruction<OneRegisterInstruction>(moveResultIndex).registerA
|
|
||||||
|
|
||||||
addInstruction(
|
|
||||||
moveResultIndex + 1,
|
|
||||||
"const/4 v$hasAudioAdsRegister, 0"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.pandora.ads
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint
|
||||||
|
|
||||||
|
internal val getIsAdSupportedFingerprint = fingerprint {
|
||||||
|
custom { method, classDef ->
|
||||||
|
method.name == "getIsAdSupported" && classDef.endsWith("UserData;")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal val requestAudioAdFingerprint = fingerprint {
|
||||||
|
custom { method, classDef ->
|
||||||
|
method.name == "requestAudioAdFromAdSDK" && classDef.endsWith("ContentServiceOpsImpl;")
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,7 @@
|
|||||||
package app.revanced.patches.pandora.misc
|
package app.revanced.patches.pandora.misc
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.pandora.shared.constructUserDataFingerprint
|
import app.revanced.util.returnEarly
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val enableUnlimitedSkipsPatch = bytecodePatch(
|
val enableUnlimitedSkipsPatch = bytecodePatch(
|
||||||
@ -15,17 +10,6 @@ val enableUnlimitedSkipsPatch = bytecodePatch(
|
|||||||
compatibleWith("com.pandora.android")
|
compatibleWith("com.pandora.android")
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
constructUserDataFingerprint.method.apply {
|
skipLimitBehaviorFingerprint.method.returnEarly("unlimited")
|
||||||
// Last match is "skipLimitBehavior".
|
|
||||||
val skipLimitBehaviorStringIndex = constructUserDataFingerprint.stringMatches!!.last().index
|
|
||||||
val moveResultObjectIndex =
|
|
||||||
indexOfFirstInstructionOrThrow(skipLimitBehaviorStringIndex, Opcode.MOVE_RESULT_OBJECT)
|
|
||||||
val skipLimitBehaviorRegister = getInstruction<OneRegisterInstruction>(moveResultObjectIndex).registerA
|
|
||||||
|
|
||||||
addInstruction(
|
|
||||||
moveResultObjectIndex + 1,
|
|
||||||
"const-string v$skipLimitBehaviorRegister, \"unlimited\""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.pandora.misc
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint
|
||||||
|
|
||||||
|
internal val skipLimitBehaviorFingerprint = fingerprint {
|
||||||
|
custom { method, classDef ->
|
||||||
|
method.name == "getSkipLimitBehavior" && classDef.endsWith("UserData;")
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +0,0 @@
|
|||||||
package app.revanced.patches.pandora.shared
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint
|
|
||||||
|
|
||||||
internal val constructUserDataFingerprint = fingerprint {
|
|
||||||
strings("hasAudioAds", "skipLimitBehavior")
|
|
||||||
}
|
|
Reference in New Issue
Block a user