Skip to content

Commit

Permalink
fix: Use activity fingerprint for YT Music, so GmsCore can show a dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Apr 3, 2024
1 parent b92fe69 commit a7d0cd8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
import app.revanced.patches.music.misc.gms.fingerprints.*
import app.revanced.patches.music.misc.integrations.IntegrationsPatch
import app.revanced.patches.music.misc.integrations.fingerprints.ApplicationInitFingerprint
import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch

Expand All @@ -21,10 +20,7 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
CastDynamiteModuleV2Fingerprint,
CastContextFetchFingerprint,
),
// This fingerprint could be improved by using a main Activity,
// as that allows showing a dialog if GmsCore is not whitelisted for battery optimizations.
// Because using this fingerprint only allows showing a brief toast and then opening a website.
mainActivityOnCreateFingerprint = ApplicationInitFingerprint,
mainActivityOnCreateFingerprint = MusicActivityOnCreateFingerprint,
integrationsPatchDependency = IntegrationsPatch::class,
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package app.revanced.patches.music.misc.gms.fingerprints

import app.revanced.patcher.fingerprint.MethodFingerprint

internal object MusicActivityOnCreateFingerprint : MethodFingerprint(
returnType = "V",
parameters = listOf("Landroid/os/Bundle;"),
customFingerprint = { methodDef, classDef ->
methodDef.name == "onCreate" && classDef.type.endsWith("/MusicActivity;")
}
)

0 comments on commit a7d0cd8

Please sign in to comment.