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

Commit 1ae7fd5f authored by Gene Karshenboym's avatar Gene Karshenboym Committed by Android (Google) Code Review
Browse files

Merge "Implement RadioMetadata.toString." into pi-dev

parents bfb35ad0 dd2e6c50
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
     *