Compare commits

...

9 Commits

Author SHA1 Message Date
semantic-release-bot
9e32835e5a chore(release): 2.175.0-dev.14 [skip ci]
# [2.175.0-dev.14](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.13...v2.175.0-dev.14) (2023-05-30)

### Bug Fixes

* **youtube/theme:** use dynamic background color for custom splash screen ([#2319](https://github.com/revanced/revanced-patches/issues/2319)) ([308b1bc](308b1bc0d2))

### Features

* **tiktok:** remove compatibility version constraints ([#2306](https://github.com/revanced/revanced-patches/issues/2306)) ([06f70f3](06f70f305e))
2023-05-30 11:44:04 +00:00
KAZI MMT
06f70f305e feat(tiktok): remove compatibility version constraints (#2306)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-05-30 13:42:17 +02:00
LisoUseInAIKyrios
308b1bc0d2 fix(youtube/theme): use dynamic background color for custom splash screen (#2319) 2023-05-30 15:41:13 +04:00
semantic-release-bot
e74df8bba9 chore(release): 2.175.0-dev.13 [skip ci]
# [2.175.0-dev.13](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.12...v2.175.0-dev.13) (2023-05-29)

### Bug Fixes

* **settings:** sort setting preferences using lowercase ([#2312](https://github.com/revanced/revanced-patches/issues/2312)) ([b285e46](b285e4663b))
2023-05-29 10:02:59 +00:00
LisoUseInAIKyrios
b285e4663b fix(settings): sort setting preferences using lowercase (#2312) 2023-05-29 14:01:13 +04:00
semantic-release-bot
9159c77725 chore(release): 2.175.0-dev.12 [skip ci]
# [2.175.0-dev.12](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.11...v2.175.0-dev.12) (2023-05-29)

### Bug Fixes

* **youtube/integrations:** fix playback of embedded videos ([#2304](https://github.com/revanced/revanced-patches/issues/2304)) ([3ac1be3](3ac1be3f01))
2023-05-29 07:25:57 +00:00
LisoUseInAIKyrios
3ac1be3f01 fix(youtube/integrations): fix playback of embedded videos (#2304) 2023-05-29 11:23:54 +04:00
semantic-release-bot
0c0e30d7be chore(release): 2.175.0-dev.11 [skip ci]
# [2.175.0-dev.11](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.10...v2.175.0-dev.11) (2023-05-28)

### Features

* **scbeasy:** add `remove-debugging-detection` patch ([#2287](https://github.com/revanced/revanced-patches/issues/2287)) ([be94f17](be94f17302))
2023-05-28 01:01:55 +00:00
ssense
be94f17302 feat(scbeasy): add remove-debugging-detection patch (#2287)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-05-28 02:59:42 +02:00
26 changed files with 325 additions and 153 deletions

View File

@@ -1,3 +1,36 @@
# [2.175.0-dev.14](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.13...v2.175.0-dev.14) (2023-05-30)
### Bug Fixes
* **youtube/theme:** use dynamic background color for custom splash screen ([#2319](https://github.com/revanced/revanced-patches/issues/2319)) ([28594f3](https://github.com/revanced/revanced-patches/commit/28594f3eeaf99fa32ee57214ebbc4342529c6694))
### Features
* **tiktok:** remove compatibility version constraints ([#2306](https://github.com/revanced/revanced-patches/issues/2306)) ([a12c4bb](https://github.com/revanced/revanced-patches/commit/a12c4bb1610234d19b4ac86cd57bb09335566b68))
# [2.175.0-dev.13](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.12...v2.175.0-dev.13) (2023-05-29)
### Bug Fixes
* **settings:** sort setting preferences using lowercase ([#2312](https://github.com/revanced/revanced-patches/issues/2312)) ([2743a95](https://github.com/revanced/revanced-patches/commit/2743a95b417a6023799035e30631e7b3a68bcc45))
# [2.175.0-dev.12](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.11...v2.175.0-dev.12) (2023-05-29)
### Bug Fixes
* **youtube/integrations:** fix playback of embedded videos ([#2304](https://github.com/revanced/revanced-patches/issues/2304)) ([1dffbaf](https://github.com/revanced/revanced-patches/commit/1dffbaf0aa73f0f703516648d5cd935000fa2770))
# [2.175.0-dev.11](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.10...v2.175.0-dev.11) (2023-05-28)
### Features
* **scbeasy:** add `remove-debugging-detection` patch ([#2287](https://github.com/revanced/revanced-patches/issues/2287)) ([53d91e3](https://github.com/revanced/revanced-patches/commit/53d91e32183663b0aa70994cc4e1d8ae5eb8c8e4))
# [2.175.0-dev.10](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.9...v2.175.0-dev.10) (2023-05-27)

View File

@@ -89,14 +89,14 @@ The official ReVanced Patches.
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `disable-login-requirement` | Do not force login. | all |
| `downloads` | Removes download restrictions and changes the default path to download to. | 27.8.3 |
| `feed-filter` | Filters tiktok videos: removing ads, removing livestreams. | 27.8.3 |
| `downloads` | Removes download restrictions and changes the default path to download to. | all |
| `feed-filter` | Filters tiktok videos: removing ads, removing livestreams. | all |
| `fix-google-login` | Allows logging in with a Google account. | all |
| `hide-ads` | Removes ads from TikTok. | all |
| `playback-speed` | Enables the playback speed option for all videos. | all |
| `settings` | Adds ReVanced settings to TikTok. | 27.8.3 |
| `settings` | Adds ReVanced settings to TikTok. | all |
| `show-seekbar` | Shows progress bar for all video. | all |
| `sim-spoof` | Spoofs the information which is retrieved from the sim-card. | 27.8.3 |
| `sim-spoof` | Spoofs the information which is retrieved from the sim-card. | all |
</details>
### [📦 `com.zhiliaoapp.musically`](https://play.google.com/store/apps/details?id=com.zhiliaoapp.musically)
@@ -105,14 +105,14 @@ The official ReVanced Patches.
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `disable-login-requirement` | Do not force login. | all |
| `downloads` | Removes download restrictions and changes the default path to download to. | 27.8.3 |
| `feed-filter` | Filters tiktok videos: removing ads, removing livestreams. | 27.8.3 |
| `downloads` | Removes download restrictions and changes the default path to download to. | all |
| `feed-filter` | Filters tiktok videos: removing ads, removing livestreams. | all |
| `fix-google-login` | Allows logging in with a Google account. | all |
| `hide-ads` | Removes ads from TikTok. | all |
| `playback-speed` | Enables the playback speed option for all videos. | all |
| `settings` | Adds ReVanced settings to TikTok. | 27.8.3 |
| `settings` | Adds ReVanced settings to TikTok. | all |
| `show-seekbar` | Shows progress bar for all video. | all |
| `sim-spoof` | Spoofs the information which is retrieved from the sim-card. | 27.8.3 |
| `sim-spoof` | Spoofs the information which is retrieved from the sim-card. | all |
</details>
### [📦 `tv.twitch.android.app`](https://play.google.com/store/apps/details?id=tv.twitch.android.app)
@@ -284,6 +284,14 @@ The official ReVanced Patches.
| `remove-broadcasts-restriction` | Enables starting/stopping NetGuard via broadcasts. | all |
</details>
### [📦 `com.scb.phone`](https://play.google.com/store/apps/details?id=com.scb.phone)
<details>
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `remove-debugging-detection` | Removes the USB and wireless debugging checks. | all |
</details>
### [📦 `com.dci.dev.androidtwelvewidgets`](https://play.google.com/store/apps/details?id=com.dci.dev.androidtwelvewidgets)
<details>

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.175.0-dev.10
version = 2.175.0-dev.14

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
package app.revanced.patches.scbeasy.detection.debugging.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.scb.phone")])
@Target(AnnotationTarget.CLASS)
internal annotation class RemoveDebuggingDetectionCompatibility

View File

@@ -0,0 +1,8 @@
package app.revanced.patches.scbeasy.detection.debugging.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object DebuggingDetectionFingerprint : MethodFingerprint(
returnType = "Z",
strings = listOf("adb_enabled")
)

View File

@@ -0,0 +1,31 @@
package app.revanced.patches.scbeasy.detection.debugging.patch
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.scbeasy.detection.debugging.annotations.RemoveDebuggingDetectionCompatibility
import app.revanced.patches.scbeasy.detection.debugging.fingerprints.DebuggingDetectionFingerprint
@Patch(false)
@Name("remove-debugging-detection")
@Description("Removes the USB and wireless debugging checks.")
@RemoveDebuggingDetectionCompatibility
@Version("0.0.1")
class RemoveDebuggingDetectionPatch : BytecodePatch(
listOf(DebuggingDetectionFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
DebuggingDetectionFingerprint.result!!.mutableMethod.addInstructions(
0,
"""
const/4 v0, 0x0
return v0
"""
)
return PatchResultSuccess()
}
}

View File

@@ -35,8 +35,8 @@ internal abstract class AbstractPreferenceScreen(
return PreferenceScreen(
key,
StringResource("${key}_title", title),
preferences.sortedBy { it.title.value } +
categories.sortedBy { it.title }.map { it.transform() },
preferences.sortedBy { it.title.value.lowercase() } +
categories.sortedBy { it.title.lowercase() }.map { it.transform() },
summary?.let { summary ->
StringResource("${key}_summary", summary)
}
@@ -63,7 +63,7 @@ internal abstract class AbstractPreferenceScreen(
return PreferenceCategory(
key,
StringResource("${key}_title", title),
preferences.sortedBy { it.title.value }
preferences.sortedBy { it.title.value.lowercase() }
)
}

View File

@@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[
Package("com.ss.android.ugc.trill", arrayOf("27.8.3")),
Package("com.zhiliaoapp.musically", arrayOf("27.8.3"))
Package("com.ss.android.ugc.trill"),
Package("com.zhiliaoapp.musically")
]
)
@Target(AnnotationTarget.CLASS)

View File

@@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[
Package("com.ss.android.ugc.trill", arrayOf("27.8.3")),
Package("com.zhiliaoapp.musically", arrayOf("27.8.3"))
Package("com.ss.android.ugc.trill"),
Package("com.zhiliaoapp.musically")
]
)
@Target(AnnotationTarget.CLASS)

View File

@@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[
Package("com.ss.android.ugc.trill", arrayOf("27.8.3")),
Package("com.zhiliaoapp.musically", arrayOf("27.8.3"))
Package("com.ss.android.ugc.trill"),
Package("com.zhiliaoapp.musically")
]
)
@Target(AnnotationTarget.CLASS)

View File

@@ -0,0 +1,17 @@
package app.revanced.patches.tiktok.misc.settings.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object AboutPageFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.CONST, // copyrightPolicyLabel resource id
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_STRING
),
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/ss/android/ugc/aweme/setting/page/AboutPage;" &&
methodDef.name == "onViewCreated"
}
)

View File

@@ -1,37 +0,0 @@
package app.revanced.patches.tiktok.misc.settings.fingerprints
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
@FuzzyPatternScanMethod(4)
object AboutViewFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.INVOKE_DIRECT_RANGE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.NEW_INSTANCE,
Opcode.CONST,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.SGET_OBJECT,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.CONST_4,
Opcode.CONST_STRING,
Opcode.INVOKE_DIRECT_RANGE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.CONST,
Opcode.SGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.IF_EQZ,
Opcode.CONST
)
)

View File

@@ -8,7 +8,6 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
@@ -17,14 +16,14 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.tiktok.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.tiktok.misc.settings.annotations.SettingsCompatibility
import app.revanced.patches.tiktok.misc.settings.fingerprints.AboutViewFingerprint
import app.revanced.patches.tiktok.misc.settings.fingerprints.AboutPageFingerprint
import app.revanced.patches.tiktok.misc.settings.fingerprints.AdPersonalizationActivityOnCreateFingerprint
import app.revanced.patches.tiktok.misc.settings.fingerprints.SettingsOnViewCreatedFingerprint
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
import org.jf.dexlib2.iface.reference.StringReference
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
@Patch
@DependsOn([IntegrationsPatch::class])
@@ -34,84 +33,92 @@ import org.jf.dexlib2.iface.reference.StringReference
@Version("0.0.1")
class SettingsPatch : BytecodePatch(
listOf(
AboutPageFingerprint,
AdPersonalizationActivityOnCreateFingerprint,
SettingsOnViewCreatedFingerprint,
)
) {
override fun execute(context: BytecodeContext): PatchResult {
SettingsOnViewCreatedFingerprint.result?.let {
AboutViewFingerprint.resolve(context, it.method, it.classDef)
}
// Patch Settings UI to add 'Revanced Settings'.
val targetIndexes = findOptionsOnClickIndex()
with(SettingsOnViewCreatedFingerprint.result!!.mutableMethod) {
for (index in targetIndexes) {
if (
instruction(index).opcode != Opcode.NEW_INSTANCE ||
instruction(index - 4).opcode != Opcode.MOVE_RESULT_OBJECT
)
return PatchResultError("Hardcode offset changed.")
patchOptionNameAndOnClickEvent(index, context)
}
}
// Implement settings screen in `AdPersonalizationActivity`
with(AdPersonalizationActivityOnCreateFingerprint.result!!.mutableMethod) {
for ((index, instruction) in implementation!!.instructions.withIndex()) {
if (instruction.opcode != Opcode.INVOKE_SUPER) continue
val thisRegister = (instruction as Instruction35c).registerC
addInstructions(
index + 1,
SettingsOnViewCreatedFingerprint.result?.mutableMethod?.apply {
val instructions = implementation!!.instructions
// Find the indices that need to be patched.
val copyrightPolicyLabelId = AboutPageFingerprint.result?.let {
val startIndex = it.scanResult.patternScanResult!!.startIndex
it.mutableMethod.instruction<WideLiteralInstruction>(startIndex).wideLiteral
} ?: return AboutPageFingerprint.toErrorResult()
val copyrightIndex = instructions.indexOfFirst {
(it as? ReferenceInstruction)?.reference.toString() == "copyright_policy"
} - 6
val copyrightPolicyIndex = instructions.indexOfFirst {
(it as? WideLiteralInstruction)?.wideLiteral == copyrightPolicyLabelId
} + 2
// Replace an existing settings entry with ReVanced settings entry.
arrayOf(
copyrightIndex,
copyrightPolicyIndex
).forEach { index ->
val instruction = instruction(index)
if (instruction.opcode != Opcode.MOVE_RESULT_OBJECT)
return PatchResultError("Hardcoded offset changed.")
val settingsEntryStringRegister = (instruction as OneRegisterInstruction).registerA
// Replace the settings entry string with a custom one.
replaceInstruction(
index,
"""
invoke-static {v$thisRegister}, Lapp/revanced/tiktok/settingsmenu/SettingsMenu;->initializeSettings(Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;)V
const-string v$settingsEntryStringRegister, "ReVanced Settings"
"""
)
// Replace the OnClickListener class with a custom one.
val onClickListener = instruction<ReferenceInstruction>(index + 4).reference.toString()
context.findClass(onClickListener)?.mutableClass?.methods?.first {
it.name == "onClick"
}?.addInstructions(
0,
"""
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->startSettingsActivity()V
return-void
"""
)
break
) ?: return PatchResultError("Could not find the onClick method.")
}
}
} ?: return SettingsOnViewCreatedFingerprint.toErrorResult()
// Initialize the settings menu once the replaced setting entry is clicked.
AdPersonalizationActivityOnCreateFingerprint.result?.mutableMethod?.apply {
val initializeSettingsIndex = implementation!!.instructions.indexOfFirst {
it.opcode == Opcode.INVOKE_SUPER
} + 1
val thisRegister = instruction<FiveRegisterInstruction>(initializeSettingsIndex - 1).registerC
addInstructions(
initializeSettingsIndex,
"""
invoke-static {v$thisRegister}, $INITIALIZE_SETTINGS_METHOD_DESCRIPTOR
return-void
"""
)
} ?: return AdPersonalizationActivityOnCreateFingerprint.toErrorResult()
return PatchResultSuccess()
}
private fun findOptionsOnClickIndex(): IntArray {
val results = IntArray(2)
SettingsOnViewCreatedFingerprint.result?.apply {
for ((index, instruction) in mutableMethod.implementation!!.instructions.withIndex()) {
// Old UI settings option to replace to 'Revanced Settings'
if (instruction.opcode == Opcode.CONST_STRING) {
val string = ((instruction as ReferenceInstruction).reference as StringReference).string
if (string == "copyright_policy") {
results[0] = index - 2
break
}
}
}
private companion object {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/tiktok/settingsmenu/SettingsMenu;"
// New UI settings option to replace to 'Revanced Settings'
results[1] = AboutViewFingerprint.result!!.scanResult.patternScanResult!!.startIndex
} ?: throw SettingsOnViewCreatedFingerprint.toErrorResult()
return results
}
private fun patchOptionNameAndOnClickEvent(index: Int, context: BytecodeContext) {
with(SettingsOnViewCreatedFingerprint.result!!.mutableMethod) {
// Patch option name
val overrideRegister = instruction<OneRegisterInstruction>(index - 4).registerA
replaceInstruction(
index - 4,
"""
const-string v$overrideRegister, "Revanced Settings"
"""
)
// Patch option OnClick Event
val type = instruction<ReferenceInstruction>(index).reference.toString()
context.findClass(type)!!.mutableClass.methods.first { type == "onClick" }.addInstructions(
0,
"""
invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsMenu;->startSettingsActivity()V
return-void
"""
)
}
private const val INITIALIZE_SETTINGS_METHOD_DESCRIPTOR =
"$INTEGRATIONS_CLASS_DESCRIPTOR->initializeSettings(" +
"Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;" +
")V"
}
}

View File

@@ -5,8 +5,8 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[
Package("com.ss.android.ugc.trill", arrayOf("27.8.3")),
Package("com.zhiliaoapp.musically", arrayOf("27.8.3"))
Package("com.ss.android.ugc.trill"),
Package("com.zhiliaoapp.musically")
]
)
@Target(AnnotationTarget.CLASS)

View File

@@ -49,7 +49,7 @@ class ThemeBytecodePatch : BytecodePatch() {
var splashScreenBackgroundColor: String? by option(
PatchOption.StringOption(
key = "splashScreenBackgroundColor",
default = "@android:color/black",
default = "?android:attr/colorBackground",
title = "Background color for the splash screen",
description = "The background color of the splash screen. Can be a hex color or a resource reference.",
)

View File

@@ -0,0 +1,17 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback.
* It appears this hook may no longer be needed as one of the constructor parameters is the already hooked
* [EmbeddedPlayerControlsOverlayFingerprint]
*/
object APIPlayerServiceFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lcom/google/android/apps/youtube/embeddedplayer/service/service/jar/ApiPlayerService;" },
// Integrations context is the first method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -2,6 +2,10 @@ package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
object InitFingerprint : IntegrationsFingerprint(
/**
* Hooks the context when the app is launched as a regular application (and is not an embedded video playback).
*/
object ApplicationInitFingerprint : IntegrationsFingerprint(
strings = listOf("Application creation", "Application.onCreate"),
// Integrations context is the Activity itself.
)

View File

@@ -4,12 +4,19 @@ import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback inside Google Play store (and probably other situations as well).
*
* Note: this fingerprint may no longer be needed, as it appears
* [RemoteEmbedFragmentFingerprint] may be set before this hook is called.
*/
object EmbeddedPlayerControlsOverlayFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
returnType = "V",
parameters = listOf("L", "L", "L"),
parameters = listOf("Landroid/content/Context;", "L", "L"),
customFingerprint = { methodDef, _ ->
methodDef.definingClass.startsWith("Lcom/google/android/apps/youtube/embeddedplayer/service/ui/overlays/controlsoverlay/remoteloaded/")
},
// Integrations context is the first method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -0,0 +1,20 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback inside the Google app (such as the in app 'discover' tab).
*
* Note: this fingerprint may or may not be needed, as
* [RemoteEmbedFragmentFingerprint] might be set before this is called.
*/
object EmbeddedPlayerFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
returnType = "L",
parameters = listOf("L", "L", "Landroid/content/Context;"),
strings = listOf("android.hardware.type.television"), // String is also found in other classes
// Integrations context is the third method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size + 2 }
)

View File

@@ -0,0 +1,19 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback. Likely covers Google Play store and other Google products.
*/
object RemoteEmbedFragmentFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
returnType = "V",
parameters = listOf("Landroid/content/Context;", "L", "L"),
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/google/android/apps/youtube/embeddedplayer/service/jar/client/RemoteEmbedFragment;"
},
// Integrations context is the first method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -0,0 +1,19 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback inside 3rd party android app (such as 3rd party Reddit apps).
*/
object RemoteEmbeddedPlayerFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
returnType = "V",
parameters = listOf("Landroid/content/Context;", "L", "L", "Z"),
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/google/android/youtube/api/jar/client/RemoteEmbeddedPlayer;"
},
// Integrations context is the first method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -1,8 +0,0 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
object ServiceFingerprint : IntegrationsFingerprint(
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("ApiPlayerService;") && methodDef.name == "<init>" },
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -0,0 +1,18 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
/**
* Old API activity to embed YouTube into 3rd party Android apps.
*
* In 2023 supported was ended and is no longer available,
* but this may still be used by older apps:
* https://developers.google.com/youtube/android/player
*/
object StandalonePlayerActivityFingerprint : IntegrationsFingerprint(
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/google/android/youtube/api/StandalonePlayerActivity;"
&& methodDef.name == "onCreate"
},
// Integrations context is the Activity itself.
)

View File

@@ -1,10 +0,0 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
object StandalonePlayerFingerprint : IntegrationsFingerprint(
strings = listOf(
"Invalid PlaybackStartDescriptor. Returning the instance itself.",
"com.google.android.music",
),
)

View File

@@ -4,15 +4,26 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
import app.revanced.patches.youtube.misc.integrations.fingerprints.InitFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.EmbeddedPlayerControlsOverlayFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.ServiceFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.EmbeddedPlayerFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.ApplicationInitFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.RemoteEmbedFragmentFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.RemoteEmbeddedPlayerFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.APIPlayerServiceFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerActivityFingerprint
@Name("integrations")
@IntegrationsCompatibility
@RequiresIntegrations
class IntegrationsPatch : AbstractIntegrationsPatch(
"Lapp/revanced/integrations/utils/ReVancedUtils;",
listOf(InitFingerprint, StandalonePlayerFingerprint, ServiceFingerprint, EmbeddedPlayerControlsOverlayFingerprint),
listOf(
ApplicationInitFingerprint,
StandalonePlayerActivityFingerprint,
RemoteEmbeddedPlayerFingerprint,
RemoteEmbedFragmentFingerprint,
EmbeddedPlayerControlsOverlayFingerprint,
EmbeddedPlayerFingerprint,
APIPlayerServiceFingerprint,
),
)