|
|
|
@ -309,37 +309,40 @@ public class Log {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void logBundle(Bundle data) {
|
|
|
|
|
if (data != null) {
|
|
|
|
|
Set<String> keys = data.keySet();
|
|
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
|
for (String key : keys) {
|
|
|
|
|
Object v = data.get(key);
|
|
|
|
|
|
|
|
|
|
Object value = v;
|
|
|
|
|
if (v != null && v.getClass().isArray()) {
|
|
|
|
|
int length = Array.getLength(v);
|
|
|
|
|
if (length <= 10) {
|
|
|
|
|
String[] elements = new String[length];
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
Object element = Array.get(v, i);
|
|
|
|
|
if (element instanceof Long)
|
|
|
|
|
elements[i] = "0x" + Long.toHexString((Long) element);
|
|
|
|
|
else
|
|
|
|
|
elements[i] = (element == null ? null : element.toString());
|
|
|
|
|
}
|
|
|
|
|
value = TextUtils.join(",", elements);
|
|
|
|
|
for (String extra : getExtras(data))
|
|
|
|
|
i(extra);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static List<String> getExtras(Bundle data) {
|
|
|
|
|
List<String> result = new ArrayList<>();
|
|
|
|
|
if (data == null)
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
Set<String> keys = data.keySet();
|
|
|
|
|
for (String key : keys) {
|
|
|
|
|
Object v = data.get(key);
|
|
|
|
|
|
|
|
|
|
Object value = v;
|
|
|
|
|
if (v != null && v.getClass().isArray()) {
|
|
|
|
|
int length = Array.getLength(v);
|
|
|
|
|
if (length <= 10) {
|
|
|
|
|
String[] elements = new String[length];
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
Object element = Array.get(v, i);
|
|
|
|
|
if (element instanceof Long)
|
|
|
|
|
elements[i] = "0x" + Long.toHexString((Long) element);
|
|
|
|
|
else
|
|
|
|
|
elements[i] = (element == null ? null : element.toString());
|
|
|
|
|
}
|
|
|
|
|
} else if (v instanceof Long)
|
|
|
|
|
value = "0x" + Long.toHexString((Long) v);
|
|
|
|
|
|
|
|
|
|
stringBuilder.append(key)
|
|
|
|
|
.append("=")
|
|
|
|
|
.append(value)
|
|
|
|
|
.append(value == null ? "" : " (" + v.getClass().getSimpleName() + ")")
|
|
|
|
|
.append("\r\n");
|
|
|
|
|
}
|
|
|
|
|
i(stringBuilder.toString());
|
|
|
|
|
value = TextUtils.join(",", elements);
|
|
|
|
|
}
|
|
|
|
|
} else if (v instanceof Long)
|
|
|
|
|
value = "0x" + Long.toHexString((Long) v);
|
|
|
|
|
|
|
|
|
|
result.add(key + "=" + value + (value == null ? "" : " (" + v.getClass().getSimpleName() + ")"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void logMemory(Context context, String message) {
|
|
|
|
|