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

Commit 5ef58f6d authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "Cleanup and add public wrapper for IGeocodeProvider interface to...

Merge "Cleanup and add public wrapper for IGeocodeProvider interface to prepare for network location unbundling."
parents 1af33d0d 34901409
Loading
Loading
Loading
Loading
+125 −0
Original line number Diff line number Diff line
@@ -74882,6 +74882,75 @@
</exception>
</method>
</class>
<class name="GeocoderParams"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.os.Parcelable">
</implements>
<method name="describeContents"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getClientPackage"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getLocale"
 return="java.util.Locale"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="writeToParcel"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="parcel" type="android.os.Parcel">
</parameter>
<parameter name="flags" type="int">
</parameter>
</method>
<field name="CREATOR"
 type="android.os.Parcelable.Creator"
 transient="false"
 volatile="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="GpsSatellite"
 extends="java.lang.Object"
 abstract="false"
@@ -76181,6 +76250,62 @@
>
</field>
</class>
<interface name="LocationManager.GeocodeProvider"
 abstract="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="getFromLocation"
 return="java.lang.String"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="latitude" type="double">
</parameter>
<parameter name="longitude" type="double">
</parameter>
<parameter name="maxResults" type="int">
</parameter>
<parameter name="params" type="android.location.GeocoderParams">
</parameter>
<parameter name="addrs" type="java.util.List&lt;android.location.Address&gt;">
</parameter>
</method>
<method name="getFromLocationName"
 return="java.lang.String"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="locationName" type="java.lang.String">
</parameter>
<parameter name="lowerLeftLatitude" type="double">
</parameter>
<parameter name="lowerLeftLongitude" type="double">
</parameter>
<parameter name="upperRightLatitude" type="double">
</parameter>
<parameter name="upperRightLongitude" type="double">
</parameter>
<parameter name="maxResults" type="int">
</parameter>
<parameter name="params" type="android.location.GeocoderParams">
</parameter>
<parameter name="addrs" type="java.util.List&lt;android.location.Address&gt;">
</parameter>
</method>
</interface>
<class name="LocationProvider"
 extends="java.lang.Object"
 abstract="true"
+5 −12
Original line number Diff line number Diff line
@@ -45,10 +45,7 @@ import java.util.List;
public final class Geocoder {
    private static final String TAG = "Geocoder";

    private String mLanguage;
    private String mCountry;
    private String mVariant;
    private String mAppName;
    private GeocoderParams mParams;
    private ILocationManager mService;

    /**
@@ -64,11 +61,7 @@ public final class Geocoder {
        if (locale == null) {
            throw new NullPointerException("locale == null");
        }
        mLanguage = locale.getLanguage();
        mCountry = locale.getCountry();
        mVariant = locale.getVariant();
        mAppName = context.getPackageName();

        mParams = new GeocoderParams(context, locale);
        IBinder b = ServiceManager.getService(Context.LOCATION_SERVICE);
        mService = ILocationManager.Stub.asInterface(b);
    }
@@ -119,7 +112,7 @@ public final class Geocoder {
        try {
            List<Address> results = new ArrayList<Address>();
            String ex =  mService.getFromLocation(latitude, longitude, maxResults,
                mLanguage, mCountry, mVariant, mAppName, results);
                mParams, results);
            if (ex != null) {
                throw new IOException(ex);
            } else {
@@ -161,7 +154,7 @@ public final class Geocoder {
        try {
            List<Address> results = new ArrayList<Address>();
            String ex = mService.getFromLocationName(locationName,
                0, 0, 0, 0, maxResults, mLanguage, mCountry, mVariant, mAppName, results);
                0, 0, 0, 0, maxResults, mParams, results);
            if (ex != null) {
                throw new IOException(ex);
            } else {
@@ -234,7 +227,7 @@ public final class Geocoder {
            ArrayList<Address> result = new ArrayList<Address>();
            String ex =  mService.getFromLocationName(locationName,
                lowerLeftLatitude, lowerLeftLongitude, upperRightLatitude, upperRightLongitude,
                maxResults, mLanguage, mCountry, mVariant, mAppName, result);
                maxResults, mParams, result);
            if (ex != null) {
                throw new IOException(ex);
            } else {
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010, 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;

parcelable GeocoderParams;
+92 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 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.content.Context;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.Locale;

/**
 * This class contains extra parameters to pass to an IGeocodeProvider
 * implementation from the Geocoder class.  Currently this contains the
 * language, country and variant information from the Geocoder's locale
 * as well as the Geocoder client's package name for geocoder server
 * logging.  This information is kept in a separate class to allow for
 * future expansion of the IGeocodeProvider interface.
 */
public class GeocoderParams implements Parcelable {
    private Locale mLocale;
    private String mPackageName;

    // used only for parcelling
    private GeocoderParams() {
    }

    /**
     * This object is only constructed by the Geocoder class
     *
     * @hide
     */
    public GeocoderParams(Context context, Locale locale) {
        mLocale = locale;
        mPackageName = context.getPackageName();
    }

    /**
     * returns the Geocoder's locale
     */
    public Locale getLocale() {
        return mLocale;
    }

    /**
     * returns the package name of the Geocoder's client
     */
    public String getClientPackage() {
        return mPackageName;
    }

    public static final Parcelable.Creator<GeocoderParams> CREATOR =
        new Parcelable.Creator<GeocoderParams>() {
        public GeocoderParams createFromParcel(Parcel in) {
            GeocoderParams gp = new GeocoderParams();
            String language = in.readString();
            String country = in.readString();
            String variant = in.readString();
            gp.mLocale = new Locale(language, country, variant);
            gp.mPackageName = in.readString();
            return gp;
        }

        public GeocoderParams[] newArray(int size) {
            return new GeocoderParams[size];
        }
    };

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeString(mLocale.getLanguage());
        parcel.writeString(mLocale.getCountry());
        parcel.writeString(mLocale.getVariant());
        parcel.writeString(mPackageName);
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.location;

import android.location.Address;
import android.location.GeocoderParams;

/**
 * An interface for location providers implementing the Geocoder services.
@@ -26,10 +27,10 @@ import android.location.Address;
interface IGeocodeProvider {

    String getFromLocation(double latitude, double longitude, int maxResults,
        String language, String country, String variant, String appName, out List<Address> addrs);
        in GeocoderParams params, 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, out List<Address> addrs);
        in GeocoderParams params, out List<Address> addrs);
}
Loading