summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorArthur Ishiguro <arthuri@google.com>2017-11-27 16:33:36 -0800
committerArthur Ishiguro <arthuri@google.com>2017-12-19 10:47:47 -0800
commitfdbbd468dc12f2390f8065fa0a16dd4bdb4bfae4 (patch)
tree8bfc1b32c56a1498b378dca0033c08337e80eeb3 /core/java/android
parentab7113d48507a6777c81f14b1134387382947026 (diff)
Implements getContextHubs
Bug: 67734082 Test: Run test app that uses this API, verify app can find the appropriate hub. Change-Id: I7cd588419bc5b30cf2e8d95ee21f0b6a5592540f
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/hardware/location/ContextHubManager.java10
-rw-r--r--core/java/android/hardware/location/IContextHubService.aidl3
2 files changed, 10 insertions, 3 deletions
diff --git a/core/java/android/hardware/location/ContextHubManager.java b/core/java/android/hardware/location/ContextHubManager.java
index 5b89f54b5050..6da6fb7bfdb7 100644
--- a/core/java/android/hardware/location/ContextHubManager.java
+++ b/core/java/android/hardware/location/ContextHubManager.java
@@ -258,9 +258,9 @@ public final class ContextHubManager {
}
/**
- * Returns the list of context hubs in the system.
+ * Returns the list of ContextHubInfo objects describing the available Context Hubs.
*
- * @return the list of context hub informations
+ * @return the list of ContextHubInfo objects
*
* @see ContextHubInfo
*
@@ -268,7 +268,11 @@ public final class ContextHubManager {
*/
@RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE)
public List<ContextHubInfo> getContextHubs() {
- throw new UnsupportedOperationException("TODO: Implement this");
+ try {
+ return mService.getContextHubs();
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
}
/**
diff --git a/core/java/android/hardware/location/IContextHubService.aidl b/core/java/android/hardware/location/IContextHubService.aidl
index 43b0655d69ab..233e857d8e67 100644
--- a/core/java/android/hardware/location/IContextHubService.aidl
+++ b/core/java/android/hardware/location/IContextHubService.aidl
@@ -60,6 +60,9 @@ interface IContextHubService {
// Creates a client to send and receive messages
IContextHubClient createClient(in IContextHubClientCallback client, int contextHubId);
+ // Returns a list of ContextHub objects of available hubs
+ List<ContextHubInfo> getContextHubs();
+
// Loads a nanoapp at the specified hub (new API)
void loadNanoAppOnHub(
int contextHubId, in IContextHubTransactionCallback transactionCallback,