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

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

AI 144663: Use Binder interfaces between NetworkLocationManager and LocationManagerService.

  This fixes a hack that was added when NetworkLocationManager was moved out of the framework.
  This also lays the groundwork for supporting location providers outside of the system process.
  BUG=1729031

Automated import of CL 144663
parent 53566b14
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ LOCAL_SRC_FILES := $(filter-out \

## READ ME: ########################################################
##
## When updading this list of aidl files, consider if that aidl is
## When updating this list of aidl files, consider if that aidl is
## part of the SDK API.  If it is, also add it to the list below that
## is preprocessed and distributed with the SDK.  This list should
## not contain any aidl files for parcelables, but the one below should
@@ -110,8 +110,10 @@ LOCAL_SRC_FILES += \
	core/java/com/android/internal/view/IInputMethodSession.aidl \
	im/java/android/im/IImPlugin.aidl \
	location/java/android/location/IGpsStatusListener.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 \
	media/java/android/media/IAudioService.aidl \
	media/java/android/media/IMediaScannerListener.aidl \
	media/java/android/media/IMediaScannerService.aidl \
+7 −6
Original line number Diff line number Diff line
@@ -14,22 +14,23 @@
 * limitations under the License.
 */

package com.android.internal.location;
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.
 * 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}
 */
public interface ILocationCollector {
oneway interface ILocationCollector {
    /**
     * Updates GPS location if collection is enabled
     *
     * @param location location object
     */
    abstract public void updateLocation(Location location);
    void updateLocation(in Location location);
}
+6 −0
Original line number Diff line number Diff line
@@ -19,7 +19,9 @@ package android.location;
import android.app.PendingIntent;
import android.location.Address;
import android.location.IGpsStatusListener;
import android.location.ILocationCollector;
import android.location.ILocationListener;
import android.location.ILocationProvider;
import android.location.Location;
import android.os.Bundle;

@@ -74,4 +76,8 @@ interface ILocationManager
    void clearTestProviderEnabled(String provider);
    void setTestProviderStatus(String provider, int status, in Bundle extras, long updateTime);
    void clearTestProviderStatus(String provider);

    /* for installing Network Location Provider */
    void setNetworkLocationProvider(ILocationProvider provider);
    void setLocationCollector(ILocationCollector collector);
}
+61 −0
Original line number Diff line number Diff line
@@ -14,51 +14,48 @@
 * limitations under the License.
 */

package com.android.internal.location;
package android.location;

import android.location.Address;
import android.location.Location;
import android.net.wifi.ScanResult;

import java.util.List;
import android.os.Bundle;

/**
 * Interface for network location provider
 * An interface for location providers implemented outside of the system process.
 *
 * {@hide}
 */
public interface INetworkLocationProvider {

    /**
     * Updates the current cell lock status.
     *
     * @param acquired true if a cell lock has been acquired
     */
    abstract public void updateCellLockStatus(boolean acquired);

    /**
     * Adds a list of application clients
     * Only used by the NetworkLocationProvider
     *
     * @param applications list of package names
     */
    abstract public void addListener(String[] applications);

    /**
     * Removes a list of application clients
     * Only used by the NetworkLocationProvider
     *
     * @param applications list of package names
     */
    abstract public void removeListener(String[] applications);


    abstract public String getFromLocation(double latitude, double longitude, int maxResults,
        String language, String country, String variant, String appName, List<Address> addrs);

    abstract public String getFromLocationName(String locationName,
interface ILocationProvider {

    /* for LocationProvider */
    boolean requiresNetwork();
    boolean requiresSatellite();
    boolean requiresCell();
    boolean hasMonetaryCost();
    boolean supportsAltitude();
    boolean supportsSpeed();
    boolean supportsBearing();
    int getPowerRequirement();
    int getAccuracy();

    /* for LocationProviderImpl */
    void enable();
    void disable();
    boolean isEnabled();
    int getStatus(out Bundle extras);
    long getStatusUpdateTime();
    void enableLocationTracking(boolean enable);
    void setMinTime(long minTime);
    void updateNetworkState(int state);
    boolean sendExtraCommand(String command, inout Bundle extras);

    /* the following are only used for NetworkLocationProvider */
    void updateCellLockStatus(boolean acquired);
    void addListener(in String[] applications);
    void removeListener(in String[] applications);
    String getFromLocation(double latitude, double longitude, int maxResults,
        String language, String country, String variant, String appName, out List<Address> addrs);
    String getFromLocationName(String locationName,
        double lowerLeftLatitude, double lowerLeftLongitude,
        double upperRightLatitude, double upperRightLongitude, int maxResults,
        String language, String country, String variant, String appName, List<Address> addrs);

        String language, String country, String variant, String appName, out List<Address> addrs);
}
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ public abstract class LocationProviderImpl extends LocationProvider {
        try {
            mLocationManager.setLocation(location);
        } catch (RemoteException e) {
            Log.e(TAG, "RemoteException calling ILocationManager.onLocationChanged");
            Log.e(TAG, "RemoteException calling ILocationManager.setLocation");
        }
    }
    
Loading