diff options
author | Jiyong Park <jiyong@google.com> | 2018-03-08 16:43:07 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2018-03-21 10:36:44 +0900 |
commit | 4cc3a1c056f69ac4da1dc5055c36b7357e9f673c (patch) | |
tree | 106fdc43e6561b8a14543eb34ef4fd94932993b2 | |
parent | eee99986c8021d6825f99a25434725fccf7b2b12 (diff) |
Remove FlpHardwareProvider
After Treble's FLP merge into GNSS HAL, the FlpHardwareProvider is just
an empty shell. Removing FusedLocation and/or Flp + Hardware classes
altogether.
Bug: 35726697
Test: m -j
Test: Open Google Map and then walk around. The dot moves as I walk.
Change-Id: I7f413e38b57424e8ebb9d7d14d94f145a48d10f8
16 files changed, 6 insertions, 1159 deletions
diff --git a/Android.bp b/Android.bp index 1caa4977a168..33f374328b33 100644 --- a/Android.bp +++ b/Android.bp @@ -169,8 +169,6 @@ java_library { "core/java/android/hardware/location/IActivityRecognitionHardwareClient.aidl", "core/java/android/hardware/location/IActivityRecognitionHardwareSink.aidl", "core/java/android/hardware/location/IActivityRecognitionHardwareWatcher.aidl", - "core/java/android/hardware/location/IFusedLocationHardware.aidl", - "core/java/android/hardware/location/IFusedLocationHardwareSink.aidl", "core/java/android/hardware/location/IGeofenceHardware.aidl", "core/java/android/hardware/location/IGeofenceHardwareCallback.aidl", "core/java/android/hardware/location/IGeofenceHardwareMonitorCallback.aidl", @@ -409,7 +407,6 @@ java_library { "location/java/android/location/IBatchedLocationCallback.aidl", "location/java/android/location/ICountryDetector.aidl", "location/java/android/location/ICountryListener.aidl", - "location/java/android/location/IFusedProvider.aidl", "location/java/android/location/IGeocodeProvider.aidl", "location/java/android/location/IGeofenceProvider.aidl", "location/java/android/location/IGnssStatusListener.aidl", diff --git a/config/boot-image-profile.txt b/config/boot-image-profile.txt index 40b266fe29d7..87fb99807ebc 100644 --- a/config/boot-image-profile.txt +++ b/config/boot-image-profile.txt @@ -3375,8 +3375,6 @@ HPLandroid/location/ICountryListener$Stub;-><init>()V HPLandroid/location/ICountryListener$Stub;->asBinder()Landroid/os/IBinder; HPLandroid/location/ICountryListener$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/ICountryListener; HPLandroid/location/ICountryListener;->onCountryDetected(Landroid/location/Country;)V -HPLandroid/location/IFusedProvider$Stub;-><init>()V -HPLandroid/location/IFusedProvider;->onFusedLocationHardwareChange(Landroid/hardware/location/IFusedLocationHardware;)V HPLandroid/location/IGeocodeProvider$Stub$Proxy;-><init>(Landroid/os/IBinder;)V HPLandroid/location/IGeocodeProvider$Stub$Proxy;->getFromLocation(DDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String; HPLandroid/location/IGeocodeProvider$Stub;-><init>()V diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt index 99d871e0f6f5..b3e515522fcc 100644 --- a/config/hiddenapi-light-greylist.txt +++ b/config/hiddenapi-light-greylist.txt @@ -781,7 +781,6 @@ Landroid/location/Country;->getCountryIso()Ljava/lang/String; Landroid/location/Country;->getSource()I Landroid/location/GeocoderParams;->getClientPackage()Ljava/lang/String; Landroid/location/GeocoderParams;->getLocale()Ljava/util/Locale; -Landroid/location/IFusedProvider$Stub;-><init>()V Landroid/location/IGeocodeProvider$Stub;-><init>()V Landroid/location/IGeofenceProvider$Stub;-><init>()V Landroid/location/ILocationManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/ILocationManager; diff --git a/config/hiddenapi-vendor-list.txt b/config/hiddenapi-vendor-list.txt index 952b28b8b820..aacfba439c61 100644 --- a/config/hiddenapi-vendor-list.txt +++ b/config/hiddenapi-vendor-list.txt @@ -76,7 +76,6 @@ Landroid/graphics/drawable/Drawable;->updateTintFilter(Landroid/graphics/PorterD Landroid/hardware/camera2/CaptureRequest$Key;-><init>(Ljava/lang/String;Ljava/lang/Class;)V Landroid/hardware/location/GeofenceHardware;-><init>(Landroid/hardware/location/IGeofenceHardware;)V Landroid/hardware/location/IActivityRecognitionHardwareClient;->onAvailabilityChanged(ZLandroid/hardware/location/IActivityRecognitionHardware;)V -Landroid/location/IFusedProvider;->onFusedLocationHardwareChange(Landroid/hardware/location/IFusedLocationHardware;)V Landroid/location/IGeocodeProvider;->getFromLocation(DDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String; Landroid/location/IGeocodeProvider;->getFromLocationName(Ljava/lang/String;DDDDILandroid/location/GeocoderParams;Ljava/util/List;)Ljava/lang/String; Landroid/location/IGeofenceProvider;->setGeofenceHardware(Landroid/hardware/location/IGeofenceHardware;)V diff --git a/core/java/android/hardware/location/IFusedLocationHardware.aidl b/core/java/android/hardware/location/IFusedLocationHardware.aidl deleted file mode 100644 index 2ea4d2374958..000000000000 --- a/core/java/android/hardware/location/IFusedLocationHardware.aidl +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2013, 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/license/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.hardware.location; - -import android.hardware.location.IFusedLocationHardwareSink; -import android.location.FusedBatchOptions; - -/** - * Fused Location hardware interface. - * This interface is the basic set of supported functionality by Fused Hardware - * modules that offer Location batching capabilities. - * - * @hide - */ -interface IFusedLocationHardware { - /** - * Registers a sink with the Location Hardware object. - * - * @param eventSink The sink to register. - */ - void registerSink(in IFusedLocationHardwareSink eventSink) = 0; - - /** - * Unregisters a sink with the Location Hardware object. - * - * @param eventSink The sink to unregister. - */ - void unregisterSink(in IFusedLocationHardwareSink eventSink) = 1; - - /** - * Provides access to the batch size available in Hardware. - * - * @return The batch size the hardware supports. - */ - int getSupportedBatchSize() = 2; - - /** - * Requests the Hardware to start batching locations. - * - * @param id An Id associated with the request. - * @param batchOptions The options required for batching. - * - * @throws RuntimeException if the request Id exists. - */ - void startBatching(in int id, in FusedBatchOptions batchOptions) = 3; - - /** - * Requests the Hardware to stop batching for the given Id. - * - * @param id The request that needs to be stopped. - * @throws RuntimeException if the request Id is unknown. - */ - void stopBatching(in int id) = 4; - - /** - * Updates a batching operation in progress. - * - * @param id The Id of the operation to update. - * @param batchOptions The options to apply to the given operation. - * - * @throws RuntimeException if the Id of the request is unknown. - */ - void updateBatchingOptions(in int id, in FusedBatchOptions batchOptions) = 5; - - /** - * Requests the most recent locations available in Hardware. - * This operation does not dequeue the locations, so still other batching - * events will continue working. - * - * @param batchSizeRequested The number of locations requested. - */ - void requestBatchOfLocations(in int batchSizeRequested) = 6; - - /** - * Flags if the Hardware supports injection of diagnostic data. - * - * @return True if data injection is supported, false otherwise. - */ - boolean supportsDiagnosticDataInjection() = 7; - - /** - * Injects diagnostic data into the Hardware subsystem. - * - * @param data The data to inject. - * @throws RuntimeException if injection is not supported. - */ - void injectDiagnosticData(in String data) = 8; - - /** - * Flags if the Hardware supports injection of device context information. - * - * @return True if device context injection is supported, false otherwise. - */ - boolean supportsDeviceContextInjection() = 9; - - /** - * Injects device context information into the Hardware subsystem. - * - * @param deviceEnabledContext The context to inject. - * @throws RuntimeException if injection is not supported. - */ - void injectDeviceContext(in int deviceEnabledContext) = 10; - - /** - * Requests all batched locations currently available in Hardware - * and clears the buffer. Any subsequent calls will not return any - * of the locations returned in this call. - */ - void flushBatchedLocations() = 11; - - /** - * Returns the version of this FLP HAL implementation. - */ - int getVersion() = 12; -} diff --git a/core/java/android/hardware/location/IFusedLocationHardwareSink.aidl b/core/java/android/hardware/location/IFusedLocationHardwareSink.aidl deleted file mode 100644 index a7dd0351010d..000000000000 --- a/core/java/android/hardware/location/IFusedLocationHardwareSink.aidl +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2013, 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/license/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.hardware.location; - -import android.location.Location; - -/** - * Fused Location hardware event sink interface. - * This interface defines the set of events that the FusedLocationHardware provides. - * - * @hide - */ -oneway interface IFusedLocationHardwareSink { - /** - * Event generated when a batch of location information is available. - * - * @param locations The batch of location information available. - */ - void onLocationAvailable(in Location[] locations) = 0; - - /** - * Event generated from FLP HAL to provide diagnostic data to the platform. - * - * @param data The diagnostic data provided by FLP HAL. - */ - void onDiagnosticDataAvailable(in String data) = 1; - - /** - * Event generated from FLP HAL to provide a mask of supported - * capabilities. Should be called immediatly after init. - */ - void onCapabilities(int capabilities) = 2; - - /** - * Event generated from FLP HAL when the status of location batching - * changes (location is successful/unsuccessful). - */ - void onStatusChanged(int status) = 3; -} diff --git a/location/java/android/location/IFusedProvider.aidl b/location/java/android/location/IFusedProvider.aidl deleted file mode 100644 index e86ad1ac5147..000000000000 --- a/location/java/android/location/IFusedProvider.aidl +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2013 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.hardware.location.IFusedLocationHardware; - -/** - * Interface definition for Location providers that require FLP services. - * @hide - */ -oneway interface IFusedProvider { - /** - * Provides access to a FusedLocationHardware instance needed for the provider to work. - * - * @param instance The FusedLocationHardware available for the provider to use. - */ - void onFusedLocationHardwareChange(in IFusedLocationHardware instance); -} diff --git a/location/lib/java/com/android/location/provider/FusedLocationHardware.java b/location/lib/java/com/android/location/provider/FusedLocationHardware.java deleted file mode 100644 index eb3b2f4609e7..000000000000 --- a/location/lib/java/com/android/location/provider/FusedLocationHardware.java +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright (C) 2013 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 com.android.location.provider; - -import android.hardware.location.IFusedLocationHardware; -import android.hardware.location.IFusedLocationHardwareSink; - -import android.location.Location; - -import android.os.Handler; -import android.os.Looper; -import android.os.Message; -import android.os.RemoteException; -import android.util.Log; - -import java.util.HashMap; -import java.util.Map; - -/** - * Class that exposes IFusedLocationHardware functionality to unbundled services. - */ -public final class FusedLocationHardware { - private static final String TAG = "FusedLocationHardware"; - - private IFusedLocationHardware mLocationHardware; - - // the list uses a copy-on-write pattern to update its contents - HashMap<FusedLocationHardwareSink, DispatcherHandler> mSinkList = - new HashMap<FusedLocationHardwareSink, DispatcherHandler>(); - - private IFusedLocationHardwareSink mInternalSink = new IFusedLocationHardwareSink.Stub() { - @Override - public void onLocationAvailable(Location[] locations) { - dispatchLocations(locations); - } - - @Override - public void onDiagnosticDataAvailable(String data) { - dispatchDiagnosticData(data); - } - - @Override - public void onCapabilities(int capabilities) { - dispatchCapabilities(capabilities); - } - - @Override - public void onStatusChanged(int status) { - dispatchStatus(status); - } - }; - - /** - * @hide - */ - public FusedLocationHardware(IFusedLocationHardware locationHardware) { - mLocationHardware = locationHardware; - } - - /* - * Methods to provide a Facade for IFusedLocationHardware - */ - public void registerSink(FusedLocationHardwareSink sink, Looper looper) { - if(sink == null || looper == null) { - throw new IllegalArgumentException("Parameter sink and looper cannot be null."); - } - - boolean registerSink; - synchronized (mSinkList) { - // register only on first insertion - registerSink = mSinkList.size() == 0; - // guarantee uniqueness - if(mSinkList.containsKey(sink)) { - return; - } - - HashMap<FusedLocationHardwareSink, DispatcherHandler> newSinkList = - new HashMap<FusedLocationHardwareSink, DispatcherHandler>(mSinkList); - newSinkList.put(sink, new DispatcherHandler(looper)); - mSinkList = newSinkList; - } - - if(registerSink) { - try { - mLocationHardware.registerSink(mInternalSink); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at registerSink"); - } - } - } - - public void unregisterSink(FusedLocationHardwareSink sink) { - if(sink == null) { - throw new IllegalArgumentException("Parameter sink cannot be null."); - } - - boolean unregisterSink; - synchronized(mSinkList) { - if(!mSinkList.containsKey(sink)) { - //done - return; - } - - HashMap<FusedLocationHardwareSink, DispatcherHandler> newSinkList = - new HashMap<FusedLocationHardwareSink, DispatcherHandler>(mSinkList); - newSinkList.remove(sink); - //unregister after the last sink - unregisterSink = newSinkList.size() == 0; - - mSinkList = newSinkList; - } - - if(unregisterSink) { - try { - mLocationHardware.unregisterSink(mInternalSink); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at unregisterSink"); - } - } - } - - public int getSupportedBatchSize() { - try { - return mLocationHardware.getSupportedBatchSize(); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at getSupportedBatchSize"); - return 0; - } - } - - public void startBatching(int id, GmsFusedBatchOptions batchOptions) { - try { - mLocationHardware.startBatching(id, batchOptions.getParcelableOptions()); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at startBatching"); - } - } - - public void stopBatching(int id) { - try { - mLocationHardware.stopBatching(id); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at stopBatching"); - } - } - - public void updateBatchingOptions(int id, GmsFusedBatchOptions batchOptions) { - try { - mLocationHardware.updateBatchingOptions(id, batchOptions.getParcelableOptions()); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at updateBatchingOptions"); - } - } - - public void requestBatchOfLocations(int batchSizeRequest) { - try { - mLocationHardware.requestBatchOfLocations(batchSizeRequest); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at requestBatchOfLocations"); - } - } - - public void flushBatchedLocations() { - try { - mLocationHardware.flushBatchedLocations(); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at flushBatchedLocations"); - } - } - - public boolean supportsDiagnosticDataInjection() { - try { - return mLocationHardware.supportsDiagnosticDataInjection(); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at supportsDiagnisticDataInjection"); - return false; - } - } - - public void injectDiagnosticData(String data) { - try { - mLocationHardware.injectDiagnosticData(data); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at injectDiagnosticData"); - } - } - - public boolean supportsDeviceContextInjection() { - try { - return mLocationHardware.supportsDeviceContextInjection(); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at supportsDeviceContextInjection"); - return false; - } - } - - public void injectDeviceContext(int deviceEnabledContext) { - try { - mLocationHardware.injectDeviceContext(deviceEnabledContext); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at injectDeviceContext"); - } - } - - - /** - * Returns the version of the FLP HAL. - * - * <p>Version 1 is the initial release. - * <p>Version 2 adds the ability to use {@link #flushBatchedLocations}, - * {@link FusedLocationHardwareSink#onCapabilities}, and - * {@link FusedLocationHardwareSink#onStatusChanged}. - * - * <p>This method is only available on API 23 or later. Older APIs have version 1. - */ - public int getVersion() { - try { - return mLocationHardware.getVersion(); - } catch(RemoteException e) { - Log.e(TAG, "RemoteException at getVersion"); - } - return 1; - } - - /* - * Helper methods and classes - */ - private class DispatcherHandler extends Handler { - public static final int DISPATCH_LOCATION = 1; - public static final int DISPATCH_DIAGNOSTIC_DATA = 2; - public static final int DISPATCH_CAPABILITIES = 3; - public static final int DISPATCH_STATUS = 4; - - public DispatcherHandler(Looper looper) { - super(looper, null /*callback*/ , true /*async*/); - } - - @Override - public void handleMessage(Message message) { - MessageCommand command = (MessageCommand) message.obj; - switch(message.what) { - case DISPATCH_LOCATION: - command.dispatchLocation(); - break; - case DISPATCH_DIAGNOSTIC_DATA: - command.dispatchDiagnosticData(); - break; - case DISPATCH_CAPABILITIES: - command.dispatchCapabilities(); - break; - case DISPATCH_STATUS: - command.dispatchStatus(); - break; - default: - Log.e(TAG, "Invalid dispatch message"); - break; - } - } - } - - private class MessageCommand { - private final FusedLocationHardwareSink mSink; - private final Location[] mLocations; - private final String mData; - private final int mCapabilities; - private final int mStatus; - - public MessageCommand( - FusedLocationHardwareSink sink, - Location[] locations, - String data, - int capabilities, - int status) { - mSink = sink; - mLocations = locations; - mData = data; - mCapabilities = capabilities; - mStatus = status; - } - - public void dispatchLocation() { - mSink.onLocationAvailable(mLocations); - } - - public void dispatchDiagnosticData() { - mSink.onDiagnosticDataAvailable(mData); - } - - public void dispatchCapabilities() { - mSink.onCapabilities(mCapabilities); - } - - public void dispatchStatus() { - mSink.onStatusChanged(mStatus); - } - } - - private void dispatchLocations(Location[] locations) { - HashMap<FusedLocationHardwareSink, DispatcherHandler> sinks; - synchronized (mSinkList) { - sinks = mSinkList; - } - - for(Map.Entry<FusedLocationHardwareSink, DispatcherHandler> entry : sinks.entrySet()) { - Message message = Message.obtain( - entry.getValue(), - DispatcherHandler.DISPATCH_LOCATION, - new MessageCommand(entry.getKey(), locations, null /*data*/, 0, 0)); - message.sendToTarget(); - } - } - - private void dispatchDiagnosticData(String data) { - HashMap<FusedLocationHardwareSink, DispatcherHandler> sinks; - synchronized(mSinkList) { - sinks = mSinkList; - } - - for(Map.Entry<FusedLocationHardwareSink, DispatcherHandler> entry : sinks.entrySet()) { - Message message = Message.obtain( - entry.getValue(), - DispatcherHandler.DISPATCH_DIAGNOSTIC_DATA, - new MessageCommand(entry.getKey(), null /*locations*/, data, 0, 0)); - message.sendToTarget(); - } - } - - private void dispatchCapabilities(int capabilities) { - HashMap<FusedLocationHardwareSink, DispatcherHandler> sinks; - synchronized(mSinkList) { - sinks = mSinkList; - } - - for(Map.Entry<FusedLocationHardwareSink, DispatcherHandler> entry : sinks.entrySet()) { - Message message = Message.obtain( - entry.getValue(), - DispatcherHandler.DISPATCH_CAPABILITIES, - new MessageCommand(entry.getKey(), null /*locations*/, null, capabilities, 0)); - message.sendToTarget(); - } - } - - private void dispatchStatus(int status) { - HashMap<FusedLocationHardwareSink, DispatcherHandler> sinks; - synchronized(mSinkList) { - sinks = mSinkList; - } - - for(Map.Entry<FusedLocationHardwareSink, DispatcherHandler> entry : sinks.entrySet()) { - Message message = Message.obtain( - entry.getValue(), - DispatcherHandler.DISPATCH_STATUS, - new MessageCommand(entry.getKey(), null /*locations*/, null, 0, status)); - message.sendToTarget(); - } - } -} diff --git a/location/lib/java/com/android/location/provider/FusedLocationHardwareSink.java b/location/lib/java/com/android/location/provider/FusedLocationHardwareSink.java deleted file mode 100644 index 01d37acde7b8..000000000000 --- a/location/lib/java/com/android/location/provider/FusedLocationHardwareSink.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2013 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 com.android.location.provider; - -import android.location.Location; - -/** - * Base class for sinks to interact with FusedLocationHardware. - * - * <p>Default implementations allow new methods to be added without crashing - * clients compiled against an old library version. - */ -public class FusedLocationHardwareSink { - /** - * Called when one or more locations are available from the FLP - * HAL. - */ - public void onLocationAvailable(Location[] locations) { - // default do nothing - } - - /** - * Called when diagnostic data is available from the FLP HAL. - */ - public void onDiagnosticDataAvailable(String data) { - // default do nothing - } - - /** - * Called when capabilities are available from the FLP HAL. - * Should be called once right after initialization. - * - * @param capabilities A bitmask of capabilities defined in - * fused_location.h. - */ - public void onCapabilities(int capabilities) { - // default do nothing - } - - /** - * Called when the status changes in the underlying FLP HAL - * implementation (the ability to compute location). This - * callback will only be made on version 2 or later - * (see {@link FusedLocationHardware#getVersion()}). - * - * @param status One of FLP_STATUS_LOCATION_AVAILABLE or - * FLP_STATUS_LOCATION_UNAVAILABLE as defined in - * fused_location.h. - */ - public void onStatusChanged(int status) { - // default do nothing - } -}
\ No newline at end of file diff --git a/location/lib/java/com/android/location/provider/FusedProvider.java b/location/lib/java/com/android/location/provider/FusedProvider.java index c966adeadc6f..78a593b6670b 100644 --- a/location/lib/java/com/android/location/provider/FusedProvider.java +++ b/location/lib/java/com/android/location/provider/FusedProvider.java @@ -16,8 +16,6 @@ package com.android.location.provider; -import android.hardware.location.IFusedLocationHardware; -import android.location.IFusedProvider; import android.os.IBinder; /** @@ -26,17 +24,12 @@ import android.os.IBinder; * <p>Fused providers can be implemented as services and return the result of * {@link com.android.location.provider.FusedProvider#getBinder()} in its getBinder() method. * - * <p>IMPORTANT: This class is effectively a public API for unbundled applications, and must remain - * API stable. See README.txt in the root of this package for more information. + * @deprecated This class should no longer be used. The location service does not uses this. + * This class exist here just to prevent existing apps having reference to this class from + * breaking. */ +@Deprecated public abstract class FusedProvider { - private IFusedProvider.Stub mProvider = new IFusedProvider.Stub() { - @Override - public void onFusedLocationHardwareChange(IFusedLocationHardware instance) { - setFusedLocationHardware(new FusedLocationHardware(instance)); - } - }; - /** * Gets the Binder associated with the provider. * This is intended to be used for the onBind() method of a service that implements a fused @@ -45,13 +38,6 @@ public abstract class FusedProvider { * @return The IBinder instance associated with the provider. */ public IBinder getBinder() { - return mProvider; + return null; } - - /** - * Sets the FusedLocationHardware instance in the provider.. - * @param value The instance to set. This can be null in cases where the service connection - * is disconnected. - */ - public abstract void setFusedLocationHardware(FusedLocationHardware value); } diff --git a/location/lib/java/com/android/location/provider/GmsFusedBatchOptions.java b/location/lib/java/com/android/location/provider/GmsFusedBatchOptions.java deleted file mode 100644 index 13278e7afc1f..000000000000 --- a/location/lib/java/com/android/location/provider/GmsFusedBatchOptions.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2013 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 com.android.location.provider; - -import android.location.FusedBatchOptions; - -/** - * Class that exposes FusedBatchOptions to the GmsCore . - */ -public class GmsFusedBatchOptions { - private FusedBatchOptions mOptions = new FusedBatchOptions(); - - /* - * Methods that provide a facade for properties in FusedBatchOptions. - */ - public void setMaxPowerAllocationInMW(double value) { - mOptions.setMaxPowerAllocationInMW(value); - } - - public double getMaxPowerAllocationInMW() { - return mOptions.getMaxPowerAllocationInMW(); - } - - public void setPeriodInNS(long value) { - mOptions.setPeriodInNS(value); - } - - public long getPeriodInNS() { - return mOptions.getPeriodInNS(); - } - - public void setSmallestDisplacementMeters(float value) { - mOptions.setSmallestDisplacementMeters(value); - } - - public float getSmallestDisplacementMeters() { - return mOptions.getSmallestDisplacementMeters(); - } - - public void setSourceToUse(int source) { - mOptions.setSourceToUse(source); - } - - public void resetSourceToUse(int source) { - mOptions.resetSourceToUse(source); - } - - public boolean isSourceToUseSet(int source) { - return mOptions.isSourceToUseSet(source); - } - - public int getSourcesToUse() { - return mOptions.getSourcesToUse(); - } - - public void setFlag(int flag) { - mOptions.setFlag(flag); - } - - public void resetFlag(int flag) { - mOptions.resetFlag(flag); - } - - public boolean isFlagSet(int flag) { - return mOptions.isFlagSet(flag); - } - - public int getFlags() { - return mOptions.getFlags(); - } - - /** - * Definition of enum flag sets needed by this class. - * Such values need to be kept in sync with the ones in fused_location.h - */ - - public static final class SourceTechnologies { - public static int GNSS = 1<<0; - public static int WIFI = 1<<1; - public static int SENSORS = 1<<2; - public static int CELL = 1<<3; - public static int BLUETOOTH = 1<<4; - } - - public static final class BatchFlags { - public static int WAKEUP_ON_FIFO_FULL = 1<<0; - public static int CALLBACK_ON_LOCATION_FIX = 1<<1; - } - - /* - * Method definitions for internal use. - */ - - /** - * @hide - */ - public FusedBatchOptions getParcelableOptions() { - return mOptions; - } -} diff --git a/services/art-profile b/services/art-profile index d2cde029b490..93e580af759a 100644 --- a/services/art-profile +++ b/services/art-profile @@ -10677,7 +10677,6 @@ PLcom/android/server/location/ContextHubService;->sendMessage(IILandroid/hardwar PLcom/android/server/location/CountryDetectorBase;-><init>(Landroid/content/Context;)V PLcom/android/server/location/CountryDetectorBase;->notifyListener(Landroid/location/Country;)V PLcom/android/server/location/CountryDetectorBase;->setCountryListener(Landroid/location/CountryListener;)V -PLcom/android/server/location/FlpHardwareProvider;->isSupported()Z PLcom/android/server/location/GeocoderProxy;-><init>(Landroid/content/Context;IIILandroid/os/Handler;)V PLcom/android/server/location/GeocoderProxy;->bind()Z PLcom/android/server/location/GeocoderProxy;->createAndBind(Landroid/content/Context;IIILandroid/os/Handler;)Lcom/android/server/location/GeocoderProxy; diff --git a/services/core/java/com/android/server/LocationManagerService.java b/services/core/java/com/android/server/LocationManagerService.java index 65e90bad41a7..d5cbfd4a70cb 100644 --- a/services/core/java/com/android/server/LocationManagerService.java +++ b/services/core/java/com/android/server/LocationManagerService.java @@ -82,8 +82,6 @@ import com.android.internal.os.BackgroundThread; import com.android.internal.util.ArrayUtils; import com.android.internal.util.DumpUtils; import com.android.server.location.ActivityRecognitionProxy; -import com.android.server.location.FlpHardwareProvider; -import com.android.server.location.FusedProxy; import com.android.server.location.GeocoderProxy; import com.android.server.location.GeofenceManager; import com.android.server.location.GeofenceProxy; @@ -491,13 +489,6 @@ public class LocationManagerService extends ILocationManager.Stub { if (gpsProvider != null && gpsProvider.isEnabled()) { gpsProvider.disable(); } - - // it is needed to check if FLP HW provider is supported before accessing the instance, this - // avoids an exception to be thrown by the singleton factory method - if (FlpHardwareProvider.isSupported()) { - FlpHardwareProvider flpHardwareProvider = FlpHardwareProvider.getInstance(mContext); - flpHardwareProvider.cleanup(); - } } /** @@ -686,27 +677,6 @@ public class LocationManagerService extends ILocationManager.Stub { Slog.e(TAG, "no geocoder provider found"); } - // bind to fused hardware provider if supported - // in devices without support, requesting an instance of FlpHardwareProvider will raise an - // exception, so make sure we only do that when supported - FlpHardwareProvider flpHardwareProvider; - if (FlpHardwareProvider.isSupported()) { - flpHardwareProvider = FlpHardwareProvider.getInstance(mContext); - FusedProxy fusedProxy = FusedProxy.createAndBind( - mContext, - mLocationHandler, - flpHardwareProvider.getLocationHardware(), - com.android.internal.R.bool.config_enableHardwareFlpOverlay, - com.android.internal.R.string.config_hardwareFlpPackageName, - com.android.internal.R.array.config_locationProviderPackageNames); - if (fusedProxy == null) { - Slog.d(TAG, "Unable to bind FusedProxy."); - } - } else { - flpHardwareProvider = null; - Slog.d(TAG, "FLP HAL not supported"); - } - // bind to geofence provider GeofenceProxy provider = GeofenceProxy.createAndBind( mContext, com.android.internal.R.bool.config_enableGeofenceOverlay, @@ -714,7 +684,7 @@ public class LocationManagerService extends ILocationManager.Stub { com.android.internal.R.array.config_locationProviderPackageNames, mLocationHandler, mGpsGeofenceProxy, - flpHardwareProvider != null ? flpHardwareProvider.getGeofenceHardware() : null); + null); if (provider == null) { Slog.d(TAG, "Unable to bind FLP Geofence proxy."); } diff --git a/services/core/java/com/android/server/location/FlpHardwareProvider.java b/services/core/java/com/android/server/location/FlpHardwareProvider.java deleted file mode 100644 index 5c9b0eaa29cc..000000000000 --- a/services/core/java/com/android/server/location/FlpHardwareProvider.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2013 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 com.android.server.location; - -import android.content.Context; -import android.hardware.location.IFusedLocationHardware; -import android.location.IFusedGeofenceHardware; -import android.util.Log; - -/** - * This class was an interop layer for JVM types and the JNI code that interacted - * with the FLP HAL implementation. - * - * Now, after Treble FLP & GNSS HAL simplification, it is a thin shell that acts like the - * pre-existing cases where there was no FLP Hardware support, to keep legacy users of this - * class operating. - * - * {@hide} - * {@Deprecated} - */ -public class FlpHardwareProvider { - private static FlpHardwareProvider sSingletonInstance = null; - - private final static String TAG = "FlpHardwareProvider"; - - private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); - - public static FlpHardwareProvider getInstance(Context context) { - if (sSingletonInstance == null) { - sSingletonInstance = new FlpHardwareProvider(); - if (DEBUG) Log.d(TAG, "getInstance() created empty provider"); - } - return sSingletonInstance; - } - - private FlpHardwareProvider() { - } - - public static boolean isSupported() { - if (DEBUG) Log.d(TAG, "isSupported() returning false"); - return false; - } - - /** - * Interface implementations for services built on top of this functionality. - */ - public static final String LOCATION = "Location"; - - public IFusedLocationHardware getLocationHardware() { - return null; - } - - public IFusedGeofenceHardware getGeofenceHardware() { - return null; - } - - public void cleanup() { - if (DEBUG) Log.d(TAG, "empty cleanup()"); - } -} diff --git a/services/core/java/com/android/server/location/FusedLocationHardwareSecure.java b/services/core/java/com/android/server/location/FusedLocationHardwareSecure.java deleted file mode 100644 index a08d3263be6c..000000000000 --- a/services/core/java/com/android/server/location/FusedLocationHardwareSecure.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2013 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 com.android.server.location; - -import android.content.Context; -import android.hardware.location.IFusedLocationHardware; -import android.hardware.location.IFusedLocationHardwareSink; -import android.location.FusedBatchOptions; -import android.os.RemoteException; - -/** - * FusedLocationHardware decorator that adds permission checking. - * @hide - */ -public class FusedLocationHardwareSecure extends IFusedLocationHardware.Stub { - private final IFusedLocationHardware mLocationHardware; - private final Context mContext; - private final String mPermissionId; - - public FusedLocationHardwareSecure( - IFusedLocationHardware locationHardware, - Context context, - String permissionId) { - mLocationHardware = locationHardware; - mContext = context; - mPermissionId = permissionId; - } - - private void checkPermissions() { - mContext.enforceCallingPermission( - mPermissionId, - String.format( - "Permission '%s' not granted to access FusedLocationHardware", - mPermissionId)); - } - - @Override - public void registerSink(IFusedLocationHardwareSink eventSink) throws RemoteException { - checkPermissions(); - mLocationHardware.registerSink(eventSink); - } - - @Override - public void unregisterSink(IFusedLocationHardwareSink eventSink) throws RemoteException { - checkPermissions(); - mLocationHardware.unregisterSink(eventSink); - } - - @Override - public int getSupportedBatchSize() throws RemoteException { - checkPermissions(); - return mLocationHardware.getSupportedBatchSize(); - } - - @Override - public void startBatching(int id, FusedBatchOptions batchOptions) throws RemoteException { - checkPermissions(); - mLocationHardware.startBatching(id, batchOptions); - } - - @Override - public void stopBatching(int id) throws RemoteException { - checkPermissions(); - mLocationHardware.stopBatching(id); - } - - @Override - public void updateBatchingOptions( - int id, - FusedBatchOptions batchoOptions - ) throws RemoteException { - checkPermissions(); - mLocationHardware.updateBatchingOptions(id, batchoOptions); - } - - @Override - public void requestBatchOfLocations(int batchSizeRequested) throws RemoteException { - checkPermissions(); - mLocationHardware.requestBatchOfLocations(batchSizeRequested); - } - - @Override - public boolean supportsDiagnosticDataInjection() throws RemoteException { - checkPermissions(); - return mLocationHardware.supportsDiagnosticDataInjection(); - } - - @Override - public void injectDiagnosticData(String data) throws RemoteException { - checkPermissions(); - mLocationHardware.injectDiagnosticData(data); - } - - @Override - public boolean supportsDeviceContextInjection() throws RemoteException { - checkPermissions(); - return mLocationHardware.supportsDeviceContextInjection(); - } - - @Override - public void injectDeviceContext(int deviceEnabledContext) throws RemoteException { - checkPermissions(); - mLocationHardware.injectDeviceContext(deviceEnabledContext); - } - - @Override - public void flushBatchedLocations() throws RemoteException { - checkPermissions(); - mLocationHardware.flushBatchedLocations(); - } - - @Override - public int getVersion() throws RemoteException { - checkPermissions(); - return mLocationHardware.getVersion(); - } -} diff --git a/services/core/java/com/android/server/location/FusedProxy.java b/services/core/java/com/android/server/location/FusedProxy.java deleted file mode 100644 index b90f037a5046..000000000000 --- a/services/core/java/com/android/server/location/FusedProxy.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2013 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 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 com.android.server.location; - -import com.android.server.ServiceWatcher; - -import android.Manifest; -import android.content.Context; -import android.hardware.location.IFusedLocationHardware; -import android.location.IFusedProvider; -import android.os.Handler; -import android.os.IBinder; -import android.os.RemoteException; -import android.util.Log; - -/** - * Proxy that helps bind GCore FusedProvider implementations to the Fused Hardware instances. - * - * @hide - */ -public final class FusedProxy { - private final String TAG = "FusedProxy"; - private final ServiceWatcher mServiceWatcher; - private final FusedLocationHardwareSecure mLocationHardware; - - /** - * Constructor of the class. - * This is private as the class follows a factory pattern for construction. - * - * @param context The context needed for construction. - * @param handler The handler needed for construction. - * @param locationHardware The instance of the Fused location hardware assigned to the proxy. - */ - private FusedProxy( - Context context, - Handler handler, - IFusedLocationHardware locationHardware, - int overlaySwitchResId, - int defaultServicePackageNameResId, - int initialPackageNameResId) { - mLocationHardware = new FusedLocationHardwareSecure( - locationHardware, - context, - Manifest.permission.LOCATION_HARDWARE); - Runnable newServiceWork = new Runnable() { - @Override - public void run() { - bindProvider(mLocationHardware); - } - }; - - // prepare the connection to the provider - mServiceWatcher = new ServiceWatcher( - context, - TAG, - "com.android.location.service.FusedProvider", - overlaySwitchResId, - defaultServicePackageNameResId, - initialPackageNameResId, - newServiceWork, - handler); - } - - /** - * Creates an instance of the proxy and binds it to the appropriate FusedProvider. - * - * @param context The context needed for construction. - * @param handler The handler needed for construction. - * @param locationHardware The instance of the Fused location hardware assigned to the proxy. - * - * @return An instance of the proxy if it could be bound, null otherwise. - */ - public static FusedProxy createAndBind( - Context context, - Handler handler, - IFusedLocationHardware locationHardware, - int overlaySwitchResId, - int defaultServicePackageNameResId, - int initialPackageNameResId) { - FusedProxy fusedProxy = new FusedProxy( - context, - handler, - locationHardware, - overlaySwitchResId, - defaultServicePackageNameResId, - initialPackageNameResId); - - // try to bind the Fused provider - if (!fusedProxy.mServiceWatcher.start()) { - return null; - } - - return fusedProxy; - } - - /** - * Helper function to bind the FusedLocationHardware to the appropriate FusedProvider instance. - * - * @param locationHardware The FusedLocationHardware instance to use for the binding operation. - */ - private void bindProvider(IFusedLocationHardware locationHardware) { - if (!mServiceWatcher.runOnBinder(new ServiceWatcher.BinderRunner() { - @Override - public void run(IBinder binder) { - IFusedProvider provider = IFusedProvider.Stub.asInterface(binder); - try { - provider.onFusedLocationHardwareChange(locationHardware); - } catch (RemoteException e) { - Log.e(TAG, e.toString()); - } - } - })) { - Log.e(TAG, "No instance of FusedProvider found on FusedLocationHardware connected."); - } - } -} |