Merge "Ensure only valid events are reported." into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ab109af8fa
@@ -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