Telephony: Allow getCellLocation() if client has permission ACCESS_FINE_LOCATION

ACCESS_FINE_LOCATION should imply ACCESS_COARSE_LOCATION, so either of these
permissions should be sufficient to allow TelephonyManager.getCellLocation().

Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood
2009-05-19 09:14:41 -04:00
parent 12bb9471cb
commit ac61f6bc2b
2 changed files with 10 additions and 5 deletions

View File

@ -112,9 +112,13 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
if (events != 0) { if (events != 0) {
// check permissions // check permissions
if ((events & PhoneStateListener.LISTEN_CELL_LOCATION) != 0) { if ((events & PhoneStateListener.LISTEN_CELL_LOCATION) != 0) {
mContext.enforceCallingOrSelfPermission( // ACCESS_FINE_LOCATION implies ACCESS_COARSE_LOCATION
android.Manifest.permission.ACCESS_COARSE_LOCATION, null); if (mContext.checkCallingPermission(
android.Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.ACCESS_COARSE_LOCATION, null);
}
} }
synchronized (mRecords) { synchronized (mRecords) {

View File

@ -192,8 +192,9 @@ public class TelephonyManager {
/** /**
* Returns the current location of the device. * Returns the current location of the device.
* *
* <p>Requires Permission: {@link android.Manifest.permission#ACCESS_COARSE_LOCATION * <p>Requires Permission:
* ACCESS_COARSE_LOCATION}. * {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_COARSE_LOCATION} or
* {@link android.Manifest.permission#ACCESS_COARSE_LOCATION ACCESS_FINE_LOCATION}.
*/ */
public CellLocation getCellLocation() { public CellLocation getCellLocation() {
try { try {