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

Commit 2d89c243 authored by Alison Cichowlas's avatar Alison Cichowlas
Browse files

Tron logging - Fix isValidValue to match its name, allow nulls.

Test: runtest --path frameworks/base/core/tests/coretests/src/android/metrics/LogMakerTest.java
Change-Id: I92567e1873c5178606ac88135b5934d760b4ec24
parent 07e29ad1
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public class LogMaker {
     * @return
     */
    public LogMaker addTaggedData(int tag, Object value) {
        if (isValidValue(value)) {
        if (!isValidValue(value)) {
            throw new IllegalArgumentException(
                    "Value must be loggable type - int, long, float, String");
        }
@@ -119,10 +119,14 @@ public class LogMaker {
    }

    public boolean isValidValue(Object value) {
        return !(value instanceof Integer ||
        if (value == null) {
            Log.i("LogBuilder", "Logging a null value.");
            return true;
        }
        return value instanceof Integer ||
            value instanceof String ||
            value instanceof Long ||
            value instanceof Float);
            value instanceof Float;
    }

    public Object getTaggedData(int tag) {
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ public class LogMakerTest extends TestCase {
        builder.addTaggedData(2, 123);
        builder.addTaggedData(3, 123L);
        builder.addTaggedData(4, 123.0F);
        builder.addTaggedData(5, null);
        Object[] out = builder.serialize();
        assertEquals("onetwothree", out[1]);
        assertEquals(123, out[3]);