Surface App Permissions to the HAL
Bug: 166846988
Test: Compile
Change-Id: I83b6809cbcdf08f26d9cb29a03ad1c1910366d98
diff --git a/host/common/test/chre_test_client.cc b/host/common/test/chre_test_client.cc
index 8e74657..9ebca52 100644
--- a/host/common/test/chre_test_client.cc
+++ b/host/common/test/chre_test_client.cc
@@ -113,10 +113,9 @@
for (const std::unique_ptr<fbs::NanoappListEntryT> &nanoapp :
response.nanoapps) {
LOGI(" App ID 0x%016" PRIx64 " version 0x%" PRIx32
- " enabled %d system "
- "%d",
- nanoapp->app_id, nanoapp->version, nanoapp->enabled,
- nanoapp->is_system);
+ " permissions 0x%" PRIx32 " enabled %d system %d",
+ nanoapp->app_id, nanoapp->version, nanoapp->permissions,
+ nanoapp->enabled, nanoapp->is_system);
}
}
diff --git a/host/common/test/power_test/chre_power_test_client.cc b/host/common/test/power_test/chre_power_test_client.cc
index 6bdfdcc..fceb77f 100644
--- a/host/common/test/power_test/chre_power_test_client.cc
+++ b/host/common/test/power_test/chre_power_test_client.cc
@@ -291,9 +291,10 @@
LOGI("Got nanoapp list response with %zu apps:", response.nanoapps.size());
mAppIdVector.clear();
for (const auto &nanoapp : response.nanoapps) {
- LOGI("App ID 0x%016" PRIx64 " version 0x%" PRIx32 " enabled %d system %d",
- nanoapp->app_id, nanoapp->version, nanoapp->enabled,
- nanoapp->is_system);
+ LOGI("App ID 0x%016" PRIx64 " version 0x%" PRIx32
+ " permissions 0x%" PRIx32 " enabled %d system %d",
+ nanoapp->app_id, nanoapp->version, nanoapp->permissions,
+ nanoapp->enabled, nanoapp->is_system);
mAppIdVector.push_back(nanoapp->app_id);
}
mConditionVariable.notify_all();
diff --git a/host/hal_generic/common/generic_context_hub_base.h b/host/hal_generic/common/generic_context_hub_base.h
index 79eec7b..c0c1a56 100644
--- a/host/hal_generic/common/generic_context_hub_base.h
+++ b/host/hal_generic/common/generic_context_hub_base.h
@@ -409,9 +409,10 @@
continue;
}
- ALOGV("App 0x%016" PRIx64 " ver 0x%" PRIx32 " enabled %d system %d",
- nanoapp->app_id, nanoapp->version, nanoapp->enabled,
- nanoapp->is_system);
+ ALOGV("App 0x%016" PRIx64 " ver 0x%" PRIx32 " permissions 0x%" PRIx32
+ " enabled %d system %d",
+ nanoapp->app_id, nanoapp->version, nanoapp->permissions,
+ nanoapp->enabled, nanoapp->is_system);
if (!nanoapp->is_system) {
HubAppInfo appInfo;
diff --git a/platform/android/host_link.cc b/platform/android/host_link.cc
index 47f2b07..7962847 100644
--- a/platform/android/host_link.cc
+++ b/platform/android/host_link.cc
@@ -124,6 +124,7 @@
nanoappListEntry->version = nanoapp->getAppVersion();
nanoappListEntry->enabled = true;
nanoappListEntry->is_system = nanoapp->isSystemNanoapp();
+ nanoappListEntry->permissions = nanoapp->getAppPermissions();
response->nanoapps.push_back(std::move(nanoappListEntry));
};
diff --git a/platform/shared/host_protocol_chre.cc b/platform/shared/host_protocol_chre.cc
index 9ebd354..75ef9b7 100644
--- a/platform/shared/host_protocol_chre.cc
+++ b/platform/shared/host_protocol_chre.cc
@@ -148,9 +148,10 @@
void HostProtocolChre::addNanoappListEntry(
ChreFlatBufferBuilder &builder,
DynamicVector<Offset<fbs::NanoappListEntry>> &offsetVector, uint64_t appId,
- uint32_t appVersion, bool enabled, bool isSystemNanoapp) {
+ uint32_t appVersion, bool enabled, bool isSystemNanoapp,
+ uint32_t appPermissions) {
auto offset = fbs::CreateNanoappListEntry(builder, appId, appVersion, enabled,
- isSystemNanoapp);
+ isSystemNanoapp, appPermissions);
if (!offsetVector.push_back(offset)) {
LOGE("Couldn't push nanoapp list entry offset!");
}
diff --git a/platform/shared/include/chre/platform/shared/host_protocol_chre.h b/platform/shared/include/chre/platform/shared/host_protocol_chre.h
index 13bce53..ae2696e 100644
--- a/platform/shared/include/chre/platform/shared/host_protocol_chre.h
+++ b/platform/shared/include/chre/platform/shared/host_protocol_chre.h
@@ -128,7 +128,8 @@
static void addNanoappListEntry(
ChreFlatBufferBuilder &builder,
DynamicVector<NanoappListEntryOffset> &offsetVector, uint64_t appId,
- uint32_t appVersion, bool enabled, bool isSystemNanoapp);
+ uint32_t appVersion, bool enabled, bool isSystemNanoapp,
+ uint32_t appPermissions);
/**
* Finishes encoding a NanoappListResponse message after all NanoappListEntry
diff --git a/platform/slpi/host_link.cc b/platform/slpi/host_link.cc
index 9dbad06..d549014 100644
--- a/platform/slpi/host_link.cc
+++ b/platform/slpi/host_link.cc
@@ -216,7 +216,8 @@
auto *cbData = static_cast<NanoappListData *>(data);
HostProtocolChre::addNanoappListEntry(
*(cbData->builder), cbData->nanoappEntries, nanoapp->getAppId(),
- nanoapp->getAppVersion(), true /*enabled*/, nanoapp->isSystemNanoapp());
+ nanoapp->getAppVersion(), true /*enabled*/, nanoapp->isSystemNanoapp(),
+ nanoapp->getAppPermissions());
};
// Add a NanoappListEntry to the FlatBuffer for each nanoapp