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

Commit dd2e6c50 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Implement RadioMetadata.toString.

This is required for metadata debugging.

Bug: 78885613
Test: build, run radio, watch logs
Change-Id: I63393bf555ede396a04f50897490049568b089dd
parent be654b35
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -269,6 +269,29 @@ public final class RadioMetadata implements Parcelable {
        mBundle = in.readBundle();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("RadioMetadata[");

        final String removePrefix = "android.hardware.radio.metadata";

        boolean first = true;
        for (String key : mBundle.keySet()) {
            if (first) first = false;
            else sb.append(", ");

            String keyDisp = key;
            if (key.startsWith(removePrefix)) keyDisp = key.substring(removePrefix.length());

            sb.append(keyDisp);
            sb.append('=');
            sb.append(mBundle.get(key));
        }

        sb.append("]");
        return sb.toString();
    }

    /**
     * Returns {@code true} if the given key is contained in the meta data
     *