Merge "Protect ConnectivityService from SecurityException in permission check."

This commit is contained in:
Cody Kesting
2020-03-16 14:33:25 +00:00
committed by Gerrit Code Review
2 changed files with 29 additions and 2 deletions

View File

@@ -7885,8 +7885,15 @@ public class ConnectivityService extends IConnectivityManager.Stub
return true;
}
if (!mLocationPermissionChecker.checkLocationPermission(
callbackPackageName, null /* featureId */, callbackUid, null /* message */)) {
// LocationPermissionChecker#checkLocationPermission can throw SecurityException if the uid
// and package name don't match. Throwing on the CS thread is not acceptable, so wrap the
// call in a try-catch.
try {
if (!mLocationPermissionChecker.checkLocationPermission(
callbackPackageName, null /* featureId */, callbackUid, null /* message */)) {
return false;
}
} catch (SecurityException e) {
return false;
}