Merge "Remove application package name from ContentCapture logging" into tm-dev am: 65f8aea175
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18281616 Change-Id: I5fc74677800fc808297eee8579b17ac108bdc971 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -730,7 +730,7 @@ public final class ContentCaptureManagerService extends
|
|||||||
String serviceName = mServiceNameResolver.getServiceName(userId);
|
String serviceName = mServiceNameResolver.getServiceName(userId);
|
||||||
ContentCaptureMetricsLogger.writeServiceEvent(
|
ContentCaptureMetricsLogger.writeServiceEvent(
|
||||||
EVENT__DATA_SHARE_ERROR_CONCURRENT_REQUEST,
|
EVENT__DATA_SHARE_ERROR_CONCURRENT_REQUEST,
|
||||||
serviceName, request.getPackageName());
|
serviceName);
|
||||||
clientAdapter.error(
|
clientAdapter.error(
|
||||||
ContentCaptureManager.DATA_SHARE_ERROR_CONCURRENT_REQUEST);
|
ContentCaptureManager.DATA_SHARE_ERROR_CONCURRENT_REQUEST);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
@@ -1303,8 +1303,7 @@ public final class ContentCaptureManagerService extends
|
|||||||
private void logServiceEvent(int eventType) {
|
private void logServiceEvent(int eventType) {
|
||||||
int userId = UserHandle.getCallingUserId();
|
int userId = UserHandle.getCallingUserId();
|
||||||
String serviceName = mParentService.mServiceNameResolver.getServiceName(userId);
|
String serviceName = mParentService.mServiceNameResolver.getServiceName(userId);
|
||||||
ContentCaptureMetricsLogger.writeServiceEvent(eventType, serviceName,
|
ContentCaptureMetricsLogger.writeServiceEvent(eventType, serviceName);
|
||||||
mDataShareRequest.getPackageName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,72 +34,48 @@ public final class ContentCaptureMetricsLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static void writeServiceEvent(int eventType, @NonNull String serviceName,
|
public static void writeServiceEvent(int eventType, @NonNull String serviceName) {
|
||||||
@Nullable String targetPackage) {
|
// we should not logging the application package name
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS, eventType,
|
FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS, eventType,
|
||||||
serviceName, targetPackage);
|
serviceName, /* componentName= */ null);
|
||||||
}
|
|
||||||
|
|
||||||
/** @hide */
|
|
||||||
public static void writeServiceEvent(int eventType, @NonNull ComponentName service,
|
|
||||||
@Nullable ComponentName target) {
|
|
||||||
writeServiceEvent(eventType, ComponentName.flattenToShortString(service),
|
|
||||||
ComponentName.flattenToShortString(target));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @hide */
|
|
||||||
public static void writeServiceEvent(int eventType, @NonNull ComponentName service,
|
|
||||||
@Nullable String targetPackage) {
|
|
||||||
writeServiceEvent(eventType, ComponentName.flattenToShortString(service), targetPackage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static void writeServiceEvent(int eventType, @NonNull ComponentName service) {
|
public static void writeServiceEvent(int eventType, @NonNull ComponentName service) {
|
||||||
writeServiceEvent(eventType, ComponentName.flattenToShortString(service), null);
|
writeServiceEvent(eventType, ComponentName.flattenToShortString(service));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static void writeSetWhitelistEvent(@Nullable ComponentName service,
|
public static void writeSetWhitelistEvent(@Nullable ComponentName service,
|
||||||
@Nullable List<String> packages, @Nullable List<ComponentName> activities) {
|
@Nullable List<String> packages, @Nullable List<ComponentName> activities) {
|
||||||
final String serviceName = ComponentName.flattenToShortString(service);
|
final String serviceName = ComponentName.flattenToShortString(service);
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
// TODO: log allow list count.
|
||||||
if (packages != null && packages.size() > 0) {
|
int packageCount = packages != null ? packages.size() : 0;
|
||||||
final int size = packages.size();
|
int activityCount = activities != null ? activities.size() : 0;
|
||||||
stringBuilder.append(packages.get(0));
|
// we should not logging the application package name
|
||||||
for (int i = 1; i < size; i++) {
|
// log the allow list package and activity count instead
|
||||||
stringBuilder.append(" ");
|
|
||||||
stringBuilder.append(packages.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (activities != null && activities.size() > 0) {
|
|
||||||
stringBuilder.append(" ");
|
|
||||||
stringBuilder.append(activities.get(0).flattenToShortString());
|
|
||||||
final int size = activities.size();
|
|
||||||
for (int i = 1; i < size; i++) {
|
|
||||||
stringBuilder.append(" ");
|
|
||||||
stringBuilder.append(activities.get(i).flattenToShortString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS,
|
FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS,
|
||||||
FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS__EVENT__SET_WHITELIST,
|
FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS__EVENT__SET_WHITELIST,
|
||||||
serviceName, stringBuilder.toString());
|
serviceName, /* allowListStr= */ null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static void writeSessionEvent(int sessionId, int event, int flags,
|
public static void writeSessionEvent(int sessionId, int event, int flags,
|
||||||
@NonNull ComponentName service, @Nullable ComponentName app, boolean isChildSession) {
|
@NonNull ComponentName service, boolean isChildSession) {
|
||||||
|
// we should not logging the application package name
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS, sessionId, event,
|
FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS, sessionId, event,
|
||||||
flags, ComponentName.flattenToShortString(service),
|
flags, ComponentName.flattenToShortString(service),
|
||||||
ComponentName.flattenToShortString(app), isChildSession);
|
/* componentName= */ null, isChildSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static void writeSessionFlush(int sessionId, @NonNull ComponentName service,
|
public static void writeSessionFlush(int sessionId, @NonNull ComponentName service,
|
||||||
@Nullable ComponentName app, @NonNull FlushMetrics fm,
|
@NonNull FlushMetrics fm, @NonNull ContentCaptureOptions options,
|
||||||
@NonNull ContentCaptureOptions options, int flushReason) {
|
int flushReason) {
|
||||||
|
// we should not logging the application package name
|
||||||
FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_FLUSHED, sessionId,
|
FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_FLUSHED, sessionId,
|
||||||
ComponentName.flattenToShortString(service),
|
ComponentName.flattenToShortString(service),
|
||||||
ComponentName.flattenToShortString(app), fm.sessionStarted, fm.sessionFinished,
|
/* componentName= */ null, fm.sessionStarted, fm.sessionFinished,
|
||||||
fm.viewAppearedCount, fm.viewDisappearedCount, fm.viewTextChangedCount,
|
fm.viewAppearedCount, fm.viewDisappearedCount, fm.viewTextChangedCount,
|
||||||
options.maxBufferSize, options.idleFlushingFrequencyMs,
|
options.maxBufferSize, options.idleFlushingFrequencyMs,
|
||||||
options.textChangeFlushingFrequencyMs, flushReason);
|
options.textChangeFlushingFrequencyMs, flushReason);
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ final class ContentCapturePerUserService
|
|||||||
writeSessionEvent(sessionId,
|
writeSessionEvent(sessionId,
|
||||||
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED,
|
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED,
|
||||||
STATE_DISABLED | STATE_NO_SERVICE, serviceComponentName,
|
STATE_DISABLED | STATE_NO_SERVICE, serviceComponentName,
|
||||||
componentName, /* isChildSession= */ false);
|
/* isChildSession= */ false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (serviceComponentName == null) {
|
if (serviceComponentName == null) {
|
||||||
@@ -354,7 +354,7 @@ final class ContentCapturePerUserService
|
|||||||
writeSessionEvent(sessionId,
|
writeSessionEvent(sessionId,
|
||||||
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED,
|
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED,
|
||||||
STATE_DISABLED | STATE_NOT_WHITELISTED, serviceComponentName,
|
STATE_DISABLED | STATE_NOT_WHITELISTED, serviceComponentName,
|
||||||
componentName, /* isChildSession= */ false);
|
/* isChildSession= */ false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,7 +368,7 @@ final class ContentCapturePerUserService
|
|||||||
writeSessionEvent(sessionId,
|
writeSessionEvent(sessionId,
|
||||||
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED,
|
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED,
|
||||||
STATE_DISABLED | STATE_DUPLICATED_ID,
|
STATE_DISABLED | STATE_DUPLICATED_ID,
|
||||||
serviceComponentName, componentName, /* isChildSession= */ false);
|
serviceComponentName, /* isChildSession= */ false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +385,7 @@ final class ContentCapturePerUserService
|
|||||||
writeSessionEvent(sessionId,
|
writeSessionEvent(sessionId,
|
||||||
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED,
|
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED,
|
||||||
STATE_DISABLED | STATE_NO_SERVICE, serviceComponentName,
|
STATE_DISABLED | STATE_NO_SERVICE, serviceComponentName,
|
||||||
componentName, /* isChildSession= */ false);
|
/* isChildSession= */ false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,7 +740,7 @@ final class ContentCapturePerUserService
|
|||||||
@Override
|
@Override
|
||||||
public void writeSessionFlush(int sessionId, ComponentName app, FlushMetrics flushMetrics,
|
public void writeSessionFlush(int sessionId, ComponentName app, FlushMetrics flushMetrics,
|
||||||
ContentCaptureOptions options, int flushReason) {
|
ContentCaptureOptions options, int flushReason) {
|
||||||
ContentCaptureMetricsLogger.writeSessionFlush(sessionId, getServiceComponentName(), app,
|
ContentCaptureMetricsLogger.writeSessionFlush(sessionId, getServiceComponentName(),
|
||||||
flushMetrics, options, flushReason);
|
flushMetrics, options, flushReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,8 +119,7 @@ final class RemoteContentCaptureService
|
|||||||
// Metrics logging.
|
// Metrics logging.
|
||||||
writeSessionEvent(sessionId,
|
writeSessionEvent(sessionId,
|
||||||
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__ON_SESSION_STARTED,
|
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__ON_SESSION_STARTED,
|
||||||
initialState, getComponentName(), context.getActivityComponent(),
|
initialState, getComponentName(), /* is_child_session= */ false);
|
||||||
/* is_child_session= */ false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,8 +131,7 @@ final class RemoteContentCaptureService
|
|||||||
// Metrics logging.
|
// Metrics logging.
|
||||||
writeSessionEvent(sessionId,
|
writeSessionEvent(sessionId,
|
||||||
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__ON_SESSION_FINISHED,
|
FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__ON_SESSION_FINISHED,
|
||||||
/* flags= */ 0, getComponentName(), /* app= */ null,
|
/* flags= */ 0, getComponentName(), /* is_child_session= */ false);
|
||||||
/* is_child_session= */ false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,7 +156,7 @@ final class RemoteContentCaptureService
|
|||||||
scheduleAsyncRequest((s) -> s.onDataShared(request, dataShareCallback));
|
scheduleAsyncRequest((s) -> s.onDataShared(request, dataShareCallback));
|
||||||
writeServiceEvent(
|
writeServiceEvent(
|
||||||
FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS__EVENT__ON_DATA_SHARE_REQUEST,
|
FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS__EVENT__ON_DATA_SHARE_REQUEST,
|
||||||
mComponentName, request.getPackageName());
|
mComponentName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user