Merge changes I7f413e38,I20aba7e9 into pi-dev

am: 4d6dc48d24

Change-Id: Ib63541d0924b400580d62513864d790a02021de9
This commit is contained in:
Jiyong Park
2018-03-22 00:46:46 +00:00
committed by android-build-merger
27 changed files with 38 additions and 1159 deletions

View File

@@ -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",

View File

@@ -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

View File

@@ -823,7 +823,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;

View File

@@ -113,7 +113,6 @@ Landroid/hardware/display/DisplayManagerGlobal;->getInstance()Landroid/hardware/
Landroid/hardware/display/DisplayManagerGlobal;->getRealDisplay(I)Landroid/view/Display;
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

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -42,3 +42,25 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
# ==== Stub library ===========================================
include $(CLEAR_VARS)
LOCAL_MODULE := com.android.location.provider-stubs-gen
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_SRC_FILES := $(call all-java-files-under,java)
LOCAL_DROIDDOC_STUB_OUT_DIR := $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/com.android.location.provider.stubs_intermediates/src
LOCAL_DROIDDOC_OPTIONS:= \
-hide 111 -hide 113 -hide 125 -hide 126 -hide 127 -hide 128 \
-stubpackages com.android.location.provider \
-nodocs
LOCAL_UNINSTALLABLE_MODULE := true
include $(BUILD_DROIDDOC)
com_android_nfc_extras_gen_stamp := $(full_target)
include $(CLEAR_VARS)
LOCAL_MODULE := com.android.location.provider.stubs
LOCAL_SOURCE_FILES_ALL_GENERATED := true
LOCAL_SDK_VERSION := current
LOCAL_ADDITIONAL_DEPENDENCIES := $(com_android_nfc_extras_gen_stamp)
com_android_nfc_extras_gen_stamp :=
include $(BUILD_STATIC_JAVA_LIBRARY)

View File

@@ -23,6 +23,7 @@ import java.util.List;
/**
* A class representing an event for Activity changes.
* @hide
*/
public class ActivityChangedEvent {
private final List<ActivityRecognitionEvent> mActivityRecognitionEvents;

View File

@@ -18,6 +18,7 @@ package com.android.location.provider;
/**
* A class that represents an Activity Recognition Event.
* @hide
*/
public class ActivityRecognitionEvent {
private final String mActivity;

View File

@@ -28,6 +28,7 @@ import java.util.HashSet;
/**
* A class that exposes {@link IActivityRecognitionHardware} functionality to unbundled services.
* @hide
*/
public final class ActivityRecognitionProvider {
private final IActivityRecognitionHardware mService;

View File

@@ -27,6 +27,7 @@ import android.util.Log;
/**
* A client class for interaction with an Activity-Recognition provider.
* @hide
*/
public abstract class ActivityRecognitionProviderClient {
private static final String TAG = "ArProviderClient";

View File

@@ -30,6 +30,7 @@ import android.util.Log;
* A watcher class for Activity-Recognition instances.
*
* @deprecated use {@link ActivityRecognitionProviderClient} instead.
* @hide
*/
@Deprecated
public class ActivityRecognitionProviderWatcher {

View File

@@ -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();
}
}
}

View File

@@ -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
}
}

View File

@@ -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);
}

View File

@@ -33,6 +33,7 @@ import java.util.List;
* <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.
* @hide
*/
public abstract class GeocodeProvider {

View File

@@ -31,6 +31,7 @@ import android.location.IGeofenceProvider;
* <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.
* @hide
*/
public abstract class GeofenceProvider {

View File

@@ -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;
}
}

View File

@@ -56,6 +56,7 @@ import com.android.internal.util.FastPrintWriter;
public abstract class LocationProviderBase {
private final String TAG;
/** @hide */
protected final ILocationManager mLocationManager;
private final ProviderProperties mProperties;
private final IBinder mBinder;

View File

@@ -41,6 +41,7 @@ public final class ProviderPropertiesUnbundled {
mProperties = properties;
}
/** @hide */
public ProviderProperties getProviderProperties() {
return mProperties;
}

View File

@@ -33,6 +33,7 @@ import com.android.internal.location.ProviderRequest;
public final class ProviderRequestUnbundled {
private final ProviderRequest mRequest;
/** @hide */
public ProviderRequestUnbundled(ProviderRequest request) {
mRequest = request;
}

View File

@@ -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;

View File

@@ -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.");
}

View File

@@ -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()");
}
}

View File

@@ -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();
}
}

View File

@@ -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.");
}
}
}