Loading core/java/android/app/ContextImpl.java +3 −3 Original line number Diff line number Diff line Loading @@ -361,10 +361,10 @@ class ContextImpl extends Context { return PolicyManager.makeNewLayoutInflater(ctx.getOuterContext()); }}); registerService(LOCATION_SERVICE, new StaticServiceFetcher() { public Object createStaticService() { registerService(LOCATION_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(LOCATION_SERVICE); return new LocationManager(ILocationManager.Stub.asInterface(b)); return new LocationManager(ctx, ILocationManager.Stub.asInterface(b)); }}); registerService(NETWORK_POLICY_SERVICE, new ServiceFetcher() { Loading location/java/android/location/ILocationManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ interface ILocationManager boolean sendExtraCommand(String provider, String command, inout Bundle extras); void addProximityAlert(double latitude, double longitude, float distance, long expiration, in PendingIntent intent); long expiration, in PendingIntent intent, in String packageName); void removeProximityAlert(in PendingIntent intent); Bundle getProviderInfo(String provider); Loading location/java/android/location/LocationManager.java +17 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.location; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Looper; Loading Loading @@ -52,7 +53,9 @@ import java.util.List; */ public class LocationManager { private static final String TAG = "LocationManager"; private ILocationManager mService; private final Context mContext; private final ILocationManager mService; private final HashMap<GpsStatus.Listener, GpsStatusListenerTransport> mGpsStatusListeners = new HashMap<GpsStatus.Listener, GpsStatusListenerTransport>(); private final HashMap<GpsStatus.NmeaListener, GpsStatusListenerTransport> mNmeaListeners = Loading Loading @@ -193,6 +196,7 @@ public class LocationManager { } } @Override public void onLocationChanged(Location location) { Message msg = Message.obtain(); msg.what = TYPE_LOCATION_CHANGED; Loading @@ -200,6 +204,7 @@ public class LocationManager { mListenerHandler.sendMessage(msg); } @Override public void onStatusChanged(String provider, int status, Bundle extras) { Message msg = Message.obtain(); msg.what = TYPE_STATUS_CHANGED; Loading @@ -213,6 +218,7 @@ public class LocationManager { mListenerHandler.sendMessage(msg); } @Override public void onProviderEnabled(String provider) { Message msg = Message.obtain(); msg.what = TYPE_PROVIDER_ENABLED; Loading @@ -220,6 +226,7 @@ public class LocationManager { mListenerHandler.sendMessage(msg); } @Override public void onProviderDisabled(String provider) { Message msg = Message.obtain(); msg.what = TYPE_PROVIDER_DISABLED; Loading Loading @@ -260,8 +267,9 @@ public class LocationManager { * right way to create an instance of this class is using the * factory Context.getSystemService. */ public LocationManager(ILocationManager service) { public LocationManager(Context context, ILocationManager service) { mService = service; mContext = context; } private LocationProvider createProvider(String name, Bundle info) { Loading Loading @@ -1086,8 +1094,8 @@ public class LocationManager { ", intent = " + intent); } try { mService.addProximityAlert(latitude, longitude, radius, expiration, intent); mService.addProximityAlert(latitude, longitude, radius, expiration, intent, mContext.getPackageName()); } catch (RemoteException ex) { Log.e(TAG, "addProximityAlert: RemoteException", ex); } Loading Loading @@ -1361,6 +1369,7 @@ public class LocationManager { mNmeaBuffer = new ArrayList<Nmea>(); } @Override public void onGpsStarted() { if (mListener != null) { Message msg = Message.obtain(); Loading @@ -1369,6 +1378,7 @@ public class LocationManager { } } @Override public void onGpsStopped() { if (mListener != null) { Message msg = Message.obtain(); Loading @@ -1377,6 +1387,7 @@ public class LocationManager { } } @Override public void onFirstFix(int ttff) { if (mListener != null) { mGpsStatus.setTimeToFirstFix(ttff); Loading @@ -1386,6 +1397,7 @@ public class LocationManager { } } @Override public void onSvStatusChanged(int svCount, int[] prns, float[] snrs, float[] elevations, float[] azimuths, int ephemerisMask, int almanacMask, int usedInFixMask) { Loading @@ -1401,6 +1413,7 @@ public class LocationManager { } } @Override public void onNmeaReceived(long timestamp, String nmea) { if (mNmeaListener != null) { synchronized (mNmeaBuffer) { Loading location/java/com/android/internal/location/DummyLocationProvider.java +10 −1 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ public class DummyLocationProvider extends LocationProvider { * Returns true if the provider requires access to a * data network (e.g., the Internet), false otherwise. */ @Override public boolean requiresNetwork() { return mRequiresNetwork; } Loading @@ -95,6 +96,7 @@ public class DummyLocationProvider extends LocationProvider { * satellite-based positioning system (e.g., GPS), false * otherwise. */ @Override public boolean requiresSatellite() { return mRequiresSatellite; } Loading @@ -104,6 +106,7 @@ public class DummyLocationProvider extends LocationProvider { * cellular network (e.g., to make use of cell tower IDs), false * otherwise. */ @Override public boolean requiresCell() { return mRequiresCell; } Loading @@ -113,6 +116,7 @@ public class DummyLocationProvider extends LocationProvider { * monetary charge to the user, false if use is free. It is up to * each provider to give accurate information. */ @Override public boolean hasMonetaryCost() { return mHasMonetaryCost; } Loading @@ -123,6 +127,7 @@ public class DummyLocationProvider extends LocationProvider { * under most circumstances but may occassionally not report it * should return true. */ @Override public boolean supportsAltitude() { return mSupportsAltitude; } Loading @@ -133,6 +138,7 @@ public class DummyLocationProvider extends LocationProvider { * under most circumstances but may occassionally not report it * should return true. */ @Override public boolean supportsSpeed() { return mSupportsSpeed; } Loading @@ -143,6 +149,7 @@ public class DummyLocationProvider extends LocationProvider { * under most circumstances but may occassionally not report it * should return true. */ @Override public boolean supportsBearing() { return mSupportsBearing; } Loading @@ -153,6 +160,7 @@ public class DummyLocationProvider extends LocationProvider { * @return the power requirement for this provider, as one of the * constants Criteria.POWER_REQUIREMENT_*. */ @Override public int getPowerRequirement() { return mPowerRequirement; } Loading @@ -164,6 +172,7 @@ public class DummyLocationProvider extends LocationProvider { * @return the horizontal accuracy for this provider, as one of the * constants Criteria.ACCURACY_*. */ @Override public int getAccuracy() { return mAccuracy; } Loading services/java/com/android/server/LocationManagerService.java +93 −356 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/java/android/app/ContextImpl.java +3 −3 Original line number Diff line number Diff line Loading @@ -361,10 +361,10 @@ class ContextImpl extends Context { return PolicyManager.makeNewLayoutInflater(ctx.getOuterContext()); }}); registerService(LOCATION_SERVICE, new StaticServiceFetcher() { public Object createStaticService() { registerService(LOCATION_SERVICE, new ServiceFetcher() { public Object createService(ContextImpl ctx) { IBinder b = ServiceManager.getService(LOCATION_SERVICE); return new LocationManager(ILocationManager.Stub.asInterface(b)); return new LocationManager(ctx, ILocationManager.Stub.asInterface(b)); }}); registerService(NETWORK_POLICY_SERVICE, new ServiceFetcher() { Loading
location/java/android/location/ILocationManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ interface ILocationManager boolean sendExtraCommand(String provider, String command, inout Bundle extras); void addProximityAlert(double latitude, double longitude, float distance, long expiration, in PendingIntent intent); long expiration, in PendingIntent intent, in String packageName); void removeProximityAlert(in PendingIntent intent); Bundle getProviderInfo(String provider); Loading
location/java/android/location/LocationManager.java +17 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.location; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Looper; Loading Loading @@ -52,7 +53,9 @@ import java.util.List; */ public class LocationManager { private static final String TAG = "LocationManager"; private ILocationManager mService; private final Context mContext; private final ILocationManager mService; private final HashMap<GpsStatus.Listener, GpsStatusListenerTransport> mGpsStatusListeners = new HashMap<GpsStatus.Listener, GpsStatusListenerTransport>(); private final HashMap<GpsStatus.NmeaListener, GpsStatusListenerTransport> mNmeaListeners = Loading Loading @@ -193,6 +196,7 @@ public class LocationManager { } } @Override public void onLocationChanged(Location location) { Message msg = Message.obtain(); msg.what = TYPE_LOCATION_CHANGED; Loading @@ -200,6 +204,7 @@ public class LocationManager { mListenerHandler.sendMessage(msg); } @Override public void onStatusChanged(String provider, int status, Bundle extras) { Message msg = Message.obtain(); msg.what = TYPE_STATUS_CHANGED; Loading @@ -213,6 +218,7 @@ public class LocationManager { mListenerHandler.sendMessage(msg); } @Override public void onProviderEnabled(String provider) { Message msg = Message.obtain(); msg.what = TYPE_PROVIDER_ENABLED; Loading @@ -220,6 +226,7 @@ public class LocationManager { mListenerHandler.sendMessage(msg); } @Override public void onProviderDisabled(String provider) { Message msg = Message.obtain(); msg.what = TYPE_PROVIDER_DISABLED; Loading Loading @@ -260,8 +267,9 @@ public class LocationManager { * right way to create an instance of this class is using the * factory Context.getSystemService. */ public LocationManager(ILocationManager service) { public LocationManager(Context context, ILocationManager service) { mService = service; mContext = context; } private LocationProvider createProvider(String name, Bundle info) { Loading Loading @@ -1086,8 +1094,8 @@ public class LocationManager { ", intent = " + intent); } try { mService.addProximityAlert(latitude, longitude, radius, expiration, intent); mService.addProximityAlert(latitude, longitude, radius, expiration, intent, mContext.getPackageName()); } catch (RemoteException ex) { Log.e(TAG, "addProximityAlert: RemoteException", ex); } Loading Loading @@ -1361,6 +1369,7 @@ public class LocationManager { mNmeaBuffer = new ArrayList<Nmea>(); } @Override public void onGpsStarted() { if (mListener != null) { Message msg = Message.obtain(); Loading @@ -1369,6 +1378,7 @@ public class LocationManager { } } @Override public void onGpsStopped() { if (mListener != null) { Message msg = Message.obtain(); Loading @@ -1377,6 +1387,7 @@ public class LocationManager { } } @Override public void onFirstFix(int ttff) { if (mListener != null) { mGpsStatus.setTimeToFirstFix(ttff); Loading @@ -1386,6 +1397,7 @@ public class LocationManager { } } @Override public void onSvStatusChanged(int svCount, int[] prns, float[] snrs, float[] elevations, float[] azimuths, int ephemerisMask, int almanacMask, int usedInFixMask) { Loading @@ -1401,6 +1413,7 @@ public class LocationManager { } } @Override public void onNmeaReceived(long timestamp, String nmea) { if (mNmeaListener != null) { synchronized (mNmeaBuffer) { Loading
location/java/com/android/internal/location/DummyLocationProvider.java +10 −1 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ public class DummyLocationProvider extends LocationProvider { * Returns true if the provider requires access to a * data network (e.g., the Internet), false otherwise. */ @Override public boolean requiresNetwork() { return mRequiresNetwork; } Loading @@ -95,6 +96,7 @@ public class DummyLocationProvider extends LocationProvider { * satellite-based positioning system (e.g., GPS), false * otherwise. */ @Override public boolean requiresSatellite() { return mRequiresSatellite; } Loading @@ -104,6 +106,7 @@ public class DummyLocationProvider extends LocationProvider { * cellular network (e.g., to make use of cell tower IDs), false * otherwise. */ @Override public boolean requiresCell() { return mRequiresCell; } Loading @@ -113,6 +116,7 @@ public class DummyLocationProvider extends LocationProvider { * monetary charge to the user, false if use is free. It is up to * each provider to give accurate information. */ @Override public boolean hasMonetaryCost() { return mHasMonetaryCost; } Loading @@ -123,6 +127,7 @@ public class DummyLocationProvider extends LocationProvider { * under most circumstances but may occassionally not report it * should return true. */ @Override public boolean supportsAltitude() { return mSupportsAltitude; } Loading @@ -133,6 +138,7 @@ public class DummyLocationProvider extends LocationProvider { * under most circumstances but may occassionally not report it * should return true. */ @Override public boolean supportsSpeed() { return mSupportsSpeed; } Loading @@ -143,6 +149,7 @@ public class DummyLocationProvider extends LocationProvider { * under most circumstances but may occassionally not report it * should return true. */ @Override public boolean supportsBearing() { return mSupportsBearing; } Loading @@ -153,6 +160,7 @@ public class DummyLocationProvider extends LocationProvider { * @return the power requirement for this provider, as one of the * constants Criteria.POWER_REQUIREMENT_*. */ @Override public int getPowerRequirement() { return mPowerRequirement; } Loading @@ -164,6 +172,7 @@ public class DummyLocationProvider extends LocationProvider { * @return the horizontal accuracy for this provider, as one of the * constants Criteria.ACCURACY_*. */ @Override public int getAccuracy() { return mAccuracy; } Loading
services/java/com/android/server/LocationManagerService.java +93 −356 File changed.Preview size limit exceeded, changes collapsed. Show changes