Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3d6e869 authored by Shai Barack's avatar Shai Barack
Browse files

Don't copy MediaMetadata in sanitizer if there is nothing to sanitize

See: b/407234313#comment2 for complete explanation.

This patch will eliminate 0.45% of CPU cycles in system server.

Flag: EXEMPT bugfix
Bug: 407234313
Bug: 271851153
Change-Id: Ic2cd40f5fb218c928f791661ad339dd10854993f
parent ad3850c3
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1260,6 +1260,19 @@ public class MediaSessionRecord extends MediaSessionRecordImpl implements IBinde
            if (metadata == null) {
                return null;
            }

            // Check if there are URIs to sanitize
            boolean hasUris = false;
            for (String key : ART_URIS) {
                if (metadata.containsKey(key)) {
                    hasUris = true;
                    break;
                }
            }
            if (!hasUris) {
                return metadata;
            }

            MediaMetadata.Builder metadataBuilder = new MediaMetadata.Builder(metadata);
            for (String key: ART_URIS) {
                String uriString = metadata.getString(key);