Merge "Fix event validation check for CHOOSER_ACTION usage events" into main
diff --git a/services/usage/java/com/android/server/usage/UsageStatsService.java b/services/usage/java/com/android/server/usage/UsageStatsService.java
index 58b5ae5..67ae0b2 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsService.java
@@ -2587,11 +2587,12 @@
@Override
public void reportChooserSelection(@NonNull String packageName, int userId,
@NonNull String contentType, String[] annotations, @NonNull String action) {
- // A valid package name, content type, and action must be provided for these events
- Objects.requireNonNull(packageName);
- Objects.requireNonNull(contentType);
- Objects.requireNonNull(action);
- if (contentType.isBlank() || action.isBlank()) {
+ if (packageName == null) {
+ throw new IllegalArgumentException("Package selection must not be null.");
+ }
+ // A valid contentType and action must be provided for chooser selection events.
+ if (contentType == null || contentType.isBlank()
+ || action == null || action.isBlank()) {
return;
}