Merge "USB: Adjust exception message in dealing with permission check #3" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ebe7d4996e
@@ -688,6 +688,8 @@ class UsbUserPermissionManager {
|
|||||||
String packageName,
|
String packageName,
|
||||||
PendingIntent pi,
|
PendingIntent pi,
|
||||||
int uid) {
|
int uid) {
|
||||||
|
boolean throwException = false;
|
||||||
|
|
||||||
// compare uid with packageName to foil apps pretending to be someone else
|
// compare uid with packageName to foil apps pretending to be someone else
|
||||||
try {
|
try {
|
||||||
ApplicationInfo aInfo = mContext.getPackageManager().getApplicationInfo(packageName, 0);
|
ApplicationInfo aInfo = mContext.getPackageManager().getApplicationInfo(packageName, 0);
|
||||||
@@ -695,11 +697,13 @@ class UsbUserPermissionManager {
|
|||||||
Slog.w(TAG, "package " + packageName
|
Slog.w(TAG, "package " + packageName
|
||||||
+ " does not match caller's uid " + uid);
|
+ " does not match caller's uid " + uid);
|
||||||
EventLog.writeEvent(SNET_EVENT_LOG_ID, "180104273", -1, "");
|
EventLog.writeEvent(SNET_EVENT_LOG_ID, "180104273", -1, "");
|
||||||
throw new IllegalArgumentException("package " + packageName
|
throwException = true;
|
||||||
+ " not found");
|
|
||||||
}
|
}
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
throw new IllegalArgumentException("package " + packageName + " not found");
|
throwException = true;
|
||||||
|
} finally {
|
||||||
|
if (throwException)
|
||||||
|
throw new IllegalArgumentException("package " + packageName + " not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
requestPermissionDialog(device, accessory, canBeDefault, packageName, uid, mContext, pi);
|
requestPermissionDialog(device, accessory, canBeDefault, packageName, uid, mContext, pi);
|
||||||
|
|||||||
Reference in New Issue
Block a user