From bd512f385432d0cc9372b79122aefc5a9dcf149f Mon Sep 17 00:00:00 2001 From: Vova Sharaienko Date: Fri, 17 Mar 2023 03:46:12 +0000 Subject: [TeX] Introduced Telemetry Express Logging APIs - provided Java Counter metric logging API with UID Bug: 262791247 Test: m Change-Id: I98bab34d348768d3b66d70e654fe697db5269023 --- .../com/android/internal/expresslog/Counter.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/core/java/com/android/internal/expresslog/Counter.java b/core/java/com/android/internal/expresslog/Counter.java index afdbdc8ead73..4a46d91efbf0 100644 --- a/core/java/com/android/internal/expresslog/Counter.java +++ b/core/java/com/android/internal/expresslog/Counter.java @@ -35,6 +35,16 @@ public final class Counter { logIncrement(metricId, 1); } + /** + * Increments Telemetry Express Counter metric by 1 + * @param metricId to log, no-op if metricId is not defined in the TeX catalog + * @param uid used as a dimension for the count metric + * @hide + */ + public static void logIncrementWithUid(@NonNull String metricId, int uid) { + logIncrementWithUid(metricId, uid, 1); + } + /** * Increments Telemetry Express Counter metric by arbitrary value * @param metricId to log, no-op if metricId is not defined in the TeX catalog @@ -45,4 +55,17 @@ public final class Counter { final long metricIdHash = Utils.hashString(metricId); FrameworkStatsLog.write(FrameworkStatsLog.EXPRESS_EVENT_REPORTED, metricIdHash, amount); } + + /** + * Increments Telemetry Express Counter metric by arbitrary value + * @param metricId to log, no-op if metricId is not defined in the TeX catalog + * @param uid used as a dimension for the count metric + * @param amount to increment counter + * @hide + */ + public static void logIncrementWithUid(@NonNull String metricId, int uid, long amount) { + final long metricIdHash = Utils.hashString(metricId); + FrameworkStatsLog.write( + FrameworkStatsLog.EXPRESS_UID_EVENT_REPORTED, metricIdHash, amount, uid); + } } -- cgit v1.2.3-59-g8ed1b