Loading location/java/android/location/LocationManager.java +259 −134 File changed.Preview size limit exceeded, changes collapsed. Show changes services/java/com/android/server/LocationManagerService.java +20 −11 Original line number Diff line number Diff line Loading @@ -105,6 +105,12 @@ public class LocationManagerService extends ILocationManager.Stub implements Run private static final String INSTALL_LOCATION_PROVIDER = android.Manifest.permission.INSTALL_LOCATION_PROVIDER; // Location Providers may sometimes deliver location updates // slightly faster that requested - provide grace period so // we don't unnecessarily filter events that are otherwise on // time private static final int MAX_PROVIDER_SCHEDULING_JITTER = 100; // Set of providers that are explicitly enabled private final Set<String> mEnabledProviders = new HashSet<String>(); Loading Loading @@ -194,8 +200,9 @@ public class LocationManagerService extends ILocationManager.Stub implements Run final PendingIntent mPendingIntent; final Object mKey; final HashMap<String,UpdateRecord> mUpdateRecords = new HashMap<String,UpdateRecord>(); int mPendingBroadcasts; String requiredPermissions; String mRequiredPermissions; Receiver(ILocationListener listener) { mListener = listener; Loading Loading @@ -286,7 +293,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run // synchronize to ensure incrementPendingBroadcastsLocked() // is called before decrementPendingBroadcasts() mPendingIntent.send(mContext, 0, statusChanged, this, mLocationHandler, requiredPermissions); mRequiredPermissions); // call this after broadcasting so we do not increment // if we throw an exeption. incrementPendingBroadcastsLocked(); Loading Loading @@ -322,7 +329,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run // synchronize to ensure incrementPendingBroadcastsLocked() // is called before decrementPendingBroadcasts() mPendingIntent.send(mContext, 0, locationChanged, this, mLocationHandler, requiredPermissions); mRequiredPermissions); // call this after broadcasting so we do not increment // if we throw an exeption. incrementPendingBroadcastsLocked(); Loading Loading @@ -362,7 +369,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run // synchronize to ensure incrementPendingBroadcastsLocked() // is called before decrementPendingBroadcasts() mPendingIntent.send(mContext, 0, providerIntent, this, mLocationHandler, requiredPermissions); mRequiredPermissions); // call this after broadcasting so we do not increment // if we throw an exeption. incrementPendingBroadcastsLocked(); Loading @@ -374,6 +381,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run return true; } @Override public void binderDied() { if (LOCAL_LOGV) { Slog.v(TAG, "Location listener died"); Loading Loading @@ -1155,10 +1163,11 @@ public class LocationManagerService extends ILocationManager.Stub implements Run LocationProviderInterface p = mProvidersByName.get(provider); if (p == null) { throw new IllegalArgumentException("provider=" + provider); throw new IllegalArgumentException("requested provider " + provider + " doesn't exisit"); } receiver.requiredPermissions = checkPermissionsSafe(provider, receiver.requiredPermissions); receiver.mRequiredPermissions = checkPermissionsSafe(provider, receiver.mRequiredPermissions); // so wakelock calls will succeed final int callingPid = Binder.getCallingPid(); Loading Loading @@ -1752,9 +1761,9 @@ public class LocationManagerService extends ILocationManager.Stub implements Run return true; } // Don't broadcast same location again regardless of condition // TODO - we should probably still rebroadcast if user explicitly sets a minTime > 0 if (loc.getTime() == lastLoc.getTime()) { // Check whether sufficient time has passed long minTime = record.mMinTime; if (loc.getTime() - lastLoc.getTime() < minTime - MAX_PROVIDER_SCHEDULING_JITTER) { return false; } Loading Loading
location/java/android/location/LocationManager.java +259 −134 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/java/com/android/server/LocationManagerService.java +20 −11 Original line number Diff line number Diff line Loading @@ -105,6 +105,12 @@ public class LocationManagerService extends ILocationManager.Stub implements Run private static final String INSTALL_LOCATION_PROVIDER = android.Manifest.permission.INSTALL_LOCATION_PROVIDER; // Location Providers may sometimes deliver location updates // slightly faster that requested - provide grace period so // we don't unnecessarily filter events that are otherwise on // time private static final int MAX_PROVIDER_SCHEDULING_JITTER = 100; // Set of providers that are explicitly enabled private final Set<String> mEnabledProviders = new HashSet<String>(); Loading Loading @@ -194,8 +200,9 @@ public class LocationManagerService extends ILocationManager.Stub implements Run final PendingIntent mPendingIntent; final Object mKey; final HashMap<String,UpdateRecord> mUpdateRecords = new HashMap<String,UpdateRecord>(); int mPendingBroadcasts; String requiredPermissions; String mRequiredPermissions; Receiver(ILocationListener listener) { mListener = listener; Loading Loading @@ -286,7 +293,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run // synchronize to ensure incrementPendingBroadcastsLocked() // is called before decrementPendingBroadcasts() mPendingIntent.send(mContext, 0, statusChanged, this, mLocationHandler, requiredPermissions); mRequiredPermissions); // call this after broadcasting so we do not increment // if we throw an exeption. incrementPendingBroadcastsLocked(); Loading Loading @@ -322,7 +329,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run // synchronize to ensure incrementPendingBroadcastsLocked() // is called before decrementPendingBroadcasts() mPendingIntent.send(mContext, 0, locationChanged, this, mLocationHandler, requiredPermissions); mRequiredPermissions); // call this after broadcasting so we do not increment // if we throw an exeption. incrementPendingBroadcastsLocked(); Loading Loading @@ -362,7 +369,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run // synchronize to ensure incrementPendingBroadcastsLocked() // is called before decrementPendingBroadcasts() mPendingIntent.send(mContext, 0, providerIntent, this, mLocationHandler, requiredPermissions); mRequiredPermissions); // call this after broadcasting so we do not increment // if we throw an exeption. incrementPendingBroadcastsLocked(); Loading @@ -374,6 +381,7 @@ public class LocationManagerService extends ILocationManager.Stub implements Run return true; } @Override public void binderDied() { if (LOCAL_LOGV) { Slog.v(TAG, "Location listener died"); Loading Loading @@ -1155,10 +1163,11 @@ public class LocationManagerService extends ILocationManager.Stub implements Run LocationProviderInterface p = mProvidersByName.get(provider); if (p == null) { throw new IllegalArgumentException("provider=" + provider); throw new IllegalArgumentException("requested provider " + provider + " doesn't exisit"); } receiver.requiredPermissions = checkPermissionsSafe(provider, receiver.requiredPermissions); receiver.mRequiredPermissions = checkPermissionsSafe(provider, receiver.mRequiredPermissions); // so wakelock calls will succeed final int callingPid = Binder.getCallingPid(); Loading Loading @@ -1752,9 +1761,9 @@ public class LocationManagerService extends ILocationManager.Stub implements Run return true; } // Don't broadcast same location again regardless of condition // TODO - we should probably still rebroadcast if user explicitly sets a minTime > 0 if (loc.getTime() == lastLoc.getTime()) { // Check whether sufficient time has passed long minTime = record.mMinTime; if (loc.getTime() - lastLoc.getTime() < minTime - MAX_PROVIDER_SCHEDULING_JITTER) { return false; } Loading