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

Commit e2e2db84 authored by Sarah Chin's avatar Sarah Chin Committed by Automerger Merge Worker
Browse files

Merge "RILUtils convertToString use AIDL toString if available" am: 25623965

parents 7996fd1f 25623965
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("[");