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

Commit 7d928a51 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Ensure valid parameters for CHOOSER_ACTION events." into udc-dev am:...

Merge "Ensure valid parameters for CHOOSER_ACTION events." into udc-dev am: aefac4e0 am: dd39ab94 am: dbbbef72

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



Change-Id: I902b18d218a1f01fc91ce305a2fb1ffa2e272dfc
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2fb8607d dbbbef72
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -2540,10 +2540,15 @@ public class UsageStatsService extends SystemService implements


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