Log the service component name in the service_request_event_reported

Bug: 259370123
Test: statsd_testdrive 476
Change-Id: I06e6476a17fa86a3f3dc0445bdb08d4d0abb71ca
This commit is contained in:
Jing Ji
2023-01-24 23:56:57 -08:00
parent 2fb90954b5
commit 96d8935a05

View File

@@ -1272,7 +1272,8 @@ public final class ActiveServices {
: (wasStartRequested || !r.getConnections().isEmpty()
? SERVICE_REQUEST_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_HOT
: SERVICE_REQUEST_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM),
getShortProcessNameForStats(callingUid, callingProcessName));
getShortProcessNameForStats(callingUid, callingProcessName),
getShortServiceNameForStats(r));
if (r.startRequested && addToStarting) {
boolean first = smap.mStartingBackground.size() == 0;
@@ -1311,6 +1312,11 @@ public final class ActiveServices {
return processName;
}
private @Nullable String getShortServiceNameForStats(@NonNull ServiceRecord r) {
final ComponentName cn = r.getComponentName();
return cn != null ? cn.getShortClassName() : null;
}
private void stopServiceLocked(ServiceRecord service, boolean enqueueOomAdj) {
try {
Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "stopServiceLocked()");
@@ -3488,7 +3494,8 @@ public final class ActiveServices {
: (wasStartRequested || hadConnections
? SERVICE_REQUEST_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_HOT
: SERVICE_REQUEST_EVENT_REPORTED__PROC_START_TYPE__PROCESS_START_TYPE_WARM),
getShortProcessNameForStats(callingUid, callerApp.processName));
getShortProcessNameForStats(callingUid, callerApp.processName),
getShortServiceNameForStats(s));
if (DEBUG_SERVICE) Slog.v(TAG_SERVICE, "Bind " + s + " with " + b
+ ": received=" + b.intent.received