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

Commit a8036660 authored by Samuel Tan's avatar Samuel Tan
Browse files

Add support for reading and writing double array values

Add support for reading and writing double arrays in
Parcel.readValue() and Parcel.writeValue.

Also, remove some trailing whitespaces in Parcel.java.

BUG: 25848659
Change-Id: Ib5430f492df4195051b83d9bf2b5163ec684bbff
parent 7d72975c
Loading
Loading
Loading
Loading
+29 −22
Original line number Diff line number Diff line
@@ -229,6 +229,7 @@ public final class Parcel {
    private static final int VAL_PERSISTABLEBUNDLE = 25;
    private static final int VAL_SIZE = 26;
    private static final int VAL_SIZEF = 27;
    private static final int VAL_DOUBLEARRAY = 28;

    // The initial int32 in a Binder call's reply Parcel header:
    private static final int EX_SECURITY = -1;
@@ -1408,6 +1409,9 @@ public final class Parcel {
        } else if (v instanceof SizeF) {
            writeInt(VAL_SIZEF);
            writeSizeF((SizeF) v);
        } else if (v instanceof double[]) {
            writeInt(VAL_DOUBLEARRAY);
            writeDoubleArray((double[]) v);
        } else {
            Class<?> clazz = v.getClass();
            if (clazz.isArray() && clazz.getComponentType() == Object.class) {
@@ -2375,6 +2379,9 @@ public final class Parcel {
        case VAL_SIZEF:
            return readSizeF();

        case VAL_DOUBLEARRAY:
            return createDoubleArray();

        default:
            int off = dataPosition() - 4;
            throw new RuntimeException(