summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorMuhammad Qureshi <muhammadq@google.com>2019-11-06 15:26:08 -0800
committerRuchir Rastogi <ruchirr@google.com>2019-12-19 21:27:18 +0000
commitbc1002d5204dc433ed3f6d210e754d4bc616c351 (patch)
tree89c4cf4242fe551e11d74367bd6dac1237767f78 /core/java/android
parentf5b6267d93647d9cb992442071f76f19e37d3a44 (diff)
Use write_buffer_to_statsd within StatsLog_write
This CL is a partial cherrypick of ag/9686088. This is needed because new changes to libstatssocket (that need to be cherrypicked into AOSP) wrap #write_to_statsd() with #write_buffer_to_statsd(). Bug: 143978873 Test: m -j Test: flashes successfully Test: DocumentsUI(a Mainline module) is able to successfully log to statsd Change-Id: I886331f728ccaa3d281b5683eb89179aa73596b6 Merged-In: I9cdc6151d8feb29a712532e50f143af9d52c8d94
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/util/StatsLog.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/java/android/util/StatsLog.java b/core/java/android/util/StatsLog.java
index f7077bb2a418..ae9966b7b934 100644
--- a/core/java/android/util/StatsLog.java
+++ b/core/java/android/util/StatsLog.java
@@ -224,12 +224,25 @@ public final class StatsLog extends StatsLogInternal {
/**
* Write an event to stats log using the raw format.
*
- * @param buffer The encoded buffer of data to write..
+ * @param buffer The encoded buffer of data to write.
* @param size The number of bytes from the buffer to write.
* @hide
*/
+ // TODO(b/144935988): Mark deprecated.
@SystemApi
- public static native void writeRaw(@NonNull byte[] buffer, int size);
+ public static void writeRaw(@NonNull byte[] buffer, int size) {
+ // TODO(b/144935988): make this no-op once clients have migrated to StatsEvent.
+ writeImpl(buffer, size, 0);
+ }
+
+ /**
+ * Write an event to stats log using the raw format.
+ *
+ * @param buffer The encoded buffer of data to write.
+ * @param size The number of bytes from the buffer to write.
+ * @param atomId The id of the atom to which the event belongs.
+ */
+ private static native void writeImpl(@NonNull byte[] buffer, int size, int atomId);
private static void enforceDumpCallingPermission(Context context) {
context.enforceCallingPermission(android.Manifest.permission.DUMP, "Need DUMP permission.");