update to new apply, afterDependents and Patch api

This commit is contained in:
oSumAtrIX
2025-12-30 01:22:15 +01:00
parent bbd8ae0e24
commit 30076b7a9b
302 changed files with 352 additions and 359 deletions

View File

@@ -8,7 +8,7 @@ val exportAllActivitiesPatch = resourcePatch(
description = "Makes all app activities exportable.",
use = false,
) {
execute {
apply {
val exportedFlag = "android:exported"
document("AndroidManifest.xml").use { document ->

View File

@@ -12,7 +12,7 @@ val hideAppIconPatch = resourcePatch(
description = "Hides the app icon from the Android launcher.",
use = false,
) {
execute {
apply {
document("AndroidManifest.xml").use { document ->
var changed = false

View File

@@ -132,7 +132,7 @@ ${trustAnchorsXML.trimEnd()}
}
execute {
apply {
val nscFileNameBare = "network_security_config"
val resXmlDir = "res/xml"
val resRawDir = "res/raw"

View File

@@ -8,7 +8,7 @@ val enableAndroidDebuggingPatch = resourcePatch(
description = "Enables Android debugging capabilities. This can slow down the app.",
use = false,
) {
execute {
apply {
document("AndroidManifest.xml").use { document ->
val applicationNode =
document

View File

@@ -18,7 +18,7 @@ val exportInternalDataDocumentsProviderPatch = resourcePatch(
},
)
execute {
apply {
val documentsProviderClass =
"app.revanced.extension.all.misc.directory.documentsprovider.InternalDataDocumentsProvider"

View File

@@ -8,7 +8,7 @@ val predictiveBackGesturePatch = resourcePatch(
description = "Enables the predictive back gesture introduced on Android 13.",
use = false,
) {
execute {
apply {
val flag = "android:enableOnBackInvokedCallback"
document("AndroidManifest.xml").use { document ->

View File

@@ -14,7 +14,7 @@ val overrideCertificatePinningPatch = resourcePatch(
) {
dependsOn(enableAndroidDebuggingPatch)
execute {
apply {
val resXmlDirectory = get("res/xml")
// Add android:networkSecurityConfig="@xml/network_security_config" and the "networkSecurityConfig" attribute if it does not exist.

View File

@@ -59,7 +59,7 @@ val changePackageNamePatch = resourcePatch(
"Enabling this can fix installation errors, but this can also break features in certain apps.",
)
finalize {
afterDependents {
/**
* Apps that are confirmed to not work correctly with this patch.
* This is not an exhaustive list, and is only the apps with
@@ -80,7 +80,7 @@ val changePackageNamePatch = resourcePatch(
val packageName = manifest.getAttribute("package")
if (incompatibleAppPackages.contains(packageName)) {
return@finalize Logger.getLogger(this::class.java.name).severe(
return@afterDependents Logger.getLogger(this::class.java.name).severe(
"'$packageName' does not work correctly with \"Change package name\"",
)
}

View File

@@ -215,8 +215,8 @@ fun addResources(
* @see addResourcesPatch
*/
fun addResources(
patch: Patch<*>,
parseIds: (Patch<*>) -> Map<AppId, Set<PatchId>> = {
patch: Patch,
parseIds: (Patch) -> Map<AppId, Set<PatchId>> = {
val patchId = patch.name ?: throw PatchException("Patch has no name")
val packages = patch.compatiblePackages ?: throw PatchException("Patch has no compatible packages")
@@ -273,9 +273,9 @@ val addResourcesPatch = resourcePatch(
from the temporary map to addResourcesPatch.
After all patches that depend on addResourcesPatch have been executed,
addResourcesPatch#finalize is finally called to add all staged resources to the app.
addResourcesPatch#afterDependents is finally called to add all staged resources to the app.
*/
execute {
apply {
stagedResources = buildMap {
/**
* Puts resources under `/resources/addresources/<value>/<resourceKind>.xml` into the map.
@@ -324,7 +324,7 @@ val addResourcesPatch = resourcePatch(
// Stage all resources to a temporary map.
// Staged resources consumed by addResourcesPatch#invoke(Patch)
// are later used in addResourcesPatch#finalize.
// are later used in addResourcesPatch#afterDependents.
try {
val addStringResources = { source: Value, dest: Value ->
addResources(source, dest, "strings", StringResource::fromNode)
@@ -343,7 +343,7 @@ val addResourcesPatch = resourcePatch(
* Adds all resources staged in [addResourcesPatch] to the app.
* This is called after all patches that depend on [addResourcesPatch] have been executed.
*/
finalize {
afterDependents {
operator fun MutableMap<String, Pair<Document, Node>>.invoke(
value: Value,
resource: BaseResource,
@@ -359,7 +359,7 @@ val addResourcesPatch = resourcePatch(
}
getOrPut(resourceFileName) {
this@finalize["res/$value/$resourceFileName.xml"].also {
this@afterDependents["res/$value/$resourceFileName.xml"].also {
it.parentFile?.mkdirs()
if (it.createNewFile()) {

View File

@@ -10,7 +10,7 @@ import org.w3c.dom.Element
private val removeCaptureRestrictionResourcePatch = resourcePatch(
description = "Sets allowAudioPlaybackCapture in manifest to true.",
) {
execute {
apply {
document("AndroidManifest.xml").use { document ->
// Get the application node.
val applicationNode =

View File

@@ -13,7 +13,7 @@ val removeShareTargetsPatch = resourcePatch(
description = "Removes share targets like directly sharing to a frequent contact.",
use = false,
) {
execute {
apply {
try {
document("res/xml/shortcuts.xml")
} catch (_: FileNotFoundException) {

View File

@@ -32,7 +32,7 @@ val enableRomSignatureSpoofing = resourcePatch(
description = "The hex-encoded signature or path to an APK file with the desired signature.",
required = true,
)
execute {
apply {
document("AndroidManifest.xml").use { document ->
val permission = document.createElement("uses-permission").apply {
setAttribute("android:name", "android.permission.FAKE_PACKAGE_SIGNATURE")

View File

@@ -12,7 +12,7 @@ val setTargetSdkVersion34 = resourcePatch(
"For devices running Android 15+, this will disable edge-to-edge display.",
use = false,
) {
execute {
apply {
val targetSdkOverride = 34 // Android 14.
document("AndroidManifest.xml").use { document ->

View File

@@ -11,7 +11,7 @@ fun <T> transformInstructionsPatch(
filterMap: (ClassDef, Method, Instruction, Int) -> T?,
transform: (MutableMethod, T) -> Unit,
) = bytecodePatch {
execute {
apply {
forEachInstructionAsSequence { classDef, method, i, instruction ->
transform(method, filterMap(classDef, method, instruction, i) ?: return@forEachInstructionAsSequence)
}

View File

@@ -25,7 +25,7 @@ val changeVersionCodePatch = resourcePatch(
required = true,
) { versionCode -> versionCode!! >= 1 }
execute {
apply {
document("AndroidManifest.xml").use { document ->
val manifestElement = document.getNode("manifest") as Element
manifestElement.setAttribute("android:versionCode", "$versionCode")

View File

@@ -10,7 +10,7 @@ val deepLinkingPatch = bytecodePatch(
) {
compatibleWith("com.amazon.mShop.android.shopping")
execute {
apply {
deepLinkingFingerprint.method.addInstructions(
0,
"""

View File

@@ -10,7 +10,7 @@ val angulusPatch = bytecodePatch(name = "Hide ads") {
dependsOn(disableLicenseCheckPatch)
execute {
apply {
// Always return 0 as the daily measurement count.
getDailyMeasurementCountFingerprint.method.returnEarly(0)
}

View File

@@ -10,7 +10,7 @@ val removePlayLimitsPatch = bytecodePatch(
) {
compatibleWith("com.bandcamp.android")
execute {
apply {
handlePlaybackLimitsFingerprint.method.returnEarly()
}
}

View File

@@ -10,7 +10,7 @@ val bypassRootChecksPatch = bytecodePatch(
) {
compatibleWith("it.ipzs.cieid")
execute {
apply {
checkRootFingerprint.method.addInstruction(1, "return-void")
}
}

View File

@@ -14,7 +14,7 @@ val removeAdsPatch = bytecodePatch(
dependsOn(disableLicenseCheckPatch)
execute {
apply {
shouldShowAdvertisingTVFingerprint.method.returnEarly(true)
shouldShowPauseAdFingerprint.method.returnEarly(false)

View File

@@ -22,7 +22,7 @@ val disableAdsPatch = bytecodePatch (
dependsOn(sharedExtensionPatch)
execute {
apply {
userStateSwitchFingerprint.method.returnEarly(true)
// Remove region-specific Cricbuzz11 elements.

View File

@@ -18,7 +18,7 @@ val hideAdsPatch = bytecodePatch(
) {
compatibleWith("com.crunchyroll.crunchyroid")
execute {
apply {
// Get obfuscated "enableAds" field from toString method.
val enableAdsField = videoUrlReadyToStringFingerprint.let {
val strIndex = videoUrlReadyToStringFingerprint.stringMatches.last().index

View File

@@ -14,7 +14,7 @@ val skipAdsPatch = bytecodePatch(
"in.startv.hotstaronly",
)
execute {
apply {
arrayOf(insertionGetPointsFingerprint, insertionGetRangesFingerprint).forEach {
it.method.addInstructions(
0,

View File

@@ -12,7 +12,7 @@ val disableAdsPatch = bytecodePatch(
// 6.55.3 and higher can show ads after each exercise.
compatibleWith("com.duolingo"("6.54.5"))
execute {
apply {
// Couple approaches to remove ads exist:
//
// MonetizationDebugSettings has a boolean value for "disableAds".

View File

@@ -13,7 +13,7 @@ val enableDebugMenuPatch = bytecodePatch(
) {
compatibleWith("com.duolingo")
execute {
apply {
// It seems all categories are allowed on release. Force this on anyway.
debugCategoryAllowOnReleaseBuildsFingerprint.method.returnEarly(true)

View File

@@ -11,7 +11,7 @@ val skipEnergyRechargeAdsPatch = bytecodePatch(
) {
compatibleWith("com.duolingo")
execute {
apply {
initializeEnergyConfigFingerprint
.match(energyConfigToStringFingerprint.classDef)
.method.apply {

View File

@@ -16,7 +16,7 @@ val hideSponsoredStoriesPatch = bytecodePatch(
) {
compatibleWith("com.facebook.katana"("490.0.0.63.82"))
execute {
apply {
val sponsoredDataModelTemplateMethod = getSponsoredDataModelTemplateFingerprint.originalMethod
val baseModelMapperMethod = baseModelMapperFingerprint.originalMethod
val baseModelWithTreeType = baseModelMapperMethod.returnType

View File

@@ -10,7 +10,7 @@ val hideStoryAdsPatch = bytecodePatch(
) {
compatibleWith("com.facebook.katana")
execute {
apply {
setOf(
fetchMoreAdsFingerprint,
adsInsertionFingerprint,

View File

@@ -10,7 +10,7 @@ val bootloaderDetectionPatch = bytecodePatch(
) {
compatibleWith("at.gv.bmf.bmf2go")
execute {
apply {
setOf(createKeyFingerprint, bootStateFingerprint).forEach { fingerprint ->
fingerprint.method.addInstructions(
0,

View File

@@ -12,7 +12,7 @@ val rootDetectionPatch = bytecodePatch(
) {
compatibleWith("at.gv.bmf.bmf2go")
execute {
apply {
rootDetectionFingerprint.method.addInstructions(
0,
"""

View File

@@ -12,7 +12,7 @@ val enableCustomTabsPatch = bytecodePatch(
) {
compatibleWith("com.google.android.apps.magazines")
execute {
apply {
launchCustomTabFingerprint.method.apply {
val checkIndex = launchCustomTabFingerprint.instructionMatches.last().index + 1
val register = getInstruction<OneRegisterInstruction>(checkIndex).registerA

View File

@@ -12,7 +12,7 @@ val enableDCIMFoldersBackupControlPatch = bytecodePatch(
) {
compatibleWith("com.google.android.apps.photos")
execute {
apply {
isDCIMFolderBackupControlDisabled.method.returnEarly(false)
}
}

View File

@@ -55,7 +55,7 @@ val spoofFeaturesPatch = bytecodePatch(
required = true,
)
execute {
apply {
@Suppress("NAME_SHADOWING")
val featuresToEnable = featuresToEnable!!.toSet()

View File

@@ -13,7 +13,7 @@ val removeDeviceRestrictionsPatch = bytecodePatch(
) {
compatibleWith("com.google.android.apps.recorder")
execute {
apply {
val featureStringIndex = onApplicationCreateFingerprint.stringMatches.first().index
onApplicationCreateFingerprint.method.apply {

View File

@@ -9,7 +9,7 @@ val disableAdsPatch = bytecodePatch(
) {
compatibleWith("com.myprog.hexedit")
execute {
apply {
primaryAdsFingerprint.method.replaceInstructions(
0,
"""

View File

@@ -9,7 +9,7 @@ val unlockProPatch = bytecodePatch(
) {
compatibleWith("ginlemon.iconpackstudio"("2.2 build 016"))
execute {
apply {
checkProFingerprint.method.addInstructions(
0,
"""

View File

@@ -12,7 +12,7 @@ val removeDeviceIntegrityChecksPatch = bytecodePatch(
) {
compatibleWith("at.gv.oe.app")
execute {
apply {
isDeviceRootedFingerprint.method.returnEarly(false)
isDeviceBootloaderOpenFingerprint.method.apply {

View File

@@ -10,7 +10,7 @@ val spoofSignaturePatch = bytecodePatch(
) {
compatibleWith("at.gv.oe.app")
execute {
apply {
val expectedSignature =
"OpenSSLRSAPublicKey{modulus=ac3e6fd6050aa7e0d6010ae58190404cd89a56935b44f6fee" +
"067c149768320026e10b24799a1339e414605e448e3f264444a327b9ae292be2b62ad567dd1800dbed4a88f718a33dc6db6b" +

View File

@@ -9,7 +9,7 @@ val hideAdsPatch = bytecodePatch(
) {
compatibleWith("com.nis.app")
execute {
apply {
inshortsAdsFingerprint.method.addInstruction(
0,
"""

View File

@@ -10,7 +10,7 @@ val hideAdsPatch = bytecodePatch(
) {
compatibleWith("com.instagram.android")
execute {
apply {
adInjectorFingerprint.method.returnEarly(false)
}
}

View File

@@ -22,7 +22,7 @@ val limitFeedToFollowedProfiles = bytecodePatch(
dependsOn(sharedExtensionPatch)
execute {
apply {
/**
* Since the header field is obfuscated and there is no easy way to identify it among all the class fields,
* an additional method is fingerprinted.

View File

@@ -16,7 +16,7 @@ val anonymousStoryViewingPatch = bytecodePatch(
) {
compatibleWith("com.instagram.android")
execute {
apply {
// Prevent the hashmap of the seen media to be filled
setMediaSeenHashmapFingerprint.method.returnEarly()
}

View File

@@ -33,7 +33,7 @@ val hideExploreFeedPatch = bytecodePatch(
) {
compatibleWith("com.instagram.android")
execute {
apply {
exploreResponseJsonParserFingerprint.replaceJsonFieldWithBogus(EXPLORE_KEY_TO_BE_HIDDEN)
}
}

View File

@@ -71,7 +71,7 @@ val hideNavigationButtonsPatch = bytecodePatch(
description = "Permanently hides the Create button."
)
execute {
apply {
if (!hideHome!! &&!hideReels!! && !hideDirect!! && !hideSearch!! && !hideProfile!! && !hideCreate!!) {
return@execute Logger.getLogger(this::class.java.name).warning(
"No hide navigation buttons options are enabled. No changes made."

View File

@@ -10,7 +10,7 @@ val hideStoriesPatch = bytecodePatch(
) {
compatibleWith("com.instagram.android")
execute {
apply {
val addStoryMethod = getOrCreateAvatarViewFingerprint.method // Creates Story
val addStoryEndIndex = getOrCreateAvatarViewFingerprint.patternMatch.endIndex

View File

@@ -11,7 +11,7 @@ val hideSuggestedContent = bytecodePatch(
) {
compatibleWith("com.instagram.android")
execute {
apply {
FEED_ITEM_KEYS_TO_BE_HIDDEN.forEach { key ->
feedItemParseFromJsonFingerprint.replaceJsonFieldWithBogus(key)
}

View File

@@ -20,7 +20,7 @@ val enableDeveloperMenuPatch = bytecodePatch(
) {
compatibleWith("com.instagram.android")
execute {
apply {
with(clearNotificationReceiverFingerprint.method) {
indexOfFirstInstructionReversedOrThrow(clearNotificationReceiverFingerprint.stringMatches.first().index) {
val reference = getReference<MethodReference>()

View File

@@ -21,7 +21,7 @@ val openLinksExternallyPatch = bytecodePatch(
compatibleWith("com.instagram.android")
execute {
apply {
inAppBrowserFunctionFingerprint.let {
val stringMatchIndex = it.stringMatches?.first { match -> match.string == TARGET_STRING }!!.index

View File

@@ -29,7 +29,7 @@ val changeLinkSharingDomainPatch = bytecodePatch(
description = "The domain name to use when sharing links."
)
execute {
apply {
getCustomShareDomainFingerprint.method.returnEarly(customDomainHost!!)
editShareLinksPatch { index, register ->

View File

@@ -19,7 +19,7 @@ val sanitizeSharingLinksPatch = bytecodePatch(
dependsOn(sharedExtensionPatch)
execute {
apply {
editShareLinksPatch { index, register ->
addInstructions(
index,

View File

@@ -12,7 +12,7 @@ val signatureCheckPatch = bytecodePatch(
) {
compatibleWith("com.instagram.android")
execute {
apply {
isValidSignatureMethodFingerprint
.match(isValidSignatureClassFingerprint.classDef)
.method

View File

@@ -13,7 +13,7 @@ val disableReelsScrollingPatch = bytecodePatch(
) {
compatibleWith("com.instagram.android")
execute {
apply {
val viewPagerField = clipsViewPagerImplGetViewAtIndexFingerprint.classDef.fields.first {
it.type == "Landroidx/viewpager2/widget/ViewPager2;"
}

View File

@@ -11,7 +11,7 @@ val disableStoryAutoFlippingPatch = bytecodePatch(
) {
compatibleWith("com.instagram.android")
execute {
apply {
onStoryTimeoutActionFingerprint.method.returnEarly()
}
}

View File

@@ -9,7 +9,7 @@ val removeAdsPatch = bytecodePatch(
) {
compatibleWith("net.binarymode.android.irplus")
execute {
apply {
// By overwriting the second parameter of the method,
// the view which holds the advertisement is removed.
irplusAdsFingerprint.method.addInstruction(0, "const/4 p2, 0x0")

View File

@@ -11,7 +11,7 @@ val hideAdsPatch = bytecodePatch(
) {
compatibleWith("com.letterboxd.letterboxd")
execute {
apply {
admobHelperSetShowAdsFingerprint.method.addInstruction(0, "const p1, 0x0")
listOf(admobHelperShouldShowAdsFingerprint, filmFragmentShowAdsFingerprint, memberExtensionShowAdsFingerprint).forEach {
it.method.returnEarly(false)

View File

@@ -11,7 +11,7 @@ val disableVersionCheckPatch = bytecodePatch(
) {
compatibleWith("com.adobe.lrmobile"("9.3.0"))
execute {
apply {
refreshRemoteConfigurationFingerprint.method.apply {
val igetIndex = refreshRemoteConfigurationFingerprint.patternMatch!!.endIndex

View File

@@ -9,7 +9,7 @@ val disableMandatoryLoginPatch = bytecodePatch(
) {
compatibleWith("com.adobe.lrmobile"("9.3.0"))
execute {
apply {
isLoggedInFingerprint.method.apply {
val index = implementation!!.instructions.lastIndex - 1
// Set isLoggedIn = true.

View File

@@ -9,7 +9,7 @@ val unlockPremiumPatch = bytecodePatch(
) {
compatibleWith("com.adobe.lrmobile"("9.3.0"))
execute {
apply {
// Set hasPremium = true.
hasPurchasedFingerprint.method.replaceInstruction(2, "const/4 v2, 0x1")
}

View File

@@ -7,7 +7,7 @@ val licenseValidationPatch = bytecodePatch(
description = "Disables Firebase license validation.",
) {
execute {
apply {
licenseValidationFingerprint.method.replaceInstructions(
0,
"""

View File

@@ -7,7 +7,7 @@ val signatureVerificationPatch = bytecodePatch(
description = "Disables detection of incorrect signature.",
) {
execute {
apply {
verifySignatureFingerprint.method.replaceInstructions(
0,
"""

View File

@@ -13,7 +13,7 @@ val unlockProVersionPatch = bytecodePatch(
compatibleWith("com.zombodroid.MemeGenerator"("4.6364", "4.6370", "4.6375", "4.6377"))
execute {
apply {
isFreeVersionFingerprint.method.replaceInstructions(
0,
"""

View File

@@ -10,7 +10,7 @@ val hideInboxAdsPatch = bytecodePatch(
) {
compatibleWith("com.facebook.orca")
execute {
apply {
loadInboxAdsFingerprint.method.replaceInstruction(0, "return-void")
}
}

View File

@@ -10,7 +10,7 @@ val hideInboxSubtabsPatch = bytecodePatch(
) {
compatibleWith("com.facebook.orca")
execute {
apply {
createInboxSubTabsFingerprint.method.replaceInstruction(2, "const/4 v0, 0x0")
}
}

View File

@@ -10,7 +10,7 @@ val hideFacebookButtonPatch = bytecodePatch(
) {
compatibleWith("com.facebook.orca")
execute {
apply {
isFacebookButtonEnabledFingerprint.method.returnEarly(false)
}
}

View File

@@ -20,7 +20,7 @@ val removeMetaAIPatch = bytecodePatch(
dependsOn(sharedExtensionPatch)
execute {
apply {
getMobileConfigBoolFingerprint.method.apply {
val returnIndex = getMobileConfigBoolFingerprint.patternMatch.startIndex
val returnRegister = getInstruction<OneRegisterInstruction>(returnIndex).registerA

View File

@@ -15,7 +15,7 @@ val forceEnglishLocalePatch = bytecodePatch(
dependsOn(fixLoginPatch)
execute {
apply {
syncBluetoothLanguageFingerprint.method.apply {
val resolvePhoneLocaleInstruction = syncBluetoothLanguageFingerprint.instructionMatches.first().index
val registerIndexToUpdate = getInstruction<OneRegisterInstruction>(resolvePhoneLocaleInstruction).registerA

View File

@@ -9,7 +9,7 @@ val fixLoginPatch = bytecodePatch(
) {
compatibleWith("com.xiaomi.wearable")
execute {
apply {
xiaomiAccountManagerConstructorFingerprint.method.addInstruction(0, "const/16 p2, 0x0")
}
}

View File

@@ -29,7 +29,7 @@ val hideVideoAdsPatch = bytecodePatch(
)
)
execute {
apply {
addResources("music", "ad.video.hideVideoAdsPatch")
PreferenceScreen.ADS.addPreferences(

View File

@@ -22,7 +22,7 @@ val enableExclusiveAudioPlaybackPatch = bytecodePatch(
)
)
execute {
apply {
allowExclusiveAudioPlaybackFingerprint.method.returnEarly(true)
}
}

View File

@@ -32,7 +32,7 @@ val permanentRepeatPatch = bytecodePatch(
)
)
execute {
apply {
addResources("music", "interaction.permanentrepeat.permanentRepeatPatch")
PreferenceScreen.PLAYER.addPreferences(

View File

@@ -24,7 +24,7 @@ private val disableSplashAnimationPatch = bytecodePatch {
dependsOn(resourceMappingPatch)
execute {
apply {
// The existing YT animation usually only shows for a fraction of a second,
// and the existing animation does not match the new splash screen
// causing the original YT Music logo to momentarily flash on screen as the animation starts.

View File

@@ -51,7 +51,7 @@ val hideButtons = bytecodePatch(
)
)
execute {
apply {
playerOverlayChip = getResourceId(ResourceType.ID, "player_overlay_chip")
historyMenuItem = getResourceId(ResourceType.ID, "history_menu_item")
offlineSettingsMenuItem = getResourceId(ResourceType.ID, "offline_settings_menu_item")

View File

@@ -36,7 +36,7 @@ val hideCategoryBar = bytecodePatch(
)
)
execute {
apply {
addResources("music", "layout.compactheader.hideCategoryBar")
PreferenceScreen.GENERAL.addPreferences(

View File

@@ -43,7 +43,7 @@ val changeMiniplayerColor = bytecodePatch(
)
)
execute {
apply {
addResources("music", "layout.miniplayercolor.changeMiniplayerColor")
PreferenceScreen.PLAYER.addPreferences(

View File

@@ -38,7 +38,7 @@ val navigationBarPatch = bytecodePatch(
settingsPatch,
addResourcesPatch,
resourcePatch {
execute {
apply {
// Ensure the first ImageView has 'layout_weight' to stay properly sized
// when the TextView is hidden.
document("res/layout/image_with_text_tab.xml").use { document ->
@@ -62,7 +62,7 @@ val navigationBarPatch = bytecodePatch(
)
)
execute {
apply {
text1 = getResourceId(ResourceType.ID, "text1")
addResources("music", "layout.navigationbar.navigationBarPatch")

View File

@@ -33,7 +33,7 @@ val hideGetPremiumPatch = bytecodePatch(
)
)
execute {
apply {
addResources("music", "layout.premium.hideGetPremiumPatch")
PreferenceScreen.ADS.addPreferences(

View File

@@ -22,7 +22,7 @@ val bypassCertificateChecksPatch = bytecodePatch(
)
)
execute {
apply {
checkCertificateFingerprint.method.returnEarly(true)
}
}

View File

@@ -22,7 +22,7 @@ val backgroundPlaybackPatch = bytecodePatch(
)
)
execute {
apply {
kidsBackgroundPlaybackPolicyControllerFingerprint.method.addInstruction(
0,
"return-void",

View File

@@ -11,7 +11,7 @@ internal fun fileProviderPatch(
) = bytecodePatch(
description = "Fixes broken YouTube Music file provider that prevents sharing with specific apps such as Instagram."
) {
finalize {
afterDependents {
// Must do modification last, so change package name value is correctly set.
val musicChangedPackageName = setOrGetFallbackPackageName(musicPackageName)

View File

@@ -8,14 +8,7 @@ import app.revanced.patches.all.misc.resources.addResourcesPatch
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
import app.revanced.patches.shared.misc.settings.preference.BasePreference
import app.revanced.patches.shared.misc.settings.preference.BasePreferenceScreen
import app.revanced.patches.shared.misc.settings.preference.InputType
import app.revanced.patches.shared.misc.settings.preference.IntentPreference
import app.revanced.patches.shared.misc.settings.preference.NonInteractivePreference
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.shared.misc.settings.preference.TextPreference
import app.revanced.patches.shared.misc.settings.preference.*
import app.revanced.patches.shared.misc.settings.settingsPatch
import app.revanced.patches.youtube.misc.settings.modifyActivityForSettingsInjection
import app.revanced.util.copyXmlNode
@@ -41,7 +34,7 @@ private val settingsResourcePatch = resourcePatch {
)
)
execute {
apply {
// Set the style for the ReVanced settings to follow the style of the music settings,
// namely: action bar height, menu item padding and remove horizontal dividers.
@@ -80,7 +73,7 @@ val settingsPatch = bytecodePatch(
addResourcesPatch,
)
execute {
apply {
addResources("music", "misc.settings.settingsPatch")
addResources("shared", "misc.debugging.enableDebuggingPatch")
@@ -114,7 +107,7 @@ val settingsPatch = bytecodePatch(
)
}
finalize {
afterDependents {
PreferenceScreen.close()
}
}

View File

@@ -24,7 +24,7 @@ var is_8_15_or_greater: Boolean by Delegates.notNull()
val versionCheckPatch = resourcePatch(
description = "Uses the Play Store service version to find the major/minor version of the YouTube Music target app.",
) {
execute {
apply {
// The app version is missing from the decompiled manifest,
// so instead use the Google Play services version and compare against specific releases.
val playStoreServicesVersion = findPlayStoreServicesVersion()

View File

@@ -9,7 +9,7 @@ val unlockProPatch = bytecodePatch(
) {
compatibleWith("org.totschnig.myexpenses"("3.4.9"))
execute {
apply {
isEnabledFingerprint.method.addInstructions(
0,
"""

View File

@@ -10,7 +10,7 @@ val hideAdsPatch = bytecodePatch(
) {
compatibleWith("com.myfitnesspal.android"("24.14.2"))
execute {
apply {
// Overwrite the premium status specifically for ads.
isPremiumUseCaseImplFingerprint.method.replaceInstructions(
0,

View File

@@ -10,7 +10,7 @@ val removeBroadcastsRestrictionPatch = resourcePatch(
) {
compatibleWith("eu.faircode.netguard")
execute {
apply {
document("AndroidManifest.xml").use { document ->
val applicationNode =
document

View File

@@ -18,7 +18,7 @@ val hideAdsPatch = bytecodePatch(
dependsOn(sharedExtensionPatch("nunl", mainActivityOnCreateHook))
execute {
apply {
// Disable video pre-roll ads.
// Whenever the app tries to define the advertising config for JWPlayer, don't set the advertising config and directly return.
val iputInstructionIndex = jwPlayerConfigFingerprint.method.indexOfFirstInstructionOrThrow(Opcode.IPUT_OBJECT)

View File

@@ -10,7 +10,7 @@ val spoofCertificatePatch = bytecodePatch(
) {
compatibleWith("nl.sanomamedia.android.nu")
execute {
apply {
getFingerprintHashForPackageFingerprints.forEach { fingerprint ->
fingerprint.method.returnEarly("eae41fc018df2731a9b6ae1ac327da44a288667b")
}

View File

@@ -17,7 +17,7 @@ val fixCrashPatch = bytecodePatch(
) {
compatibleWith("de.simon.openinghours"("1.0"))
execute {
apply {
val indexedInstructions = setPlaceFingerprint.method.instructions.withIndex().toList()
/**

View File

@@ -12,7 +12,7 @@ val removeRootDetectionPatch = bytecodePatch(
) {
compatibleWith("com.nousguide.android.orftvthek")
execute {
apply {
isDeviceRootedFingeprint.method.returnEarly(false)
}
}

View File

@@ -9,7 +9,7 @@ val disableAudioAdsPatch = bytecodePatch(
) {
compatibleWith("com.pandora.android")
execute {
apply {
getIsAdSupportedFingerprint.method.returnEarly(false)
requestAudioAdFingerprint.method.returnEarly()
}

View File

@@ -9,7 +9,7 @@ val enableUnlimitedSkipsPatch = bytecodePatch(
) {
compatibleWith("com.pandora.android")
execute {
apply {
skipLimitBehaviorFingerprint.method.returnEarly("unlimited")
}
}

View File

@@ -10,7 +10,7 @@ val hideAdsPatch = bytecodePatch(
) {
compatibleWith("com.peacocktv.peacockandroid")
execute {
apply {
mediaTailerAdServiceFingerprint.method.returnEarly(false)
}
}

View File

@@ -14,7 +14,7 @@ val getDeviceIdPatch = bytecodePatch(
compatibleWith("com.microblink.photomath")
execute {
apply {
getDeviceIdFingerprint.method.returnEarly(Random.nextLong().toString(16))
}
}

View File

@@ -9,7 +9,7 @@ val signatureDetectionPatch = bytecodePatch(
description = "Disables detection of incorrect signature.",
) {
execute {
apply {
val replacementIndex = checkSignatureFingerprint.instructionMatches.last().index
val checkRegister =
checkSignatureFingerprint.method.getInstruction<OneRegisterInstruction>(replacementIndex).registerA

View File

@@ -13,7 +13,7 @@ val hideUpdatePopupPatch = bytecodePatch(
compatibleWith("com.microblink.photomath")
execute {
apply {
hideUpdatePopupFingerprint.method.addInstructions(
2, // Insert after the null check.
"return-void",

View File

@@ -7,7 +7,7 @@ val enableBookpointPatch = bytecodePatch(
description = "Enables textbook access",
) {
execute {
apply {
isBookpointEnabledFingerprint.method.replaceInstructions(
0,
"""

View File

@@ -13,7 +13,7 @@ val unlockPlusPatch = bytecodePatch(
compatibleWith("com.microblink.photomath")
execute {
apply {
isPlusUnlockedFingerprint.method.addInstructions(
0,
"""

View File

@@ -39,7 +39,7 @@ val spoofAndroidDeviceIdPatch = bytecodePatch(
required = true,
) { it!!.matches("[A-Fa-f0-9]{16}".toRegex()) }
execute {
apply {
getAndroidIdFingerprint.method.returnEarly(androidDeviceId!!)
}
}

View File

@@ -33,7 +33,7 @@ val disableTrackingPatch = bytecodePatch(
),
)
execute {
apply {
facebookSDKFingerprint.method.apply {
instructions.filter { instruction ->
instruction.opcode == Opcode.CONST_STRING

View File

@@ -9,7 +9,7 @@ val hideAdsPatch = bytecodePatch(
) {
compatibleWith("jp.pxv.android"("6.141.1"))
execute {
apply {
shouldShowAdsFingerprint.method.returnEarly(false)
}
}

View File

@@ -18,7 +18,7 @@ val skipAdsPatch = bytecodePatch(
// Skip all the logic in ServerInsertedAdBreakState.enter(), which plays all the ad clips in this
// ad break. Instead, force the video player to seek over the entire break and reset the state machine.
execute {
apply {
// Force doTrigger() access to public so we can call it from our extension.
doTriggerFingerprint.method.accessFlags = AccessFlags.PUBLIC.value;

Some files were not shown because too many files have changed in this diff Show More