Loading services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java +2 −3 Original line number Diff line number Diff line Loading @@ -730,7 +730,7 @@ public final class ContentCaptureManagerService extends String serviceName = mServiceNameResolver.getServiceName(userId); ContentCaptureMetricsLogger.writeServiceEvent( EVENT__DATA_SHARE_ERROR_CONCURRENT_REQUEST, serviceName, request.getPackageName()); serviceName); clientAdapter.error( ContentCaptureManager.DATA_SHARE_ERROR_CONCURRENT_REQUEST); } catch (RemoteException e) { Loading Loading @@ -1303,8 +1303,7 @@ public final class ContentCaptureManagerService extends private void logServiceEvent(int eventType) { int userId = UserHandle.getCallingUserId(); String serviceName = mParentService.mServiceNameResolver.getServiceName(userId); ContentCaptureMetricsLogger.writeServiceEvent(eventType, serviceName, mDataShareRequest.getPackageName()); ContentCaptureMetricsLogger.writeServiceEvent(eventType, serviceName); } } } services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java +17 −41 Original line number Diff line number Diff line Loading @@ -34,72 +34,48 @@ public final class ContentCaptureMetricsLogger { } /** @hide */ public static void writeServiceEvent(int eventType, @NonNull String serviceName, @Nullable String targetPackage) { public static void writeServiceEvent(int eventType, @NonNull String serviceName) { // we should not logging the application package name FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS, eventType, serviceName, targetPackage); } /** @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); serviceName, /* componentName= */ null); } /** @hide */ public static void writeServiceEvent(int eventType, @NonNull ComponentName service) { writeServiceEvent(eventType, ComponentName.flattenToShortString(service), null); writeServiceEvent(eventType, ComponentName.flattenToShortString(service)); } /** @hide */ public static void writeSetWhitelistEvent(@Nullable ComponentName service, @Nullable List<String> packages, @Nullable List<ComponentName> activities) { final String serviceName = ComponentName.flattenToShortString(service); StringBuilder stringBuilder = new StringBuilder(); if (packages != null && packages.size() > 0) { final int size = packages.size(); stringBuilder.append(packages.get(0)); for (int i = 1; i < size; i++) { 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()); } } // TODO: log allow list count. int packageCount = packages != null ? packages.size() : 0; int activityCount = activities != null ? activities.size() : 0; // we should not logging the application package name // log the allow list package and activity count instead FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS, FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS__EVENT__SET_WHITELIST, serviceName, stringBuilder.toString()); serviceName, /* allowListStr= */ null); } /** @hide */ 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, flags, ComponentName.flattenToShortString(service), ComponentName.flattenToShortString(app), isChildSession); /* componentName= */ null, isChildSession); } /** @hide */ public static void writeSessionFlush(int sessionId, @NonNull ComponentName service, @Nullable ComponentName app, @NonNull FlushMetrics fm, @NonNull ContentCaptureOptions options, int flushReason) { @NonNull FlushMetrics fm, @NonNull ContentCaptureOptions options, int flushReason) { // we should not logging the application package name FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_FLUSHED, sessionId, ComponentName.flattenToShortString(service), ComponentName.flattenToShortString(app), fm.sessionStarted, fm.sessionFinished, /* componentName= */ null, fm.sessionStarted, fm.sessionFinished, fm.viewAppearedCount, fm.viewDisappearedCount, fm.viewTextChangedCount, options.maxBufferSize, options.idleFlushingFrequencyMs, options.textChangeFlushingFrequencyMs, flushReason); Loading services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java +5 −5 Original line number Diff line number Diff line Loading @@ -330,7 +330,7 @@ final class ContentCapturePerUserService writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED, STATE_DISABLED | STATE_NO_SERVICE, serviceComponentName, componentName, /* isChildSession= */ false); /* isChildSession= */ false); return; } if (serviceComponentName == null) { Loading @@ -354,7 +354,7 @@ final class ContentCapturePerUserService writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED, STATE_DISABLED | STATE_NOT_WHITELISTED, serviceComponentName, componentName, /* isChildSession= */ false); /* isChildSession= */ false); return; } Loading @@ -368,7 +368,7 @@ final class ContentCapturePerUserService writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED, STATE_DISABLED | STATE_DUPLICATED_ID, serviceComponentName, componentName, /* isChildSession= */ false); serviceComponentName, /* isChildSession= */ false); return; } Loading @@ -385,7 +385,7 @@ final class ContentCapturePerUserService writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED, STATE_DISABLED | STATE_NO_SERVICE, serviceComponentName, componentName, /* isChildSession= */ false); /* isChildSession= */ false); return; } Loading Loading @@ -740,7 +740,7 @@ final class ContentCapturePerUserService @Override public void writeSessionFlush(int sessionId, ComponentName app, FlushMetrics flushMetrics, ContentCaptureOptions options, int flushReason) { ContentCaptureMetricsLogger.writeSessionFlush(sessionId, getServiceComponentName(), app, ContentCaptureMetricsLogger.writeSessionFlush(sessionId, getServiceComponentName(), flushMetrics, options, flushReason); } Loading services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java +3 −5 Original line number Diff line number Diff line Loading @@ -119,8 +119,7 @@ final class RemoteContentCaptureService // Metrics logging. writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__ON_SESSION_STARTED, initialState, getComponentName(), context.getActivityComponent(), /* is_child_session= */ false); initialState, getComponentName(), /* is_child_session= */ false); } /** Loading @@ -132,8 +131,7 @@ final class RemoteContentCaptureService // Metrics logging. writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__ON_SESSION_FINISHED, /* flags= */ 0, getComponentName(), /* app= */ null, /* is_child_session= */ false); /* flags= */ 0, getComponentName(), /* is_child_session= */ false); } /** Loading @@ -158,7 +156,7 @@ final class RemoteContentCaptureService scheduleAsyncRequest((s) -> s.onDataShared(request, dataShareCallback)); writeServiceEvent( FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS__EVENT__ON_DATA_SHARE_REQUEST, mComponentName, request.getPackageName()); mComponentName); } /** Loading Loading
services/contentcapture/java/com/android/server/contentcapture/ContentCaptureManagerService.java +2 −3 Original line number Diff line number Diff line Loading @@ -730,7 +730,7 @@ public final class ContentCaptureManagerService extends String serviceName = mServiceNameResolver.getServiceName(userId); ContentCaptureMetricsLogger.writeServiceEvent( EVENT__DATA_SHARE_ERROR_CONCURRENT_REQUEST, serviceName, request.getPackageName()); serviceName); clientAdapter.error( ContentCaptureManager.DATA_SHARE_ERROR_CONCURRENT_REQUEST); } catch (RemoteException e) { Loading Loading @@ -1303,8 +1303,7 @@ public final class ContentCaptureManagerService extends private void logServiceEvent(int eventType) { int userId = UserHandle.getCallingUserId(); String serviceName = mParentService.mServiceNameResolver.getServiceName(userId); ContentCaptureMetricsLogger.writeServiceEvent(eventType, serviceName, mDataShareRequest.getPackageName()); ContentCaptureMetricsLogger.writeServiceEvent(eventType, serviceName); } } }
services/contentcapture/java/com/android/server/contentcapture/ContentCaptureMetricsLogger.java +17 −41 Original line number Diff line number Diff line Loading @@ -34,72 +34,48 @@ public final class ContentCaptureMetricsLogger { } /** @hide */ public static void writeServiceEvent(int eventType, @NonNull String serviceName, @Nullable String targetPackage) { public static void writeServiceEvent(int eventType, @NonNull String serviceName) { // we should not logging the application package name FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS, eventType, serviceName, targetPackage); } /** @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); serviceName, /* componentName= */ null); } /** @hide */ public static void writeServiceEvent(int eventType, @NonNull ComponentName service) { writeServiceEvent(eventType, ComponentName.flattenToShortString(service), null); writeServiceEvent(eventType, ComponentName.flattenToShortString(service)); } /** @hide */ public static void writeSetWhitelistEvent(@Nullable ComponentName service, @Nullable List<String> packages, @Nullable List<ComponentName> activities) { final String serviceName = ComponentName.flattenToShortString(service); StringBuilder stringBuilder = new StringBuilder(); if (packages != null && packages.size() > 0) { final int size = packages.size(); stringBuilder.append(packages.get(0)); for (int i = 1; i < size; i++) { 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()); } } // TODO: log allow list count. int packageCount = packages != null ? packages.size() : 0; int activityCount = activities != null ? activities.size() : 0; // we should not logging the application package name // log the allow list package and activity count instead FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS, FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS__EVENT__SET_WHITELIST, serviceName, stringBuilder.toString()); serviceName, /* allowListStr= */ null); } /** @hide */ 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, flags, ComponentName.flattenToShortString(service), ComponentName.flattenToShortString(app), isChildSession); /* componentName= */ null, isChildSession); } /** @hide */ public static void writeSessionFlush(int sessionId, @NonNull ComponentName service, @Nullable ComponentName app, @NonNull FlushMetrics fm, @NonNull ContentCaptureOptions options, int flushReason) { @NonNull FlushMetrics fm, @NonNull ContentCaptureOptions options, int flushReason) { // we should not logging the application package name FrameworkStatsLog.write(FrameworkStatsLog.CONTENT_CAPTURE_FLUSHED, sessionId, ComponentName.flattenToShortString(service), ComponentName.flattenToShortString(app), fm.sessionStarted, fm.sessionFinished, /* componentName= */ null, fm.sessionStarted, fm.sessionFinished, fm.viewAppearedCount, fm.viewDisappearedCount, fm.viewTextChangedCount, options.maxBufferSize, options.idleFlushingFrequencyMs, options.textChangeFlushingFrequencyMs, flushReason); Loading
services/contentcapture/java/com/android/server/contentcapture/ContentCapturePerUserService.java +5 −5 Original line number Diff line number Diff line Loading @@ -330,7 +330,7 @@ final class ContentCapturePerUserService writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED, STATE_DISABLED | STATE_NO_SERVICE, serviceComponentName, componentName, /* isChildSession= */ false); /* isChildSession= */ false); return; } if (serviceComponentName == null) { Loading @@ -354,7 +354,7 @@ final class ContentCapturePerUserService writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED, STATE_DISABLED | STATE_NOT_WHITELISTED, serviceComponentName, componentName, /* isChildSession= */ false); /* isChildSession= */ false); return; } Loading @@ -368,7 +368,7 @@ final class ContentCapturePerUserService writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED, STATE_DISABLED | STATE_DUPLICATED_ID, serviceComponentName, componentName, /* isChildSession= */ false); serviceComponentName, /* isChildSession= */ false); return; } Loading @@ -385,7 +385,7 @@ final class ContentCapturePerUserService writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__SESSION_NOT_CREATED, STATE_DISABLED | STATE_NO_SERVICE, serviceComponentName, componentName, /* isChildSession= */ false); /* isChildSession= */ false); return; } Loading Loading @@ -740,7 +740,7 @@ final class ContentCapturePerUserService @Override public void writeSessionFlush(int sessionId, ComponentName app, FlushMetrics flushMetrics, ContentCaptureOptions options, int flushReason) { ContentCaptureMetricsLogger.writeSessionFlush(sessionId, getServiceComponentName(), app, ContentCaptureMetricsLogger.writeSessionFlush(sessionId, getServiceComponentName(), flushMetrics, options, flushReason); } Loading
services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java +3 −5 Original line number Diff line number Diff line Loading @@ -119,8 +119,7 @@ final class RemoteContentCaptureService // Metrics logging. writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__ON_SESSION_STARTED, initialState, getComponentName(), context.getActivityComponent(), /* is_child_session= */ false); initialState, getComponentName(), /* is_child_session= */ false); } /** Loading @@ -132,8 +131,7 @@ final class RemoteContentCaptureService // Metrics logging. writeSessionEvent(sessionId, FrameworkStatsLog.CONTENT_CAPTURE_SESSION_EVENTS__EVENT__ON_SESSION_FINISHED, /* flags= */ 0, getComponentName(), /* app= */ null, /* is_child_session= */ false); /* flags= */ 0, getComponentName(), /* is_child_session= */ false); } /** Loading @@ -158,7 +156,7 @@ final class RemoteContentCaptureService scheduleAsyncRequest((s) -> s.onDataShared(request, dataShareCallback)); writeServiceEvent( FrameworkStatsLog.CONTENT_CAPTURE_SERVICE_EVENTS__EVENT__ON_DATA_SHARE_REQUEST, mComponentName, request.getPackageName()); mComponentName); } /** Loading