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

Commit 17b3881b authored by Sarah Chin's avatar Sarah Chin
Browse files

RILUtils convertToString use AIDL toString if available

Test: manually verify logcat
Bug: 223230764
Change-Id: Ifeb1530b63cf5b84b218aaaff9cc3dea8f7d1fe6
parent c4076c61
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -5222,7 +5222,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("[");