diff options
author | Jeff Brown <jeffbrown@google.com> | 2015-04-28 13:26:48 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2015-04-28 17:53:32 -0700 |
commit | e7e9ccea3246eec3607bfc77bc8500611989e84c (patch) | |
tree | e7fadd486939848ea17582e21e315617978b3f8c /core/java/android/util | |
parent | 4703273e400981e9ec1bca7e9fbf949b20e91d57 (diff) | |
download | frameworks_base-e7e9ccea3246eec3607bfc77bc8500611989e84c.zip frameworks_base-e7e9ccea3246eec3607bfc77bc8500611989e84c.tar.gz frameworks_base-e7e9ccea3246eec3607bfc77bc8500611989e84c.tar.bz2 |
Add float support to binary event log.
Bug: 20664753
Change-Id: I90456400b878f943e39cbddec45649662176e2aa
Diffstat (limited to 'core/java/android/util')
-rw-r--r-- | core/java/android/util/EventLog.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/core/java/android/util/EventLog.java b/core/java/android/util/EventLog.java index aefced8..558b8f5 100644 --- a/core/java/android/util/EventLog.java +++ b/core/java/android/util/EventLog.java @@ -74,6 +74,7 @@ public class EventLog { private static final byte LONG_TYPE = 1; private static final byte STRING_TYPE = 2; private static final byte LIST_TYPE = 3; + private static final byte FLOAT_TYPE = 4; /** @param data containing event, read from the system */ /*package*/ Event(byte[] data) { @@ -106,7 +107,7 @@ public class EventLog { return mBuffer.getInt(offset); } - /** @return one of Integer, Long, String, null, or Object[] of same. */ + /** @return one of Integer, Long, Float, String, null, or Object[] of same. */ public synchronized Object getData() { try { int offset = mBuffer.getShort(HEADER_SIZE_OFFSET); @@ -130,10 +131,13 @@ public class EventLog { byte type = mBuffer.get(); switch (type) { case INT_TYPE: - return (Integer) mBuffer.getInt(); + return mBuffer.getInt(); case LONG_TYPE: - return (Long) mBuffer.getLong(); + return mBuffer.getLong(); + + case FLOAT_TYPE: + return mBuffer.getFloat(); case STRING_TYPE: try { @@ -180,6 +184,14 @@ public class EventLog { /** * Record an event log message. * @param tag The event type tag code + * @param value A value to log + * @return The number of bytes written + */ + public static native int writeEvent(int tag, float value); + + /** + * Record an event log message. + * @param tag The event type tag code * @param str A value to log * @return The number of bytes written */ |