[automerge] Add HotwordMetricsLogger for statistics logging. 2p: b8c2da2587
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17184397 Bug: 207717787 Change-Id: I62f56158ce443eebb85aed8721e2f928487e1d31 Merged-In: If436aae1b4ebdb06c7bd5a1c0b8d6df4e94488cd
This commit is contained in:
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.server.voiceinteraction;
|
||||||
|
|
||||||
|
import com.android.internal.util.FrameworkStatsLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A utility class for logging hotword statistics event.
|
||||||
|
*/
|
||||||
|
public final class HotwordMetricsLogger {
|
||||||
|
|
||||||
|
private HotwordMetricsLogger() {
|
||||||
|
// Class only contains static utility functions, and should not be instantiated
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs information related to create hotword detector.
|
||||||
|
*/
|
||||||
|
public static void writeDetectorCreateEvent(int detectorType, boolean isCreated, int uid) {
|
||||||
|
FrameworkStatsLog.write(FrameworkStatsLog.HOTWORD_DETECTOR_CREATE_REQUESTED, detectorType,
|
||||||
|
isCreated, uid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs information related to hotword detection service init result.
|
||||||
|
*/
|
||||||
|
public static void writeServiceInitResultEvent(int detectorType, int result) {
|
||||||
|
FrameworkStatsLog.write(FrameworkStatsLog.HOTWORD_DETECTION_SERVICE_INIT_RESULT_REPORTED,
|
||||||
|
detectorType, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs information related to hotword detection service restarting.
|
||||||
|
*/
|
||||||
|
public static void writeServiceRestartEvent(int detectorType, int reason) {
|
||||||
|
FrameworkStatsLog.write(FrameworkStatsLog.HOTWORD_DETECTION_SERVICE_RESTARTED,
|
||||||
|
detectorType, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs information related to keyphrase trigger.
|
||||||
|
*/
|
||||||
|
public static void writeKeyphraseTriggerEvent(int detectorType, int result) {
|
||||||
|
FrameworkStatsLog.write(FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED,
|
||||||
|
detectorType, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs information related to hotword detector events.
|
||||||
|
*/
|
||||||
|
public static void writeDetectorEvent(int detectorType, int event, int uid) {
|
||||||
|
FrameworkStatsLog.write(FrameworkStatsLog.HOTWORD_DETECTOR_EVENTS,
|
||||||
|
detectorType, event, uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user