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

Commit 7cacc1fb authored by Gene Karshenboym's avatar Gene Karshenboym Committed by android-build-merger
Browse files

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

am: 1ae7fd5f

Change-Id: I4440c9acb16f557dc98e90815912e4efd67702dc
parents 48638d8f 1ae7fd5f
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
     *