Merge "Add support for reading and writing double array values"

This commit is contained in:
Samuel Tan
2015-12-07 18:56:01 +00:00
committed by Gerrit Code Review

View File

@@ -229,6 +229,7 @@ public final class Parcel {
private static final int VAL_PERSISTABLEBUNDLE = 25; private static final int VAL_PERSISTABLEBUNDLE = 25;
private static final int VAL_SIZE = 26; private static final int VAL_SIZE = 26;
private static final int VAL_SIZEF = 27; 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: // The initial int32 in a Binder call's reply Parcel header:
private static final int EX_SECURITY = -1; private static final int EX_SECURITY = -1;
@@ -1408,6 +1409,9 @@ public final class Parcel {
} else if (v instanceof SizeF) { } else if (v instanceof SizeF) {
writeInt(VAL_SIZEF); writeInt(VAL_SIZEF);
writeSizeF((SizeF) v); writeSizeF((SizeF) v);
} else if (v instanceof double[]) {
writeInt(VAL_DOUBLEARRAY);
writeDoubleArray((double[]) v);
} else { } else {
Class<?> clazz = v.getClass(); Class<?> clazz = v.getClass();
if (clazz.isArray() && clazz.getComponentType() == Object.class) { if (clazz.isArray() && clazz.getComponentType() == Object.class) {
@@ -2375,6 +2379,9 @@ public final class Parcel {
case VAL_SIZEF: case VAL_SIZEF:
return readSizeF(); return readSizeF();
case VAL_DOUBLEARRAY:
return createDoubleArray();
default: default:
int off = dataPosition() - 4; int off = dataPosition() - 4;
throw new RuntimeException( throw new RuntimeException(