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
This commit is contained in:
Anthony Stange
2020-12-15 11:06:14 -05:00
parent de9e202ef2
commit e351e3b321
5 changed files with 112 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ hidl_interface {
srcs: [
"types.hal",
"IContexthub.hal",
"IContexthubCallback.hal",
],
interfaces: [
"android.hardware.contexthub@1.0",

View File

@@ -16,10 +16,40 @@
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.

View File

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

View File

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

View File

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