Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 260f75a9 authored by Xin Guan's avatar Xin Guan
Browse files

Fix event validation check for CHOOSER_ACTION usage events

Revert back to the original parameter check for reportChooserSelection
to ensure no application behavior breakage.

Bug: 301564659
Test: atest CtsUsageStatsTest
Change-Id: If7f72724395a14222cf75c1281c078a2a85468a3
parent a1bfd75d
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -2587,11 +2587,12 @@ public class UsageStatsService extends SystemService implements
        @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;
            }