diff --git a/api/removed.txt b/api/removed.txt index 10e6eb5e60d86..35b485980276c 100644 --- a/api/removed.txt +++ b/api/removed.txt @@ -99,67 +99,6 @@ package android.graphics { } -package android.location { - - public final class GnssMeasurement implements android.os.Parcelable { - field public static final int MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2 - } - - public final class GnssMeasurementsEvent implements android.os.Parcelable { - field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2 - field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0 - field public static final int STATUS_READY = 1; // 0x1 - } - - public final class GnssNavigationMessageEvent implements android.os.Parcelable { - ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage); - method public int describeContents(); - method public android.location.GnssNavigationMessage getNavigationMessage(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator CREATOR; - field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2 - field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0 - field public static final int STATUS_READY = 1; // 0x1 - } - - public static abstract class GnssNavigationMessageEvent.Callback { - ctor public GnssNavigationMessageEvent.Callback(); - method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent); - method public void onStatusChanged(int); - } - - public abstract interface GnssNmeaListener { - method public abstract void onNmeaReceived(long, java.lang.String); - } - - public final class GnssStatus { - method public int getNumSatellites(); - method public boolean hasAlmanac(int); - method public boolean hasEphemeris(int); - } - - public abstract class GnssStatusCallback { - ctor public GnssStatusCallback(); - method public void onFirstFix(int); - method public void onSatelliteStatusChanged(android.location.GnssStatus); - method public void onStarted(); - method public void onStopped(); - } - - public class LocationManager { - method public boolean addNmeaListener(android.location.GnssNmeaListener); - method public boolean addNmeaListener(android.location.GnssNmeaListener, android.os.Handler); - method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback); - method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler); - method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback); - method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler); - method public void removeNmeaListener(android.location.GnssNmeaListener); - method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback); - method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback); - } - -} - package android.media { public final class AudioFormat implements android.os.Parcelable { diff --git a/api/system-current.txt b/api/system-current.txt index cde1831042483..726fe54d586ff 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -26132,8 +26132,8 @@ package android.net { } public final class RecommendationResult implements android.os.Parcelable { - method public static android.net.RecommendationResult createDoNotConnectRecommendation(); method public static android.net.RecommendationResult createConnectRecommendation(android.net.wifi.WifiConfiguration); + method public static android.net.RecommendationResult createDoNotConnectRecommendation(); method public int describeContents(); method public android.net.wifi.WifiConfiguration getWifiConfiguration(); method public boolean hasRecommendation(); diff --git a/api/system-removed.txt b/api/system-removed.txt index 0919b8f4d275d..8016f58ccedbd 100644 --- a/api/system-removed.txt +++ b/api/system-removed.txt @@ -97,67 +97,6 @@ package android.graphics { } -package android.location { - - public final class GnssMeasurement implements android.os.Parcelable { - field public static final int MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2 - } - - public final class GnssMeasurementsEvent implements android.os.Parcelable { - field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2 - field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0 - field public static final int STATUS_READY = 1; // 0x1 - } - - public final class GnssNavigationMessageEvent implements android.os.Parcelable { - ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage); - method public int describeContents(); - method public android.location.GnssNavigationMessage getNavigationMessage(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator CREATOR; - field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2 - field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0 - field public static final int STATUS_READY = 1; // 0x1 - } - - public static abstract class GnssNavigationMessageEvent.Callback { - ctor public GnssNavigationMessageEvent.Callback(); - method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent); - method public void onStatusChanged(int); - } - - public abstract interface GnssNmeaListener { - method public abstract void onNmeaReceived(long, java.lang.String); - } - - public final class GnssStatus { - method public int getNumSatellites(); - method public boolean hasAlmanac(int); - method public boolean hasEphemeris(int); - } - - public abstract class GnssStatusCallback { - ctor public GnssStatusCallback(); - method public void onFirstFix(int); - method public void onSatelliteStatusChanged(android.location.GnssStatus); - method public void onStarted(); - method public void onStopped(); - } - - public class LocationManager { - method public boolean addNmeaListener(android.location.GnssNmeaListener); - method public boolean addNmeaListener(android.location.GnssNmeaListener, android.os.Handler); - method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback); - method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler); - method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback); - method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler); - method public void removeNmeaListener(android.location.GnssNmeaListener); - method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback); - method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback); - } - -} - package android.media { public final class AudioFormat implements android.os.Parcelable { diff --git a/api/test-removed.txt b/api/test-removed.txt index 10e6eb5e60d86..35b485980276c 100644 --- a/api/test-removed.txt +++ b/api/test-removed.txt @@ -99,67 +99,6 @@ package android.graphics { } -package android.location { - - public final class GnssMeasurement implements android.os.Parcelable { - field public static final int MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2 - } - - public final class GnssMeasurementsEvent implements android.os.Parcelable { - field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2 - field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0 - field public static final int STATUS_READY = 1; // 0x1 - } - - public final class GnssNavigationMessageEvent implements android.os.Parcelable { - ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage); - method public int describeContents(); - method public android.location.GnssNavigationMessage getNavigationMessage(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator CREATOR; - field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2 - field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0 - field public static final int STATUS_READY = 1; // 0x1 - } - - public static abstract class GnssNavigationMessageEvent.Callback { - ctor public GnssNavigationMessageEvent.Callback(); - method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent); - method public void onStatusChanged(int); - } - - public abstract interface GnssNmeaListener { - method public abstract void onNmeaReceived(long, java.lang.String); - } - - public final class GnssStatus { - method public int getNumSatellites(); - method public boolean hasAlmanac(int); - method public boolean hasEphemeris(int); - } - - public abstract class GnssStatusCallback { - ctor public GnssStatusCallback(); - method public void onFirstFix(int); - method public void onSatelliteStatusChanged(android.location.GnssStatus); - method public void onStarted(); - method public void onStopped(); - } - - public class LocationManager { - method public boolean addNmeaListener(android.location.GnssNmeaListener); - method public boolean addNmeaListener(android.location.GnssNmeaListener, android.os.Handler); - method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback); - method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler); - method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback); - method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler); - method public void removeNmeaListener(android.location.GnssNmeaListener); - method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback); - method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback); - } - -} - package android.media { public final class AudioFormat implements android.os.Parcelable { diff --git a/location/java/android/location/GnssMeasurement.java b/location/java/android/location/GnssMeasurement.java index 761ee2209a204..70339005581fe 100644 --- a/location/java/android/location/GnssMeasurement.java +++ b/location/java/android/location/GnssMeasurement.java @@ -63,7 +63,7 @@ public final class GnssMeasurement implements Parcelable { */ @Retention(RetentionPolicy.SOURCE) @IntDef({MULTIPATH_INDICATOR_UNKNOWN, MULTIPATH_INDICATOR_DETECTED, - MULTIPATH_INDICATOR_NOT_USED}) + MULTIPATH_INDICATOR_NOT_DETECTED}) public @interface MultipathIndicator {} /** @@ -81,9 +81,6 @@ public final class GnssMeasurement implements Parcelable { */ public static final int MULTIPATH_INDICATOR_NOT_DETECTED = 2; - /** @removed */ - public static final int MULTIPATH_INDICATOR_NOT_USED = 2; - /** This GNSS measurement's tracking state is invalid or unknown. */ public static final int STATE_UNKNOWN = 0; /** This GNSS measurement's tracking state has code lock. */ @@ -803,8 +800,8 @@ public final class GnssMeasurement implements Parcelable { return "Unknown"; case MULTIPATH_INDICATOR_DETECTED: return "Detected"; - case MULTIPATH_INDICATOR_NOT_USED: - return "NotUsed"; + case MULTIPATH_INDICATOR_NOT_DETECTED: + return "NotDetected"; default: return ""; } diff --git a/location/java/android/location/GnssMeasurementsEvent.java b/location/java/android/location/GnssMeasurementsEvent.java index 7db04663c83be..d66fd9c48b88a 100644 --- a/location/java/android/location/GnssMeasurementsEvent.java +++ b/location/java/android/location/GnssMeasurementsEvent.java @@ -34,13 +34,6 @@ import java.util.Collections; * Events are delivered to registered instances of {@link Callback}. */ public final class GnssMeasurementsEvent implements Parcelable { - /** @removed */ - public static final int STATUS_NOT_SUPPORTED = 0; - /** @removed */ - public static final int STATUS_READY = 1; - /** @removed */ - public static final int STATUS_GNSS_LOCATION_DISABLED = 2; - private final GnssClock mClock; private final Collection mReadOnlyMeasurements; diff --git a/location/java/android/location/GnssNavigationMessageEvent.aidl b/location/java/android/location/GnssNavigationMessageEvent.aidl deleted file mode 100644 index e765739942bfc..0000000000000 --- a/location/java/android/location/GnssNavigationMessageEvent.aidl +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2014, 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 GnssNavigationMessageEvent; diff --git a/location/java/android/location/GnssNavigationMessageEvent.java b/location/java/android/location/GnssNavigationMessageEvent.java deleted file mode 100644 index f7e566517fc2e..0000000000000 --- a/location/java/android/location/GnssNavigationMessageEvent.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2014 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.annotation.IntDef; -import android.annotation.NonNull; -import android.os.Parcel; -import android.os.Parcelable; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.security.InvalidParameterException; - -/** - * A class implementing a container for data associated with a navigation message event. - * Events are delivered to registered instances of {@link Callback}. - * @removed - */ -public final class GnssNavigationMessageEvent implements Parcelable { - /** - * The status of GNSS measurements event. - * @hide - */ - @Retention(RetentionPolicy.SOURCE) - @IntDef({STATUS_NOT_SUPPORTED, STATUS_READY, STATUS_GNSS_LOCATION_DISABLED}) - public @interface GnssNavigationMessageStatus {} - - /** - * The system does not support tracking of GNSS Navigation Messages. - * - * This status will not change in the future. - */ - public static final int STATUS_NOT_SUPPORTED = 0; - - /** - * GNSS Navigation Messages are successfully being tracked, it will receive updates once they - * are available. - */ - public static final int STATUS_READY = 1; - - /** - * GNSS provider or Location is disabled, updated will not be received until they are enabled. - */ - public static final int STATUS_GNSS_LOCATION_DISABLED = 2; - - private final GnssNavigationMessage mNavigationMessage; - - /** - * Used for receiving GNSS satellite Navigation Messages from the GNSS engine. - * - *

You can implement this interface and call - * {@link LocationManager#registerGnssNavigationMessageCallback}. - */ - public static abstract class Callback { - - /** - * Returns the latest collected GNSS Navigation Message. - */ - public void onGnssNavigationMessageReceived(GnssNavigationMessageEvent event) {} - - /** - * Returns the latest status of the GNSS Navigation Messages sub-system. - */ - public void onStatusChanged(@GnssNavigationMessageStatus int status) {} - } - - public GnssNavigationMessageEvent(GnssNavigationMessage message) { - if (message == null) { - throw new InvalidParameterException("Parameter 'message' must not be null."); - } - mNavigationMessage = message; - } - - @NonNull - public GnssNavigationMessage getNavigationMessage() { - return mNavigationMessage; - } - - public static final Creator CREATOR = - new Creator() { - @Override - public GnssNavigationMessageEvent createFromParcel(Parcel in) { - ClassLoader classLoader = getClass().getClassLoader(); - GnssNavigationMessage navigationMessage = in.readParcelable(classLoader); - return new GnssNavigationMessageEvent(navigationMessage); - } - - @Override - public GnssNavigationMessageEvent[] newArray(int size) { - return new GnssNavigationMessageEvent[size]; - } - }; - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel parcel, int flags) { - parcel.writeParcelable(mNavigationMessage, flags); - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder("[ GnssNavigationMessageEvent:\n\n"); - builder.append(mNavigationMessage.toString()); - builder.append("\n]"); - return builder.toString(); - } -} diff --git a/location/java/android/location/GnssNmeaListener.java b/location/java/android/location/GnssNmeaListener.java deleted file mode 100644 index 756ae49f92cfb..0000000000000 --- a/location/java/android/location/GnssNmeaListener.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2016 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; - -/** -* Used for receiving NMEA sentences from the GNSS. -* NMEA 0183 is a standard for communicating with marine electronic devices -* and is a common method for receiving data from a GNSS, typically over a serial port. -* See NMEA 0183 for more details. -* You can implement this interface and call {@link LocationManager#addNmeaListener} -* to receive NMEA data from the GNSS engine. -* @removed -*/ -public interface GnssNmeaListener { - /** Called when an NMEA message is received. */ - void onNmeaReceived(long timestamp, String nmea); -} diff --git a/location/java/android/location/GnssStatus.java b/location/java/android/location/GnssStatus.java index e68821b5a2202..f105144274550 100644 --- a/location/java/android/location/GnssStatus.java +++ b/location/java/android/location/GnssStatus.java @@ -111,11 +111,6 @@ public final class GnssStatus { mAzimuths = azimuths; } - /** @removed */ - public int getNumSatellites() { - return getSatelliteCount(); - } - /** * Gets the total number of satellites in satellite list. */ @@ -191,11 +186,6 @@ public final class GnssStatus { return mAzimuths[satIndex]; } - /** @removed */ - public boolean hasEphemeris(int satIndex) { - return hasEphemerisData(satIndex); - } - /** * Reports whether the satellite at the specified index has ephemeris data. * @@ -205,11 +195,6 @@ public final class GnssStatus { return (mSvidWithFlags[satIndex] & GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA) != 0; } - /** @removed */ - public boolean hasAlmanac(int satIndex) { - return hasAlmanacData(satIndex); - } - /** * Reports whether the satellite at the specified index has almanac data. * diff --git a/location/java/android/location/GnssStatusCallback.java b/location/java/android/location/GnssStatusCallback.java deleted file mode 100644 index bf295ef7d8172..0000000000000 --- a/location/java/android/location/GnssStatusCallback.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2016 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; - -/** - * Used for receiving notifications when GNSS events happen. - * @removed - */ -public abstract class GnssStatusCallback { - /** - * Called when GNSS system has started. - */ - public void onStarted() {} - - /** - * Called when GNSS system has stopped. - */ - public void onStopped() {} - - /** - * Called when the GNSS system has received its first fix since starting. - * @param ttffMillis the time from start to first fix in milliseconds. - */ - public void onFirstFix(int ttffMillis) {} - - /** - * Called periodically to report GNSS satellite status. - * @param status the current status of all satellites. - */ - public void onSatelliteStatusChanged(GnssStatus status) {} -} diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java index da0e515cda4be..087e74f54006c 100644 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -70,16 +70,10 @@ public class LocationManager { new HashMap<>(); private final HashMap mGpsNmeaListeners = new HashMap<>(); - private final HashMap - mOldGnssStatusListeners = new HashMap<>(); private final HashMap mGnssStatusListeners = new HashMap<>(); - private final HashMap mOldGnssNmeaListeners = - new HashMap<>(); private final HashMap mGnssNmeaListeners = new HashMap<>(); - private final HashMap - mNavigationMessageBridge = new HashMap<>(); private GnssStatus mGnssStatus; private int mTimeToFirstFix; @@ -1398,9 +1392,7 @@ public class LocationManager { private final GpsStatus.Listener mGpsListener; private final GpsStatus.NmeaListener mGpsNmeaListener; - private final GnssStatusCallback mOldGnssCallback; private final GnssStatus.Callback mGnssCallback; - private final GnssNmeaListener mOldGnssNmeaListener; private final OnNmeaMessageListener mGnssNmeaListener; private class GnssHandler extends Handler { @@ -1464,7 +1456,6 @@ public class LocationManager { mGnssHandler = new GnssHandler(handler); mGpsNmeaListener = null; mNmeaBuffer = null; - mOldGnssCallback = null; mGnssCallback = mGpsListener != null ? new GnssStatus.Callback() { @Override public void onStarted() { @@ -1486,7 +1477,6 @@ public class LocationManager { mGpsListener.onGpsStatusChanged(GpsStatus.GPS_EVENT_SATELLITE_STATUS); } } : null; - mOldGnssNmeaListener = null; mGnssNmeaListener = null; } @@ -1499,9 +1489,7 @@ public class LocationManager { mGnssHandler = new GnssHandler(handler); mGpsNmeaListener = listener; mNmeaBuffer = new ArrayList(); - mOldGnssCallback = null; mGnssCallback = null; - mOldGnssNmeaListener = null; mGnssNmeaListener = mGpsNmeaListener != null ? new OnNmeaMessageListener() { @Override public void onNmeaMessage(String nmea, long timestamp) { @@ -1510,85 +1498,26 @@ public class LocationManager { } : null; } - GnssStatusListenerTransport(GnssStatusCallback callback) { - this(callback, null); - } - - GnssStatusListenerTransport(GnssStatusCallback callback, Handler handler) { - mOldGnssCallback = callback; - mGnssCallback = mOldGnssCallback != null ? new GnssStatus.Callback() { - @Override - public void onStarted() { - mOldGnssCallback.onStarted(); - } - - @Override - public void onStopped() { - mOldGnssCallback.onStopped(); - } - - @Override - public void onFirstFix(int ttff) { - mOldGnssCallback.onFirstFix(ttff); - } - - @Override - public void onSatelliteStatusChanged(GnssStatus status) { - mOldGnssCallback.onSatelliteStatusChanged(status); - } - } : null; - mGnssHandler = new GnssHandler(handler); - mOldGnssNmeaListener = null; - mGnssNmeaListener = null; - mNmeaBuffer = null; - mGpsListener = null; - mGpsNmeaListener = null; - } - GnssStatusListenerTransport(GnssStatus.Callback callback) { this(callback, null); } GnssStatusListenerTransport(GnssStatus.Callback callback, Handler handler) { - mOldGnssCallback = null; mGnssCallback = callback; mGnssHandler = new GnssHandler(handler); - mOldGnssNmeaListener = null; mGnssNmeaListener = null; mNmeaBuffer = null; mGpsListener = null; mGpsNmeaListener = null; } - GnssStatusListenerTransport(GnssNmeaListener listener) { - this(listener, null); - } - - GnssStatusListenerTransport(GnssNmeaListener listener, Handler handler) { - mGnssCallback = null; - mOldGnssCallback = null; - mGnssHandler = new GnssHandler(handler); - mOldGnssNmeaListener = listener; - mGnssNmeaListener = mOldGnssNmeaListener != null ? new OnNmeaMessageListener() { - @Override - public void onNmeaMessage(String message, long timestamp) { - mOldGnssNmeaListener.onNmeaReceived(timestamp, message); - } - } : null; - mGpsListener = null; - mGpsNmeaListener = null; - mNmeaBuffer = new ArrayList(); - } - GnssStatusListenerTransport(OnNmeaMessageListener listener) { this(listener, null); } GnssStatusListenerTransport(OnNmeaMessageListener listener, Handler handler) { - mOldGnssCallback = null; mGnssCallback = null; mGnssHandler = new GnssHandler(handler); - mOldGnssNmeaListener = null; mGnssNmeaListener = listener; mGpsListener = null; mGpsNmeaListener = null; @@ -1703,73 +1632,9 @@ public class LocationManager { } /** - * Registers a GNSS status listener. + * Registers a GNSS status callback. * - * @param callback GNSS status listener object to register - * - * @return true if the listener was successfully added - * - * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present - * @removed - */ - @RequiresPermission(ACCESS_FINE_LOCATION) - public boolean registerGnssStatusCallback(GnssStatusCallback callback) { - return registerGnssStatusCallback(callback, null); - } - - /** - * Registers a GNSS status listener. - * - * @param callback GNSS status listener object to register - * @param handler the handler that the callback runs on. - * - * @return true if the listener was successfully added - * - * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present - * @removed - */ - @RequiresPermission(ACCESS_FINE_LOCATION) - public boolean registerGnssStatusCallback(GnssStatusCallback callback, Handler handler) { - boolean result; - if (mOldGnssStatusListeners.get(callback) != null) { - // listener is already registered - return true; - } - try { - GnssStatusListenerTransport transport = - new GnssStatusListenerTransport(callback, handler); - result = mService.registerGnssStatusCallback(transport, mContext.getPackageName()); - if (result) { - mOldGnssStatusListeners.put(callback, transport); - } - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - - return result; - } - - /** - * Removes a GNSS status listener. - * - * @param callback GNSS status listener object to remove - * @removed - */ - public void unregisterGnssStatusCallback(GnssStatusCallback callback) { - try { - GnssStatusListenerTransport transport = mOldGnssStatusListeners.remove(callback); - if (transport != null) { - mService.unregisterGnssStatusCallback(transport); - } - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } - - /** - * Registers a GNSS status listener. - * - * @param callback GNSS status listener object to register + * @param callback GNSS status callback object to register * * @return true if the listener was successfully added * @@ -1781,9 +1646,9 @@ public class LocationManager { } /** - * Registers a GNSS status listener. + * Registers a GNSS status callback. * - * @param callback GNSS status listener object to register + * @param callback GNSS status callback object to register * @param handler the handler that the callback runs on. * * @return true if the listener was successfully added @@ -1812,9 +1677,9 @@ public class LocationManager { } /** - * Removes a GNSS status listener. + * Removes a GNSS status callback. * - * @param callback GNSS status listener object to remove + * @param callback GNSS status callback object to remove */ public void unregisterGnssStatusCallback(GnssStatus.Callback callback) { try { @@ -1877,71 +1742,6 @@ public class LocationManager { } } - /** - * Adds an NMEA listener. - * - * @param listener a {@link GnssNmeaListener} object to register - * - * @return true if the listener was successfully added - * - * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present - * @removed - */ - @RequiresPermission(ACCESS_FINE_LOCATION) - public boolean addNmeaListener(GnssNmeaListener listener) { - return addNmeaListener(listener, null); - } - - /** - * Adds an NMEA listener. - * - * @param listener a {@link GnssNmeaListener} object to register - * @param handler the handler that the listener runs on. - * - * @return true if the listener was successfully added - * - * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present - * @removed - */ - @RequiresPermission(ACCESS_FINE_LOCATION) - public boolean addNmeaListener(GnssNmeaListener listener, Handler handler) { - boolean result; - - if (mGpsNmeaListeners.get(listener) != null) { - // listener is already registered - return true; - } - try { - GnssStatusListenerTransport transport = - new GnssStatusListenerTransport(listener, handler); - result = mService.registerGnssStatusCallback(transport, mContext.getPackageName()); - if (result) { - mOldGnssNmeaListeners.put(listener, transport); - } - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - - return result; - } - - /** - * Removes an NMEA listener. - * - * @param listener a {@link GnssNmeaListener} object to remove - * @removed - */ - public void removeNmeaListener(GnssNmeaListener listener) { - try { - GnssStatusListenerTransport transport = mOldGnssNmeaListeners.remove(listener); - if (transport != null) { - mService.unregisterGnssStatusCallback(transport); - } - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } - /** * Adds an NMEA listener. * @@ -2085,58 +1885,6 @@ public class LocationManager { public void removeGpsNavigationMessageListener(GpsNavigationMessageEvent.Listener listener) { } - /** - * Registers a GNSS Navigation Message callback. - * - * @param callback a {@link GnssNavigationMessageEvent.Callback} object to register. - * @return {@code true} if the callback was added successfully, {@code false} otherwise. - * @removed - */ - public boolean registerGnssNavigationMessageCallback( - GnssNavigationMessageEvent.Callback callback) { - return registerGnssNavigationMessageCallback(callback, null); - } - - /** - * Registers a GNSS Navigation Message callback. - * - * @param callback a {@link GnssNavigationMessageEvent.Callback} object to register. - * @param handler the handler that the callback runs on. - * @return {@code true} if the callback was added successfully, {@code false} otherwise. - * @removed - */ - @RequiresPermission(ACCESS_FINE_LOCATION) - public boolean registerGnssNavigationMessageCallback( - final GnssNavigationMessageEvent.Callback callback, Handler handler) { - GnssNavigationMessage.Callback bridge = new GnssNavigationMessage.Callback() { - @Override - public void onGnssNavigationMessageReceived(GnssNavigationMessage message) { - GnssNavigationMessageEvent event = new GnssNavigationMessageEvent(message); - callback.onGnssNavigationMessageReceived(event); - } - - @Override - public void onStatusChanged(int status) { - callback.onStatusChanged(status); - } - }; - mNavigationMessageBridge.put(callback, bridge); - return mGnssNavigationMessageCallbackTransport.add(bridge, handler); - } - - /** - * Unregisters a GNSS Navigation Message callback. - * - * @param callback a {@link GnssNavigationMessageEvent.Callback} object to remove. - * @removed - */ - public void unregisterGnssNavigationMessageCallback( - GnssNavigationMessageEvent.Callback callback) { - mGnssNavigationMessageCallbackTransport.remove( - mNavigationMessageBridge.remove( - callback)); - } - /** * Registers a GNSS Navigation Message callback. *