Merge "Fix a bug where LocationManager's addGpsStatusListener does not throw a SecurityException if LocationManagerService.mGpsStatusProvider is null even when ACCESS_FINE_LOCATION permission is not present." into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ee57224c0f
@@ -1796,9 +1796,6 @@ public class LocationManagerService extends ILocationManager.Stub {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addGpsStatusListener(IGpsStatusListener listener, String packageName) {
|
public boolean addGpsStatusListener(IGpsStatusListener listener, String packageName) {
|
||||||
if (mGpsStatusProvider == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int allowedResolutionLevel = getCallerAllowedResolutionLevel();
|
int allowedResolutionLevel = getCallerAllowedResolutionLevel();
|
||||||
checkResolutionLevelIsSufficientForProviderUse(allowedResolutionLevel,
|
checkResolutionLevelIsSufficientForProviderUse(allowedResolutionLevel,
|
||||||
LocationManager.GPS_PROVIDER);
|
LocationManager.GPS_PROVIDER);
|
||||||
@@ -1813,6 +1810,10 @@ public class LocationManagerService extends ILocationManager.Stub {
|
|||||||
Binder.restoreCallingIdentity(ident);
|
Binder.restoreCallingIdentity(ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mGpsStatusProvider == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mGpsStatusProvider.addGpsStatusListener(listener);
|
mGpsStatusProvider.addGpsStatusListener(listener);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user