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

Commit a4bba9ad authored by Muhammad Qureshi's avatar Muhammad Qureshi Committed by android-build-merger
Browse files

Merge "Add JNI call for writing StatsEvent to statsd."

am: 9e52462c

Change-Id: I26a17ae02b774ff86ec4c59a9fcc6947ed7f3f02
parents 166b068d 9e52462c
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.");
    }