summaryrefslogtreecommitdiffstats
path: root/location
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2012-03-29 00:09:58 -0700
committerSteve Kondik <shade@chemlab.org>2012-03-29 00:09:58 -0700
commitd6590d4c89a5cf2c174e83561b09125732c8bcab (patch)
tree629cf90df08fbc849cd448c27977c1aff2b18fc5 /location
parent1e5dab5b7653758a198a3314c445cc514c4a52a7 (diff)
parentdf331873c8576e0ae34ae1ee3cc258beed373535 (diff)
downloadframeworks_base-d6590d4c89a5cf2c174e83561b09125732c8bcab.zip
frameworks_base-d6590d4c89a5cf2c174e83561b09125732c8bcab.tar.gz
frameworks_base-d6590d4c89a5cf2c174e83561b09125732c8bcab.tar.bz2
Merge branch 'ics-mr1-release' of https://android.googlesource.com/platform/frameworks/base into aosp
Conflicts: core/res/res/values-de/strings.xml core/res/res/values-el/strings.xml core/res/res/values-nl/strings.xml core/res/res/values-pt/strings.xml core/res/res/values-ru/strings.xml core/res/res/values-tr/strings.xml core/res/res/values-zh-rCN/strings.xml core/res/res/values/config.xml data/fonts/Roboto-Bold.ttf data/fonts/Roboto-BoldItalic.ttf data/fonts/Roboto-Italic.ttf data/fonts/Roboto-Regular.ttf packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java policy/src/com/android/internal/policy/impl/PhoneWindowManager.java Change-Id: I376757e52555fe45860f404da5fd2293ea45ddce
Diffstat (limited to 'location')
-rwxr-xr-xlocation/java/android/location/Country.java47
-rw-r--r--location/java/android/location/LocationListener.java7
-rw-r--r--location/java/android/location/LocationManager.java7
-rw-r--r--location/java/android/location/package.html6
4 files changed, 60 insertions, 7 deletions
diff --git a/location/java/android/location/Country.java b/location/java/android/location/Country.java
index 939bd4a..7c1485d 100755
--- a/location/java/android/location/Country.java
+++ b/location/java/android/location/Country.java
@@ -18,6 +18,7 @@ package android.location;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.SystemClock;
import java.util.Locale;
@@ -58,8 +59,14 @@ public class Country implements Parcelable {
private final int mSource;
private int mHashCode;
+
+ /**
+ * Time that this object was created (which we assume to be the time that the source was
+ * consulted). This time is in milliseconds since boot up.
+ */
+ private final long mTimestamp;
+
/**
- *
* @param countryIso the ISO 3166-1 two letters country code.
* @param source where the countryIso came from, could be one of below
* values
@@ -78,11 +85,23 @@ public class Country implements Parcelable {
}
mCountryIso = countryIso.toUpperCase(Locale.US);
mSource = source;
+ mTimestamp = SystemClock.elapsedRealtime();
+ }
+
+ private Country(final String countryIso, final int source, long timestamp) {
+ if (countryIso == null || source < COUNTRY_SOURCE_NETWORK
+ || source > COUNTRY_SOURCE_LOCALE) {
+ throw new IllegalArgumentException();
+ }
+ mCountryIso = countryIso.toUpperCase(Locale.US);
+ mSource = source;
+ mTimestamp = timestamp;
}
public Country(Country country) {
mCountryIso = country.mCountryIso;
mSource = country.mSource;
+ mTimestamp = country.mTimestamp;
}
/**
@@ -106,9 +125,17 @@ public class Country implements Parcelable {
return mSource;
}
+ /**
+ * Returns the time that this object was created (which we assume to be the time that the source
+ * was consulted).
+ */
+ public final long getTimestamp() {
+ return mTimestamp;
+ }
+
public static final Parcelable.Creator<Country> CREATOR = new Parcelable.Creator<Country>() {
public Country createFromParcel(Parcel in) {
- return new Country(in.readString(), in.readInt());
+ return new Country(in.readString(), in.readInt(), in.readLong());
}
public Country[] newArray(int size) {
@@ -123,8 +150,14 @@ public class Country implements Parcelable {
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeString(mCountryIso);
parcel.writeInt(mSource);
+ parcel.writeLong(mTimestamp);
}
+ /**
+ * Returns true if this {@link Country} is equivalent to the given object. This ignores
+ * the timestamp value and just checks for equivalence of countryIso and source values.
+ * Returns false otherwise.
+ */
@Override
public boolean equals(Object object) {
if (object == this) {
@@ -132,6 +165,7 @@ public class Country implements Parcelable {
}
if (object instanceof Country) {
Country c = (Country) object;
+ // No need to check the equivalence of the timestamp
return mCountryIso.equals(c.getCountryIso()) && mSource == c.getSource();
}
return false;
@@ -150,8 +184,8 @@ public class Country implements Parcelable {
}
/**
- * Compare the specified country to this country object ignoring the mSource
- * field, return true if the countryIso fields are equal
+ * Compare the specified country to this country object ignoring the source
+ * and timestamp fields, return true if the countryIso fields are equal
*
* @param country the country to compare
* @return true if the specified country's countryIso field is equal to this
@@ -160,4 +194,9 @@ public class Country implements Parcelable {
public boolean equalsIgnoreSource(Country country) {
return country != null && mCountryIso.equals(country.getCountryIso());
}
+
+ @Override
+ public String toString() {
+ return "Country {ISO=" + mCountryIso + ", source=" + mSource + ", time=" + mTimestamp + "}";
+ }
}
diff --git a/location/java/android/location/LocationListener.java b/location/java/android/location/LocationListener.java
index 0f5f388..88904c8 100644
--- a/location/java/android/location/LocationListener.java
+++ b/location/java/android/location/LocationListener.java
@@ -24,6 +24,13 @@ import android.os.Bundle;
* LocationListener has been registered with the location manager service
* using the {@link LocationManager#requestLocationUpdates(String, long, float, LocationListener)}
* method.
+ *
+ * <div class="special reference">
+ * <h3>Developer Guides</h3>
+ * <p>For more information about identifying user location, read the
+ * <a href="{@docRoot}guide/topics/location/obtaining-user-location.html">Obtaining User
+ * Location</a> developer guide.</p>
+ * </div>
*/
public interface LocationListener {
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 19e19ad..4b949df 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -42,6 +42,13 @@ import java.util.List;
* instantiate this class directly; instead, retrieve it through
* {@link android.content.Context#getSystemService
* Context.getSystemService(Context.LOCATION_SERVICE)}.
+ *
+ * <div class="special reference">
+ * <h3>Developer Guides</h3>
+ * <p>For more information about using location services, read the
+ * <a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a>
+ * developer guide.</p>
+ * </div>
*/
public class LocationManager {
private static final String TAG = "LocationManager";
diff --git a/location/java/android/location/package.html b/location/java/android/location/package.html
index be34774..1abe098 100644
--- a/location/java/android/location/package.html
+++ b/location/java/android/location/package.html
@@ -1,10 +1,10 @@
<html>
-
<body>
<p>Contains classes that define Android location-based and related services.</p>
-<p>For more information about location services, see the documentation for <a
-href="{@docRoot}guide/topics/location/obtaining-user-location.html">Obtaining User Location</a>.</p>
+
+<p>For more information, see the
+<a href="{@docRoot}guide/topics/location/index.html">Location and Maps</a> developer guide.</p>
{@more}
</body>