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

Commit 34db7217 authored by Varun Shah's avatar Varun Shah Committed by Automerger Merge Worker
Browse files

Merge "Ensure only valid events are reported." into udc-dev am: 4bde468c am: 2bba110b

parents 9a9ecbcb 2bba110b
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -2539,10 +2539,20 @@ public class UsageStatsService extends SystemService implements
        }

        @Override
        public void reportChooserSelection(String packageName, int userId, String contentType,
                                           String[] annotations, String action) {
        public void reportChooserSelection(@NonNull String packageName, int userId,
                @NonNull String contentType, String[] annotations, @NonNull String action) {
            if (packageName == null) {
                Slog.w(TAG, "Event report user selecting a null package");
                throw new IllegalArgumentException("Package selection must not be null.");
            }
            if (contentType == null) {
                throw new IllegalArgumentException("Content type for selection must not be null.");
            }
            if (action == null) {
                throw new IllegalArgumentException("Selection action must not be null.");
            }
            // Verify if this package exists before reporting an event for it.
            if (mPackageManagerInternal.getPackageUid(packageName, 0, userId) < 0) {
                Slog.w(TAG, "Event report user selecting an invalid package");
                return;
            }