Merge remote-tracking branch 'upstream/dev' into chore/lint

# Conflicts:
#	gradle.properties
#	src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt
#	src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt
#	src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt
This commit is contained in:
LisoUseInAIKyrios 2024-03-31 23:28:19 +04:00
commit 4ee26c77b0
20 changed files with 234 additions and 113 deletions

View File

@ -1,3 +1,39 @@
# [4.6.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.5.1-dev.2...v4.6.0-dev.1) (2024-03-31)
### Features
* **Tumblr:** Add `Fix old versions` patch ([#2954](https://github.com/ReVanced/revanced-patches/issues/2954)) ([2fde60e](https://github.com/ReVanced/revanced-patches/commit/2fde60eceb0a96fa857c32cd55c1fd7fe776a679))
## [4.5.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.5.1-dev.1...v4.5.1-dev.2) (2024-03-30)
### Bug Fixes
* **Mi Fitness - Fix login:** Patch correct register ([#2942](https://github.com/ReVanced/revanced-patches/issues/2942)) ([dc96942](https://github.com/ReVanced/revanced-patches/commit/dc969422b5d50f21e6ea7a64b67dfc650fee6e36))
## [4.5.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.5.0...v4.5.1-dev.1) (2024-03-30)
### Bug Fixes
* **Tumblr:** Restore compatibility with latest versions ([#2955](https://github.com/ReVanced/revanced-patches/issues/2955)) ([2954ba7](https://github.com/ReVanced/revanced-patches/commit/2954ba78d21d77308404961f79234bbec606d42e))
# [4.5.0](https://github.com/ReVanced/revanced-patches/compare/v4.4.0...v4.5.0) (2024-03-30)
### Features
* **YouTube - Alternative thumbnails:** Selectively enable for home / subscription / search ([#2926](https://github.com/ReVanced/revanced-patches/issues/2926)) ([8549e1b](https://github.com/ReVanced/revanced-patches/commit/8549e1ba58ad1e1608f5e3ceacd31eeb94578949))
* **YouTube - GmsCore:** Require ignoring battery optimizations ([#2952](https://github.com/ReVanced/revanced-patches/issues/2952)) ([c0bef25](https://github.com/ReVanced/revanced-patches/commit/c0bef255909ca884838675ca6f7ac5b0e2e21730))
# [4.5.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v4.5.0-dev.1...v4.5.0-dev.2) (2024-03-30)
### Features
* **YouTube - GmsCore:** Require ignoring battery optimizations ([#2952](https://github.com/ReVanced/revanced-patches/issues/2952)) ([c0bef25](https://github.com/ReVanced/revanced-patches/commit/c0bef255909ca884838675ca6f7ac5b0e2e21730))
# [4.5.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v4.4.0...v4.5.0-dev.1) (2024-03-29)

View File

@ -1056,6 +1056,16 @@ public final class app/revanced/patches/tumblr/featureflags/OverrideFeatureFlags
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/tumblr/fixes/FixOldVersionsPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/tumblr/fixes/FixOldVersionsPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/tumblr/fixes/fingerprints/HttpPathParserFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
public static final field INSTANCE Lapp/revanced/patches/tumblr/fixes/fingerprints/HttpPathParserFingerprint;
}
public final class app/revanced/patches/tumblr/live/DisableTumblrLivePatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/tumblr/live/DisableTumblrLivePatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V

View File

@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = auto # Use Project style setting.
version = 4.5.0-dev.1
version = 4.6.0-dev.1

View File

@ -2,13 +2,11 @@ package app.revanced.patches.mifitness.misc.login
import app.revanced.patcher.data.BytecodeContext
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.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.mifitness.misc.login.fingerprints.XiaomiAccountManagerConstructorFingerprint
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch(
name = "Fix login",
@ -20,16 +18,9 @@ object FixLoginPatch : BytecodePatch(
setOf(XiaomiAccountManagerConstructorFingerprint),
) {
override fun execute(context: BytecodeContext) {
XiaomiAccountManagerConstructorFingerprint.result?.let {
it.mutableMethod.apply {
val isCertifiedIndex = it.scanResult.patternScanResult!!.startIndex
val isCertifiedRegister = getInstruction<OneRegisterInstruction>(isCertifiedIndex).registerA
addInstruction(
isCertifiedIndex,
"const/4 p$isCertifiedRegister, 0x0",
)
}
} ?: throw XiaomiAccountManagerConstructorFingerprint.exception
XiaomiAccountManagerConstructorFingerprint.result?.mutableMethod?.addInstruction(
0,
"const/16 p2, 0x0",
) ?: throw XiaomiAccountManagerConstructorFingerprint.exception
}
}

View File

@ -3,12 +3,14 @@ package app.revanced.patches.mifitness.misc.login.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
internal object XiaomiAccountManagerConstructorFingerprint : MethodFingerprint(
accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/xiaomi/passport/accountmanager/XiaomiAccountManager;"
},
opcodes = listOf(Opcode.IF_NEZ),
parameters = listOf(
"Landroid/content/Context;",
"Z",
),
)

View File

@ -34,5 +34,5 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
PrimeMethodFingerprint,
),
) {
override val gmsCoreVendor by gmsCoreVendorGroupIdOption
override val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption
}

View File

@ -2,7 +2,7 @@ package app.revanced.patches.shared.misc.gms
import app.revanced.patcher.PatchClass
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.fingerprint.MethodFingerprint
@ -12,7 +12,7 @@ import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.AC
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.AUTHORITIES
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.PERMISSIONS
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint.GET_GMS_CORE_VENDOR_METHOD_NAME
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint.GET_GMS_CORE_VENDOR_GROUP_ID_METHOD_NAME
import app.revanced.util.exception
import app.revanced.util.getReference
import app.revanced.util.returnEarly
@ -32,7 +32,7 @@ import com.android.tools.smali.dexlib2.util.MethodUtil
* @param toPackageName The package name to fall back to if no custom package name is specified in patch options.
* @param primeMethodFingerprint The fingerprint of the "prime" method that needs to be patched.
* @param earlyReturnFingerprints The fingerprints of methods that need to be returned early.
* @param mainActivityOnCreateFingerprint The fingerprint of the main activity's onCreate method.
* @param mainActivityOnCreateFingerprint The fingerprint of the main activity onCreate method.
* @param integrationsPatchDependency The patch responsible for the integrations.
* @param gmsCoreSupportResourcePatch The corresponding resource patch that is used to patch the resources.
* @param dependencies Additional dependencies of this patch.
@ -60,7 +60,10 @@ abstract class BaseGmsCoreSupportPatch(
integrationsPatchDependency,
) + dependencies,
compatiblePackages = compatiblePackages,
fingerprints = setOf(GmsCoreSupportFingerprint, mainActivityOnCreateFingerprint) + fingerprints,
fingerprints = setOf(
GmsCoreSupportFingerprint,
mainActivityOnCreateFingerprint,
) + fingerprints,
requiresIntegrations = true,
) {
init {
@ -68,7 +71,7 @@ abstract class BaseGmsCoreSupportPatch(
gmsCoreSupportResourcePatch.options.values.forEach(options::register)
}
internal abstract val gmsCoreVendor: String?
internal abstract val gmsCoreVendorGroupId: String?
override fun execute(context: BytecodeContext) {
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(toPackageName)
@ -93,16 +96,17 @@ abstract class BaseGmsCoreSupportPatch(
// Return these methods early to prevent the app from crashing.
earlyReturnFingerprints.toList().returnEarly()
// Check the availability of GmsCore.
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstruction(
1, // Hack to not disturb other patches (such as the integrations patch).
"invoke-static {}, Lapp/revanced/integrations/shared/GmsCoreSupport;->checkAvailability()V",
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
1, // Hack to not disturb other patches (such as the YTMusic integrations patch).
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
"checkGmsCore(Landroid/content/Context;)V",
) ?: throw mainActivityOnCreateFingerprint.exception
// Change the vendor of GmsCore in ReVanced Integrations.
GmsCoreSupportFingerprint.result?.mutableClass?.methods
?.single { it.name == GET_GMS_CORE_VENDOR_METHOD_NAME }
?.replaceInstruction(0, "const-string v0, \"$gmsCoreVendor\"")
?.single { it.name == GET_GMS_CORE_VENDOR_GROUP_ID_METHOD_NAME }
?.replaceInstruction(0, "const-string v0, \"$gmsCoreVendorGroupId\"")
?: throw GmsCoreSupportFingerprint.exception
}
@ -146,10 +150,10 @@ abstract class BaseGmsCoreSupportPatch(
in PERMISSIONS,
in ACTIONS,
in AUTHORITIES,
-> referencedString.replace("com.google", gmsCoreVendor!!)
-> referencedString.replace("com.google", gmsCoreVendorGroupId!!)
// No vendor prefix for whatever reason...
"subscribedfeeds" -> "$gmsCoreVendor.subscribedfeeds"
"subscribedfeeds" -> "$gmsCoreVendorGroupId.subscribedfeeds"
else -> null
}
@ -162,7 +166,7 @@ abstract class BaseGmsCoreSupportPatch(
if (str.startsWith(uriPrefix)) {
return str.replace(
uriPrefix,
"content://${authority.replace("com.google", gmsCoreVendor!!)}",
"content://${authority.replace("com.google", gmsCoreVendorGroupId!!)}",
)
}
}
@ -170,7 +174,7 @@ abstract class BaseGmsCoreSupportPatch(
// gms also has a 'subscribedfeeds' authority, check for that one too
val subFeedsUriPrefix = "content://subscribedfeeds"
if (str.startsWith(subFeedsUriPrefix)) {
return str.replace(subFeedsUriPrefix, "content://$gmsCoreVendor.subscribedfeeds")
return str.replace(subFeedsUriPrefix, "content://$gmsCoreVendorGroupId.subscribedfeeds")
}
}

View File

@ -121,7 +121,6 @@ abstract class BaseGmsCoreSupportResourcePatch(
}
private companion object {
private const val VANCED_VENDOR = "com.mgoogle"
private const val PACKAGE_NAME_REGEX_PATTERN = "^[a-z]\\w*(\\.[a-z]\\w*)+\$"
}
}

View File

@ -7,5 +7,5 @@ internal object GmsCoreSupportFingerprint : MethodFingerprint(
classDef.type.endsWith("GmsCoreSupport;")
},
) {
const val GET_GMS_CORE_VENDOR_METHOD_NAME = "getGmsCoreVendor"
const val GET_GMS_CORE_VENDOR_GROUP_ID_METHOD_NAME = "getGmsCoreVendorGroupId"
}

View File

@ -1,9 +1,12 @@
package app.revanced.patches.tumblr.annoyances.popups.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
// This method is responsible for loading and displaying the visual Layout of the Gift Message Popup.
internal object ShowGiftMessagePopupFingerprint : MethodFingerprint(
strings = listOf("activity", "anchorView"),
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("GiftMessagePopup;") },
)
strings = listOf("activity", "anchorView", "textMessage"),
returnType = "V",
accessFlags = AccessFlags.FINAL or AccessFlags.PUBLIC
)

View File

@ -28,6 +28,9 @@ object OverrideFeatureFlagsPatch : BytecodePatch(
internal lateinit var addOverride: (name: String, value: String) -> Unit private set
override fun execute(context: BytecodeContext) = GetFeatureValueFingerprint.result?.let {
val configurationClass = it.method.definingClass
val featureClass = it.method.parameterTypes[0].toString()
// The method we want to inject into does not have enough registers, so we inject a helper method
// and inject more instructions into it later, see addOverride.
// This is not in an integration since the unused variable would get compiled away and the method would
@ -35,7 +38,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch(
val helperMethod = ImmutableMethod(
it.method.definingClass,
"getValueOverride",
listOf(ImmutableMethodParameter("Lcom/tumblr/configuration/Feature;", null, "feature")),
listOf(ImmutableMethodParameter(featureClass, null, "feature")),
"Ljava/lang/String;",
AccessFlags.PUBLIC or AccessFlags.FINAL,
null,
@ -50,7 +53,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch(
0,
"""
# toString() the enum value
invoke-virtual {p1}, Lcom/tumblr/configuration/Feature;->toString()Ljava/lang/String;
invoke-virtual {p1}, $featureClass->toString()Ljava/lang/String;
move-result-object v0
# !!! If you add more instructions above this line, update helperInsertIndex below!
@ -75,7 +78,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch(
getFeatureIndex,
"""
# Call the Helper Method with the Feature
invoke-virtual {p0, p1}, Lcom/tumblr/configuration/Configuration;->getValueOverride(Lcom/tumblr/configuration/Feature;)Ljava/lang/String;
invoke-virtual {p0, p1}, $configurationClass->getValueOverride($featureClass)Ljava/lang/String;
move-result-object v0
# If it returned null, skip
if-eqz v0, :is_null

View File

@ -1,6 +1,8 @@
package app.revanced.patches.tumblr.featureflags.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
// This fingerprint targets the method to get the value of a Feature in the class "com.tumblr.configuration.Feature".
@ -17,7 +19,9 @@ internal object GetFeatureValueFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.IF_EQZ,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
Opcode.MOVE_RESULT
),
customFingerprint = { method, _ -> method.definingClass == "Lcom/tumblr/configuration/Configuration;" },
)
returnType = "Ljava/lang/String;",
parameters = listOf("L", "Z"),
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL
)

View File

@ -0,0 +1,38 @@
package app.revanced.patches.tumblr.fixes
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.tumblr.fixes.fingerprints.HttpPathParserFingerprint
import app.revanced.util.exception
@Patch(
name = "Fix old versions",
description = "Fixes old versions of the app (v33.2 and earlier) breaking due to Tumblr removing remnants of Tumblr" +
" Live from the API, which causes many requests to fail. This patch has no effect on newer versions of the app.",
compatiblePackages = [CompatiblePackage("com.tumblr")],
use = false,
)
@Suppress("unused")
object FixOldVersionsPatch : BytecodePatch(
setOf(HttpPathParserFingerprint),
) {
override fun execute(context: BytecodeContext) =
HttpPathParserFingerprint.result?.let {
val endIndex = it.scanResult.patternScanResult!!.endIndex
it.mutableMethod.addInstructions(
endIndex + 1,
"""
# Remove "?live_now" from the request path p2.
# p2 = p2.replace(p1, p3)
const-string p1, ",?live_now"
const-string p3, ""
invoke-virtual {p2, p1, p3}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
move-result-object p2
""",
)
} ?: throw HttpPathParserFingerprint.exception
}

View File

@ -0,0 +1,15 @@
package app.revanced.patches.tumblr.fixes.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
// Fingerprint for the parseHttpMethodAndPath from retrofit2
// https://github.com/square/retrofit/blob/ebf87b10997e2136af4d335276fa950221852c64/retrofit/src/main/java/retrofit2/RequestFactory.java#L270-L302
// Injecting here allows modifying the path/query params of API endpoints defined via annotations
object HttpPathParserFingerprint : MethodFingerprint(
strings = listOf("Only one HTTP method is allowed. Found: %s and %s."),
opcodes = listOf(
Opcode.IPUT_OBJECT,
Opcode.IPUT_BOOLEAN
)
)

View File

@ -8,11 +8,11 @@ import app.revanced.patches.tumblr.featureflags.OverrideFeatureFlagsPatch
import app.revanced.patches.tumblr.timelinefilter.TimelineFilterPatch
@Patch(
name = "Disable Tumblr Live",
description = "Disable the Tumblr Live tab button and dashboard carousel.",
dependencies = [OverrideFeatureFlagsPatch::class, TimelineFilterPatch::class],
compatiblePackages = [CompatiblePackage("com.tumblr")],
)
@Deprecated("Tumblr Live was removed and is no longer served in the feed, making this patch useless.")
@Suppress("unused")
object DisableTumblrLivePatch : BytecodePatch(emptySet()) {
override fun execute(context: BytecodeContext) {

View File

@ -46,7 +46,6 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
)
@Suppress("unused")
object HidePlayerFlyoutMenuPatch : ResourcePatch() {
private const val KEY = "revanced_hide_player_flyout"
private const val FILTER_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/youtube/patches/components/PlayerFlyoutMenuItemsFilter;"
@ -55,21 +54,21 @@ object HidePlayerFlyoutMenuPatch : ResourcePatch() {
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.PLAYER.addPreferences(
PreferenceScreen(
key = KEY,
preferences = setOf(
SwitchPreference("${KEY}_captions"),
SwitchPreference("${KEY}_additional_settings"),
SwitchPreference("${KEY}_loop_video"),
SwitchPreference("${KEY}_ambient_mode"),
SwitchPreference("${KEY}_report"),
SwitchPreference("${KEY}_help"),
SwitchPreference("${KEY}_speed"),
SwitchPreference("${KEY}_more_info"),
SwitchPreference("${KEY}_audio_track"),
SwitchPreference("${KEY}_watch_in_vr"),
),
)
PreferenceScreen(
key = "revanced_hide_player_flyout",
preferences = setOf(
SwitchPreference("revanced_hide_player_flyout_captions"),
SwitchPreference("revanced_hide_player_flyout_additional_settings"),
SwitchPreference("revanced_hide_player_flyout_loop_video"),
SwitchPreference("revanced_hide_player_flyout_ambient_mode"),
SwitchPreference("revanced_hide_player_flyout_report"),
SwitchPreference("revanced_hide_player_flyout_help"),
SwitchPreference("revanced_hide_player_flyout_speed"),
SwitchPreference("revanced_hide_player_flyout_more_info"),
SwitchPreference("revanced_hide_player_flyout_audio_track"),
SwitchPreference("revanced_hide_player_flyout_watch_in_vr"),
)
)
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)

View File

@ -2,26 +2,24 @@ package app.revanced.patches.youtube.misc.announcements
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.all.misc.resources.AddResourcesPatch
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.patches.youtube.shared.fingerprints.MainActivityFingerprint
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.Opcode
import app.revanced.patches.youtube.shared.fingerprints.MainActivityOnCreateFingerprint
import app.revanced.util.resultOrThrow
@Patch(
name = "Announcements",
description = "Adds an option to show announcements from ReVanced on app startup.",
compatiblePackages = [CompatiblePackage("com.google.android.youtube")],
dependencies = [SettingsPatch::class, AddResourcesPatch::class],
dependencies = [SettingsPatch::class,AddResourcesPatch::class]
)
@Suppress("unused")
object AnnouncementsPatch : BytecodePatch(
setOf(MainActivityFingerprint),
setOf(MainActivityOnCreateFingerprint)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/youtube/patches/announcements/AnnouncementsPatch;"
@ -30,18 +28,14 @@ object AnnouncementsPatch : BytecodePatch(
AddResourcesPatch(this::class)
SettingsPatch.PreferenceScreen.MISC.addPreferences(
SwitchPreference("revanced_announcements"),
SwitchPreference("revanced_announcements")
)
val onCreateMethod = MainActivityFingerprint.result?.let {
it.mutableClass.methods.find { method -> method.name == "onCreate" }
} ?: throw MainActivityFingerprint.exception
val superCallIndex = onCreateMethod.getInstructions().indexOfFirst { it.opcode == Opcode.INVOKE_SUPER_RANGE }
onCreateMethod.addInstructions(
superCallIndex + 1,
"invoke-static { v1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->showAnnouncement(Landroid/app/Activity;)V",
MainActivityOnCreateFingerprint.resultOrThrow().mutableMethod.addInstructions(
// Insert index must be great than the insert index used by GmsCoreSupport,
// as both patch the same method and GmsCore check should be first.
1,
"invoke-static/range { p0 .. p0 }, $INTEGRATIONS_CLASS_DESCRIPTOR->showAnnouncement(Landroid/app/Activity;)V"
)
}
}

View File

@ -9,7 +9,7 @@ import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME
import app.revanced.patches.youtube.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
import app.revanced.patches.youtube.misc.gms.fingerprints.*
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.shared.fingerprints.HomeActivityFingerprint
import app.revanced.patches.youtube.shared.fingerprints.MainActivityOnCreateFingerprint
@Suppress("unused")
object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
@ -23,7 +23,7 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
CastDynamiteModuleV2Fingerprint,
CastContextFetchFingerprint,
),
mainActivityOnCreateFingerprint = HomeActivityFingerprint,
mainActivityOnCreateFingerprint = MainActivityOnCreateFingerprint,
integrationsPatchDependency = IntegrationsPatch::class,
dependencies = setOf(
HideCastButtonPatch::class,
@ -57,5 +57,5 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
PrimeMethodFingerprint,
),
) {
override val gmsCoreVendor by gmsCoreVendorGroupIdOption
override val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption
}

View File

@ -0,0 +1,14 @@
package app.revanced.patches.youtube.shared.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
internal object MainActivityOnCreateFingerprint : MethodFingerprint(
returnType = "V",
parameters = listOf("Landroid/os/Bundle;"),
customFingerprint = { methodDef, classDef ->
methodDef.name == "onCreate" &&
(classDef.type.endsWith("MainActivity;")
// Old versions of YouTube called this class "WatchWhileActivity" instead.
|| classDef.type.endsWith("WatchWhileActivity;"))
}
)

View File

@ -13,8 +13,14 @@
<string name="revanced_settings_import_failure_parse">Import failed: %s</string>
</patch>
<patch id="misc.gms.BaseGmsCoreSupportResourcePatch">
<string name="gms_core_not_installed_warning">GmsCore is not installed. Please install.</string>
<string name="gms_core_not_running_warning">GmsCore is failing to run. Please follow the \"Don\'t kill my app\" guide for GmsCore.</string>
<!-- Translations of this should not be longer than what is here, otherwise the text can be clipped and not entirely shown. -->
<string name="gms_core_toast_not_installed_message">GmsCore is not installed. Install it.</string>
<!-- Translations of this should not be longer than what is here, otherwise the text can be clipped and not entirely shown. -->
<string name="gms_core_toast_not_whitelisted_message">Follow the \"Don\'t kill my app\" guide for GmsCore.</string>
<string name="gms_core_dialog_title">Action needed</string>
<string name="gms_core_dialog_not_whitelisted_using_battery_optimizations_message">GmsCore is not whitelisted from battery optimization.\n\nFollow the \"Don\'t kill my app\" guide for GmsCore.</string>
<string name="gms_core_dialog_not_whitelisted_not_allowed_in_background_message">GmsCore does not have permission to run in the background.\n\nFollow the \"Don\'t kill my app\" guide for GmsCore.</string>
<string name="gms_core_dialog_ok_button_text">Open website</string>
</patch>
</app>
<app id="youtube">
@ -183,8 +189,8 @@
<string name="revanced_hide_keyword_content_phrases_summary">Keywords and phrases to hide, separated by new lines\n\nWords with uppercase letters in the middle must be entered with the casing (ie: iPhone, TikTok, LeBlanc)</string>
<string name="revanced_hide_keyword_content_about_title">About keyword filtering</string>
<string name="revanced_hide_keyword_content_about_summary">Home/Subscription/Search results are filtered to hide content that matches keyword phrases\n\nLimitations\n• Some Shorts may not be hidden\n• Some UI components may not be hidden\n• Searching for a keyword may show no results</string>
<string name="revanced_hide_keyword_toast_invalid_common" formatted="false">Invalid keyword. Cannot use: \'%s\' as a filter</string>
<string name="revanced_hide_keyword_toast_invalid_length" formatted="false">Invalid keyword. \'%s\' is less than %s characters</string>
<string name="revanced_hide_keyword_toast_invalid_common">Invalid keyword. Cannot use: \'%s\' as a filter</string>
<string name="revanced_hide_keyword_toast_invalid_length">Invalid keyword. \'%1$s\' is less than %2$s characters</string>
</patch>
<patch id="ad.general.HideAdsResourcePatch">
<string name="revanced_hide_general_ads_title">Hide general ads</string>
@ -462,9 +468,6 @@
<string name="revanced_hide_load_more_button_summary_on">Button is hidden</string>
<string name="revanced_hide_load_more_button_summary_off">Button is shown</string>
</patch>
<patch id="layout.hide.player.flyoutmenupanel.HidePlayerFlyoutMenuPatch">
<string name="video_title">Video</string>
</patch>
<patch id="layout.hide.rollingnumber.DisableRollingNumberAnimationPatch">
<string name="revanced_disable_rolling_number_animations_title">Disable rolling number animations</string>
<string name="revanced_disable_rolling_number_animations_summary_on">Rolling numbers are not animated</string>
@ -560,16 +563,16 @@
<string name="revanced_ryd_settings_title">Return YouTube Dislike</string>
<string name="revanced_ryd_video_likes_hidden_by_video_owner">Hidden</string>
<string name="revanced_ryd_failure_connection_timeout">Dislikes temporarily not available (API timed out)</string>
<string name="revanced_ryd_failure_connection_status_code" formatted="false">Dislikes not available (status %d)</string>
<string name="revanced_ryd_failure_connection_status_code">Dislikes not available (status %d)</string>
<string name="revanced_ryd_failure_client_rate_limit_requested">Dislikes not available (client API limit reached)</string>
<string name="revanced_ryd_failure_generic">Dislikes not available (%s)</string>
<!-- corner case situation, where user enables RYD while video is playing and then tries
to vote for the video -->
<!-- corner case situation, where user enables RYD while video is playing and then tries to vote for the video -->
<string name="revanced_ryd_failure_ryd_enabled_while_playing_video_then_user_voted">Reload video to vote using ReturnYouTubeDislike</string>
<string name="revanced_ryd_enable_title">Return YouTube Dislike</string>
<string name="revanced_ryd_enable_summary_on">Dislikes are shown</string>
<string name="revanced_ryd_enable_summary_off">Dislikes are not shown</string>
<string name="revanced_ryd_shorts_title">Show dislikes on Shorts</string>
<!-- The %s string is either 'revanced_ryd_shorts_summary_disclaimer', or it is an empty string. This text should read normally in both situations. -->
<string name="revanced_ryd_shorts_summary_on">Dislikes shown on Shorts %s</string>
<string name="revanced_ryd_shorts_summary_off">Dislikes hidden on Shorts</string>
<string name="revanced_ryd_shorts_summary_disclaimer">Limitation: Dislikes may not appear in incognito mode</string>
@ -585,6 +588,7 @@
<string name="revanced_ryd_about">About</string>
<string name="revanced_ryd_attribution_title">ReturnYouTubeDislike.com</string>
<string name="revanced_ryd_attribution_summary">Data is provided by the Return YouTube Dislike API. Tap here to learn more</string>
<!-- Statistic strings are shown in the settings only when ReVanced debug mode is enabled. Typical users will never see these statistics. -->
<string name="revanced_ryd_statistics_category_title">ReturnYouTubeDislike API statistics of this device</string>
<string name="revanced_ryd_statistics_getFetchCallResponseTimeAverage_title">API response time, average</string>
<string name="revanced_ryd_statistics_getFetchCallResponseTimeMin_title">API response time, minimum</string>
@ -595,8 +599,7 @@
<string name="revanced_ryd_statistics_getFetchCallCount_zero_summary">No network calls made</string>
<string name="revanced_ryd_statistics_getFetchCallCount_non_zero_summary">%d network calls made</string>
<string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_title">API fetch votes, number of timeouts</string>
<string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_zero_summary">No
network calls timed out</string>
<string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_zero_summary">No network calls timed out</string>
<string name="revanced_ryd_statistics_getFetchCallNumberOfFailures_non_zero_summary">%d network calls timed out</string>
<string name="revanced_ryd_statistics_getNumberOfRateLimitRequestsEncountered_title">API client rate limits</string>
<string name="revanced_ryd_statistics_getNumberOfRateLimitRequestsEncountered_zero_summary">No client rate limits encountered</string>
@ -727,19 +730,19 @@
<string name="revanced_sb_skip_showbutton">Show a skip button</string>
<string name="revanced_sb_skip_seekbaronly">Show in seek bar</string>
<string name="revanced_sb_skip_ignore">Disable</string>
<string name="revanced_sb_submit_failed_invalid" formatted="false">Unable to submit segment: %s</string>
<string name="revanced_sb_submit_failed_invalid">Unable to submit segment: %s</string>
<string name="revanced_sb_submit_failed_timeout">SponsorBlock is temporarily down</string>
<string name="revanced_sb_submit_failed_unknown_error" formatted="false">Unable to submit segment (status: %d %s)</string>
<string name="revanced_sb_submit_failed_unknown_error">Unable to submit segment (status: %1$d %2$s)</string>
<string name="revanced_sb_submit_failed_rate_limit">Unable to submit segment.\nRate Limited (too many from the same user or IP)</string>
<string name="revanced_sb_submit_failed_forbidden" formatted="false">Can\'t submit the segment: %s</string>
<string name="revanced_sb_submit_failed_forbidden">Can\'t submit the segment: %s</string>
<string name="revanced_sb_submit_failed_duplicate">Can\'t submit the segment.\nAlready exists</string>
<string name="revanced_sb_submit_succeeded">Segment submitted successfully</string>
<string name="revanced_sb_sponsorblock_connection_failure_generic">SponsorBlock temporarily not available</string>
<string name="revanced_sb_sponsorblock_connection_failure_status" formatted="false">SponsorBlock temporarily not available (status %d)</string>
<string name="revanced_sb_sponsorblock_connection_failure_status">SponsorBlock temporarily not available (status %d)</string>
<string name="revanced_sb_sponsorblock_connection_failure_timeout">SponsorBlock temporarily not available (API timed out)</string>
<string name="revanced_sb_vote_failed_timeout">Unable to vote for segment (API timed out)</string>
<string name="revanced_sb_vote_failed_unknown_error" formatted="false">Unable to vote for segment (status: %d %s)</string>
<string name="revanced_sb_vote_failed_forbidden" formatted="false">Unable to vote for segment: %s</string>
<string name="revanced_sb_vote_failed_unknown_error">Unable to vote for segment (status: %1$d %2$s)</string>
<string name="revanced_sb_vote_failed_forbidden">Unable to vote for segment: %s</string>
<string name="revanced_sb_vote_upvote">Upvote</string>
<string name="revanced_sb_vote_downvote">Downvote</string>
<string name="revanced_sb_vote_category">Change category</string>
@ -747,14 +750,14 @@
<string name="revanced_sb_new_segment_choose_category">Choose the segment category</string>
<string name="revanced_sb_new_segment_disabled_category">Category is disabled in settings. Enable category to submit.</string>
<string name="revanced_sb_new_segment_title">New SponsorBlock segment</string>
<string name="revanced_sb_new_segment_mark_time_as_question" formatted="false">Set %02d:%02d:%03d as the start or end of a new segment?</string>
<string name="revanced_sb_new_segment_mark_time_as_question">Set %1$02d:%2$02d:%3$03d as the start or end of a new segment?</string>
<string name="revanced_sb_new_segment_mark_start">start</string>
<string name="revanced_sb_new_segment_mark_end">end</string>
<string name="revanced_sb_new_segment_now">now</string>
<string name="revanced_sb_new_segment_time_start">Time the segment begins at</string>
<string name="revanced_sb_new_segment_time_end">Time the segment ends at</string>
<string name="revanced_sb_new_segment_confirm_title">Are the times correct?</string>
<string name="revanced_sb_new_segment_confirm_content" formatted="false">The segment lasts from %02d:%02d to %02d:%02d (%d minutes %02d seconds)\nIs it ready to submit?</string>
<string name="revanced_sb_new_segment_confirm_content">The segment lasts from %1$02d:%2$02d to %3$02d:%4$02d (%5$d minutes %6$02d seconds)\nIs it ready to submit?</string>
<string name="revanced_sb_new_segment_start_is_before_end">Start must be before the end</string>
<string name="revanced_sb_new_segment_mark_locations_first">Mark two locations on the time bar first</string>
<string name="revanced_sb_new_segment_preview_segment_first">Preview the segment, and ensure it skips smoothly</string>
@ -765,22 +768,22 @@
<string name="revanced_sb_stats_connection_failure">Stats temporarily not available (API is down)</string>
<string name="revanced_sb_stats_loading">Loading...</string>
<string name="revanced_sb_stats_sb_disabled">SponsorBlock is disabled</string>
<string name="revanced_sb_stats_username" formatted="false">Your username: &lt;b>%s&lt;/b></string>
<string name="revanced_sb_stats_username">Your username: &lt;b>%s&lt;/b></string>
<string name="revanced_sb_stats_username_change">Tap here to change your username</string>
<string name="revanced_sb_stats_username_change_unknown_error" formatted="false">Unable to change username: Status: %d %s</string>
<string name="revanced_sb_stats_username_change_unknown_error">Unable to change username: Status: %1$d %2$s</string>
<string name="revanced_sb_stats_username_changed">Username successfully changed</string>
<string name="revanced_sb_stats_reputation" formatted="false">Your reputation is &lt;b>%.2f&lt;/b></string>
<string name="revanced_sb_stats_submissions" formatted="false">You\'ve created &lt;b>%s&lt;/b> segments</string>
<string name="revanced_sb_stats_reputation">Your reputation is &lt;b>%.2f&lt;/b></string>
<string name="revanced_sb_stats_submissions">You\'ve created &lt;b>%s&lt;/b> segments</string>
<string name="revanced_sb_stats_saved_zero">SponsorBlock leaderboard</string>
<string name="revanced_sb_stats_saved" formatted="false">You\'ve saved people from &lt;b>%s&lt;/b> segments</string>
<string name="revanced_sb_stats_saved">You\'ve saved people from &lt;b>%s&lt;/b> segments</string>
<string name="revanced_sb_stats_saved_sum_zero">Tap here to see the global stats and top contributors</string>
<string name="revanced_sb_stats_saved_sum" formatted="false">That\'s &lt;b>%s&lt;/b> of their lives.&lt;br>Tap here to see the leaderboard</string>
<string name="revanced_sb_stats_self_saved" formatted="false">You\'ve skipped &lt;b>%s&lt;/b> segments</string>
<string name="revanced_sb_stats_self_saved_sum" formatted="false">That\'s &lt;b>%s&lt;/b></string>
<string name="revanced_sb_stats_saved_sum">That\'s &lt;b>%s&lt;/b> of their lives.&lt;br>Tap here to see the leaderboard</string>
<string name="revanced_sb_stats_self_saved">You\'ve skipped &lt;b>%s&lt;/b> segments</string>
<string name="revanced_sb_stats_self_saved_sum">That\'s &lt;b>%s&lt;/b></string>
<string name="revanced_sb_stats_self_saved_reset_title">Reset skipped segments counter?</string>
<string name="revanced_sb_stats_saved_hour_format" formatted="false">%s hours %s minutes</string>
<string name="revanced_sb_stats_saved_minute_format" formatted="false">%s minutes %s seconds</string>
<string name="revanced_sb_stats_saved_second_format" formatted="false">%s seconds</string>
<string name="revanced_sb_stats_saved_hour_format">%1$s hours %2$s minutes</string>
<string name="revanced_sb_stats_saved_minute_format">%1$s minutes %2$s seconds</string>
<string name="revanced_sb_stats_saved_second_format">%s seconds</string>
<string name="revanced_sb_color_dot_label">Color:</string>
<string name="revanced_sb_color_changed">Color changed</string>
<string name="revanced_sb_color_reset">Color reset</string>
@ -796,7 +799,10 @@
<string name="revanced_spoof_app_version_summary_on">Version spoofed</string>
<string name="revanced_spoof_app_version_summary_off">Version not spoofed</string>
<string name="revanced_spoof_app_version_user_dialog_message">App version will be spoofed to an older version of YouTube.\n\nThis will change the appearance and features of the app, but unknown side effects may occur.\n\nIf later turned off, it is recommended to clear the app data to prevent UI bugs.</string>
<!-- It is ideal, but not required, if the text here appears alphabetically after the text used for 'revanced_spoof_app_version_title'.
This is because the 'General layout' menu uses alphabetic sorting, and it functionally works better if the spoof target selector appears below the 'Spoof app version' UI switch -->
<string name="revanced_spoof_app_version_target_title">Spoof app version target</string>
<!-- 'RYD' is referring to 'Return YouTube Dislike' -->
<string name="revanced_spoof_app_version_target_entry_1">18.33.40 - Restore RYD on Shorts incognito mode</string>
<string name="revanced_spoof_app_version_target_entry_2">18.20.39 - Restore wide video speed &amp; quality menu</string>
<string name="revanced_spoof_app_version_target_entry_3">18.09.39 - Restore library tab</string>
@ -881,6 +887,7 @@
<string name="revanced_announcements_summary_off">Announcements are not shown on startup</string>
<string name="revanced_announcements_enabled_summary">Show announcements on startup</string>
<string name="revanced_announcements_connection_failed">Failed connecting to announcements provider</string>
<string name="revanced_announcements_dialog_dismiss">Dismiss</string>
</patch>
<patch id="misc.autorepeat.AutoRepeatPatch">
<string name="revanced_auto_repeat_title">Enable auto-repeat</string>
@ -892,6 +899,7 @@
<string name="revanced_spoof_device_dimensions_summary_on">Device dimensions spoofed</string>
<string name="revanced_spoof_device_dimensions_summary_off">Device dimensions not spoofed\n\nSpoofing the device dimensions can unlock higher video qualities but unknown side effects may occur</string>
</patch>
<!-- This patch is no longer used, these strings are not in use, and these strings likely will be deleted in the future. -->
<patch id="misc.fix.playback.SpoofSignaturePatch">
<string name="revanced_spoof_signature_verification_screen_title">Spoof app signature</string>
<string name="revanced_spoof_signature_verification_screen_summary">Spoof the app signature to prevent playback issues</string>
@ -936,6 +944,7 @@
<string name="revanced_disable_zoom_haptics_summary_on">Haptics are disabled</string>
<string name="revanced_disable_zoom_haptics_summary_off">Haptics are enabled</string>
</patch>
<!-- This patch is no longer used and these strings will soon be deleted. -->
<patch id="video.hdrbrightness.HDRBrightnessPatch">
<string name="revanced_hdr_auto_brightness_title">Enable auto HDR brightness</string>
<string name="revanced_hdr_auto_brightness_summary_on">Auto HDR brightness is enabled</string>
@ -958,12 +967,12 @@
<string name="revanced_video_quality_default_mobile_title">Default video quality on mobile network</string>
<string name="revanced_remember_video_quality_mobile">mobile</string>
<string name="revanced_remember_video_quality_wifi">wifi</string>
<string name="revanced_remember_video_quality_toast" formatted="false">Changed default %s quality to: %s</string>
<string name="revanced_remember_video_quality_toast">Changed default %1$s quality to: %2$s</string>
</patch>
<patch id="video.speed.custom.CustomPlaybackSpeedPatch">
<string name="revanced_custom_playback_speeds_title">Custom playback speeds</string>
<string name="revanced_custom_playback_speeds_summary">Add or change the available playback speeds</string>
<string name="revanced_custom_playback_speeds_invalid" formatted="false">Custom speeds must be less than %s Using default values.</string>
<string name="revanced_custom_playback_speeds_invalid">Custom speeds must be less than %s Using default values.</string>
<string name="revanced_custom_playback_speeds_parse_exception">Invalid custom playback speeds. Using default values.</string>
</patch>
<patch id="video.speed.remember.RememberPlaybackSpeedPatch">
@ -971,7 +980,7 @@
<string name="revanced_remember_playback_speed_last_selected_summary_on">Playback speed changes apply to all videos</string>
<string name="revanced_remember_playback_speed_last_selected_summary_off">Playback speed changes only apply to the current video</string>
<string name="revanced_playback_speed_default_title">Default playback speed</string>
<string name="revanced_remember_playback_speed_toast" formatted="false">Changed default speed to: %s</string>
<string name="revanced_remember_playback_speed_toast">Changed default speed to: %s</string>
</patch>
<patch id="video.videoqualitymenu.RestoreOldVideoQualityMenuResourcePatch">
<string name="revanced_restore_old_video_quality_menu_title">Restore old video quality menu</string>