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

Commit 25623965 authored by Sarah Chin's avatar Sarah Chin Committed by Gerrit Code Review
Browse files

Merge "RILUtils convertToString use AIDL toString if available"

parents c5d64b1f c257d9c7
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -5170,7 +5170,15 @@ public class RILUtils {
     * @return A string containing all public non-static local variables of a class
     */
    public static String convertToString(Object o) {
        if (isPrimitiveOrWrapper(o.getClass()) || o.getClass() == String.class) return o.toString();
        boolean toStringExists = false;
        try {
            toStringExists = o.getClass().getMethod("toString").getDeclaringClass() != Object.class;
        } catch (NoSuchMethodException e) {
            loge(e.toString());
        }
        if (toStringExists || isPrimitiveOrWrapper(o.getClass()) || o instanceof ArrayList) {
            return o.toString();
        }
        if (o.getClass().isArray()) {
            // Special handling for arrays
            StringBuilder sb = new StringBuilder("[");