Patch Youtube Music to Remove Fullscreen Lockscreen Cover

This is a stupid feature -- so stupid that Google decided to remove it in Android 11 -- and Oneplus decided to "forward port" it to Android 11. I think it's finally gone in Android 12.

You can check the creepy screenshot in the Reddit post.

It's also a requested feature for Revanced but no update from developers yet.

Patch

A quick note for getting this along with Revanced(obviously I need other patches)

  1. Patch YT Music in Revanced Manager as usual and install as mounted. It's an Oneplus(stock rom) issue so no need for MicroG.

  2. Copy the patched apk
    /data/adb/revanced/com.google.android.apps.youtube.music/base.apk
    to PC.

  3. Use APKTOOL to unpack, modify the smali and repack.
    To patch the smail, find anor.smali in smali_classes2 folder.
    Note, the exact file name may subject to change, in the future, search "android.media.metadata.ALBUM_ART", there should be a function for setting up various meta fields. Patch it to skip "ALBUM_ART", which making it NULL, and, disable lockscreen cover.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
       const-string v2, "android.media.metadata.ALBUM"

    invoke-virtual {v1, v2, v0}, Lhe;->e(Ljava/lang/String;Ljava/lang/String;)V

    :cond_0
    iget-object v0, p0, Laonr;->h:Laomy;

    iget-object v0, v0, Laomy;->r:Landroid/graphics/Bitmap;


    #if-eqz v0, :cond_1
    #>>>>>>change if-eqz v0 to goto<<<<<<<<
    goto :cond_1

    const-string v2, "android.media.metadata.ALBUM_ART"

    invoke-virtual {v1, v2, v0}, Lhe;->b(Ljava/lang/String;Landroid/graphics/Bitmap;)V

    :cond_1
    iget-object v0, p0, Laonr;->k:Laons;

    iget-object v2, p0, Laonr;->h:Laomy;

    invoke-interface {v0, v1, v2}, Laons;->f(Lhe;Laomy;)V

    return-object v1
    .end method
  4. Sign the apk with apksigner. This must be signed, can use own key but can't unsigned or "reuse" original sign.

  5. Name the new apk as "base.apk" and put it back, overwrite /data/adb/revanced/com.google.android.apps.youtube.music/base.apk

  6. Force stop Youtube Music and reopen. The change should take effect then.

This doesn't affect the small icon shown in pulldown or lockscreen, so everything is good now.

How it works

In Android source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Bitmap artworkBitmap = null;
if (mediaMetadata != null && !mKeyguardBypassController.getBypassEnabled()) {
artworkBitmap = mediaMetadata.getBitmap(MediaMetadata.METADATA_KEY_ART);
if (artworkBitmap == null) {
artworkBitmap = mediaMetadata.getBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART);
}
}
NotificationEntry entry = mEntryManager
.getActiveNotificationUnfiltered(mMediaNotificationKey);
if (entry != null) {
mMediaPlayer.updateControls(entry, getMediaIcon(), mediaMetadata);
} else {
mMediaPlayer.clearControls();
}
// Process artwork on a background thread and send the resulting bitmap to
// finishUpdateMediaMetaData.
if (metaDataChanged) {
for (AsyncTask<?, ?, ?> task : mProcessArtworkTasks) {
task.cancel(true);
}
mProcessArtworkTasks.clear();
}
if (artworkBitmap != null && !Utils.useQsMediaPlayer(mContext)) {
mProcessArtworkTasks.add(new ProcessArtworkTask(this, metaDataChanged,
allowEnterAnimation).execute(artworkBitmap));
} else {
finishUpdateMediaMetaData(metaDataChanged, allowEnterAnimation, null);
}

Bitmap is loaded from MediaMetadata.METADATA_KEY_ART and MediaMetadata.METADATA_KEY_ALBUM_ART, mProcessArtworkTasks.add is called to update the lockscreen background.

In YT Music, android.media.metadata.ART is unused only android.media.metadata.ALBUM_ART, a NULL value will disable the lockscreen background. For other apps with similar issue might need to patch both fields. Another options is to patch SYSTEMUI.apk , making a Magisk module for a system-wide fix.