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

Commit 80e3e7a4 authored by Muhammad Qureshi's avatar Muhammad Qureshi
Browse files

Add JNI call for writing StatsEvent to statsd.

Bug: 143978873
Test: m -j
Test: flashes successfully
Test: DocumentsUI(a Mainline module) is able to successfully log to statsd
Change-Id: I9cdc6151d8feb29a712532e50f143af9d52c8d94
Merged-In: I9cdc6151d8feb29a712532e50f143af9d52c8d94
parent 2dfca163
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -244,6 +244,16 @@ public final class StatsLog extends StatsLogInternal {
     */
    private static native void writeImpl(@NonNull byte[] buffer, int size, int atomId);

    /**
     * Write an event to stats log using the raw format encapsulated in StatsEvent.
     *
     * @param statsEvent    The StatsEvent object containing the encoded buffer of data to write.
     * @hide
     */
    public static void write(@NonNull final StatsEvent statsEvent) {
        writeImpl(statsEvent.getBytes(), statsEvent.getNumBytes(), statsEvent.getAtomId());
    }

    private static void enforceDumpCallingPermission(Context context) {
        context.enforceCallingPermission(android.Manifest.permission.DUMP, "Need DUMP permission.");
    }