Loading core/java/android/os/StatsBootstrapAtomValue.aidl +9 −33 Original line number Diff line number Diff line Loading @@ -19,8 +19,7 @@ package android.os; * * @hide */ parcelable StatsBootstrapAtomValue { union Primitive { union StatsBootstrapAtomValue { boolean boolValue; int intValue; long longValue; Loading @@ -29,26 +28,3 @@ parcelable StatsBootstrapAtomValue { byte[] bytesValue; String[] stringArrayValue; } No newline at end of file Primitive value; parcelable Annotation { // Match the definitions in // packages/modules/StatsD/framework/java/android/util/StatsLog.java // Only supports UIDs for now. @Backing(type="byte") enum Id { NONE, IS_UID, } Id id; union Primitive { boolean boolValue; int intValue; } Primitive value; } Annotation[] annotations; } services/core/java/com/android/server/stats/bootstrap/StatsBootstrapAtomService.java +8 −28 Original line number Diff line number Diff line Loading @@ -42,28 +42,27 @@ public class StatsBootstrapAtomService extends IStatsBootstrapAtomService.Stub { return; } StatsEvent.Builder builder = StatsEvent.newBuilder().setAtomId(atom.atomId); for (StatsBootstrapAtomValue atomValue : atom.values) { StatsBootstrapAtomValue.Primitive value = atomValue.value; for (StatsBootstrapAtomValue value : atom.values) { switch (value.getTag()) { case StatsBootstrapAtomValue.Primitive.boolValue: case StatsBootstrapAtomValue.boolValue: builder.writeBoolean(value.getBoolValue()); break; case StatsBootstrapAtomValue.Primitive.intValue: case StatsBootstrapAtomValue.intValue: builder.writeInt(value.getIntValue()); break; case StatsBootstrapAtomValue.Primitive.longValue: case StatsBootstrapAtomValue.longValue: builder.writeLong(value.getLongValue()); break; case StatsBootstrapAtomValue.Primitive.floatValue: case StatsBootstrapAtomValue.floatValue: builder.writeFloat(value.getFloatValue()); break; case StatsBootstrapAtomValue.Primitive.stringValue: case StatsBootstrapAtomValue.stringValue: builder.writeString(value.getStringValue()); break; case StatsBootstrapAtomValue.Primitive.bytesValue: case StatsBootstrapAtomValue.bytesValue: builder.writeByteArray(value.getBytesValue()); break; case StatsBootstrapAtomValue.Primitive.stringArrayValue: case StatsBootstrapAtomValue.stringArrayValue: builder.writeStringArray(value.getStringArrayValue()); break; default: Loading @@ -72,25 +71,6 @@ public class StatsBootstrapAtomService extends IStatsBootstrapAtomService.Stub { return; } StatsBootstrapAtomValue.Annotation[] annotations = atomValue.annotations; for (StatsBootstrapAtomValue.Annotation annotation : atomValue.annotations) { if (annotation.id != StatsBootstrapAtomValue.Annotation.Id.IS_UID) { Slog.e(TAG, "Unexpected annotation ID: " + annotation.id + ", for atom " + atom.atomId + ": only UIDs are supported!"); return; } switch (annotation.value.getTag()) { case StatsBootstrapAtomValue.Annotation.Primitive.boolValue: builder.addBooleanAnnotation( annotation.id, annotation.value.getBoolValue()); break; default: Slog.e(TAG, "Unexpected value type " + annotation.value.getTag() + " when logging UID for atom " + atom.atomId); return; } } } StatsLog.write(builder.usePooledBuffer().build()); } Loading Loading
core/java/android/os/StatsBootstrapAtomValue.aidl +9 −33 Original line number Diff line number Diff line Loading @@ -19,8 +19,7 @@ package android.os; * * @hide */ parcelable StatsBootstrapAtomValue { union Primitive { union StatsBootstrapAtomValue { boolean boolValue; int intValue; long longValue; Loading @@ -29,26 +28,3 @@ parcelable StatsBootstrapAtomValue { byte[] bytesValue; String[] stringArrayValue; } No newline at end of file Primitive value; parcelable Annotation { // Match the definitions in // packages/modules/StatsD/framework/java/android/util/StatsLog.java // Only supports UIDs for now. @Backing(type="byte") enum Id { NONE, IS_UID, } Id id; union Primitive { boolean boolValue; int intValue; } Primitive value; } Annotation[] annotations; }
services/core/java/com/android/server/stats/bootstrap/StatsBootstrapAtomService.java +8 −28 Original line number Diff line number Diff line Loading @@ -42,28 +42,27 @@ public class StatsBootstrapAtomService extends IStatsBootstrapAtomService.Stub { return; } StatsEvent.Builder builder = StatsEvent.newBuilder().setAtomId(atom.atomId); for (StatsBootstrapAtomValue atomValue : atom.values) { StatsBootstrapAtomValue.Primitive value = atomValue.value; for (StatsBootstrapAtomValue value : atom.values) { switch (value.getTag()) { case StatsBootstrapAtomValue.Primitive.boolValue: case StatsBootstrapAtomValue.boolValue: builder.writeBoolean(value.getBoolValue()); break; case StatsBootstrapAtomValue.Primitive.intValue: case StatsBootstrapAtomValue.intValue: builder.writeInt(value.getIntValue()); break; case StatsBootstrapAtomValue.Primitive.longValue: case StatsBootstrapAtomValue.longValue: builder.writeLong(value.getLongValue()); break; case StatsBootstrapAtomValue.Primitive.floatValue: case StatsBootstrapAtomValue.floatValue: builder.writeFloat(value.getFloatValue()); break; case StatsBootstrapAtomValue.Primitive.stringValue: case StatsBootstrapAtomValue.stringValue: builder.writeString(value.getStringValue()); break; case StatsBootstrapAtomValue.Primitive.bytesValue: case StatsBootstrapAtomValue.bytesValue: builder.writeByteArray(value.getBytesValue()); break; case StatsBootstrapAtomValue.Primitive.stringArrayValue: case StatsBootstrapAtomValue.stringArrayValue: builder.writeStringArray(value.getStringArrayValue()); break; default: Loading @@ -72,25 +71,6 @@ public class StatsBootstrapAtomService extends IStatsBootstrapAtomService.Stub { return; } StatsBootstrapAtomValue.Annotation[] annotations = atomValue.annotations; for (StatsBootstrapAtomValue.Annotation annotation : atomValue.annotations) { if (annotation.id != StatsBootstrapAtomValue.Annotation.Id.IS_UID) { Slog.e(TAG, "Unexpected annotation ID: " + annotation.id + ", for atom " + atom.atomId + ": only UIDs are supported!"); return; } switch (annotation.value.getTag()) { case StatsBootstrapAtomValue.Annotation.Primitive.boolValue: builder.addBooleanAnnotation( annotation.id, annotation.value.getBoolValue()); break; default: Slog.e(TAG, "Unexpected value type " + annotation.value.getTag() + " when logging UID for atom " + atom.atomId); return; } } } StatsLog.write(builder.usePooledBuffer().build()); } Loading