diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-21 08:52:25 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-21 08:52:25 -0700 |
commit | 8c690ea9976d644db3c96eddbbbd2d50eac56913 (patch) | |
tree | 42a2a1998447ed2402d32c3ab385989e0f7781ea | |
parent | db79edc5dc39e103356cad8781148a8794520bc5 (diff) | |
parent | fd6e5f0dda50e113db4ccc55338b6c4f09da37a4 (diff) | |
download | frameworks_base-8c690ea9976d644db3c96eddbbbd2d50eac56913.zip frameworks_base-8c690ea9976d644db3c96eddbbbd2d50eac56913.tar.gz frameworks_base-8c690ea9976d644db3c96eddbbbd2d50eac56913.tar.bz2 |
Merge change 2182 into donut
* changes:
location: Replace ILocationCollector interface with new ILocationProvider method
-rw-r--r-- | Android.mk | 1 | ||||
-rw-r--r-- | api/current.xml | 11 | ||||
-rw-r--r-- | core/res/AndroidManifest.xml | 6 | ||||
-rw-r--r-- | core/res/res/values/strings.xml | 8 | ||||
-rw-r--r-- | data/etc/platform.xml | 1 | ||||
-rw-r--r-- | location/java/android/location/ILocationCollector.aidl | 36 | ||||
-rw-r--r-- | location/java/android/location/ILocationManager.aidl | 2 | ||||
-rw-r--r-- | location/java/android/location/ILocationProvider.aidl | 2 | ||||
-rw-r--r-- | location/java/android/location/LocationManager.java | 21 | ||||
-rw-r--r-- | location/java/com/android/internal/location/GpsLocationProvider.java | 7 | ||||
-rw-r--r-- | location/java/com/android/internal/location/LocationProviderProxy.java | 8 | ||||
-rw-r--r-- | location/java/com/android/internal/location/MockProvider.java | 3 | ||||
-rw-r--r-- | services/java/com/android/server/LocationManagerService.java | 37 | ||||
-rw-r--r-- | test-runner/android/test/TestLocationProvider.java | 3 |
14 files changed, 32 insertions, 114 deletions
@@ -135,7 +135,6 @@ LOCAL_SRC_FILES += \ location/java/android/location/IGeocodeProvider.aidl \ location/java/android/location/IGpsStatusListener.aidl \ location/java/android/location/IGpsStatusProvider.aidl \ - location/java/android/location/ILocationCollector.aidl \ location/java/android/location/ILocationListener.aidl \ location/java/android/location/ILocationManager.aidl \ location/java/android/location/ILocationProvider.aidl \ diff --git a/api/current.xml b/api/current.xml index e1c84ec..5bbf352 100644 --- a/api/current.xml +++ b/api/current.xml @@ -529,17 +529,6 @@ visibility="public" > </field> -<field name="INSTALL_LOCATION_COLLECTOR" - type="java.lang.String" - transient="false" - volatile="false" - value=""android.permission.INSTALL_LOCATION_COLLECTOR"" - static="true" - final="true" - deprecated="not deprecated" - visibility="public" -> -</field> <field name="INSTALL_LOCATION_PROVIDER" type="java.lang.String" transient="false" diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index b5f3a0f..fbaef5f 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -220,12 +220,6 @@ android:label="@string/permlab_installLocationProvider" android:description="@string/permdesc_installLocationProvider" /> - <!-- Allows an application to install a location collector into the Location Manager --> - <permission android:name="android.permission.INSTALL_LOCATION_COLLECTOR" - android:protectionLevel="signatureOrSystem" - android:label="@string/permlab_installLocationCollector" - android:description="@string/permdesc_installLocationCollector" /> - <!-- ======================================= --> <!-- Permissions for accessing networks --> <!-- ======================================= --> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 0f146e5..8b2689b 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -769,13 +769,7 @@ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_installLocationProvider">Create mock location sources for testing. Malicious applications can use this to override the location and/or status returned by real - location sources such as GPS or Network providers.</string> - - <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> - <string name="permlab_installLocationCollector">permission to install a location collector</string> - <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> - <string name="permdesc_installLocationCollector">Create mock location sources for testing. - Malicious applications can use this to monitor and report your location to an external source.</string> + location sources such as GPS or Network providers or monitor and report your location to an external source.</string> <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permlab_accessFineLocation">fine (GPS) location</string> diff --git a/data/etc/platform.xml b/data/etc/platform.xml index 526b6d9..6d750b3 100644 --- a/data/etc/platform.xml +++ b/data/etc/platform.xml @@ -133,7 +133,6 @@ <assign-permission name="android.permission.READ_FRAME_BUFFER" uid="shell" /> <assign-permission name="android.permission.DEVICE_POWER" uid="shell" /> <assign-permission name="android.permission.INSTALL_LOCATION_PROVIDER" uid="shell" /> - <assign-permission name="android.permission.INSTALL_LOCATION_COLLECTOR" uid="shell" /> <assign-permission name="android.permission.MODIFY_AUDIO_SETTINGS" uid="media" /> <assign-permission name="android.permission.ACCESS_DRM" uid="media" /> diff --git a/location/java/android/location/ILocationCollector.aidl b/location/java/android/location/ILocationCollector.aidl deleted file mode 100644 index b2e1796..0000000 --- a/location/java/android/location/ILocationCollector.aidl +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package android.location; - -import android.location.Location; - -/** - * Listens for GPS and cell/wifi changes and anonymously uploads to server - * for improving quality of service of NetworkLocationProvider. - * This service is only enabled when the user has enabled the - * network location provider. - * - * {@hide} - */ -oneway interface ILocationCollector { - /** - * Updates GPS location if collection is enabled - * - * @param location location object - */ - void updateLocation(in Location location); -} diff --git a/location/java/android/location/ILocationManager.aidl b/location/java/android/location/ILocationManager.aidl index 2c214c9..caf9516 100644 --- a/location/java/android/location/ILocationManager.aidl +++ b/location/java/android/location/ILocationManager.aidl @@ -20,7 +20,6 @@ import android.app.PendingIntent; import android.location.Address; import android.location.IGeocodeProvider; import android.location.IGpsStatusListener; -import android.location.ILocationCollector; import android.location.ILocationListener; import android.location.ILocationProvider; import android.location.Location; @@ -83,6 +82,5 @@ interface ILocationManager /* for installing external Location Providers */ void installLocationProvider(String name, ILocationProvider provider); - void installLocationCollector(ILocationCollector collector); void installGeocodeProvider(IGeocodeProvider provider); } diff --git a/location/java/android/location/ILocationProvider.aidl b/location/java/android/location/ILocationProvider.aidl index 6c23f83..4fe0494 100644 --- a/location/java/android/location/ILocationProvider.aidl +++ b/location/java/android/location/ILocationProvider.aidl @@ -16,6 +16,7 @@ package android.location; +import android.location.Location; import android.os.Bundle; /** @@ -41,6 +42,7 @@ interface ILocationProvider { void enableLocationTracking(boolean enable); void setMinTime(long minTime); void updateNetworkState(int state); + void updateLocation(in Location location); boolean sendExtraCommand(String command, inout Bundle extras); void addListener(int uid); void removeListener(int uid); diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index 872838c..86ea66f 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -1279,27 +1279,6 @@ public class LocationManager { } /** - * Installs a location collector. - * - * @param provider Binder interface for the location collector - * - * @return true if the command succeeds. - * - * Requires the android.permission.INSTALL_LOCATION_COLLECTOR permission. - * - * {@hide} - */ - public boolean installLocationCollector(ILocationCollector collector) { - try { - mService.installLocationCollector(collector); - return true; - } catch (RemoteException e) { - Log.e(TAG, "RemoteException in setLocationCollector: ", e); - return false; - } - } - - /** * Installs a geocoder server. * * @param provider Binder interface for the geocoder provider diff --git a/location/java/com/android/internal/location/GpsLocationProvider.java b/location/java/com/android/internal/location/GpsLocationProvider.java index 9003848..725fbf9 100644 --- a/location/java/com/android/internal/location/GpsLocationProvider.java +++ b/location/java/com/android/internal/location/GpsLocationProvider.java @@ -406,6 +406,13 @@ public class GpsLocationProvider extends ILocationProvider.Stub { } /** + * This is called to inform us when another location provider returns a location. + * Someday we might use this for network location injection to aid the GPS + */ + public void updateLocation(Location location) { + } + + /** * Returns true if the provider requires access to a * satellite-based positioning system (e.g., GPS), false * otherwise. diff --git a/location/java/com/android/internal/location/LocationProviderProxy.java b/location/java/com/android/internal/location/LocationProviderProxy.java index b40cdca..bd7088c 100644 --- a/location/java/com/android/internal/location/LocationProviderProxy.java +++ b/location/java/com/android/internal/location/LocationProviderProxy.java @@ -219,6 +219,14 @@ public class LocationProviderProxy implements IBinder.DeathRecipient { } } + public void updateLocation(Location location) { + try { + mProvider.updateLocation(location); + } catch (RemoteException e) { + Log.e(TAG, "updateLocation failed", e); + } + } + public boolean sendExtraCommand(String command, Bundle extras) { try { return mProvider.sendExtraCommand(command, extras); diff --git a/location/java/com/android/internal/location/MockProvider.java b/location/java/com/android/internal/location/MockProvider.java index f167a44..e2e0562 100644 --- a/location/java/com/android/internal/location/MockProvider.java +++ b/location/java/com/android/internal/location/MockProvider.java @@ -172,6 +172,9 @@ public class MockProvider extends ILocationProvider.Stub { public void updateNetworkState(int state) { } + public void updateLocation(Location location) { + } + public boolean sendExtraCommand(String command, Bundle extras) { return false; } diff --git a/services/java/com/android/server/LocationManagerService.java b/services/java/com/android/server/LocationManagerService.java index 05888e0..147a085 100644 --- a/services/java/com/android/server/LocationManagerService.java +++ b/services/java/com/android/server/LocationManagerService.java @@ -46,7 +46,6 @@ import android.location.Address; import android.location.IGeocodeProvider; import android.location.IGpsStatusListener; import android.location.IGpsStatusProvider; -import android.location.ILocationCollector; import android.location.ILocationListener; import android.location.ILocationManager; import android.location.ILocationProvider; @@ -107,8 +106,6 @@ public class LocationManagerService extends ILocationManager.Stub implements Run android.Manifest.permission.ACCESS_LOCATION_EXTRA_COMMANDS; private static final String INSTALL_LOCATION_PROVIDER = android.Manifest.permission.INSTALL_LOCATION_PROVIDER; - private static final String INSTALL_LOCATION_COLLECTOR = - android.Manifest.permission.INSTALL_LOCATION_COLLECTOR; // Set of providers that are explicitly enabled private final Set<String> mEnabledProviders = new HashSet<String>(); @@ -171,9 +168,6 @@ public class LocationManagerService extends ILocationManager.Stub implements Run private HashMap<String,Location> mLastKnownLocation = new HashMap<String,Location>(); - // Location collector - private ILocationCollector mCollector; - private int mNetworkState = LocationProvider.TEMPORARILY_UNAVAILABLE; // for Settings change notification @@ -630,16 +624,6 @@ public class LocationManagerService extends ILocationManager.Stub implements Run } } - public void installLocationCollector(ILocationCollector collector) { - if (mContext.checkCallingOrSelfPermission(INSTALL_LOCATION_COLLECTOR) - != PackageManager.PERMISSION_GRANTED) { - throw new SecurityException("Requires INSTALL_LOCATION_COLLECTOR permission"); - } - - // FIXME - only support one collector - mCollector = collector; - } - public void installGeocodeProvider(IGeocodeProvider provider) { if (mContext.checkCallingOrSelfPermission(INSTALL_LOCATION_PROVIDER) != PackageManager.PERMISSION_GRANTED) { @@ -1619,23 +1603,19 @@ public class LocationManagerService extends ILocationManager.Stub implements Run synchronized (mLock) { Location location = (Location) msg.obj; + String provider = location.getProvider(); - if (mCollector != null && - LocationManager.GPS_PROVIDER.equals(location.getProvider())) { - try { - mCollector.updateLocation(location); - } catch (RemoteException e) { - Log.w(TAG, "mCollector.updateLocation failed"); - mCollector = null; + // notify other providers of the new location + for (int i = mProviders.size() - 1; i >= 0; i--) { + LocationProviderProxy proxy = mProviders.get(i); + if (!provider.equals(proxy.getName())) { + proxy.updateLocation(location); } } - String provider = location.getProvider(); - if (!isAllowedBySettingsLocked(provider)) { - return; + if (isAllowedBySettingsLocked(provider)) { + handleLocationChangedLocked(location); } - - handleLocationChangedLocked(location); } } } catch (Exception e) { @@ -1935,7 +1915,6 @@ public class LocationManagerService extends ILocationManager.Stub implements Run synchronized (mLock) { pw.println("Current Location Manager state:"); pw.println(" sProvidersLoaded=" + sProvidersLoaded); - pw.println(" mCollector=" + mCollector); pw.println(" Listeners:"); int N = mReceivers.size(); for (int i=0; i<N; i++) { diff --git a/test-runner/android/test/TestLocationProvider.java b/test-runner/android/test/TestLocationProvider.java index dded745..2ea020e 100644 --- a/test-runner/android/test/TestLocationProvider.java +++ b/test-runner/android/test/TestLocationProvider.java @@ -159,6 +159,9 @@ public class TestLocationProvider extends ILocationProvider.Stub { public void updateNetworkState(int state) { } + public void updateLocation(Location location) { + } + public boolean sendExtraCommand(String command, Bundle extras) { return false; } |