summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Stange <stange@google.com>2020-12-15 11:06:14 -0500
committerAnthony Stange <stange@google.com>2020-12-17 16:33:51 -0500
commite351e3b3215cdfab62db6a5a4734b1d9ece6aa45 (patch)
treee18b150056be49ecd9e89b0ff3fabd866aa9edf7
parentde9e202ef2829c2a1f43aa2e18510e6e43827eb5 (diff)
Update Contexthub HAL 1.2
Update Contexthub HAL 1.2 to support passing permissions information about host apps and nanoapps to the HAL and contexthub framework. Bug: 166846988 Test: hidl-gen && Run VTS against default HAL Change-Id: I483cb066b3228c4a80bab8f12f8bfee2610c9e6b
-rw-r--r--contexthub/1.2/Android.bp1
-rw-r--r--contexthub/1.2/IContexthub.hal30
-rw-r--r--contexthub/1.2/IContexthubCallback.hal45
-rw-r--r--contexthub/1.2/types.hal35
-rw-r--r--current.txt4
5 files changed, 112 insertions, 3 deletions
diff --git a/contexthub/1.2/Android.bp b/contexthub/1.2/Android.bp
index e81948234a..9722a97ee6 100644
--- a/contexthub/1.2/Android.bp
+++ b/contexthub/1.2/Android.bp
@@ -6,6 +6,7 @@ hidl_interface {
srcs: [
"types.hal",
"IContexthub.hal",
+ "IContexthubCallback.hal",
],
interfaces: [
"android.hardware.contexthub@1.0",
diff --git a/contexthub/1.2/IContexthub.hal b/contexthub/1.2/IContexthub.hal
index 819fc1d6e1..3488b7446c 100644
--- a/contexthub/1.2/IContexthub.hal
+++ b/contexthub/1.2/IContexthub.hal
@@ -16,11 +16,41 @@
package android.hardware.contexthub@1.2;
+import @1.0::Result;
import @1.1::IContexthub;
import @1.1::SettingValue;
+import IContexthubCallback;
interface IContexthub extends @1.1::IContexthub {
/**
+ * Register a callback for the HAL implementation to send asynchronous
+ * messages to the service from a context hub. There can be a maximum of
+ * one callback registered with the HAL. A call to this function when a
+ * callback has already been registered must override the previous
+ * registration.
+ *
+ * @param hubId identifier for the hub
+ * @param callback an implementation of the IContextHubCallbacks
+ *
+ * @return result OK on success
+ * BAD_VALUE if parameters are not valid
+ *
+ */
+ registerCallback_1_2(uint32_t hubId, IContexthubCallback cb) generates (Result result);
+
+ /**
+ * Send a message to a hub
+ *
+ * @param hubId identifier for hub to send message to
+ * @param msg message to be sent
+ *
+ * @return result OK if successful, error code otherwise
+ * BAD_VALUE if parameters are not valid
+ * TRANSACTION_FAILED if message send failed
+ */
+ sendMessageToHub_1_2(uint32_t hubId, ContextHubMsg msg) generates (Result result);
+
+ /**
* Notification sent by the framework to indicate that the user
* has changed a setting.
*
diff --git a/contexthub/1.2/IContexthubCallback.hal b/contexthub/1.2/IContexthubCallback.hal
new file mode 100644
index 0000000000..0236160305
--- /dev/null
+++ b/contexthub/1.2/IContexthubCallback.hal
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 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.hardware.contexthub@1.2;
+
+import @1.0::IContexthubCallback;
+
+interface IContexthubCallback extends @1.0::IContexthubCallback {
+ /**
+ * This callback is passed by the Contexthub service to the HAL
+ * implementation to allow the HAL to send asynchronous messages back
+ * to the service and registered clients of the ContextHub service.
+ *
+ * @param msg message that should be delivered to host app clients
+ *
+ */
+ handleClientMsg_1_2(ContextHubMsg msg);
+
+ /**
+ * This callback is passed by the Contexthub service to the HAL
+ * implementation to allow the HAL to send information about the
+ * currently loaded and active nanoapps on the hub.
+ *
+ * @param appInfo vector of HubAppinfo structure for each nanoApp
+ * on the hub that can be enabled, disabled and
+ * unloaded by the service. Any nanoApps that cannot
+ * be controlled by the service must not be reported.
+ * All nanoApps that can be controlled by the service
+ * must be reported.
+ */
+ handleAppsInfo_1_2(vec<HubAppInfo> appInfo);
+};
diff --git a/contexthub/1.2/types.hal b/contexthub/1.2/types.hal
index 38f9f7af55..e6c8acc57d 100644
--- a/contexthub/1.2/types.hal
+++ b/contexthub/1.2/types.hal
@@ -16,6 +16,8 @@
package android.hardware.contexthub@1.2;
+import @1.0::ContextHubMsg;
+import @1.0::HubAppInfo;
import @1.1::Setting;
/**
@@ -32,3 +34,36 @@ enum Setting : @1.1::Setting {
WIFI_AVAILABLE,
AIRPLANE_MODE,
};
+
+struct ContextHubMsg {
+ @1.0::ContextHubMsg msg_1_0;
+
+ /**
+ * The list of Android permissions that the sender of this message has at
+ * the time the message was sent.
+ *
+ * The HAL MUST drop messages to nanoapps if this list of permissions is not
+ * a superset of those of the receiving nanoapp(s).
+ *
+ * The framework MUST drop messages to host apps that don't have a superset
+ * of the permissions that the sending nanoapp is using.
+ */
+ vec<string> permissions;
+};
+
+struct HubAppInfo {
+ @1.0::HubAppInfo info_1_0;
+
+ /**
+ * The list of Android permissions used by this nanoapp. This list MUST
+ * correspond to the permissions required for an equivalent Android app to
+ * sample similar signals through the Android framework.
+ *
+ * For example, if a nanoapp used location-based signals, the permissions
+ * list MUST contains android.permission.ACCESS_FINE_LOCATION and
+ * android.permission.ACCESS_BACKGROUND_LOCATION. If it were to also list to
+ * audio data, it would require adding android.permission.RECORD_AUDIO to
+ * this list.
+ */
+ vec<string> permissions;
+};
diff --git a/current.txt b/current.txt
index 8623fc001b..0b88a7a835 100644
--- a/current.txt
+++ b/current.txt
@@ -787,6 +787,4 @@ b9fbb6e2e061ed0960939d48b785e9700210add1f13ed32ecd688d0f1ca20ef7 android.hardwar
# HALs released in Android S
# NOTE: waiting to freeze HALs until later in the release
-# NOTE: new HALs are recommended to be in AIDL
-6e64b33f1b720b66b0deb5e08dee37a99deaa94e2e9ebf7806703cabab56e21d android.hardware.contexthub@1.2::IContexthub
-3fb83f4539cab2c7bf9fdbecf7265d1c1dd6e8de9694046fe512b493c127ccea android.hardware.contexthub@1.2::types
+# NOTE: new HALs are recommended to be in AIDL \ No newline at end of file