Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e90c0da6 authored by Mike Lockwood's avatar Mike Lockwood Committed by The Android Open Source Project
Browse files

am 275555c8: location: Add support for location providers outside of the

Merge commit '275555c8'

* commit '275555c8':
  location: Add support for location providers outside of the system process.
parents ee96dc51 275555c8
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -529,6 +529,28 @@
 visibility="public"
>
</field>
<field name="INSTALL_LOCATION_COLLECTOR"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.permission.INSTALL_LOCATION_COLLECTOR&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="INSTALL_LOCATION_PROVIDER"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;android.permission.INSTALL_LOCATION_PROVIDER&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="INSTALL_PACKAGES"
 type="java.lang.String"
 transient="false"
+13 −1
Original line number Diff line number Diff line
@@ -214,6 +214,18 @@
        android:label="@string/permlab_accessLocationExtraCommands"
        android:description="@string/permdesc_accessLocationExtraCommands" />

    <!-- Allows an application to install a location provider into the Location Manager -->
    <permission android:name="android.permission.INSTALL_LOCATION_PROVIDER"
        android:protectionLevel="signatureOrSystem"
        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 -->
    <!-- ======================================= -->
@@ -921,7 +933,7 @@
    <permission android:name="android.permission.CONTROL_LOCATION_UPDATES"
        android:label="@string/permlab_locationUpdates"
        android:description="@string/permdesc_locationUpdates"
        android:protectionLevel="signature" />
        android:protectionLevel="signatureOrSystem" />

    <!-- Allows read/write access to the "properties" table in the checkin
         database, to change values that get uploaded. -->
+13 −0
Original line number Diff line number Diff line
@@ -759,6 +759,19 @@
        Malicious applications could use this to interfere with the operation of the GPS
        or other location sources.</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_installLocationProvider">permission to install a location provider</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_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>

    <!-- 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>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+5 −5
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ interface ILocationManager
    Location getLastKnownLocation(String provider);

    /* used by location providers to tell the location manager when it has a new location */
    void setLocation(in Location location);
    void reportLocation(in Location location);

    String getFromLocation(double latitude, double longitude, int maxResults,
        String language, String country, String variant, String appName, out List<Address> addrs);
@@ -82,7 +82,7 @@ interface ILocationManager
    void clearTestProviderStatus(String provider);

    /* for installing external Location Providers */
    void setNetworkLocationProvider(ILocationProvider provider);
    void setLocationCollector(ILocationCollector collector);
    void setGeocodeProvider(IGeocodeProvider provider);
    void installLocationProvider(String name, ILocationProvider provider);
    void installLocationCollector(ILocationCollector collector);
    void installGeocodeProvider(IGeocodeProvider provider);
}
+81 −0
Original line number Diff line number Diff line
@@ -1255,4 +1255,85 @@ public class LocationManager {
            return false;
        }
    }

    /**
     * Installs a network location provider.
     *
     * @param name of the location provider
     * @param provider Binder interface for the location provider
     *
     * @return true if the command succeeds.
     *
     * Requires the android.permission.INSTALL_LOCATION_PROVIDER permission.
     *
     * {@hide}
     */
    public boolean installLocationProvider(String name, ILocationProvider provider) {
        try {
            mService.installLocationProvider(name, provider);
            return true;
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException in installLocationProvider: ", e);
            return false;
        }
    }

    /**
     * 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
     *
     * @return true if the command succeeds.
     *
     * Requires the android.permission.INSTALL_LOCATION_PROVIDER permission.
     *
     * {@hide}
     */
    public boolean installGeocodeProvider(IGeocodeProvider provider) {
        try {
            mService.installGeocodeProvider(provider);
            return true;
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException in setGeocodeProvider: ", e);
            return false;
        }
    }

    /**
     * Used by location providers to report new locations.
     *
     * @param location new Location to report
     *
     * Requires the android.permission.INSTALL_LOCATION_PROVIDER permission.
     *
     * {@hide}
     */
    public void reportLocation(Location location) {
        try {
            mService.reportLocation(location);
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException in reportLocation: ", e);
        }
    }
}
Loading