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

Commit f38dd2b7 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:...

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22788860



Change-Id: Ic71b9417bcb2baffce585692b0df3096ff65a7ba
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents e20b6ec3 a524b924
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;
            }