Merge "Ensure only valid events are reported." into udc-dev am: ab109af8fa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23067922 Change-Id: I9643e9e9b5b18060ab3f362ecbfa8b04fdc09a88 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -2539,10 +2539,14 @@ public class UsageStatsService extends SystemService implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reportChooserSelection(String packageName, int userId, String contentType,
|
public void reportChooserSelection(@NonNull String packageName, int userId,
|
||||||
String[] annotations, String action) {
|
String contentType, String[] annotations, String action) {
|
||||||
if (packageName == null) {
|
if (packageName == null) {
|
||||||
Slog.w(TAG, "Event report user selecting a null package");
|
throw new IllegalArgumentException("Package selection 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user