Add null check for component name when fetching uid

Bug: 133442663
Test: Bug is not reproducible, but this is just adding a null check
Change-Id: Iaf4231b4b3b1e6e35ab7e7f7cac86a192ad7cd9b
This commit is contained in:
Winson Chung
2019-05-24 13:48:55 -07:00
parent f581d1b92f
commit 0edcacb14c

View File

@@ -72,6 +72,9 @@ public class MetricsLoggerWrapper {
*/
private static int getUid(Context context, ComponentName componentName, int userId) {
int uid = -1;
if (componentName == null) {
return uid;
}
try {
uid = context.getPackageManager().getApplicationInfoAsUser(
componentName.getPackageName(), 0, userId).uid;