Merge "use binder_auto_utils.h ostream" am: a18dea216e am: 2676d3242a am: ddd84bd776
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2288036
Change-Id: I3d1bab3c8ca5750a6dfeb8237c501faab7354557
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/audio/README.md b/audio/README.md
index 1938ad4..3f40d72 100644
--- a/audio/README.md
+++ b/audio/README.md
@@ -2,10 +2,29 @@
Directory structure of the audio HAL related code.
-Run `common/all-versions/copyHAL.sh` to create a new version of the audio HAL
-based on an existing one.
+## Directory Structure for AIDL audio HAL
-## Directory Structure
+The AIDL version is located inside `aidl` directory. The tree below explains
+the role of each subdirectory:
+
+* `aidl_api` — snapshots of the API created each Android release. Every
+ release, the current version of the API becomes "frozen" and gets assigned
+ the next version number. If the API needs further modifications, they are
+ made on the "current" version. After making modifications, run
+ `m <package name>-update-api` to update the snapshot of the "current"
+ version.
+* `android/hardware/audio/common` — data structures and interfaces shared
+ between various HALs: BT HAL, core and effects audio HALs.
+* `android/hardware/audio/core` — data structures and interfaces of the
+ core audio HAL.
+* `default` — the default, reference implementation of the audio HAL service.
+* `vts` — VTS tests for the AIDL HAL.
+
+## Directory Structure for HIDL audio HAL
+
+Run `common/all-versions/copyHAL.sh` to create a new version of the HIDL audio
+HAL based on an existing one. Note that this isn't possible since Android T
+release. Android U and above uses AIDL audio HAL.
* `2.0` — version 2.0 of the core HIDL API. Note that `.hal` files
can not be moved into the `core` directory because that would change
diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp
index 505c54c..4b76a0b 100644
--- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp
@@ -710,11 +710,9 @@
}
void releasePatchIfNeeded() {
- if (getDevice()) {
- if (areAudioPatchesSupported() && mHasPatch) {
- EXPECT_OK(getDevice()->releaseAudioPatch(mPatchHandle));
- mHasPatch = false;
- }
+ if (getDevice() && areAudioPatchesSupported() && mHasPatch) {
+ EXPECT_OK(getDevice()->releaseAudioPatch(mPatchHandle));
+ mHasPatch = false;
}
}
diff --git a/automotive/can/1.0/default/libnetdevice/can.cpp b/automotive/can/1.0/default/libnetdevice/can.cpp
index 083f4f0..2a0545a 100644
--- a/automotive/can/1.0/default/libnetdevice/can.cpp
+++ b/automotive/can/1.0/default/libnetdevice/can.cpp
@@ -80,7 +80,7 @@
{
auto linkinfo = req.addNested(IFLA_LINKINFO);
- req.add(IFLA_INFO_KIND, "can");
+ req.addBuffer(IFLA_INFO_KIND, "can");
{
auto infodata = req.addNested(IFLA_INFO_DATA);
/* For CAN FD, it would require to add IFLA_CAN_DATA_BITTIMING
diff --git a/automotive/can/1.0/default/libnetdevice/ifreqs.cpp b/automotive/can/1.0/default/libnetdevice/ifreqs.cpp
index 8df6434..8471173 100644
--- a/automotive/can/1.0/default/libnetdevice/ifreqs.cpp
+++ b/automotive/can/1.0/default/libnetdevice/ifreqs.cpp
@@ -47,7 +47,7 @@
return params;
}
-bool send(unsigned long request, struct ifreq& ifr) {
+int trySend(unsigned long request, struct ifreq& ifr) {
const auto sp = getSocketParams(socketDomain);
base::unique_fd sock(socket(sp.domain, sp.type, sp.protocol));
if (!sock.ok()) {
@@ -55,7 +55,12 @@
return false;
}
- if (ioctl(sock.get(), request, &ifr) < 0) {
+ if (ioctl(sock.get(), request, &ifr) < 0) return errno;
+ return 0;
+}
+
+bool send(unsigned long request, struct ifreq& ifr) {
+ if (trySend(request, ifr) != 0) {
PLOG(ERROR) << "ioctl(" << std::hex << request << std::dec << ") failed";
return false;
}
diff --git a/automotive/can/1.0/default/libnetdevice/ifreqs.h b/automotive/can/1.0/default/libnetdevice/ifreqs.h
index 74e5877..d8d6fe0 100644
--- a/automotive/can/1.0/default/libnetdevice/ifreqs.h
+++ b/automotive/can/1.0/default/libnetdevice/ifreqs.h
@@ -28,6 +28,15 @@
extern std::atomic_int socketDomain;
/**
+ * Tries to send ioctl interface request.
+ *
+ * \param request Request type (such as SIOCGIFFLAGS)
+ * \param ifr Request data (both input and output)
+ * \return error code of the call (0 for success)
+ */
+int trySend(unsigned long request, struct ifreq& ifr);
+
+/**
* Sends ioctl interface request.
*
* \param request Request type (such as SIOCGIFFLAGS)
diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h
index 70cb688..657f9b2 100644
--- a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h
+++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h
@@ -68,20 +68,32 @@
PRESENT_AND_UP,
/**
+ * Interface is up and with IPv4 address configured.
+ */
+ PRESENT_AND_IPV4,
+
+ /**
* Interface is down or not present (disconnected) at all.
*/
DOWN_OR_GONE,
};
+enum class Quantifier {
+ ALL_OF,
+ ANY_OF,
+};
+
/**
* Listens for interface changes until anticipated condition takes place.
*
* \param ifnames List of interfaces to watch for.
* \param cnd Awaited condition.
- * \param allOf true if all interfaces need to satisfy the condition, false if only one satistying
+ * \param quant Whether all interfaces need to satisfy the condition or just one satistying
* interface should stop the wait.
+ * \return name of one interface that satisfied the condition
*/
-void waitFor(std::set<std::string> ifnames, WaitCondition cnd, bool allOf = true);
+std::optional<std::string> waitFor(std::set<std::string> ifnames, WaitCondition cnd,
+ Quantifier quant = Quantifier::ALL_OF);
/**
* Brings network interface up.
diff --git a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
index 4c5b309..aad07de 100644
--- a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
+++ b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
@@ -60,7 +60,7 @@
{
auto linkinfo = req.addNested(IFLA_LINKINFO);
- req.add(IFLA_INFO_KIND, type);
+ req.addBuffer(IFLA_INFO_KIND, type);
}
nl::Socket sock(NETLINK_ROUTE);
@@ -100,23 +100,36 @@
return ifr.ifr_flags & IFF_UP;
}
+static bool hasIpv4(std::string ifname) {
+ auto ifr = ifreqs::fromName(ifname);
+ switch (const auto status = ifreqs::trySend(SIOCGIFADDR, ifr)) {
+ case 0:
+ return true;
+ case EADDRNOTAVAIL:
+ case ENODEV:
+ return false;
+ default:
+ PLOG(WARNING) << "Failed checking IPv4 address";
+ return false;
+ }
+}
+
struct WaitState {
bool present;
bool up;
+ bool hasIpv4Addr;
bool satisfied(WaitCondition cnd) const {
switch (cnd) {
case WaitCondition::PRESENT:
- if (present) return true;
- break;
+ return present;
case WaitCondition::PRESENT_AND_UP:
- if (present && up) return true;
- break;
+ return present && up;
+ case WaitCondition::PRESENT_AND_IPV4:
+ return present && up && hasIpv4Addr;
case WaitCondition::DOWN_OR_GONE:
- if (!present || !up) return true;
- break;
+ return !present || !up;
}
- return false;
}
};
@@ -126,11 +139,22 @@
return "become present";
case WaitCondition::PRESENT_AND_UP:
return "come up";
+ case WaitCondition::PRESENT_AND_IPV4:
+ return "get IPv4 address";
case WaitCondition::DOWN_OR_GONE:
return "go down";
}
}
+static std::string toString(Quantifier quant) {
+ switch (quant) {
+ case Quantifier::ALL_OF:
+ return "all of";
+ case Quantifier::ANY_OF:
+ return "any of";
+ }
+}
+
static std::string toString(const std::set<std::string>& ifnames) {
std::stringstream ss;
std::copy(ifnames.begin(), ifnames.end(), std::ostream_iterator<std::string>(ss, ","));
@@ -139,50 +163,73 @@
return str;
}
-void waitFor(std::set<std::string> ifnames, WaitCondition cnd, bool allOf) {
- nl::Socket sock(NETLINK_ROUTE, 0, RTMGRP_LINK);
+std::optional<std::string> waitFor(std::set<std::string> ifnames, WaitCondition cnd,
+ Quantifier quant) {
+ nl::Socket sock(NETLINK_ROUTE, 0, RTMGRP_LINK | RTMGRP_IPV4_IFADDR);
using StatesMap = std::map<std::string, WaitState>;
StatesMap states = {};
for (const auto ifname : ifnames) {
const auto present = exists(ifname);
const auto up = present && isUp(ifname).value_or(false);
- states[ifname] = {present, up};
+ const auto hasIpv4Addr = present && hasIpv4(ifname);
+ states[ifname] = {present, up, hasIpv4Addr};
}
const auto mapConditionChecker = [cnd](const StatesMap::iterator::value_type& it) {
return it.second.satisfied(cnd);
};
- const auto isFullySatisfied = [&states, allOf, mapConditionChecker]() {
- if (allOf) {
- return std::all_of(states.begin(), states.end(), mapConditionChecker);
- } else {
- return std::any_of(states.begin(), states.end(), mapConditionChecker);
+ const auto isFullySatisfied = [&states, quant,
+ mapConditionChecker]() -> std::optional<std::string> {
+ if (quant == Quantifier::ALL_OF) {
+ if (!std::all_of(states.begin(), states.end(), mapConditionChecker)) return {};
+ return states.begin()->first;
+ } else { // Quantifier::ANY_OF
+ const auto it = std::find_if(states.begin(), states.end(), mapConditionChecker);
+ if (it == states.end()) return {};
+ return it->first;
}
};
- if (isFullySatisfied()) return;
+ if (const auto iface = isFullySatisfied()) return iface;
- LOG(DEBUG) << "Waiting for " << (allOf ? "" : "any of ") << toString(ifnames) << " to "
+ LOG(DEBUG) << "Waiting for " << toString(quant) << " " << toString(ifnames) << " to "
<< toString(cnd);
for (const auto rawMsg : sock) {
- const auto msg = nl::Message<ifinfomsg>::parse(rawMsg, {RTM_NEWLINK, RTM_DELLINK});
- if (!msg.has_value()) continue;
+ if (const auto msg = nl::Message<ifinfomsg>::parse(rawMsg, {RTM_NEWLINK, RTM_DELLINK});
+ msg.has_value()) {
+ // Interface added / removed
+ const auto ifname = msg->attributes.get<std::string>(IFLA_IFNAME);
+ if (ifnames.count(ifname) == 0) continue;
- const auto ifname = msg->attributes.get<std::string>(IFLA_IFNAME);
- if (ifnames.count(ifname) == 0) continue;
+ auto& state = states[ifname];
+ state.present = (msg->header.nlmsg_type != RTM_DELLINK);
+ state.up = state.present && (msg->data.ifi_flags & IFF_UP) != 0;
+ if (!state.present) state.hasIpv4Addr = false;
- const bool present = (msg->header.nlmsg_type != RTM_DELLINK);
- const bool up = present && (msg->data.ifi_flags & IFF_UP) != 0;
- states[ifname] = {present, up};
+ } else if (const auto msg =
+ nl::Message<ifaddrmsg>::parse(rawMsg, {RTM_NEWADDR, RTM_DELADDR});
+ msg.has_value()) {
+ // Address added / removed
+ const auto ifname = msg->attributes.get<std::string>(IFLA_IFNAME);
+ if (ifnames.count(ifname) == 0) continue;
- if (isFullySatisfied()) {
- LOG(DEBUG) << "Finished waiting for " << (allOf ? "" : "some of ") << toString(ifnames)
+ if (msg->header.nlmsg_type == RTM_NEWADDR) {
+ states[ifname].hasIpv4Addr = true;
+ } else {
+ // instead of tracking which one got deleted, let's just ask
+ states[ifname].hasIpv4Addr = hasIpv4(ifname);
+ }
+ }
+
+ if (const auto iface = isFullySatisfied()) {
+ LOG(DEBUG) << "Finished waiting for " << toString(quant) << " " << toString(ifnames)
<< " to " << toString(cnd);
- return;
+ return iface;
}
}
LOG(FATAL) << "Can't read Netlink socket";
+ return {};
}
} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/vlan.cpp b/automotive/can/1.0/default/libnetdevice/vlan.cpp
index ee02f7b..35b21b8 100644
--- a/automotive/can/1.0/default/libnetdevice/vlan.cpp
+++ b/automotive/can/1.0/default/libnetdevice/vlan.cpp
@@ -40,7 +40,7 @@
{
auto linkinfo = req.addNested(IFLA_LINKINFO);
- req.add(IFLA_INFO_KIND, "vlan");
+ req.addBuffer(IFLA_INFO_KIND, "vlan");
{
auto linkinfo = req.addNested(IFLA_INFO_DATA);
diff --git a/automotive/can/1.0/default/libnl++/Android.bp b/automotive/can/1.0/default/libnl++/Android.bp
index 2ebd1b4..01c1e55 100644
--- a/automotive/can/1.0/default/libnl++/Android.bp
+++ b/automotive/can/1.0/default/libnl++/Android.bp
@@ -37,8 +37,10 @@
"protocols/generic/Unknown.cpp",
"protocols/generic/families/Mac80211hwsim.cpp",
"protocols/generic/families/Nl80211.cpp",
+ "protocols/route/Addr.cpp",
"protocols/route/Link.cpp",
"protocols/route/Route.cpp",
+ "protocols/route/attributes.cpp",
"protocols/route/structs.cpp",
"protocols/MessageDefinition.cpp",
"protocols/NetlinkProtocol.cpp",
diff --git a/automotive/can/1.0/default/libnl++/MessageFactory.cpp b/automotive/can/1.0/default/libnl++/MessageFactory.cpp
index 6f35897..eff068e 100644
--- a/automotive/can/1.0/default/libnl++/MessageFactory.cpp
+++ b/automotive/can/1.0/default/libnl++/MessageFactory.cpp
@@ -27,8 +27,8 @@
nlattr* MessageFactoryBase::add(nlmsghdr* msg, size_t maxLen, nlattrtype_t type, const void* data,
size_t dataLen) {
- const auto totalAttrLen = impl::space<nlattr>(dataLen);
- const auto newLen = impl::align(msg->nlmsg_len) + totalAttrLen;
+ const auto totalAttrLen = impl::length<nlattr>(dataLen);
+ const auto newLen = impl::align(msg->nlmsg_len) + impl::align(totalAttrLen);
if (newLen > maxLen) {
LOG(ERROR) << "Can't add attribute of size " << dataLen //
<< " - exceeded maxLen: " << newLen << " > " << maxLen;
diff --git a/automotive/can/1.0/default/libnl++/Socket.cpp b/automotive/can/1.0/default/libnl++/Socket.cpp
index cc1d839..221063d 100644
--- a/automotive/can/1.0/default/libnl++/Socket.cpp
+++ b/automotive/can/1.0/default/libnl++/Socket.cpp
@@ -47,6 +47,17 @@
}
}
+void Socket::clearPollErr() {
+ sockaddr_nl sa = {};
+ socklen_t saLen = sizeof(sa);
+ const auto bytesReceived = recvfrom(mFd.get(), mReceiveBuffer.data(), mReceiveBuffer.size(), 0,
+ reinterpret_cast<sockaddr*>(&sa), &saLen);
+ if (errno != EINVAL) {
+ PLOG(WARNING) << "clearPollError() caught unexpected error: ";
+ }
+ CHECK_LE(bytesReceived, 0) << "clearPollError() didn't find an error!";
+}
+
bool Socket::send(const Buffer<nlmsghdr>& msg, const sockaddr_nl& sa) {
if constexpr (kSuperVerbose) {
LOG(VERBOSE) << (mFailed ? "(not) " : "") << "sending to " << sa.nl_pid << ": "
@@ -110,6 +121,13 @@
if constexpr (kSuperVerbose) {
LOG(VERBOSE) << "received from " << sa.nl_pid << ": " << toString(msg, mProtocol);
}
+ long headerByteTotal = 0;
+ for (const auto hdr : msg) {
+ headerByteTotal += hdr->nlmsg_len;
+ }
+ if (bytesReceived != headerByteTotal) {
+ LOG(ERROR) << "received " << bytesReceived << " bytes, header claims " << headerByteTotal;
+ }
return {msg, sa};
}
@@ -159,6 +177,7 @@
}
pollfd Socket::preparePoll(short events) {
+ CHECK(mFd.get() > 0) << "Netlink socket fd is invalid!";
return {mFd.get(), events, 0};
}
diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h b/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h
index c3d72c5..a5a425e 100644
--- a/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h
+++ b/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h
@@ -106,18 +106,25 @@
*/
template <class A>
void add(nlattrtype_t type, const A& attr) {
- add(type, &attr, sizeof(attr));
+ addInternal(type, &attr, sizeof(attr));
}
+ // It will always send the last null character, otherwise use addBuffer
+ // variant instead
template <>
void add(nlattrtype_t type, const std::string& s) {
- add(type, s.c_str(), s.size() + 1);
+ addInternal(type, s.c_str(), s.size() + 1);
+ }
+
+ void addBuffer(nlattrtype_t type, const std::string_view& s) {
+ addInternal(type, s.data(), s.size());
}
/** Guard class to frame nested attributes. \see addNested(nlattrtype_t). */
class [[nodiscard]] NestedGuard {
public:
- NestedGuard(MessageFactory & req, nlattrtype_t type) : mReq(req), mAttr(req.add(type)) {}
+ NestedGuard(MessageFactory& req, nlattrtype_t type)
+ : mReq(req), mAttr(req.addInternal(type)) {}
~NestedGuard() { closeNested(&mReq.mMessage.header, mAttr); }
private:
@@ -138,7 +145,7 @@
* MessageFactory<ifinfomsg> req(RTM_NEWLINK, NLM_F_REQUEST);
* {
* auto linkinfo = req.addNested(IFLA_LINKINFO);
- * req.add(IFLA_INFO_KIND, "can");
+ * req.addBuffer(IFLA_INFO_KIND, "can");
* {
* auto infodata = req.addNested(IFLA_INFO_DATA);
* req.add(IFLA_CAN_BITTIMING, bitTimingStruct);
@@ -154,7 +161,7 @@
Message mMessage = {};
bool mIsGood = true;
- nlattr* add(nlattrtype_t type, const void* data = nullptr, size_t len = 0) {
+ nlattr* addInternal(nlattrtype_t type, const void* data = nullptr, size_t len = 0) {
if (!mIsGood) return nullptr;
auto attr = MessageFactoryBase::add(&mMessage.header, sizeof(mMessage), type, data, len);
if (attr == nullptr) mIsGood = false;
diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h b/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h
index 7ec0f7b..996a350 100644
--- a/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h
+++ b/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h
@@ -55,6 +55,12 @@
Socket(int protocol, unsigned pid = 0, uint32_t groups = 0);
/**
+ * Attempt to clear POLLERR by recv-ing.
+ * TODO(224850481): determine if this is necessary, or if the socket is locked up anyway.
+ */
+ void clearPollErr();
+
+ /**
* Send Netlink message with incremented sequence number to the Kernel.
*
* \param msg Message to send. Its sequence number will be updated.
diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/bits.h b/automotive/can/1.0/default/libnl++/include/libnl++/bits.h
index 4c8f1aa..b6573b3 100644
--- a/automotive/can/1.0/default/libnl++/include/libnl++/bits.h
+++ b/automotive/can/1.0/default/libnl++/include/libnl++/bits.h
@@ -36,11 +36,19 @@
}
/**
+ * Equivalent to NLMSG_LENGTH(len).
+ */
+template <typename H>
+constexpr size_t length(size_t len) {
+ return align(sizeof(H)) + len;
+}
+
+/**
* Equivalent to NLMSG_SPACE(len).
*/
template <typename H>
constexpr size_t space(size_t len) {
- return align(align(sizeof(H)) + len);
+ return align(length<H>(len));
}
/**
diff --git a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp
index aaf24a5..158d2a1 100644
--- a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp
@@ -34,7 +34,7 @@
MessageDescriptor::MessageDescriptor(const std::string& name,
const MessageDetailsMap&& messageDetails,
- const AttributeMap&& attrTypes, size_t contentsSize)
+ const AttributeMap& attrTypes, size_t contentsSize)
: mName(name),
mContentsSize(contentsSize),
mMessageDetails(messageDetails),
diff --git a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h
index 8bed5e7..33ded9a 100644
--- a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h
+++ b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h
@@ -163,7 +163,7 @@
protected:
MessageDescriptor(const std::string& name, const MessageDetailsMap&& messageDetails,
- const AttributeMap&& attrTypes, size_t contentsSize);
+ const AttributeMap& attrTypes, size_t contentsSize);
private:
const std::string mName;
@@ -183,7 +183,7 @@
MessageDefinition( //
const std::string& name,
const std::initializer_list<MessageDescriptor::MessageDetailsMap::value_type> msgDet,
- const std::initializer_list<AttributeMap::value_type> attrTypes = {})
+ const AttributeMap& attrTypes = {})
: MessageDescriptor(name, msgDet, attrTypes, sizeof(T)) {}
void dataToStream(std::stringstream& ss, const Buffer<nlmsghdr> hdr) const override {
diff --git a/automotive/can/1.0/default/libnl++/protocols/all.cpp b/automotive/can/1.0/default/libnl++/protocols/all.cpp
index a398dc8..72c60f2 100644
--- a/automotive/can/1.0/default/libnl++/protocols/all.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/all.cpp
@@ -33,12 +33,12 @@
return map;
}
-static auto all = toMap({
- std::make_unique<generic::Generic>(),
- std::make_unique<route::Route>(),
-});
-
std::optional<std::reference_wrapper<NetlinkProtocol>> get(int protocol) {
+ static auto all = toMap({
+ std::make_unique<generic::Generic>(),
+ std::make_unique<route::Route>(),
+ });
+
if (all.count(protocol) == 0) return std::nullopt;
return *all.find(protocol)->second.get();
}
diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/FamilyTracker.cpp b/automotive/can/1.0/default/libnl++/protocols/generic/FamilyTracker.cpp
index 900560e..3ad101e 100644
--- a/automotive/can/1.0/default/libnl++/protocols/generic/FamilyTracker.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/generic/FamilyTracker.cpp
@@ -30,6 +30,7 @@
const auto familyName = msg.attributes.get<std::string>(CTRL_ATTR_FAMILY_NAME);
const auto familyId = msg.attributes.get<uint16_t>(CTRL_ATTR_FAMILY_ID);
+ // TODO(224845900): NETLINK_GENERIC == 16, and (erroneously?) sets off this warning
if (familyId < GENL_START_ALLOC) {
LOG(WARNING) << "Invalid family ID: " << familyId;
return true;
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/Addr.cpp b/automotive/can/1.0/default/libnl++/protocols/route/Addr.cpp
new file mode 100644
index 0000000..024d389
--- /dev/null
+++ b/automotive/can/1.0/default/libnl++/protocols/route/Addr.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "Addr.h"
+
+#include "../structs.h"
+#include "attributes.h"
+#include "structs.h"
+
+namespace android::nl::protocols::route {
+
+using DataType = AttributeDefinition::DataType;
+
+// clang-format off
+Addr::Addr() : MessageDefinition<ifaddrmsg>("addr", {
+ {RTM_NEWADDR, {"NEWADDR", MessageGenre::New}},
+ {RTM_DELADDR, {"DELADDR", MessageGenre::Delete}},
+ {RTM_GETADDR, {"GETADDR", MessageGenre::Get}},
+}, gAttributes) {}
+
+static const FlagsMap ifaFlagsMap {
+ {IFA_F_SECONDARY, "SECONDARY"},
+ {IFA_F_NODAD, "NODAD"},
+ {IFA_F_OPTIMISTIC, "OPTIMISTIC"},
+ {IFA_F_DADFAILED, "DADFAILED"},
+ {IFA_F_HOMEADDRESS, "HOMEADDRESS"},
+ {IFA_F_DEPRECATED, "DEPRECATED"},
+ {IFA_F_TENTATIVE, "TENTATIVE"},
+ {IFA_F_PERMANENT, "PERMANENT"},
+ {IFA_F_MANAGETEMPADDR, "MANAGETEMPADDR"},
+ {IFA_F_NOPREFIXROUTE, "NOPREFIXROUTE"},
+ {IFA_F_MCAUTOJOIN, "MCAUTOJOIN"},
+ {IFA_F_STABLE_PRIVACY, "STABLE_PRIVACY"},
+};
+// clang-format on
+
+void Addr::toStream(std::stringstream& ss, const ifaddrmsg& data) const {
+ ss << "ifaddrmsg{"
+ << "family=" << familyToString(data.ifa_family)
+ << ", prefixlen=" << unsigned(data.ifa_prefixlen) << ", flags=";
+ flagsToStream(ss, ifaFlagsMap, data.ifa_flags);
+ ss << ", scope=" << unsigned(data.ifa_scope) << ", index=" << data.ifa_index << "}";
+}
+
+} // namespace android::nl::protocols::route
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/Addr.h b/automotive/can/1.0/default/libnl++/protocols/route/Addr.h
new file mode 100644
index 0000000..b6b8bdc
--- /dev/null
+++ b/automotive/can/1.0/default/libnl++/protocols/route/Addr.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include "../MessageDefinition.h"
+
+#include <linux/rtnetlink.h>
+
+namespace android::nl::protocols::route {
+
+class Addr : public MessageDefinition<ifaddrmsg> {
+ public:
+ Addr();
+ void toStream(std::stringstream& ss, const ifaddrmsg& data) const override;
+};
+
+} // namespace android::nl::protocols::route
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp b/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp
index 9cc05da..3dd0066 100644
--- a/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp
@@ -16,10 +16,7 @@
#include "Link.h"
-#include "../structs.h"
-#include "structs.h"
-
-#include <net/if.h>
+#include "attributes.h"
namespace android::nl::protocols::route {
@@ -30,83 +27,8 @@
{RTM_NEWLINK, {"NEWLINK", MessageGenre::New}},
{RTM_DELLINK, {"DELLINK", MessageGenre::Delete}},
{RTM_GETLINK, {"GETLINK", MessageGenre::Get}},
-}, {
- {IFLA_ADDRESS, {"ADDRESS"}},
- {IFLA_BROADCAST, {"BROADCAST"}},
- {IFLA_IFNAME, {"IFNAME", DataType::String}},
- {IFLA_MTU, {"MTU", DataType::Uint}},
- {IFLA_LINK, {"LINK", DataType::Uint}},
- {IFLA_QDISC, {"QDISC", DataType::String}},
- {IFLA_STATS, {"STATS", DataType::Struct, statsToStream<rtnl_link_stats>}},
- {IFLA_COST, {"COST"}},
- {IFLA_PRIORITY, {"PRIORITY"}},
- {IFLA_MASTER, {"MASTER", DataType::Uint}},
- {IFLA_WIRELESS, {"WIRELESS"}},
- {IFLA_PROTINFO, {"PROTINFO"}},
- {IFLA_TXQLEN, {"TXQLEN", DataType::Uint}},
- {IFLA_MAP, {"MAP", DataType::Struct, mapToStream}},
- {IFLA_WEIGHT, {"WEIGHT", DataType::Uint}},
- {IFLA_OPERSTATE, {"OPERSTATE", DataType::Uint}},
- {IFLA_LINKMODE, {"LINKMODE", DataType::Uint}},
- {IFLA_LINKINFO, {"LINKINFO", DataType::Nested, AttributeMap{
- {IFLA_INFO_KIND, {"INFO_KIND", DataType::String}},
- {IFLA_INFO_DATA, {"INFO_DATA", DataType::Nested}},
- {IFLA_INFO_XSTATS, {"INFO_XSTATS"}},
- {IFLA_INFO_SLAVE_KIND, {"INFO_SLAVE_KIND", DataType::String}},
- {IFLA_INFO_SLAVE_DATA, {"INFO_SLAVE_DATA"}},
- }}},
- {IFLA_NET_NS_PID, {"NET_NS_PID", DataType::Uint}},
- {IFLA_IFALIAS, {"IFALIAS", DataType::String}},
- {IFLA_NUM_VF, {"NUM_VF", DataType::Uint}},
- {IFLA_VFINFO_LIST, {"VFINFO_LIST"}},
- {IFLA_STATS64, {"STATS64", DataType::Struct, statsToStream<rtnl_link_stats64>}},
- {IFLA_VF_PORTS, {"VF_PORTS"}},
- {IFLA_PORT_SELF, {"PORT_SELF"}},
- {IFLA_AF_SPEC, {"AF_SPEC", DataType::Nested, AttributeMap{
- {AF_INET, {"AF_INET", DataType::Nested, AttributeMap{
- {IFLA_INET_CONF, {"INET_CONF", DataType::Struct, arrayToStream<int32_t>}},
- }}},
- {AF_INET6, {"AF_INET6", DataType::Nested, AttributeMap{
- {IFLA_INET6_FLAGS, {"INET6_FLAGS", DataType::Uint}},
- {IFLA_INET6_CONF, {"INET6_CONF", DataType::Struct, arrayToStream<int32_t>}},
- {IFLA_INET6_STATS, {"INET6_STATS", DataType::Struct, arrayToStream<uint64_t>}},
- {IFLA_INET6_MCAST, {"INET6_MCAST"}},
- {IFLA_INET6_CACHEINFO, {"INET6_CACHEINFO", DataType::Struct, ifla_cacheinfoToStream}},
- {IFLA_INET6_ICMP6STATS, {"INET6_ICMP6STATS", DataType::Struct, arrayToStream<uint64_t>}},
- {IFLA_INET6_TOKEN, {"INET6_TOKEN"}},
- {IFLA_INET6_ADDR_GEN_MODE, {"INET6_ADDR_GEN_MODE", DataType::Uint}},
- }}},
- }}},
- {IFLA_GROUP, {"GROUP", DataType::Uint}},
- {IFLA_NET_NS_FD, {"NET_NS_FD", DataType::Uint}},
- {IFLA_EXT_MASK, {"EXT_MASK", DataType::Uint}},
- {IFLA_PROMISCUITY, {"PROMISCUITY", DataType::Uint}},
- {IFLA_NUM_TX_QUEUES, {"NUM_TX_QUEUES", DataType::Uint}},
- {IFLA_NUM_RX_QUEUES, {"NUM_RX_QUEUES", DataType::Uint}},
- {IFLA_CARRIER, {"CARRIER", DataType::Uint}},
- {IFLA_PHYS_PORT_ID, {"PHYS_PORT_ID"}},
- {IFLA_CARRIER_CHANGES, {"CARRIER_CHANGES", DataType::Uint}},
- {IFLA_PHYS_SWITCH_ID, {"PHYS_SWITCH_ID"}},
- {IFLA_LINK_NETNSID, {"LINK_NETNSID"}}, // NLA_S32
- {IFLA_PHYS_PORT_NAME, {"PHYS_PORT_NAME", DataType::String}},
- {IFLA_PROTO_DOWN, {"PROTO_DOWN", DataType::Uint}},
- {IFLA_GSO_MAX_SEGS, {"GSO_MAX_SEGS", DataType::Uint}},
- {IFLA_GSO_MAX_SIZE, {"GSO_MAX_SIZE", DataType::Uint}},
- {IFLA_PAD, {"PAD"}},
- {IFLA_XDP, {"XDP"}},
- {IFLA_EVENT, {"EVENT", DataType::Uint}},
- {IFLA_NEW_NETNSID, {"NEW_NETNSID"}}, // NLA_S32
- {IFLA_TARGET_NETNSID, {"TARGET_NETNSID"}}, // NLA_S32
- {IFLA_CARRIER_UP_COUNT, {"CARRIER_UP_COUNT", DataType::Uint}},
- {IFLA_CARRIER_DOWN_COUNT, {"CARRIER_DOWN_COUNT", DataType::Uint}},
- {IFLA_NEW_IFINDEX, {"NEW_IFINDEX"}}, // NLA_S32
- {IFLA_MIN_MTU, {"MIN_MTU", DataType::Uint}},
- {IFLA_MAX_MTU, {"MAX_MTU", DataType::Uint}},
- {IFLA_PROP_LIST, {"PROP_LIST"}},
- {IFLA_ALT_IFNAME, {"ALT_IFNAME", DataType::String}},
- {IFLA_PERM_ADDRESS, {"PERM_ADDRESS"}},
-}) {}
-// clang-format off
+}, gAttributes) {}
+// clang-format on
void Link::toStream(std::stringstream& ss, const ifinfomsg& data) const {
ss << "ifinfomsg{"
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/Route.cpp b/automotive/can/1.0/default/libnl++/protocols/route/Route.cpp
index c134911..51e5b11 100644
--- a/automotive/can/1.0/default/libnl++/protocols/route/Route.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/route/Route.cpp
@@ -16,10 +16,16 @@
#include "Route.h"
+#include "Addr.h"
#include "Link.h"
namespace android::nl::protocols::route {
-Route::Route() : NetlinkProtocol(NETLINK_ROUTE, "ROUTE", {std::make_shared<Link>()}) {}
+// clang-format off
+Route::Route() : NetlinkProtocol(NETLINK_ROUTE, "ROUTE", {
+ std::make_shared<Addr>(),
+ std::make_shared<Link>(),
+}) {}
+// clang-format on
} // namespace android::nl::protocols::route
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/attributes.cpp b/automotive/can/1.0/default/libnl++/protocols/route/attributes.cpp
new file mode 100644
index 0000000..69d9b81
--- /dev/null
+++ b/automotive/can/1.0/default/libnl++/protocols/route/attributes.cpp
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "attributes.h"
+
+#include "../structs.h"
+#include "structs.h"
+
+#include <linux/rtnetlink.h>
+#include <net/if.h>
+
+namespace android::nl::protocols::route {
+
+using DataType = AttributeDefinition::DataType;
+using Flags = AttributeDefinition::Flags;
+
+// clang-format off
+AttributeMap gAttributes = {
+ {IFLA_ADDRESS, {"ADDRESS"}},
+ {IFLA_BROADCAST, {"BROADCAST"}},
+ {IFLA_IFNAME, {"IFNAME", DataType::StringNul}},
+ {IFLA_MTU, {"MTU", DataType::Uint}},
+ {IFLA_LINK, {"LINK", DataType::Uint}},
+ {IFLA_QDISC, {"QDISC", DataType::Raw, AttributeMap{}, Flags::Verbose}}, // should be DataType::String, but looks like binary blob
+ {IFLA_STATS, {"STATS", DataType::Struct, statsToStream<rtnl_link_stats>}},
+ {IFLA_COST, {"COST", DataType::Uint}},
+ {IFLA_PRIORITY, {"PRIORITY"}},
+ {IFLA_MASTER, {"MASTER", DataType::Uint}},
+ {IFLA_WIRELESS, {"WIRELESS"}},
+ {IFLA_PROTINFO, {"PROTINFO"}},
+ {IFLA_TXQLEN, {"TXQLEN", DataType::Uint}},
+ {IFLA_MAP, {"MAP", DataType::Struct, mapToStream}},
+ {IFLA_WEIGHT, {"WEIGHT", DataType::Uint}},
+ {IFLA_OPERSTATE, {"OPERSTATE", DataType::Uint}},
+ {IFLA_LINKMODE, {"LINKMODE", DataType::Uint}},
+ {IFLA_LINKINFO, {"LINKINFO", DataType::Nested, AttributeMap{
+ {IFLA_INFO_KIND, {"INFO_KIND", DataType::String}},
+ {IFLA_INFO_DATA, {"INFO_DATA", DataType::Nested}},
+ {IFLA_INFO_XSTATS, {"INFO_XSTATS"}},
+ {IFLA_INFO_SLAVE_KIND, {"INFO_SLAVE_KIND", DataType::String}},
+ {IFLA_INFO_SLAVE_DATA, {"INFO_SLAVE_DATA"}},
+ }}},
+ {IFLA_NET_NS_PID, {"NET_NS_PID", DataType::Uint}},
+ {IFLA_IFALIAS, {"IFALIAS", DataType::String}},
+ {IFLA_NUM_VF, {"NUM_VF", DataType::Uint}},
+ {IFLA_VFINFO_LIST, {"VFINFO_LIST"}},
+ {IFLA_STATS64, {"STATS64", DataType::Struct, statsToStream<rtnl_link_stats64>}},
+ {IFLA_VF_PORTS, {"VF_PORTS"}},
+ {IFLA_PORT_SELF, {"PORT_SELF"}},
+ {IFLA_AF_SPEC, {"AF_SPEC", DataType::Nested, AttributeMap{
+ {AF_INET, {"AF_INET", DataType::Nested, AttributeMap{
+ {IFLA_INET_CONF, {"INET_CONF", DataType::Struct, arrayToStream<int32_t>}},
+ }}},
+ {AF_INET6, {"AF_INET6", DataType::Nested, AttributeMap{
+ {IFLA_INET6_FLAGS, {"INET6_FLAGS", DataType::Uint}},
+ {IFLA_INET6_CONF, {"INET6_CONF", DataType::Struct, arrayToStream<int32_t>}},
+ {IFLA_INET6_STATS, {"INET6_STATS", DataType::Struct, arrayToStream<uint64_t>}},
+ {IFLA_INET6_MCAST, {"INET6_MCAST"}},
+ {IFLA_INET6_CACHEINFO, {"INET6_CACHEINFO", DataType::Struct, ifla_cacheinfoToStream}},
+ {IFLA_INET6_ICMP6STATS, {"INET6_ICMP6STATS", DataType::Struct, arrayToStream<uint64_t>}},
+ {IFLA_INET6_TOKEN, {"INET6_TOKEN"}},
+ {IFLA_INET6_ADDR_GEN_MODE, {"INET6_ADDR_GEN_MODE", DataType::Uint}},
+ }}},
+ }}},
+ {IFLA_GROUP, {"GROUP", DataType::Uint}},
+ {IFLA_NET_NS_FD, {"NET_NS_FD", DataType::Uint}},
+ {IFLA_EXT_MASK, {"EXT_MASK", DataType::Uint}},
+ {IFLA_PROMISCUITY, {"PROMISCUITY", DataType::Uint}},
+ {IFLA_NUM_TX_QUEUES, {"NUM_TX_QUEUES", DataType::Uint}},
+ {IFLA_NUM_RX_QUEUES, {"NUM_RX_QUEUES", DataType::Uint}},
+ {IFLA_CARRIER, {"CARRIER", DataType::Uint}},
+ {IFLA_PHYS_PORT_ID, {"PHYS_PORT_ID"}},
+ {IFLA_CARRIER_CHANGES, {"CARRIER_CHANGES", DataType::Uint}},
+ {IFLA_PHYS_SWITCH_ID, {"PHYS_SWITCH_ID"}},
+ {IFLA_LINK_NETNSID, {"LINK_NETNSID"}}, // NLA_S32
+ {IFLA_PHYS_PORT_NAME, {"PHYS_PORT_NAME", DataType::String}},
+ {IFLA_PROTO_DOWN, {"PROTO_DOWN", DataType::Uint}},
+ {IFLA_GSO_MAX_SEGS, {"GSO_MAX_SEGS", DataType::Uint}},
+ {IFLA_GSO_MAX_SIZE, {"GSO_MAX_SIZE", DataType::Uint}},
+ {IFLA_PAD, {"PAD"}},
+ {IFLA_XDP, {"XDP"}},
+ {IFLA_EVENT, {"EVENT", DataType::Uint}},
+ {IFLA_NEW_NETNSID, {"NEW_NETNSID"}}, // NLA_S32
+ {IFLA_TARGET_NETNSID, {"TARGET_NETNSID"}}, // NLA_S32
+ {IFLA_CARRIER_UP_COUNT, {"CARRIER_UP_COUNT", DataType::Uint}},
+ {IFLA_CARRIER_DOWN_COUNT, {"CARRIER_DOWN_COUNT", DataType::Uint}},
+ {IFLA_NEW_IFINDEX, {"NEW_IFINDEX"}}, // NLA_S32
+ {IFLA_MIN_MTU, {"MIN_MTU", DataType::Uint}},
+ {IFLA_MAX_MTU, {"MAX_MTU", DataType::Uint}},
+ {IFLA_PROP_LIST, {"PROP_LIST"}},
+ {IFLA_ALT_IFNAME, {"ALT_IFNAME", DataType::String}},
+ {IFLA_PERM_ADDRESS, {"PERM_ADDRESS"}},
+};
+// clang-format on
+
+} // namespace android::nl::protocols::route
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/attributes.h b/automotive/can/1.0/default/libnl++/protocols/route/attributes.h
new file mode 100644
index 0000000..ace9234
--- /dev/null
+++ b/automotive/can/1.0/default/libnl++/protocols/route/attributes.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include "../MessageDefinition.h"
+
+namespace android::nl::protocols::route {
+
+extern AttributeMap gAttributes;
+
+} // namespace android::nl::protocols::route
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp b/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp
index b62cec3..269771c 100644
--- a/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp
@@ -46,4 +46,58 @@
<< data.retrans_time << '}';
}
+// clang-format off
+std::string familyToString(sa_family_t family) {
+ switch (family) {
+ case AF_UNSPEC: return "UNSPEC";
+ case AF_UNIX: return "UNIX";
+ case AF_INET: return "INET";
+ case AF_AX25: return "AX25";
+ case AF_IPX: return "IPX";
+ case AF_APPLETALK: return "APPLETALK";
+ case AF_NETROM: return "NETROM";
+ case AF_BRIDGE: return "BRIDGE";
+ case AF_ATMPVC: return "ATMPVC";
+ case AF_X25: return "X25";
+ case AF_INET6: return "INET6";
+ case AF_ROSE: return "ROSE";
+ case AF_DECnet: return "DECnet";
+ case AF_NETBEUI: return "NETBEUI";
+ case AF_SECURITY: return "SECURITY";
+ case AF_KEY: return "KEY";
+ case AF_NETLINK: return "NETLINK";
+ case AF_PACKET: return "PACKET";
+ case AF_ASH: return "ASH";
+ case AF_ECONET: return "ECONET";
+ case AF_ATMSVC: return "ATMSVC";
+ case AF_RDS: return "RDS";
+ case AF_SNA: return "SNA";
+ case AF_IRDA: return "IRDA";
+ case AF_PPPOX: return "PPPOX";
+ case AF_WANPIPE: return "WANPIPE";
+ case AF_LLC: return "LLC";
+ case 27 /*AF_IB*/: return "IB";
+ case 28 /*AF_MPLS*/: return "MPLS";
+ case AF_CAN: return "CAN";
+ case AF_TIPC: return "TIPC";
+ case AF_BLUETOOTH: return "BLUETOOTH";
+ case AF_IUCV: return "IUCV";
+ case AF_RXRPC: return "RXRPC";
+ case AF_ISDN: return "ISDN";
+ case AF_PHONET: return "PHONET";
+ case AF_IEEE802154: return "IEEE802154";
+ case AF_CAIF: return "CAIF";
+ case AF_ALG: return "ALG";
+ case AF_NFC: return "NFC";
+ case AF_VSOCK: return "VSOCK";
+ case AF_KCM: return "KCM";
+ case AF_QIPCRTR: return "QIPCRTR";
+ case 43 /*AF_SMC*/: return "SMC";
+ case 44 /*AF_XDP*/: return "XDP";
+ default:
+ return std::to_string(family);
+ }
+}
+// clang-format on
+
} // namespace android::nl::protocols::route
diff --git a/automotive/can/1.0/default/libnl++/protocols/route/structs.h b/automotive/can/1.0/default/libnl++/protocols/route/structs.h
index fea2ce1..c969a6c 100644
--- a/automotive/can/1.0/default/libnl++/protocols/route/structs.h
+++ b/automotive/can/1.0/default/libnl++/protocols/route/structs.h
@@ -19,6 +19,7 @@
#include <libnl++/Buffer.h>
#include <linux/rtnetlink.h>
+#include <sys/socket.h>
#include <sstream>
@@ -30,6 +31,8 @@
// ifla_cacheinfo
void ifla_cacheinfoToStream(std::stringstream& ss, const Buffer<nlattr> attr);
+std::string familyToString(sa_family_t family);
+
// rtnl_link_stats or rtnl_link_stats64
template <typename T>
void statsToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
diff --git a/automotive/can/1.0/default/libnl++/protocols/structs.cpp b/automotive/can/1.0/default/libnl++/protocols/structs.cpp
index 8ff71f0..3f896bf 100644
--- a/automotive/can/1.0/default/libnl++/protocols/structs.cpp
+++ b/automotive/can/1.0/default/libnl++/protocols/structs.cpp
@@ -22,24 +22,27 @@
AttributeDefinition::ToStream flagsToStream(FlagsMap flags) {
return [flags](std::stringstream& ss, const Buffer<nlattr> attr) {
- auto val = attr.data<uint64_t>().copyFirst();
+ auto value = attr.data<uint64_t>().copyFirst();
+ flagsToStream(ss, flags, value);
+ };
+}
- bool first = true;
- for (const auto& [flag, name] : flags) {
- if ((val & flag) != flag) continue;
- val &= ~flag;
-
- if (!first) ss << '|';
- first = false;
-
- ss << name;
- }
-
- if (val == 0) return;
+void flagsToStream(std::stringstream& ss, const FlagsMap& flags, uint64_t val) {
+ bool first = true;
+ for (const auto& [flag, name] : flags) {
+ if ((val & flag) != flag) continue;
+ val &= ~flag;
if (!first) ss << '|';
- ss << std::hex << val << std::dec;
- };
+ first = false;
+
+ ss << name;
+ }
+
+ if (val == 0) return;
+
+ if (!first) ss << '|';
+ ss << std::hex << val << std::dec;
}
void hwaddrToStream(std::stringstream& ss, const Buffer<nlattr> attr) {
diff --git a/automotive/can/1.0/default/libnl++/protocols/structs.h b/automotive/can/1.0/default/libnl++/protocols/structs.h
index f3a8c44..9cf6f1a 100644
--- a/automotive/can/1.0/default/libnl++/protocols/structs.h
+++ b/automotive/can/1.0/default/libnl++/protocols/structs.h
@@ -34,6 +34,7 @@
typedef std::map<uint64_t, std::string> FlagsMap;
AttributeDefinition::ToStream flagsToStream(FlagsMap flags);
+void flagsToStream(std::stringstream& ss, const FlagsMap& flags, uint64_t value);
void hwaddrToStream(std::stringstream& ss, const Buffer<nlattr> attr);
diff --git a/automotive/evs/1.1/default/Android.bp b/automotive/evs/1.1/default/Android.bp
index 4c08ef3..4172e63 100644
--- a/automotive/evs/1.1/default/Android.bp
+++ b/automotive/evs/1.1/default/Android.bp
@@ -13,6 +13,7 @@
proprietary: true,
relative_install_path: "hw",
srcs: [
+ ":libgui_frame_event_aidl",
"*.cpp",
],
init_rc: ["android.hardware.automotive.evs@1.1-service.rc"],
diff --git a/automotive/evs/1.1/default/GlWrapper.cpp b/automotive/evs/1.1/default/GlWrapper.cpp
index 357b67c..9ad5729 100644
--- a/automotive/evs/1.1/default/GlWrapper.cpp
+++ b/automotive/evs/1.1/default/GlWrapper.cpp
@@ -37,28 +37,23 @@
constexpr float kDisplayAreaRatio = 0.8f;
constexpr const char vertexShaderSource[] =
- ""
- "#version 300 es \n"
- "layout(location = 0) in vec4 pos; \n"
- "layout(location = 1) in vec2 tex; \n"
- "out vec2 uv; \n"
- "void main() \n"
- "{ \n"
- " gl_Position = pos; \n"
- " uv = tex; \n"
- "} \n";
+ "attribute vec4 pos; \n"
+ "attribute vec2 tex; \n"
+ "varying vec2 uv; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = pos; \n"
+ " uv = tex; \n"
+ "} \n";
constexpr const char pixelShaderSource[] =
- "#version 300 es \n"
- "precision mediump float; \n"
- "uniform sampler2D tex; \n"
- "in vec2 uv; \n"
- "out vec4 color; \n"
- "void main() \n"
- "{ \n"
- " vec4 texel = texture(tex, uv); \n"
- " color = texel; \n"
- "} \n";
+ "precision mediump float; \n"
+ "uniform sampler2D tex; \n"
+ "varying vec2 uv; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_FragColor = texture2D(tex, uv); \n"
+ "} \n";
const char* getEGLError(void) {
switch (eglGetError()) {
@@ -157,6 +152,9 @@
glAttachShader(program, vertexShader);
glAttachShader(program, pixelShader);
+ glBindAttribLocation(program, 0, "pos");
+ glBindAttribLocation(program, 1, "tex");
+
// Link the program
glLinkProgram(program);
GLint linked = 0;
@@ -235,7 +233,7 @@
return false;
}
- EGLint major = 3;
+ EGLint major = 2;
EGLint minor = 0;
if (!eglInitialize(mDisplay, &major, &minor)) {
LOG(ERROR) << "Failed to initialize EGL: " << getEGLError();
diff --git a/automotive/evs/aidl/Android.bp b/automotive/evs/aidl/Android.bp
index 1c908aa..8aaa1ce 100644
--- a/automotive/evs/aidl/Android.bp
+++ b/automotive/evs/aidl/Android.bp
@@ -30,7 +30,7 @@
stability: "vintf",
imports: [
"android.hardware.common-V2",
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
],
backend: {
java: {
@@ -53,7 +53,7 @@
version: "1",
imports: [
"android.hardware.common-V2",
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
],
},
],
diff --git a/automotive/evs/aidl/impl/Android.bp b/automotive/evs/aidl/impl/Android.bp
index 7eb0116..0b51a0c 100644
--- a/automotive/evs/aidl/impl/Android.bp
+++ b/automotive/evs/aidl/impl/Android.bp
@@ -20,10 +20,10 @@
cc_defaults {
name: "EvsHalDefaults",
+ defaults: ["android.hardware.graphics.common-ndk_static"],
static_libs: [
"android.hardware.automotive.evs-V1-ndk",
"android.hardware.common-V2-ndk",
- "android.hardware.graphics.common-V3-ndk",
],
shared_libs: [
"libbase",
diff --git a/automotive/evs/aidl/vts/Android.bp b/automotive/evs/aidl/vts/Android.bp
index 980c6d5..5aa9501 100644
--- a/automotive/evs/aidl/vts/Android.bp
+++ b/automotive/evs/aidl/vts/Android.bp
@@ -31,6 +31,7 @@
],
defaults: [
"VtsHalTargetTestDefaults",
+ "android.hardware.graphics.common-ndk_static",
"use_libaidlvintf_gtest_helper_static",
],
shared_libs: [
@@ -43,7 +44,6 @@
"android.hardware.automotive.evs@common-default-lib",
"android.hardware.automotive.evs-V1-ndk",
"android.hardware.common-V2-ndk",
- "android.hardware.graphics.common-V3-ndk",
"libaidlcommonsupport",
],
test_suites: [
diff --git a/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp b/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp
index 58423c8..7f90501 100644
--- a/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp
+++ b/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp
@@ -32,9 +32,10 @@
// API have a requirement that width must be divied by 16 except yuyvtorgb
int min_height = 2;
- int max_height = (image_pixel_size / 16) & ~(1); // must be even number
+ int max_height = (image_pixel_size / 16);
int height = fdp.ConsumeIntegralInRange<uint32_t>(min_height, max_height);
- int width = (image_pixel_size / height) & ~(16); // must be divisible by 16
+ height &= ~(1); // must be even number
+ int width = (image_pixel_size / height) & ~(0xF); // must be divisible by 16
uint8_t* src = (uint8_t*)(data + 4);
uint32_t* tgt = (uint32_t*)malloc(sizeof(uint32_t) * image_pixel_size);
diff --git a/automotive/occupant_awareness/aidl/default/Android.bp b/automotive/occupant_awareness/aidl/default/Android.bp
index 66af9de..1b760a5 100644
--- a/automotive/occupant_awareness/aidl/default/Android.bp
+++ b/automotive/occupant_awareness/aidl/default/Android.bp
@@ -39,3 +39,21 @@
"android.hardware.automotive.occupant_awareness-V1-ndk",
],
}
+
+cc_fuzz {
+ name: "android.hardware.automotive.occupant_awareness-service.fuzzer",
+ defaults: ["service_fuzzer_defaults"],
+ static_libs: [
+ "android.hardware.automotive.occupant_awareness-V1-ndk",
+ "liblog",
+ ],
+ srcs: [
+ "fuzzer.cpp",
+ "OccupantAwareness.cpp",
+ ],
+ fuzz_config: {
+ cc: [
+ "keithmok@google.com",
+ ],
+ },
+}
diff --git a/automotive/occupant_awareness/aidl/default/fuzzer.cpp b/automotive/occupant_awareness/aidl/default/fuzzer.cpp
new file mode 100644
index 0000000..551b83a
--- /dev/null
+++ b/automotive/occupant_awareness/aidl/default/fuzzer.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include <fuzzbinder/libbinder_ndk_driver.h>
+#include <fuzzer/FuzzedDataProvider.h>
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+#include "OccupantAwareness.h"
+
+using ::aidl::android::hardware::automotive::occupant_awareness::IOccupantAwareness;
+using ::android::fuzzService;
+using ::android::hardware::automotive::occupant_awareness::V1_0::implementation::OccupantAwareness;
+using ::ndk::ScopedAStatus;
+using ::ndk::SharedRefBase;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ auto occupantAwareness = SharedRefBase::make<OccupantAwareness>();
+
+ fuzzService(occupantAwareness->asBinder().get(), FuzzedDataProvider(data, size));
+
+ return 0;
+}
diff --git a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp
index a220aeb..8c4fa08 100644
--- a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp
+++ b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp
@@ -42,6 +42,7 @@
using ::android::frameworks::automotive::vhal::ISubscriptionCallback;
using ::android::frameworks::automotive::vhal::ISubscriptionClient;
using ::android::frameworks::automotive::vhal::IVhalClient;
+using ::android::frameworks::automotive::vhal::VhalClientResult;
using ::aidl::android::hardware::automotive::remoteaccess::ApState;
using ::aidl::android::hardware::automotive::remoteaccess::BnRemoteTaskCallback;
@@ -91,9 +92,6 @@
class FakeVhalClient final : public android::frameworks::automotive::vhal::IVhalClient {
public:
- template <class T>
- using VhalClientResult = android::hardware::automotive::vehicle::VhalResult<T>;
-
inline bool isAidlVhal() { return true; }
VhalClientResult<std::unique_ptr<IHalPropValue>> getValueSync(
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index 55a7720..e803e81 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -374,6 +374,15 @@
{.config =
{
+ .prop = toInt(VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS),
+ .access = VehiclePropertyAccess::READ_WRITE,
+ .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+ .configArray = {(int)VehicleUnit::LITER, (int)VehicleUnit::US_GALLON},
+ },
+ .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}},
+
+ {.config =
+ {
.prop = toInt(VehicleProperty::HW_KEY_INPUT),
.access = VehiclePropertyAccess::READ,
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
@@ -1174,13 +1183,14 @@
{
.config =
{
- // VHAL_SUPPORTED_PROPERTY_IDS
+ // SUPPORTED_PROPERTY_IDS
.prop = 289476424,
.access = VehiclePropertyAccess::READ,
.changeMode = VehiclePropertyChangeMode::STATIC,
// Fetch 100 configs in one request. This number is just arbitrarily
// chosen here. But some HAL impl with bigger config data may need a
- // smaller number.
+ // smaller number to make sure the configs returned in one request
+ // fits the binder data size limitation.
.configArray = {100},
},
// All supported property IDs. This list is checked by
@@ -1192,22 +1202,22 @@
289408517, 356518832, 356516106, 291504644, 291504649, 291504656,
291504901, 291504903, 287310600, 291504905, 287310602, 287310603,
291504908, 291504904, 392168201, 392168202, 289408514, 289408001,
- 287310850, 287310851, 287310853, 289475088, 289475104, 289475120,
- 354419984, 320865540, 320865556, 354419975, 354419976, 354419986,
- 354419973, 354419974, 354419978, 354419977, 356517120, 356517121,
- 356582673, 356517139, 289408269, 356517131, 358614275, 291570965,
- 291505923, 289408270, 289408512, 287310855, 289408000, 289408008,
- 289408009, 289407747, 291504900, 568332561, 371198722, 373295872,
- 320867268, 322964416, 290521862, 287310858, 287310859, 289475072,
- 289475073, 289409539, 299896064, 299896065, 299896066, 299896067,
- 289410560, 289410561, 289410562, 289410563, 289410576, 289410577,
- 289410578, 289410579, 289476368, 299895808, 639631617, 627048706,
- 591397123, 554696964, 289410873, 289410874, 287313669, 299896583,
- 299896584, 299896585, 299896586, 299896587, 286265121, 286265122,
- 286265123, 290457094, 290459441, 299896626, 290459443, 289410868,
- 289476405, 299896630, 289410871, 292556600, 557853201, 559950353,
- 555756049, 554707473, 289410887, 557846324, 557911861, 568332086,
- 557846327, 560992056, 289476424}},
+ 287310850, 287310851, 287310853, 289408513, 289475088, 289475104,
+ 289475120, 354419984, 320865540, 320865556, 354419975, 354419976,
+ 354419986, 354419973, 354419974, 354419978, 354419977, 356517120,
+ 356517121, 356582673, 356517139, 289408269, 356517131, 358614275,
+ 291570965, 291505923, 289408270, 289408512, 287310855, 289408000,
+ 289408008, 289408009, 289407747, 291504900, 568332561, 371198722,
+ 373295872, 320867268, 322964416, 290521862, 287310858, 287310859,
+ 289475072, 289475073, 289409539, 299896064, 299896065, 299896066,
+ 299896067, 289410560, 289410561, 289410562, 289410563, 289410576,
+ 289410577, 289410578, 289410579, 289476368, 299895808, 639631617,
+ 627048706, 591397123, 554696964, 289410873, 289410874, 287313669,
+ 299896583, 299896584, 299896585, 299896586, 299896587, 286265121,
+ 286265122, 286265123, 290457094, 290459441, 299896626, 290459443,
+ 289410868, 289476405, 299896630, 289410871, 292556600, 557853201,
+ 559950353, 555756049, 554707473, 289410887, 557846324, 557911861,
+ 568332086, 557846327, 560992056, 289476424}},
},
#endif // ENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS
};
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/GeneratorHub.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/GeneratorHub.cpp
index 9be9ea7..503afd2 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/GeneratorHub.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/GeneratorHub.cpp
@@ -28,11 +28,18 @@
namespace impl {
-GeneratorHub::GeneratorHub(const OnHalEvent& onHalEvent)
- : mOnHalEvent(onHalEvent), mThread(&GeneratorHub::run, this) {}
+GeneratorHub::GeneratorHub(const OnHalEvent& onHalEvent) : mOnHalEvent(onHalEvent) {
+ mThread = std::thread(&GeneratorHub::run, this);
+}
GeneratorHub::~GeneratorHub() {
- mShuttingDownFlag.store(true);
+ {
+ // Even if the shared variable is atomic, it must be modified under the
+ // mutex in order to correctly publish the modification to the waiting
+ // thread.
+ std::unique_lock<std::mutex> g(mLock);
+ mShuttingDownFlag.store(true);
+ }
mCond.notify_all();
if (mThread.joinable()) {
mThread.join();
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp
index 25a1940..df5ada6 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp
@@ -141,7 +141,7 @@
TEST_F(DefaultVhalImplTest, testListProperties) {
std::vector<VehiclePropConfig> configs = mHal->listProperties();
- EXPECT_EQ((size_t)123, configs.size());
+ EXPECT_EQ((size_t)124, configs.size());
}
TEST_F(DefaultVhalImplTest, testGetDefaultPropertyFloat) {
@@ -402,7 +402,7 @@
gotValue->timestamp = 0;
std::string infoMake = toString(*gotValue);
- EXPECT_THAT(std::string(buf), HasSubstr(infoMake));
+ EXPECT_THAT(std::string(buf, sizeof(buf)), HasSubstr(infoMake));
}
TEST_F(DefaultVhalImplTest, testSetPropInvalidAreaId) {
diff --git a/automotive/vehicle/README.md b/automotive/vehicle/README.md
new file mode 100644
index 0000000..e0f03e2
--- /dev/null
+++ b/automotive/vehicle/README.md
@@ -0,0 +1,26 @@
+# Vehicle Hardware Abstraction Layer (VHAL)
+---
+
+This directory stores the VHAL interface definition and VHAL reference
+implementation.
+
+## 2.0 (deprecated)
+
+HIDL based VHAL interface and reference implementation.
+
+## aidl
+
+AIDL based VHAL interfadce and reference implementation.
+
+## proto
+
+Protobuf used to pass message between emulator VHAL and emulator.
+
+## tools
+
+Dev tools related to VHAL.
+
+## vts
+
+VTS test for VHAL. The VTS test works for both AIDL and HIDL VHAL
+implementation. Vendor implementation of VHAL must passes VTS.
diff --git a/automotive/vehicle/TEST_MAPPING b/automotive/vehicle/TEST_MAPPING
index 7e42554..da8416c 100644
--- a/automotive/vehicle/TEST_MAPPING
+++ b/automotive/vehicle/TEST_MAPPING
@@ -7,9 +7,24 @@
"name": "VehicleHalDefaultConfigTest"
},
{
+ "name": "VehicleHalDefaultConfigTestEnableTestProperties"
+ },
+ {
+ "name": "JsonConfigLoaderUnitTest"
+ },
+ {
+ "name": "JsonConfigLoaderUnitTestEnableTestProperties"
+ },
+ {
"name": "VehicleHalVehicleUtilsTest"
},
{
+ "name": "VehiclePropertyAnnotationCppTest"
+ },
+ {
+ "name": "VehiclePropertyAnnotationJavaTest"
+ },
+ {
"name": "FakeVehicleHardwareTest"
},
{
diff --git a/automotive/vehicle/aidl/README.md b/automotive/vehicle/aidl/README.md
new file mode 100644
index 0000000..09f03b4
--- /dev/null
+++ b/automotive/vehicle/aidl/README.md
@@ -0,0 +1,23 @@
+# AIDL Vehicle Hardware Abstraction Layer (VHAL)
+---
+
+This directory stores the AIDL VHAL interface and reference implementation.
+
+## aidl_api
+
+Auto-generated current and previous versions of AIDL VHAL api.
+
+## aidl_test
+
+Contains a test to test that all HIDL VHAL properties are supported in
+AIDL VHAL.
+
+## android
+
+Contains AIDL VHAL interface definition. The main interface file is
+`android/hardware/automotive/vehicle/IVehicle.aidl`.
+
+## impl
+
+Reference implementation for AIDL VHAL and useful libraries for implementing
+vendor AIDL VHAL.
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl
new file mode 100644
index 0000000..9c565ee
--- /dev/null
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum GsrComplianceRequirementType {
+ GSR_COMPLIANCE_NOT_REQUIRED = 0,
+ GSR_COMPLIANCE_REQUIRED_V1 = 1,
+}
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 04f8fa3..64c7ce7 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -206,4 +206,6 @@
EV_REGENERATIVE_BRAKING_STATE = 289410884,
TRAILER_PRESENT = 289410885,
VEHICLE_CURB_WEIGHT = 289410886,
+ GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 289410887,
+ SUPPORTED_PROPERTY_IDS = 289476424,
}
diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp
index 5284a0a..cf7ef1e 100644
--- a/automotive/vehicle/aidl/aidl_test/Android.bp
+++ b/automotive/vehicle/aidl/aidl_test/Android.bp
@@ -20,7 +20,7 @@
cc_test {
name: "VehicleHalAidlHidlCompatibilityTest",
- srcs: ["*.cpp"],
+ srcs: ["AidlHidlCompatibilityTest.cpp"],
shared_libs: [
"libbinder_ndk",
"libhidlbase",
@@ -35,3 +35,25 @@
test_suites: ["device-tests"],
vendor: true,
}
+
+cc_test {
+ name: "VehiclePropertyAnnotationCppTest",
+ srcs: ["VehiclePropertyAnnotationCppTest.cpp"],
+ header_libs: ["IVehicleGeneratedHeaders"],
+ defaults: ["VehicleHalInterfaceDefaults"],
+ test_suites: ["general-tests"],
+}
+
+android_test {
+ name: "VehiclePropertyAnnotationJavaTest",
+ srcs: [
+ "VehiclePropertyAnnotationJavaTest.java",
+ ":IVehicleGeneratedJavaFiles",
+ ],
+ static_libs: [
+ "android.hardware.automotive.vehicle-V2-java",
+ "androidx.test.runner",
+ "truth-prebuilt",
+ ],
+ test_suites: ["general-tests"],
+}
diff --git a/automotive/vehicle/aidl/aidl_test/AndroidManifest.xml b/automotive/vehicle/aidl/aidl_test/AndroidManifest.xml
new file mode 100644
index 0000000..00fdf50
--- /dev/null
+++ b/automotive/vehicle/aidl/aidl_test/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.hardware.automotive.vehicle" >
+
+ <application/>
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.hardware.automotive.vehicle"
+ android:label="test to verify VHAL annotation"/>
+
+</manifest>
\ No newline at end of file
diff --git a/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationCppTest.cpp b/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationCppTest.cpp
new file mode 100644
index 0000000..a4bbbe8
--- /dev/null
+++ b/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationCppTest.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include <AccessForVehicleProperty.h>
+#include <ChangeModeForVehicleProperty.h>
+
+#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
+#include <gtest/gtest.h>
+#include <unordered_set>
+
+namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle;
+using aidl_vehicle::AccessForVehicleProperty;
+using aidl_vehicle::ChangeModeForVehicleProperty;
+using aidl_vehicle::VehicleProperty;
+
+namespace {
+ template<class T>
+ bool doesAnnotationMapContainsAllProps(std::unordered_map<VehicleProperty, T> annotationMap) {
+ for (const VehicleProperty& v : ::ndk::enum_range<VehicleProperty>()) {
+ std::string name = aidl_vehicle::toString(v);
+ if (name == "INVALID") {
+ continue;
+ }
+ if (annotationMap.find(v) == annotationMap.end()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+} // namespace
+
+TEST(VehiclePropertyAnnotationCppTest, testChangeMode) {
+ ASSERT_TRUE(doesAnnotationMapContainsAllProps(ChangeModeForVehicleProperty))
+ << "Outdated annotation-generated AIDL files. Please run "
+ << "generate_annotation_enums.py to update.";
+}
+
+TEST(VehiclePropertyAnnotationCppTest, testAccess) {
+ ASSERT_TRUE(doesAnnotationMapContainsAllProps(AccessForVehicleProperty))
+ << "Outdated annotation-generated AIDL files. Please run "
+ << "generate_annotation_enums.py to update.";
+}
diff --git a/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationJavaTest.java b/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationJavaTest.java
new file mode 100644
index 0000000..ef49299
--- /dev/null
+++ b/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationJavaTest.java
@@ -0,0 +1,60 @@
+package android.hardware.automotive.vehicle;
+
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import static org.junit.Assert.fail;
+
+import androidx.test.filters.SmallTest;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Map;
+
+@RunWith(JUnit4.class)
+public class VehiclePropertyAnnotationJavaTest {
+
+ private boolean doesAnnotationMapContainsAllProps(Map<Integer, Integer> annotationMap) {
+ for (Field field : VehicleProperty.class.getDeclaredFields()) {
+ int modifiers = field.getModifiers();
+ try {
+ if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)
+ && Modifier.isPublic(modifiers) && field.getType().equals(int.class)) {
+ int propId = field.getInt(/* obj= */ null);
+ if (propId == VehicleProperty.INVALID) {
+ // Skip INVALID_PROP.
+ continue;
+ }
+ if (annotationMap.get(propId) == null) {
+ return false;
+ }
+ }
+ } catch (IllegalAccessException e) {
+ throw new IllegalStateException(
+ "Cannot access a member for VehicleProperty.class", e);
+ }
+ }
+ return true;
+ }
+
+ @Test
+ @SmallTest
+ public void testChangeMode() {
+ assertWithMessage("Outdated annotation-generated AIDL files. Please run "
+ + "generate_annotation_enums.py to update.")
+ .that(doesAnnotationMapContainsAllProps(ChangeModeForVehicleProperty.values))
+ .isTrue();
+ }
+
+ @Test
+ @SmallTest
+ public void testAccess() {
+ assertWithMessage("Outdated annotation-generated AIDL files. Please run "
+ + "generate_annotation_enums.py to update.")
+ .that(doesAnnotationMapContainsAllProps(AccessForVehicleProperty.values))
+ .isTrue();
+ }
+}
\ No newline at end of file
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl
new file mode 100644
index 0000000..fb3ca9f
--- /dev/null
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 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.automotive.vehicle;
+
+/**
+ * Used by GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT to indicate what
+ * kind of general safety regulation compliance requirement is enforced.
+ */
+@VintfStability
+@Backing(type="int")
+enum GsrComplianceRequirementType {
+ /**
+ * GSR compliance is not required.
+ */
+ GSR_COMPLIANCE_NOT_REQUIRED = 0,
+
+ /**
+ * GSR compliance is required and the requirement solution version is 1.
+ */
+ GSR_COMPLIANCE_REQUIRED_V1 = 1,
+}
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 727b949..1852673 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -46,32 +46,32 @@
/**
* VIN of vehicle
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
*/
INFO_VIN = 0x0100 + 0x10000000 + 0x01000000
+ 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING
/**
* Manufacturer of vehicle
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
*/
INFO_MAKE = 0x0101 + 0x10000000 + 0x01000000
+ 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING
/**
* Model of vehicle
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
*/
INFO_MODEL = 0x0102 + 0x10000000 + 0x01000000
+ 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING
/**
* Model year of vehicle.
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:YEAR
*/
INFO_MODEL_YEAR = 0x0103 + 0x10000000 + 0x01000000
@@ -79,8 +79,8 @@
/**
* Fuel capacity of the vehicle in milliliters
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:MILLILITER
*/
INFO_FUEL_CAPACITY = 0x0104 + 0x10000000 + 0x01000000
@@ -88,8 +88,8 @@
/**
* List of fuels the vehicle may use
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @data_enum FuelType
*/
INFO_FUEL_TYPE = 0x0105 + 0x10000000 + 0x01000000
@@ -98,8 +98,8 @@
* Battery capacity of the vehicle, if EV or hybrid. This is the nominal
* battery capacity when the vehicle is new.
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:WH
*/
INFO_EV_BATTERY_CAPACITY = 0x0106 + 0x10000000 + 0x01000000
@@ -107,26 +107,26 @@
/**
* List of connectors this EV may use
*
- * @change_mode VehiclePropertyChangeMode:STATIC
+ * @change_mode VehiclePropertyChangeMode.STATIC
* @data_enum EvConnectorType
- * @access VehiclePropertyAccess:READ
+ * @access VehiclePropertyAccess.READ
*/
INFO_EV_CONNECTOR_TYPE = 0x0107 + 0x10000000 + 0x01000000
+ 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC
/**
* Fuel door location
*
- * @change_mode VehiclePropertyChangeMode:STATIC
+ * @change_mode VehiclePropertyChangeMode.STATIC
* @data_enum PortLocationType
- * @access VehiclePropertyAccess:READ
+ * @access VehiclePropertyAccess.READ
*/
INFO_FUEL_DOOR_LOCATION = 0x0108 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
/**
* EV port location
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @data_enum PortLocationType
*/
INFO_EV_PORT_LOCATION = 0x0109 + 0x10000000 + 0x01000000
@@ -135,9 +135,9 @@
* Driver's seat location
* VHAL implementations must ignore the areaId. Use VehicleArea:GLOBAL.
*
- * @change_mode VehiclePropertyChangeMode:STATIC
+ * @change_mode VehiclePropertyChangeMode.STATIC
* @data_enum VehicleAreaSeat
- * @access VehiclePropertyAccess:READ
+ * @access VehiclePropertyAccess.READ
*/
INFO_DRIVER_SEAT = 0x010A + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -153,8 +153,8 @@
* int32Values[6] = track width rear
* int32Values[7] = curb to curb turning radius
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:MILLIMETER
*/
INFO_EXTERIOR_DIMENSIONS = 0x010B + 0x10000000 + 0x01000000
@@ -168,8 +168,8 @@
* int32Values[0] = PortLocationType::FRONT_LEFT
* int32Values[0] = PortLocationType::REAR_LEFT
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @data_enum PortLocationType
*/
INFO_MULTI_EV_PORT_LOCATIONS = 0x010C + 0x10000000 + 0x01000000
@@ -177,8 +177,8 @@
/**
* Current odometer value of the vehicle
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:KILOMETER
*/
PERF_ODOMETER = 0x0204 + 0x10000000 + 0x01000000
@@ -192,8 +192,8 @@
* PERF_VEHICLE_SPEED is positive when the vehicle is moving forward, negative when moving
* backward, and zero when not moving.
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:METER_PER_SEC
*/
PERF_VEHICLE_SPEED = 0x0207 + 0x10000000 + 0x01000000
@@ -204,8 +204,8 @@
* Some cars display a slightly slower speed than the actual speed. This is
* usually displayed on the speedometer.
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:METER_PER_SEC
*/
PERF_VEHICLE_SPEED_DISPLAY = 0x0208 + 0x10000000 + 0x01000000
@@ -215,8 +215,8 @@
*
* Angle is in degrees. Left is negative.
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:DEGREES
*/
PERF_STEERING_ANGLE = 0x0209 + 0x10000000 + 0x01000000
@@ -226,8 +226,8 @@
*
* Angle is in degrees. Left is negative.
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:DEGREES
*/
PERF_REAR_STEERING_ANGLE = 0x0210 + 0x10000000 + 0x01000000
@@ -235,8 +235,8 @@
/**
* Temperature of engine coolant
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:CELSIUS
*/
ENGINE_COOLANT_TEMP = 0x0301 + 0x10000000 + 0x01000000
@@ -244,8 +244,8 @@
/**
* Engine oil level
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleOilLevel
*/
ENGINE_OIL_LEVEL = 0x0303 + 0x10000000 + 0x01000000
@@ -253,8 +253,8 @@
/**
* Temperature of engine oil
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:CELSIUS
*/
ENGINE_OIL_TEMP = 0x0304 + 0x10000000 + 0x01000000
@@ -262,8 +262,8 @@
/**
* Engine rpm
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:RPM
*/
ENGINE_RPM = 0x0305 + 0x10000000 + 0x01000000
@@ -300,8 +300,8 @@
*
* VehiclePropValue.timestamp must be correctly filled in.
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
*/
WHEEL_TICK = 0x0306 + 0x10000000 + 0x01000000
+ 0x00510000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64_VEC
@@ -310,8 +310,8 @@
*
* Value may not exceed INFO_FUEL_CAPACITY
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:MILLILITER
*/
FUEL_LEVEL = 0x0307 + 0x10000000 + 0x01000000
@@ -319,8 +319,8 @@
/**
* Fuel door open
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
FUEL_DOOR_OPEN = 0x0308 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -329,8 +329,8 @@
*
* Value may not exceed INFO_EV_BATTERY_CAPACITY
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:WH
*/
EV_BATTERY_LEVEL = 0x0309 + 0x10000000 + 0x01000000
@@ -338,16 +338,16 @@
/**
* EV charge port open
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
EV_CHARGE_PORT_OPEN = 0x030A + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
/**
* EV charge port connected
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
EV_CHARGE_PORT_CONNECTED = 0x030B + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -357,8 +357,8 @@
* Positive value indicates battery is being charged.
* Negative value indicates battery being discharged.
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:MW
*/
EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = 0x030C + 0x10000000 + 0x01000000
@@ -370,8 +370,8 @@
* all energy sources in a vehicle. For example, a hybrid car's range will
* be the sum of the ranges based on fuel and battery.
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ_WRITE
* @unit VehicleUnit:METER
*/
RANGE_REMAINING = 0x0308 + 0x10000000 + 0x01000000
@@ -397,8 +397,8 @@
* }
* },
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:KILOPASCAL
*/
TIRE_PRESSURE = 0x0309 + 0x10000000 + 0x07000000
@@ -412,8 +412,8 @@
* Minimum and maximum property values (that is, minFloatValue, maxFloatValue)
* are not applicable to this property.
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:KILOPASCAL
*/
CRITICALLY_LOW_TIRE_PRESSURE = 0x030A + 0x10000000 + 0x07000000
@@ -429,8 +429,8 @@
* GEAR_1, GEAR_2,...} and for manual transmission the list must be
* {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_1, GEAR_2,...}
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleGear
*/
GEAR_SELECTION = 0x0400 + 0x10000000 + 0x01000000
@@ -448,8 +448,8 @@
* {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_1, GEAR_2,...}. This list need not be the
* same as that of the supported gears reported in GEAR_SELECTION.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleGear
*/
CURRENT_GEAR = 0x0401 + 0x10000000 + 0x01000000
@@ -457,16 +457,28 @@
/**
* Parking brake state.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * This property is true indicates that the car's parking brake is currently engaged. False
+ * implies that the car's parking brake is currently disengaged.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
PARKING_BRAKE_ON = 0x0402 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
/**
* Auto-apply parking brake.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * This property is true indicates that the car's automatic parking brake feature is currently
+ * enabled. False indicates that the car's automatic parking brake feature is currently
+ * disabled.
+ *
+ * This property is often confused with PARKING_BRAKE_ON. The difference is that
+ * PARKING_BRAKE_ON describes whether the actual parking brake is currently on/off, whereas
+ * PARKING_BRAKE_AUTO_APPLY describes whether the feature of automatic parking brake is enabled/
+ * disabled, and does not describe the current state of the actual parking brake.
+ *
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
PARKING_BRAKE_AUTO_APPLY = 0x0403 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -483,8 +495,8 @@
* For a hybrid vehicle, this property may be based on the combination of gas and battery
* levels, at the OEM's discretion.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
FUEL_LEVEL_LOW = 0x0405 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -495,16 +507,16 @@
* low light. The platform could use this, for example, to enable appropriate UI for
* better viewing in dark or low light environments.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
NIGHT_MODE = 0x0407 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
/**
* State of the vehicles turn signals
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleTurnSignal
*/
TURN_SIGNAL_STATE = 0x0408 + 0x10000000 + 0x01000000
@@ -512,8 +524,8 @@
/**
* Represents ignition state
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleIgnitionState
*/
IGNITION_STATE = 0x0409 + 0x10000000 + 0x01000000
@@ -525,8 +537,8 @@
* property may be intermittently set (pulsing) based on the real-time
* state of the ABS system.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
ABS_ACTIVE = 0x040A + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -537,12 +549,12 @@
* TC is off. This property may be intermittently set (pulsing) based on
* the real-time state of the TC system.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
TRACTION_CONTROL_ACTIVE = 0x040B + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
- /*
+ /**
* HVAC Properties
*
* Additional rules for mapping a zoned HVAC property (except
@@ -580,16 +592,16 @@
*
* Fan speed setting
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_FAN_SPEED = 0x0500 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
/**
* Fan direction setting
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleHvacFanDirection
*/
HVAC_FAN_DIRECTION = 0x0501 + 0x10000000 + 0x05000000
@@ -597,8 +609,8 @@
/**
* HVAC current temperature.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:CELSIUS
*/
HVAC_TEMPERATURE_CURRENT = 0x0502 + 0x10000000 + 0x05000000
@@ -624,8 +636,8 @@
* that property to get the suggested value before setting HVAC_TEMPERATURE_SET. Otherwise,
* the application may choose the value in HVAC_TEMPERATURE_SET configArray by itself.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @unit VehicleUnit:CELSIUS
*/
HVAC_TEMPERATURE_SET = 0x0503 + 0x10000000 + 0x05000000
@@ -633,16 +645,16 @@
/**
* Fan-based defrost for designated window.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_DEFROSTER = 0x0504 + 0x10000000 + 0x03000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN
/**
* On/off AC for designated areaId
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @config_flags Supported areaIds
*/
HVAC_AC_ON = 0x0505 + 0x10000000 + 0x05000000
@@ -655,8 +667,8 @@
* Any parameters modified as a side effect of turning on/off the MAX AC
* parameter shall generate onPropertyEvent() callbacks to the VHAL.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_MAX_AC_ON = 0x0506 + 0x10000000 + 0x05000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN
@@ -674,8 +686,8 @@
* areaConfig.areaId = {ROW_1_LEFT | ROW_1_RIGHT} indicates HVAC_MAX_DEFROST_ON
* only can be controlled for the front rows.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_MAX_DEFROST_ON = 0x0507 + 0x10000000 + 0x05000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN
@@ -687,8 +699,8 @@
* Recirc “off” means the majority of the airflow into the cabin is coming
* from outside the car.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_RECIRC_ON = 0x0508 + 0x10000000 + 0x05000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN
@@ -722,16 +734,16 @@
* onPropertyEvent() callbacks (i.e. HVAC_DUAL_ON = false,
* HVAC_TEMPERATURE_SET[AreaID] = xxx, etc).
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_DUAL_ON = 0x0509 + 0x10000000 + 0x05000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN
/**
* On/off automatic mode
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_AUTO_ON = 0x050A + 0x10000000 + 0x05000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN
@@ -746,8 +758,8 @@
* min/max range defines the allowable range and number of steps in each
* direction.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_SEAT_TEMPERATURE = 0x050B + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -758,8 +770,8 @@
* The Max value in the config data represents the highest heating level.
* The Min value in the config data MUST be zero and indicates no heating.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_SIDE_MIRROR_HEAT = 0x050C + 0x10000000 + 0x04000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32
@@ -772,8 +784,8 @@
* Negative value indicates cooling.
* 0 indicates temperature control is off.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_STEERING_WHEEL_HEAT = 0x050D + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
@@ -790,8 +802,8 @@
* Values must be one of VehicleUnit::CELSIUS or VehicleUnit::FAHRENHEIT
* Note that internally, all temperatures are represented in floating point Celsius.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleUnit
*/
HVAC_TEMPERATURE_DISPLAY_UNITS = 0x050E + 0x10000000 + 0x01000000
@@ -799,8 +811,8 @@
/**
* Actual fan speed
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
HVAC_ACTUAL_FAN_SPEED_RPM = 0x050F + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -841,8 +853,8 @@
* - ROW_1_LEFT | ROW_1_RIGHT
* - ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT | ROW_3_LEFT | ROW_3_CENTER | ROW_3_RIGHT
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_POWER_ON = 0x0510 + 0x10000000 + 0x05000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN
@@ -859,8 +871,8 @@
* - FAN_DIRECTION_DEFROST (0x4)
* - FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST (0x6)
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleHvacFanDirection
*/
HVAC_FAN_DIRECTION_AVAILABLE = 0x0511 + 0x10000000 + 0x05000000
@@ -872,8 +884,8 @@
* switch to recirculation mode if the vehicle detects poor incoming air
* quality.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_AUTO_RECIRC_ON = 0x0512 + 0x10000000 + 0x05000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN
@@ -887,16 +899,16 @@
* ventilation. This is different than seating cooling. It can be on at the
* same time as cooling, or not.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_SEAT_VENTILATION = 0x0513 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
/**
* Electric defrosters' status
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_ELECTRIC_DEFROSTER_ON = 0x0514 + 0x10000000 + 0x03000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN
@@ -935,8 +947,8 @@
* callback with property value [21, (float)VehicleUnit:CELSIUS, 21.0, 70.0].
* In this case, the application can know that the value is 70.0 Fahrenheit in the car’s UI.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
HVAC_TEMPERATURE_VALUE_SUGGESTION = 0x0515 + 0x10000000 + 0x01000000
+ 0x00610000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT_VEC
@@ -951,8 +963,8 @@
* For example: configArray[0] = METER
* configArray[1] = KILOMETER
* configArray[2] = MILE
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleUnit
*/
DISTANCE_DISPLAY_UNITS = 0x0600 + 0x10000000 + 0x01000000
@@ -967,8 +979,8 @@
* Volume units are defined in VehicleUnit.
* For example: configArray[0] = LITER
* configArray[1] = GALLON
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleUnit
*/
FUEL_VOLUME_DISPLAY_UNITS = 0x0601 + 0x10000000 + 0x01000000
@@ -984,8 +996,8 @@
* For example: configArray[0] = KILOPASCAL
* configArray[1] = PSI
* configArray[2] = BAR
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleUnit
*/
TIRE_PRESSURE_DISPLAY_UNITS = 0x0602 + 0x10000000 + 0x01000000
@@ -1001,8 +1013,8 @@
* For example: configArray[0] = WATT_HOUR
* configArray[1] = AMPERE_HOURS
* configArray[2] = KILOWATT_HOUR
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleUnit
*/
EV_BATTERY_DISPLAY_UNITS = 0x0603 + 0x10000000 + 0x01000000
@@ -1014,8 +1026,8 @@
* True indicates units are distance over volume such as MPG.
* False indicates units are volume over distance such as L/100KM.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = 0x0604 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -1029,8 +1041,8 @@
* For example: configArray[0] = METER_PER_SEC
* configArray[1] = MILES_PER_HOUR
* configArray[2] = KILOMETERS_PER_HOUR
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
VEHICLE_SPEED_DISPLAY_UNITS = 0x0605 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
@@ -1072,8 +1084,8 @@
* WARNING: The value available through this property should not be dependent
* on value written by Android to ANDROID_EPOCH_TIME property in any way.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_ONLY
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:MILLI_SECS
*/
EXTERNAL_CAR_TIME = 0x0608 + 0x10000000 // VehiclePropertyGroup:SYSTEM
@@ -1101,8 +1113,8 @@
* drift = elapsedTime - PropValue.timestamp
* effectiveTime = PropValue.value.int64Values[0] + drift
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:WRITE_ONLY
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
* @unit VehicleUnit:MILLI_SECS
*/
ANDROID_EPOCH_TIME = 0x0606 + 0x10000000 + 0x01000000
@@ -1116,16 +1128,16 @@
* AAOS will then read the property on subsequent boots. The binding seed is expected to be
* reliably persisted. Any loss of the seed results in a factory reset of the IVI.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
STORAGE_ENCRYPTION_BINDING_SEED = 0x0607 + 0x10000000 + 0x01000000
+ 0x00700000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BYTES
/**
* Outside temperature
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:CELSIUS
*/
ENV_OUTSIDE_TEMPERATURE = 0x0703 + 0x10000000 + 0x01000000
@@ -1143,8 +1155,8 @@
* int32Values[1] : additional parameter relevant for each state,
* 0 if not used.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
AP_POWER_STATE_REQ = 0x0A00 + 0x10000000 + 0x01000000
+ 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC
@@ -1158,8 +1170,8 @@
* int32Values[1] : Time in ms to wake up, if necessary. Otherwise 0.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
AP_POWER_STATE_REPORT = 0x0A01 + 0x10000000 + 0x01000000
+ 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC
@@ -1172,8 +1184,8 @@
*
* int32Values[0] must be VehicleApPowerBootupReason.
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
*/
AP_POWER_BOOTUP_REASON = 0x0A02 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
@@ -1187,8 +1199,8 @@
* change display brightness from Settings, but that must not be reflected
* to other displays.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
DISPLAY_BRIGHTNESS = 0x0A03 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
@@ -1203,8 +1215,8 @@
* int32Values[3] : [optional] Number of ticks. The value must be equal or
* greater than 1. When omitted, Android will default to 1.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @config_flags
*/
HW_KEY_INPUT = 0x0A10 + 0x10000000 + 0x01000000
@@ -1226,9 +1238,9 @@
* detents is > 1 or < -1, this is when the
* first detent of rotation occurred.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
* @data_enum RotaryInputType
- * @access VehiclePropertyAccess:READ
+ * @access VehiclePropertyAccess.READ
*/
HW_ROTARY_INPUT = 0x0A20 + 0x10000000 + 0x01000000
+ 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC
@@ -1249,9 +1261,9 @@
* int32Values[2] : repeat counter, if 0 then event is not repeated. Values 1 or above means
* how many times this event repeated.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
* @data_enum CustomInputType
- * @access VehiclePropertyAccess:READ
+ * @access VehiclePropertyAccess.READ
*/
HW_CUSTOM_INPUT = 0X0A30 + 0x10000000 + 0x01000000
+ 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC
@@ -1282,16 +1294,16 @@
* Some vehicles (minivans) can open the door electronically. Hence, the
* ability to write this property.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
DOOR_POS = 0x0B00 + 0x10000000 + 0x06000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:INT32
/**
* Door move
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
DOOR_MOVE = 0x0B01 + 0x10000000 + 0x06000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:INT32
@@ -1300,8 +1312,8 @@
*
* 'true' indicates door is locked
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
DOOR_LOCK = 0x0B02 + 0x10000000 + 0x06000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:BOOLEAN
@@ -1310,8 +1322,8 @@
*
* Positive value indicates tilt upwards, negative value is downwards
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
MIRROR_Z_POS = 0x0B40 + 0x10000000 + 0x04000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32
@@ -1320,8 +1332,8 @@
*
* Positive value indicates tilt upwards, negative value is downwards
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
MIRROR_Z_MOVE = 0x0B41 + 0x10000000 + 0x04000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32
@@ -1330,8 +1342,8 @@
*
* Positive value indicate tilt right, negative value is left
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
MIRROR_Y_POS = 0x0B42 + 0x10000000 + 0x04000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32
@@ -1340,8 +1352,8 @@
*
* Positive value indicate tilt right, negative value is left
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
MIRROR_Y_MOVE = 0x0B43 + 0x10000000 + 0x04000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32
@@ -1350,8 +1362,8 @@
*
* True indicates mirror positions are locked and not changeable
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
MIRROR_LOCK = 0x0B44 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -1360,8 +1372,8 @@
*
* True indicates mirrors are folded
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
MIRROR_FOLD = 0x0B45 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -1376,8 +1388,8 @@
* will be 3. When the user wants to select a preset, the desired preset
* number (1, 2, or 3) is set.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
*/
SEAT_MEMORY_SELECT = 0x0B80 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1388,8 +1400,8 @@
* into the selected preset slot. The maxValue for each seat position
* must match the maxValue for SEAT_MEMORY_SELECT.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
*/
SEAT_MEMORY_SET = 0x0B81 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1401,8 +1413,8 @@
* Write access indicates automatic seat buckling capabilities. There are
* no known cars at this time, but you never know...
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_BELT_BUCKLED = 0x0B82 + 0x10000000 + 0x05000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN
@@ -1413,16 +1425,16 @@
* Max value indicates highest position
* Min value indicates lowest position
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_BELT_HEIGHT_POS = 0x0B83 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
/**
* Seatbelt height move
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_BELT_HEIGHT_MOVE = 0x0B84 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1433,8 +1445,8 @@
* Max value indicates closest to wheel, min value indicates most rearward
* position.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_FORE_AFT_POS = 0x0B85 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1443,8 +1455,8 @@
*
* Moves the seat position forward and aft.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_FORE_AFT_MOVE = 0x0B86 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1455,8 +1467,8 @@
* Max value indicates angling forward towards the steering wheel.
* Min value indicates full recline.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_BACKREST_ANGLE_1_POS = 0x0B87 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1465,8 +1477,8 @@
*
* Moves the backrest forward or recline.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_BACKREST_ANGLE_1_MOVE = 0x0B88 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1477,8 +1489,8 @@
* Max value indicates angling forward towards the steering wheel.
* Min value indicates full recline.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_BACKREST_ANGLE_2_POS = 0x0B89 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1487,8 +1499,8 @@
*
* Moves the backrest forward or recline.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_BACKREST_ANGLE_2_MOVE = 0x0B8A + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1499,8 +1511,8 @@
* Max value indicates highest position.
* Min value indicates lowest position.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_HEIGHT_POS = 0x0B8B + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1509,8 +1521,8 @@
*
* Moves the seat height.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_HEIGHT_MOVE = 0x0B8C + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1521,8 +1533,8 @@
* Max value indicates longest depth position.
* Min value indicates shortest position.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_DEPTH_POS = 0x0B8D + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1531,8 +1543,8 @@
*
* Adjusts the seat depth.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_DEPTH_MOVE = 0x0B8E + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1543,8 +1555,8 @@
* Max value indicates front edge of seat higher than back edge.
* Min value indicates front edge of seat lower than back edge.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_TILT_POS = 0x0B8F + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1553,8 +1565,8 @@
*
* Tilts the seat.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_TILT_MOVE = 0x0B90 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1565,8 +1577,8 @@
* Max value indicates most forward position.
* Min value indicates most rearward position.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_LUMBAR_FORE_AFT_POS = 0x0B91 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1575,8 +1587,8 @@
*
* Adjusts the lumbar support.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_LUMBAR_FORE_AFT_MOVE = 0x0B92 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1587,8 +1599,8 @@
* Max value indicates widest lumbar setting (i.e. least support)
* Min value indicates thinnest lumbar setting.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_LUMBAR_SIDE_SUPPORT_POS = 0x0B93 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1597,8 +1609,8 @@
*
* Adjusts the amount of lateral lumbar support.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_LUMBAR_SIDE_SUPPORT_MOVE = 0x0B94 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1609,8 +1621,8 @@
* Max value indicates tallest setting.
* Min value indicates shortest setting.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_HEADREST_HEIGHT_POS = 0x0B95 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
@@ -1619,8 +1631,8 @@
*
* Moves the headrest up and down.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_HEADREST_HEIGHT_MOVE = 0x0B96 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1631,8 +1643,8 @@
* Max value indicates most upright angle.
* Min value indicates shallowest headrest angle.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_HEADREST_ANGLE_POS = 0x0B97 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1641,8 +1653,8 @@
*
* Adjusts the angle of the headrest
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_HEADREST_ANGLE_MOVE = 0x0B98 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1653,16 +1665,16 @@
* Max value indicates position closest to front of car.
* Min value indicates position closest to rear of car.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_HEADREST_FORE_AFT_POS = 0x0B99 + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
/**
* Headrest fore/aft move
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SEAT_HEADREST_FORE_AFT_MOVE = 0x0B9A + 0x10000000 + 0x05000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32
@@ -1672,8 +1684,8 @@
* Indicates whether a particular seat is occupied or not, to the best of the car's ability
* to determine. Valid values are from the VehicleSeatOccupancyState enum.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleSeatOccupancyState
*/
SEAT_OCCUPANCY = 0x0BB0 + 0x10000000 + 0x05000000
@@ -1692,8 +1704,8 @@
*
* Note that in this mode, 0 indicates the window is closed.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
WINDOW_POS = 0x0BC0 + 0x10000000 + 0x03000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32
@@ -1720,8 +1732,8 @@
* Max = open the sunroof, automatically stop when sunroof is fully open.
* Min = open the vent, automatically stop when vent is fully open.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
WINDOW_MOVE = 0x0BC1 + 0x10000000 + 0x03000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32
@@ -1730,8 +1742,8 @@
*
* True indicates windows are locked and can't be moved.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
WINDOW_LOCK = 0x0BC4 + 0x10000000 + 0x03000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN
@@ -1748,8 +1760,8 @@
*
* IVehicle#get must always return StatusCode::NOT_AVAILABLE.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
VEHICLE_MAP_SERVICE = 0x0C00 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -1791,8 +1803,8 @@
* floatValues[4 and 5] are valid sensor values
* floatValues[6] is not a valid sensor value
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
OBD2_LIVE_FRAME = 0x0D00 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -1817,8 +1829,8 @@
* freeze frames, it is possible for a frame request to respond with NOT_AVAILABLE even if
* the associated timestamp has been recently obtained via OBD2_FREEZE_FRAME_INFO.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
OBD2_FREEZE_FRAME = 0x0D01 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -1834,8 +1846,8 @@
* such element can be used as the key to OBD2_FREEZE_FRAME to retrieve
* the corresponding freeze frame.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
OBD2_FREEZE_FRAME_INFO = 0x0D02 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -1856,8 +1868,8 @@
* vehicle not support selective clearing of freeze frames, this latter mode must
* return NOT_AVAILABLE.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
*/
OBD2_FREEZE_FRAME_CLEAR = 0x0D03 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -1866,8 +1878,8 @@
*
* Return the current state of headlights.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleLightState
*/
HEADLIGHTS_STATE = 0x0E00 + 0x10000000 + 0x01000000
@@ -1877,8 +1889,8 @@
*
* Return the current state of high beam lights.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleLightState
*/
HIGH_BEAM_LIGHTS_STATE = 0x0E01 + 0x10000000 + 0x01000000
@@ -1904,8 +1916,8 @@
* Only one of FOG_LIGHTS_STATE or REAR_FOG_LIGHTS_STATE must be implemented and not both.
* FRONT_FOG_LIGHTS_STATE must not be implemented.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleLightState
*/
FOG_LIGHTS_STATE = 0x0E02 + 0x10000000 + 0x01000000
@@ -1915,8 +1927,8 @@
*
* Return the current status of hazard lights.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleLightState
*/
HAZARD_LIGHTS_STATE = 0x0E03 + 0x10000000 + 0x01000000
@@ -1926,8 +1938,8 @@
*
* The setting that the user wants.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleLightSwitch
*/
HEADLIGHTS_SWITCH = 0x0E10 + 0x10000000 + 0x01000000
@@ -1937,8 +1949,8 @@
*
* The setting that the user wants.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleLightSwitch
*/
HIGH_BEAM_LIGHTS_SWITCH = 0x0E11 + 0x10000000 + 0x01000000
@@ -1964,8 +1976,8 @@
* Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented and not both.
* FRONT_FOG_LIGHTS_SWITCH must not be implemented.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleLightSwitch
*/
FOG_LIGHTS_SWITCH = 0x0E12 + 0x10000000 + 0x01000000
@@ -1975,8 +1987,8 @@
*
* The setting that the user wants.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleLightSwitch
*/
HAZARD_LIGHTS_SWITCH = 0x0E13 + 0x10000000 + 0x01000000
@@ -1986,8 +1998,8 @@
*
* Return current status of cabin lights.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleLightState
*/
CABIN_LIGHTS_STATE = 0x0F01 + 0x10000000 + 0x01000000
@@ -2000,8 +2012,8 @@
* is open or because of a voice command.
* For example, while the switch is in the "off" or "automatic" position.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleLightSwitch
*/
CABIN_LIGHTS_SWITCH = 0x0F02 + 0x10000000 + 0x01000000
@@ -2011,8 +2023,8 @@
*
* Return current status of reading lights.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleLightState
*/
READING_LIGHTS_STATE = 0x0F03 + 0x10000000 + 0x05000000
@@ -2025,8 +2037,8 @@
* is open or because of a voice command.
* For example, while the switch is in the "off" or "automatic" position.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleLightSwitch
*/
READING_LIGHTS_SWITCH = 0x0F04 + 0x10000000 + 0x05000000
@@ -2054,8 +2066,8 @@
* If vendor chose PERMISSION_NOT_ACCESSIBLE, android will not have access to the property. In
* the example, Android can not write value for vendor_prop_2.
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
*/
SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = 0x0F05 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -2070,8 +2082,8 @@
*
* Value read should include all features disabled with ',' separation.
* ex) "com.android.car.user.CarUserNoticeService,storage_monitoring"
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
*/
DISABLED_OPTIONAL_FEATURES = 0x0F06 + 0x10000000 + 0x01000000
+ 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING
@@ -2120,8 +2132,8 @@
* by the Android System). But if it supports user management, then it must support all core
* user-related properties (INITIAL_USER_INFO, SWITCH_USER, CREATE_USER, and REMOVE_USER).
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
INITIAL_USER_INFO = 0x0F07 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -2286,8 +2298,8 @@
*
* Example: see VEHICLE_REQUEST section above.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
SWITCH_USER = 0x0F08 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -2332,8 +2344,8 @@
* string: "D'OH!" // The meaning is a blackbox - it's passed to the caller (like Settings UI),
* // which in turn can take the proper action.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
CREATE_USER = 0x0F09 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -2363,8 +2375,8 @@
* int32[8]: 10 // 2nd user (user 10)
* int32[9]: 0 // 2nd user flags (none)
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:WRITE
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.WRITE
*/
REMOVE_USER = 0x0F0A + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -2438,8 +2450,8 @@
* int32[5]: 101 (2nd type: UserIdentificationAssociationType::CUSTOM_1)
* int32[6]: 1 (2nd value: UserIdentificationAssociationValue::ASSOCIATE_CURRENT_USER)
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
USER_IDENTIFICATION_ASSOCIATION = 0x0F0B + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -2457,8 +2469,8 @@
* For example, to enable rear view EVS service, android side can set the property value as
* [EvsServiceType::REAR_VIEW, EvsServiceState::ON].
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
EVS_SERVICE_REQUEST = 0x0F10 + 0x10000000 + 0x01000000
+ 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC
@@ -2468,13 +2480,14 @@
* VHAL sets this property to change car power policy. Car power policy service subscribes to
* this property and actually changes the power policy.
* The request is made by setting the VehiclePropValue with the ID of a power policy which is
- * defined at /vendor/etc/power_policy.xml. If the given ID is not defined, car power policy
- * service ignores the request and the current power policy is maintained.
+ * defined at /vendor/etc/automotive/power_policy.xml.
+ * If the given ID is not defined, car power policy service ignores the request
+ * and the current power policy is maintained.
*
* string: "sample_policy_id" // power policy ID
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
POWER_POLICY_REQ = 0x0F21 + 0x10000000 + 0x01000000
+ 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING
@@ -2492,8 +2505,8 @@
*
* string: "sample_policy_group_id" // power policy group ID
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
POWER_POLICY_GROUP_REQ = 0x0F22 + 0x10000000 + 0x01000000
+ 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING
@@ -2504,8 +2517,8 @@
*
* string: "sample_policy_id" // power policy ID
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
CURRENT_POWER_POLICY = 0x0F23 + 0x10000000 + 0x01000000
+ 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING
@@ -2515,8 +2528,8 @@
* Car watchdog sets this property to system uptime in milliseconds at every 3 second.
* During the boot, the update may take longer time.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
*/
WATCHDOG_ALIVE = 0xF31 + 0x10000000 + 0x01000000
+ 0x00500000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64
@@ -2526,8 +2539,8 @@
* int32Values[0]: 1 // ProcessTerminationReason showing why a process is terminated.
* string: "/system/bin/log" // Process execution command.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
*/
WATCHDOG_TERMINATED_PROCESS = 0x0F32 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -2541,8 +2554,8 @@
* VHAL unhealthy and terminates it.
* If this property is not supported by VHAL, car watchdog doesn't check VHAL health status.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
VHAL_HEARTBEAT = 0x0F33 + 0x10000000 + 0x01000000
+ 0x00500000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64
@@ -2554,8 +2567,8 @@
* the default UI and a kind of launcher functionality for cluster display.
* the other values are followed by OEM's definition.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
CLUSTER_SWITCH_UI = 0x0F34 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
@@ -2578,8 +2591,8 @@
* int32[7]: Inset - right: same format with 'left'
* int32[8]: Inset - bottom: same format with 'left'
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
*/
CLUSTER_DISPLAY_STATE = 0x0F35 + 0x10000000 + 0x01000000
+ 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC
@@ -2613,8 +2626,8 @@
* and it only supports CALL UI only when the cellular network is available. Then, if the
* nework is avaibale, it'll send [1 1 1], and if it's out of network, it'll send [1 1 0].
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
*/
CLUSTER_REPORT_STATE = 0x0F36 + 0x10000000 + 0x01000000
+ 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED
@@ -2627,8 +2640,8 @@
*
* int32: the type of ClusterUI to show
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
*/
CLUSTER_REQUEST_DISPLAY = 0x0F37 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
@@ -2637,8 +2650,8 @@
*
* bytes: the serialized message of NavigationStateProto.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.WRITE
*/
CLUSTER_NAVIGATION_STATE = 0x0F38 + 0x10000000 + 0x01000000
+ 0x00700000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BYTES
@@ -2649,8 +2662,8 @@
* If the head unit is aware of an ETC card attached to the vehicle, this property should
* return the type of card attached; otherwise, this property should be UNAVAILABLE.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum ElectronicTollCollectionCardType
*/
ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = 0x0F39 + 0x10000000 + 0x01000000
@@ -2663,8 +2676,8 @@
* ELECTRONIC_TOLL_COLLECTION_CARD_TYPE gives that status of the card; otherwise,
* this property should be UNAVAILABLE.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum ElectronicTollCollectionCardStatus
*/
ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = 0x0F3A + 0x10000000 + 0x01000000
@@ -2676,8 +2689,8 @@
* Only one of FOG_LIGHTS_STATE or FRONT_FOG_LIGHTS_STATE must be implemented. Please refer to
* the documentation on FOG_LIGHTS_STATE for more information.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleLightState
*/
FRONT_FOG_LIGHTS_STATE = 0x0F3B + 0x10000000 + 0x01000000
@@ -2690,8 +2703,8 @@
* Only one of FOG_LIGHTS_SWITCH or FRONT_FOG_LIGHTS_SWITCH must be implemented. Please refer to
* the documentation on FOG_LIGHTS_SWITCH for more information.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleLightSwitch
*/
FRONT_FOG_LIGHTS_SWITCH = 0x0F3C + 0x10000000 + 0x01000000
@@ -2704,8 +2717,8 @@
* Only one of FOG_LIGHTS_STATE or REAR_FOG_LIGHTS_STATE must be implemented. Please refer to
* the documentation on FOG_LIGHTS_STATE for more information.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum VehicleLightState
*/
REAR_FOG_LIGHTS_STATE = 0x0F3D + 0x10000000 + 0x01000000
@@ -2718,8 +2731,8 @@
* Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented. Please refer to
* the documentation on FOG_LIGHTS_SWITCH for more information.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @data_enum VehicleLightSwitch
*/
REAR_FOG_LIGHTS_SWITCH = 0x0F3E + 0x10000000 + 0x01000000
@@ -2731,8 +2744,8 @@
* configArray[0] is used to specify the max current draw allowed by
* the vehicle in Amperes.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
* @unit VehicleUnit:AMPERE
*/
EV_CHARGE_CURRENT_DRAW_LIMIT = 0x0F3F + 0x10000000 + 0x01000000
@@ -2749,8 +2762,8 @@
* then the configArray should be {20, 40, 60, 80, 100}
* If the configArray is empty then all values from 0 to 100 must be valid.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
EV_CHARGE_PERCENT_LIMIT = 0x0F40 + 0x10000000 + 0x01000000
+ 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT
@@ -2760,8 +2773,8 @@
*
* Returns the current charging state of the car.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum EvChargeState
*/
EV_CHARGE_STATE = 0x0F41 + 0x10000000 + 0x01000000
@@ -2773,8 +2786,8 @@
* The setting that the user wants. Setting this property to true starts the battery charging
* and setting to false stops charging.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ_WRITE
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ_WRITE
*/
EV_CHARGE_SWITCH = 0x0F42 + 0x10000000 + 0x01000000
+ 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN
@@ -2784,8 +2797,8 @@
*
* Returns 0 if the vehicle is not charging.
*
- * @change_mode VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.CONTINUOUS
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:SECS
*/
EV_CHARGE_TIME_REMAINING = 0x0F43 + 0x10000000 + 0x01000000
@@ -2797,8 +2810,8 @@
* Returns the current state associated with the regenerative braking
* setting in the car
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum EvRegenerativeBrakingState
*/
EV_REGENERATIVE_BRAKING_STATE = 0x0F44 + 0x10000000 + 0x01000000
@@ -2809,8 +2822,8 @@
*
* Returns the trailer state of the car.
*
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+ * @access VehiclePropertyAccess.READ
* @data_enum TrailerState
*/
TRAILER_PRESENT = 0x0F45 + 0x10000000 + 0x01000000
@@ -2832,12 +2845,49 @@
* engine fluids, fuel, accessories, driver, passengers and cargo but excluding
* that of any trailers.
*
- * @change_mode VehiclePropertyChangeMode:STATIC
- * @access VehiclePropertyAccess:READ
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
* @unit VehicleUnit:KILOGRAM
*/
VEHICLE_CURB_WEIGHT = 0x0F46 + 0x10000000 + 0x01000000
+ 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
+ /**
+ * EU's General security regulation compliance requirement.
+ *
+ * Returns whether general security regulation compliance is required, if
+ * so, what type of requirement.
+ *
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
+ * @data_enum GsrComplianceRequirementType
+ */
+ GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 0x0F47 + 0x10000000 + 0x01000000
+ + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32
+
+ /**
+ * (Deprecated) List of all supported property IDs.
+ *
+ * A list of all supported property IDs (including this property). This property is required for
+ * HIDL VHAL to work with large amount of vehicle prop configs where the getAllPropConfigs
+ * payload exceeds the binder limitation. This issue is fixed in AIDL version using
+ * LargeParcelable in getAllPropConfigs, so this property is deprecated.
+ *
+ * In HIDL VHAL implementation, if the amount of data returned in getAllPropConfigs exceeds the
+ * binder limitation, vendor must support this property and return all the supported property
+ * IDs. Car service will divide this list into smaller sub lists and use getPropConfigs([ids])
+ * to query the sub lists. The results will be merged together in Car Service.
+ *
+ * The config array for this property must contain one int element which is the number of
+ * configs per getPropConfigs request by Car Service. This number must be small enough so that
+ * each getPropConfigs payload will not exceed binder limitation, however, a smaller number will
+ * cause more requests, which increase overhead to fetch all the configs.
+ *
+ * @change_mode VehiclePropertyChangeMode.STATIC
+ * @access VehiclePropertyAccess.READ
+ */
+ SUPPORTED_PROPERTY_IDS = 0x0F48 + 0x10000000 + 0x01000000
+ + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC
+
}
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
new file mode 100644
index 0000000..c91afe2
--- /dev/null
+++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+/**
+ * DO NOT EDIT MANUALLY!!!
+ *
+ * Generated by tools/generate_annotation_enums.py.
+ */
+
+#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
+#define android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
+
+#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
+#include <aidl/android/hardware/automotive/vehicle/VehiclePropertyAccess.h>
+
+#include <unordered_map>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+std::unordered_map<VehicleProperty, VehiclePropertyAccess> AccessForVehicleProperty = {
+ {VehicleProperty::INFO_VIN, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_MAKE, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_MODEL, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_MODEL_YEAR, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_FUEL_CAPACITY, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_FUEL_TYPE, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_EV_BATTERY_CAPACITY, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_EV_CONNECTOR_TYPE, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_FUEL_DOOR_LOCATION, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_EV_PORT_LOCATION, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_DRIVER_SEAT, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_EXTERIOR_DIMENSIONS, VehiclePropertyAccess::READ},
+ {VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyAccess::READ},
+ {VehicleProperty::PERF_ODOMETER, VehiclePropertyAccess::READ},
+ {VehicleProperty::PERF_VEHICLE_SPEED, VehiclePropertyAccess::READ},
+ {VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyAccess::READ},
+ {VehicleProperty::PERF_STEERING_ANGLE, VehiclePropertyAccess::READ},
+ {VehicleProperty::PERF_REAR_STEERING_ANGLE, VehiclePropertyAccess::READ},
+ {VehicleProperty::ENGINE_COOLANT_TEMP, VehiclePropertyAccess::READ},
+ {VehicleProperty::ENGINE_OIL_LEVEL, VehiclePropertyAccess::READ},
+ {VehicleProperty::ENGINE_OIL_TEMP, VehiclePropertyAccess::READ},
+ {VehicleProperty::ENGINE_RPM, VehiclePropertyAccess::READ},
+ {VehicleProperty::WHEEL_TICK, VehiclePropertyAccess::READ},
+ {VehicleProperty::FUEL_LEVEL, VehiclePropertyAccess::READ},
+ {VehicleProperty::FUEL_DOOR_OPEN, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EV_BATTERY_LEVEL, VehiclePropertyAccess::READ},
+ {VehicleProperty::EV_CHARGE_PORT_OPEN, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess::READ},
+ {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::RANGE_REMAINING, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::TIRE_PRESSURE, VehiclePropertyAccess::READ},
+ {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess::READ},
+ {VehicleProperty::GEAR_SELECTION, VehiclePropertyAccess::READ},
+ {VehicleProperty::CURRENT_GEAR, VehiclePropertyAccess::READ},
+ {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyAccess::READ},
+ {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, VehiclePropertyAccess::READ},
+ {VehicleProperty::FUEL_LEVEL_LOW, VehiclePropertyAccess::READ},
+ {VehicleProperty::NIGHT_MODE, VehiclePropertyAccess::READ},
+ {VehicleProperty::TURN_SIGNAL_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::IGNITION_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::ABS_ACTIVE, VehiclePropertyAccess::READ},
+ {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess::READ},
+ {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess::READ},
+ {VehicleProperty::HVAC_TEMPERATURE_SET, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_DEFROSTER, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_AC_ON, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_MAX_AC_ON, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_MAX_DEFROST_ON, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_RECIRC_ON, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_DUAL_ON, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_AUTO_ON, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_SEAT_TEMPERATURE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_SIDE_MIRROR_HEAT, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_STEERING_WHEEL_HEAT, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyAccess::READ},
+ {VehicleProperty::HVAC_POWER_ON, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyAccess::READ},
+ {VehicleProperty::HVAC_AUTO_RECIRC_ON, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_SEAT_VENTILATION, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::DISTANCE_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EV_BATTERY_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EXTERNAL_CAR_TIME, VehiclePropertyAccess::READ},
+ {VehicleProperty::ANDROID_EPOCH_TIME, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::ENV_OUTSIDE_TEMPERATURE, VehiclePropertyAccess::READ},
+ {VehicleProperty::AP_POWER_STATE_REQ, VehiclePropertyAccess::READ},
+ {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyAccess::READ},
+ {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HW_KEY_INPUT, VehiclePropertyAccess::READ},
+ {VehicleProperty::HW_ROTARY_INPUT, VehiclePropertyAccess::READ},
+ {VehicleProperty::HW_CUSTOM_INPUT, VehiclePropertyAccess::READ},
+ {VehicleProperty::DOOR_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::DOOR_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::DOOR_LOCK, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::MIRROR_Z_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::MIRROR_Z_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::MIRROR_Y_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::MIRROR_Y_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::MIRROR_LOCK, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::MIRROR_FOLD, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_MEMORY_SELECT, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::SEAT_MEMORY_SET, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::SEAT_BELT_BUCKLED, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_BELT_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_BELT_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_DEPTH_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_TILT_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_TILT_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_HEADREST_ANGLE_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ},
+ {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ},
+ {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ},
+ {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess::READ},
+ {VehicleProperty::OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::HEADLIGHTS_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::HIGH_BEAM_LIGHTS_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::FOG_LIGHTS_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::HAZARD_LIGHTS_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::HEADLIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::FOG_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::HAZARD_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::CABIN_LIGHTS_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::CABIN_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess::READ},
+ {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess::READ},
+ {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::SWITCH_USER, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::CREATE_USER, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::REMOVE_USER, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EVS_SERVICE_REQUEST, VehiclePropertyAccess::READ},
+ {VehicleProperty::POWER_POLICY_REQ, VehiclePropertyAccess::READ},
+ {VehicleProperty::POWER_POLICY_GROUP_REQ, VehiclePropertyAccess::READ},
+ {VehicleProperty::CURRENT_POWER_POLICY, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::WATCHDOG_ALIVE, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::WATCHDOG_TERMINATED_PROCESS, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::VHAL_HEARTBEAT, VehiclePropertyAccess::READ},
+ {VehicleProperty::CLUSTER_SWITCH_UI, VehiclePropertyAccess::READ},
+ {VehicleProperty::CLUSTER_DISPLAY_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::CLUSTER_REPORT_STATE, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::CLUSTER_REQUEST_DISPLAY, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::CLUSTER_NAVIGATION_STATE, VehiclePropertyAccess::WRITE},
+ {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyAccess::READ},
+ {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyAccess::READ},
+ {VehicleProperty::FRONT_FOG_LIGHTS_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::REAR_FOG_LIGHTS_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::REAR_FOG_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EV_CHARGE_PERCENT_LIMIT, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EV_CHARGE_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::EV_CHARGE_SWITCH, VehiclePropertyAccess::READ_WRITE},
+ {VehicleProperty::EV_CHARGE_TIME_REMAINING, VehiclePropertyAccess::READ},
+ {VehicleProperty::EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyAccess::READ},
+ {VehicleProperty::TRAILER_PRESENT, VehiclePropertyAccess::READ},
+ {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyAccess::READ},
+ {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess::READ},
+ {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ},
+};
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+} // aidl
+
+#endif // android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
diff --git a/automotive/vehicle/aidl/impl/default_config/Android.bp b/automotive/vehicle/aidl/generated_lib/cpp/Android.bp
similarity index 61%
rename from automotive/vehicle/aidl/impl/default_config/Android.bp
rename to automotive/vehicle/aidl/generated_lib/cpp/Android.bp
index 0feaf23..11d3693 100644
--- a/automotive/vehicle/aidl/impl/default_config/Android.bp
+++ b/automotive/vehicle/aidl/generated_lib/cpp/Android.bp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 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.
@@ -19,13 +19,9 @@
}
cc_library_headers {
- name: "VehicleHalDefaultConfig",
- vendor: true,
- local_include_dirs: ["include"],
- export_include_dirs: ["include"],
- defaults: ["VehicleHalDefaults"],
- static_libs: ["VehicleHalUtils"],
- header_libs: ["VehicleHalTestUtilHeaders"],
- export_static_lib_headers: ["VehicleHalUtils"],
- export_header_lib_headers: ["VehicleHalTestUtilHeaders"],
+ name: "IVehicleGeneratedHeaders",
+ vendor_available: true,
+ local_include_dirs: ["."],
+ export_include_dirs: ["."],
+ defaults: ["VehicleHalInterfaceDefaults"],
}
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
new file mode 100644
index 0000000..807be5d
--- /dev/null
+++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+/**
+ * DO NOT EDIT MANUALLY!!!
+ *
+ * Generated by tools/generate_annotation_enums.py.
+ */
+
+#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
+#define android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
+
+#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
+#include <aidl/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.h>
+
+#include <unordered_map>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+std::unordered_map<VehicleProperty, VehiclePropertyChangeMode> ChangeModeForVehicleProperty = {
+ {VehicleProperty::INFO_VIN, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_MAKE, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_MODEL, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_MODEL_YEAR, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_FUEL_CAPACITY, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_FUEL_TYPE, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_EV_BATTERY_CAPACITY, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_EV_CONNECTOR_TYPE, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_FUEL_DOOR_LOCATION, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_EV_PORT_LOCATION, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_DRIVER_SEAT, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_EXTERIOR_DIMENSIONS, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::PERF_ODOMETER, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::PERF_VEHICLE_SPEED, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::PERF_STEERING_ANGLE, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::PERF_REAR_STEERING_ANGLE, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::ENGINE_COOLANT_TEMP, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::ENGINE_OIL_LEVEL, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::ENGINE_OIL_TEMP, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::ENGINE_RPM, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::WHEEL_TICK, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::FUEL_LEVEL, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::FUEL_DOOR_OPEN, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EV_BATTERY_LEVEL, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::EV_CHARGE_PORT_OPEN, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::RANGE_REMAINING, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::TIRE_PRESSURE, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::GEAR_SELECTION, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CURRENT_GEAR, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::FUEL_LEVEL_LOW, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::NIGHT_MODE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::TURN_SIGNAL_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::IGNITION_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::ABS_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_TEMPERATURE_SET, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_DEFROSTER, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_AC_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_MAX_AC_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_MAX_DEFROST_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_RECIRC_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_DUAL_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_AUTO_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_SEAT_TEMPERATURE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_SIDE_MIRROR_HEAT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_STEERING_WHEEL_HEAT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_POWER_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::HVAC_AUTO_RECIRC_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_SEAT_VENTILATION, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::DISTANCE_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EV_BATTERY_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EXTERNAL_CAR_TIME, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::ANDROID_EPOCH_TIME, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::ENV_OUTSIDE_TEMPERATURE, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::AP_POWER_STATE_REQ, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HW_KEY_INPUT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HW_ROTARY_INPUT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HW_CUSTOM_INPUT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::DOOR_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::DOOR_LOCK, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::MIRROR_Z_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::MIRROR_Z_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::MIRROR_Y_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::MIRROR_Y_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::MIRROR_LOCK, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::MIRROR_FOLD, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_MEMORY_SELECT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_MEMORY_SET, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_BELT_BUCKLED, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_BELT_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_BELT_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_TILT_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_TILT_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_HEADREST_ANGLE_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HEADLIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HIGH_BEAM_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::FOG_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HAZARD_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HEADLIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::HAZARD_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CABIN_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CABIN_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::SWITCH_USER, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CREATE_USER, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::REMOVE_USER, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EVS_SERVICE_REQUEST, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::POWER_POLICY_REQ, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::POWER_POLICY_GROUP_REQ, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CURRENT_POWER_POLICY, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::WATCHDOG_ALIVE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::WATCHDOG_TERMINATED_PROCESS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::VHAL_HEARTBEAT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CLUSTER_SWITCH_UI, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CLUSTER_DISPLAY_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CLUSTER_REPORT_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CLUSTER_REQUEST_DISPLAY, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::CLUSTER_NAVIGATION_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::FRONT_FOG_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::REAR_FOG_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::REAR_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EV_CHARGE_PERCENT_LIMIT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EV_CHARGE_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EV_CHARGE_SWITCH, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::EV_CHARGE_TIME_REMAINING, VehiclePropertyChangeMode::CONTINUOUS},
+ {VehicleProperty::EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::TRAILER_PRESENT, VehiclePropertyChangeMode::ON_CHANGE},
+ {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode::STATIC},
+ {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC},
+};
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+} // aidl
+
+#endif // android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
new file mode 100644
index 0000000..e698f84
--- /dev/null
+++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+/**
+ * DO NOT EDIT MANUALLY!!!
+ *
+ * Generated by tools/generate_annotation_enums.py.
+ */
+
+package android.hardware.automotive.vehicle;
+
+import java.util.Map;
+
+public final class AccessForVehicleProperty {
+
+ public static final Map<Integer, Integer> values = Map.ofEntries(
+ Map.entry(VehicleProperty.INFO_VIN, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_MAKE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_MODEL, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_MODEL_YEAR, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_FUEL_CAPACITY, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_FUEL_TYPE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_EV_BATTERY_CAPACITY, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_EV_CONNECTOR_TYPE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_FUEL_DOOR_LOCATION, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_EV_PORT_LOCATION, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_DRIVER_SEAT, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_EXTERIOR_DIMENSIONS, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.PERF_ODOMETER, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.PERF_VEHICLE_SPEED, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.PERF_STEERING_ANGLE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.PERF_REAR_STEERING_ANGLE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.ENGINE_COOLANT_TEMP, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.ENGINE_OIL_LEVEL, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.ENGINE_OIL_TEMP, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.ENGINE_RPM, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.WHEEL_TICK, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.FUEL_LEVEL, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.FUEL_DOOR_OPEN, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.EV_CHARGE_PORT_OPEN, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.PARKING_BRAKE_AUTO_APPLY, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.FUEL_LEVEL_LOW, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.NIGHT_MODE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.TURN_SIGNAL_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.IGNITION_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_DEFROSTER, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_AC_ON, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_MAX_AC_ON, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_MAX_DEFROST_ON, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_RECIRC_ON, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_DUAL_ON, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_AUTO_ON, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_SEAT_TEMPERATURE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_SIDE_MIRROR_HEAT, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_STEERING_WHEEL_HEAT, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HVAC_POWER_ON, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HVAC_AUTO_RECIRC_ON, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_SEAT_VENTILATION, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.DISTANCE_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EV_BATTERY_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EXTERNAL_CAR_TIME, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.ANDROID_EPOCH_TIME, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.ENV_OUTSIDE_TEMPERATURE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.AP_POWER_STATE_REQ, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HW_ROTARY_INPUT, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HW_CUSTOM_INPUT, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.DOOR_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.DOOR_LOCK, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.MIRROR_Z_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.MIRROR_Z_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.MIRROR_Y_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.MIRROR_Y_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.MIRROR_LOCK, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.MIRROR_FOLD, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_MEMORY_SELECT, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.SEAT_MEMORY_SET, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.SEAT_BELT_BUCKLED, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_DEPTH_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_TILT_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_TILT_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.HEADLIGHTS_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.FOG_LIGHTS_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HAZARD_LIGHTS_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.HEADLIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.FOG_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.HAZARD_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.CABIN_LIGHTS_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.SWITCH_USER, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.CREATE_USER, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.REMOVE_USER, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EVS_SERVICE_REQUEST, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.POWER_POLICY_REQ, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.POWER_POLICY_GROUP_REQ, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.CURRENT_POWER_POLICY, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.WATCHDOG_ALIVE, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.WATCHDOG_TERMINATED_PROCESS, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.VHAL_HEARTBEAT, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.CLUSTER_SWITCH_UI, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.CLUSTER_DISPLAY_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.CLUSTER_REPORT_STATE, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.CLUSTER_REQUEST_DISPLAY, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.CLUSTER_NAVIGATION_STATE, VehiclePropertyAccess.WRITE),
+ Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.REAR_FOG_LIGHTS_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.REAR_FOG_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EV_CHARGE_PERCENT_LIMIT, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EV_CHARGE_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.EV_CHARGE_SWITCH, VehiclePropertyAccess.READ_WRITE),
+ Map.entry(VehicleProperty.EV_CHARGE_TIME_REMAINING, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess.READ),
+ Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ)
+ );
+
+}
diff --git a/automotive/vehicle/aidl/generated_lib/java/Android.bp b/automotive/vehicle/aidl/generated_lib/java/Android.bp
new file mode 100644
index 0000000..1d612e8
--- /dev/null
+++ b/automotive/vehicle/aidl/generated_lib/java/Android.bp
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2022 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+filegroup {
+ name: "IVehicleGeneratedJavaFiles",
+ srcs: [
+ "*.java",
+ ],
+}
diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
new file mode 100644
index 0000000..fe69450
--- /dev/null
+++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+/**
+ * DO NOT EDIT MANUALLY!!!
+ *
+ * Generated by tools/generate_annotation_enums.py.
+ */
+
+package android.hardware.automotive.vehicle;
+
+import java.util.Map;
+
+public final class ChangeModeForVehicleProperty {
+
+ public static final Map<Integer, Integer> values = Map.ofEntries(
+ Map.entry(VehicleProperty.INFO_VIN, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_MAKE, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_MODEL, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_MODEL_YEAR, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_FUEL_CAPACITY, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_FUEL_TYPE, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_EV_BATTERY_CAPACITY, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_EV_CONNECTOR_TYPE, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_FUEL_DOOR_LOCATION, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_EV_PORT_LOCATION, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_DRIVER_SEAT, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_EXTERIOR_DIMENSIONS, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.PERF_ODOMETER, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.PERF_VEHICLE_SPEED, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.PERF_STEERING_ANGLE, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.PERF_REAR_STEERING_ANGLE, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.ENGINE_COOLANT_TEMP, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.ENGINE_OIL_LEVEL, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.ENGINE_OIL_TEMP, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.ENGINE_RPM, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.WHEEL_TICK, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.FUEL_LEVEL, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.FUEL_DOOR_OPEN, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.EV_CHARGE_PORT_OPEN, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.PARKING_BRAKE_AUTO_APPLY, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.FUEL_LEVEL_LOW, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.NIGHT_MODE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.TURN_SIGNAL_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.IGNITION_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_DEFROSTER, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_AC_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_MAX_AC_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_MAX_DEFROST_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_RECIRC_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_DUAL_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_AUTO_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_SEAT_TEMPERATURE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_SIDE_MIRROR_HEAT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_STEERING_WHEEL_HEAT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_POWER_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.HVAC_AUTO_RECIRC_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_SEAT_VENTILATION, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.DISTANCE_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EV_BATTERY_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EXTERNAL_CAR_TIME, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.ANDROID_EPOCH_TIME, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.ENV_OUTSIDE_TEMPERATURE, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.AP_POWER_STATE_REQ, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HW_ROTARY_INPUT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HW_CUSTOM_INPUT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.DOOR_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.DOOR_LOCK, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.MIRROR_Z_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.MIRROR_Z_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.MIRROR_Y_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.MIRROR_Y_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.MIRROR_LOCK, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.MIRROR_FOLD, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_MEMORY_SELECT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_MEMORY_SET, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_BELT_BUCKLED, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_TILT_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_TILT_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HEADLIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.FOG_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HAZARD_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HEADLIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.HAZARD_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CABIN_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.SWITCH_USER, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CREATE_USER, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.REMOVE_USER, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EVS_SERVICE_REQUEST, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.POWER_POLICY_REQ, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.POWER_POLICY_GROUP_REQ, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CURRENT_POWER_POLICY, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.WATCHDOG_ALIVE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.WATCHDOG_TERMINATED_PROCESS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.VHAL_HEARTBEAT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CLUSTER_SWITCH_UI, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CLUSTER_DISPLAY_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CLUSTER_REPORT_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CLUSTER_REQUEST_DISPLAY, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.CLUSTER_NAVIGATION_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.REAR_FOG_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.REAR_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EV_CHARGE_PERCENT_LIMIT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EV_CHARGE_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EV_CHARGE_SWITCH, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.EV_CHARGE_TIME_REMAINING, VehiclePropertyChangeMode.CONTINUOUS),
+ Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyChangeMode.ON_CHANGE),
+ Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode.STATIC),
+ Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC)
+ );
+
+}
diff --git a/automotive/vehicle/aidl/impl/Android.bp b/automotive/vehicle/aidl/impl/Android.bp
index d24a739..73f7df0 100644
--- a/automotive/vehicle/aidl/impl/Android.bp
+++ b/automotive/vehicle/aidl/impl/Android.bp
@@ -19,10 +19,16 @@
}
cc_defaults {
+ name: "VehicleHalInterfaceDefaults",
+ static_libs: [
+ "android.hardware.automotive.vehicle-V2-ndk",
+ ],
+}
+
+cc_defaults {
name: "VehicleHalDefaults",
static_libs: [
"android-automotive-large-parcelable-lib",
- "android.hardware.automotive.vehicle-V1-ndk",
"libmath",
],
shared_libs: [
@@ -37,6 +43,7 @@
"-Wthread-safety",
],
defaults: [
+ "VehicleHalInterfaceDefaults",
"android-automotive-large-parcelable-defaults",
],
}
diff --git a/automotive/vehicle/aidl/impl/README.md b/automotive/vehicle/aidl/impl/README.md
new file mode 100644
index 0000000..121ffd1
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/README.md
@@ -0,0 +1,58 @@
+# AIDL VHAL libraries and reference implementation.
+---
+
+This directory stores the libraries useful for implementing vendor AIDL VHAL.
+This directory also stores a reference fake implementation for AIDL VHAL.
+
+## default_config
+
+Stores the default vehicle property configurations for reference vehicle HAL.
+Vendor implementation could copy this library but must update the configuration
+to meet their own requirements, e.g. enable or disable certain properties or
+update the initial value for certain properties.
+
+## fake_impl
+
+Contains libraries used specifically for the fake reference VHAL implementation.
+These libraries are for test only and must not be directly used for vendor
+VHAL implementation.
+
+These libraries contain test-spcific logic and must not run directly on a real
+vehicle.
+
+## grpc
+
+Stores code for GRPC based VHAL implementation.
+
+## hardware
+
+Defines an interface `IVehicleHardware.h` which vendor must implement for
+vehicle-specific logic if they want to follow our reference VHAL design.
+
+## proto
+
+Stores Some protobuf files translated from AIDL VHAL interface types. These
+files are used in GRPC VHAL implementation.
+
+## utils
+
+Defines a library `VehicleHalUtils` which provides useful utility functions for
+VHAL implementation. Vendor VHAL could use this library.
+
+## vhal
+
+Defines a library `DefaultVehicleHal` which provides generic logic for all VHAL
+implementations (including reference VHAL). Vendor VHAL implementation could
+use this library, along with their own implementation for `IVehicleHardware`
+interface.
+
+Also defines a binary `android.hardware.automotive.vehicle@V1-default-service`
+which is the reference VHAL implementation. It implements `IVehicle.aidl`
+interface. It uses `DefaultVehicleHal`, along with `FakeVehicleHardware`
+(in fake_impl). It simulates the vehicle bus interaction by using an
+in-memory map. Meaning that all properties (except for some special ones) are
+just written into a hash map and read from a hash map without relying on any
+hardware. As a result, the reference implementation can run on emulator or
+any host environment.
+
+Vendor must not directly use the reference implementation for a real vehicle.
\ No newline at end of file
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp
new file mode 100644
index 0000000..6984d5e
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2022 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_library {
+ name: "VehicleHalJsonConfigLoader",
+ vendor: true,
+ srcs: ["src/*.cpp"],
+ local_include_dirs: ["include"],
+ export_include_dirs: ["include"],
+ defaults: ["VehicleHalDefaults"],
+ static_libs: ["VehicleHalUtils"],
+ header_libs: [
+ "IVehicleGeneratedHeaders",
+ ],
+ shared_libs: ["libjsoncpp"],
+}
+
+cc_library {
+ name: "VehicleHalJsonConfigLoaderEnableTestProperties",
+ vendor: true,
+ srcs: ["src/*.cpp"],
+ local_include_dirs: ["include"],
+ export_include_dirs: ["include"],
+ defaults: ["VehicleHalDefaults"],
+ static_libs: ["VehicleHalUtils"],
+ header_libs: [
+ "VehicleHalTestUtilHeaders",
+ "IVehicleGeneratedHeaders",
+ ],
+ cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"],
+ shared_libs: ["libjsoncpp"],
+}
+
+cc_library_headers {
+ name: "VehicleHalJsonConfigLoaderHeaders",
+ vendor: true,
+ local_include_dirs: ["include"],
+ export_include_dirs: ["include"],
+ defaults: ["VehicleHalDefaults"],
+ static_libs: ["VehicleHalUtils"],
+ header_libs: [
+ "IVehicleGeneratedHeaders",
+ ],
+ shared_libs: ["libjsoncpp"],
+}
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/ConfigDeclaration.h b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/ConfigDeclaration.h
new file mode 100644
index 0000000..40ac129
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/ConfigDeclaration.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#ifndef android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_ConfigDeclaration_H_
+#define android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_ConfigDeclaration_H_
+
+#include <VehicleHalTypes.h>
+
+#include <unordered_map>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+// ConfigDeclaration represents one property config, its optional initial value and its optional
+// area configs and initial values for each area.
+struct ConfigDeclaration {
+ aidl::android::hardware::automotive::vehicle::VehiclePropConfig config;
+
+ // This value will be used as an initial value for the property. If this field is specified for
+ // property that supports multiple areas then it will be used for all areas unless particular
+ // area is overridden in initialAreaValue field.
+ aidl::android::hardware::automotive::vehicle::RawPropValues initialValue;
+ // Use initialAreaValues if it is necessary to specify different values per each area.
+ std::unordered_map<int32_t, aidl::android::hardware::automotive::vehicle::RawPropValues>
+ initialAreaValues;
+
+ inline bool operator==(const ConfigDeclaration& other) const {
+ return (config == other.config && initialValue == other.initialValue &&
+ initialAreaValues == other.initialAreaValues);
+ }
+
+ friend std::ostream& operator<<(std::ostream& os, const ConfigDeclaration& c) {
+ return os << "Config Declaration for property: "
+ << aidl::android::hardware::automotive::vehicle::toString(
+ static_cast<
+ aidl::android::hardware::automotive::vehicle::VehicleProperty>(
+ c.config.prop));
+ }
+};
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_ConfigDeclaration_H_
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h
new file mode 100644
index 0000000..f3bdbd2
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#ifndef android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_JsonConfigLoader_H_
+#define android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_JsonConfigLoader_H_
+
+#include <ConfigDeclaration.h>
+#include <VehicleHalTypes.h>
+
+#include <android-base/result.h>
+#include <json/json.h>
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+// private namespace
+namespace jsonconfigloader_impl {
+
+// An abstract interface that represents a ValueParser for any constant value types.
+class ConstantParserInterface {
+ public:
+ // Parses a constant variable name to its actual value.
+ virtual android::base::Result<int> parseValue(const std::string& name) const = 0;
+ virtual ~ConstantParserInterface() = default;
+};
+
+// A class to parse a value field in JSON config file.
+// If the field is a string and the field is in the format of "XX::XX", the value will be parsed
+// as a constant value in the format of "TYPE::NAME". Otherwise, the field will be return as is
+// converted to the expected type.
+class JsonValueParser final {
+ public:
+ JsonValueParser();
+
+ android::base::Result<std::string> parseStringValue(const std::string& fieldName,
+ const Json::Value& value) const;
+
+ template <class T>
+ android::base::Result<std::vector<T>> parseArray(const std::string& fieldName,
+ const Json::Value& value) const;
+
+ template <class T>
+ android::base::Result<T> parseValue(const std::string& fieldName,
+ const Json::Value& value) const;
+
+ private:
+ template <class T>
+ static android::base::Result<T> convertValueToType(const std::string& fieldName,
+ const Json::Value& value);
+
+ std::optional<std::pair<std::string, std::string>> maybeGetTypeAndValueName(
+ const std::string& jsonFieldValue) const;
+
+ android::base::Result<int> parseConstantValue(
+ const std::pair<std::string, std::string>& typeValueName) const;
+
+ const ConstantParserInterface* getParser(const std::string& type) const {
+ auto it = mConstantParsersByType.find(type);
+ if (it == mConstantParsersByType.end()) {
+ return nullptr;
+ }
+ return it->second.get();
+ }
+
+ private:
+ inline static const std::string DELIMITER = "::";
+ std::unordered_map<std::string, std::unique_ptr<ConstantParserInterface>>
+ mConstantParsersByType;
+};
+
+// The main class to parse a VHAL config file in JSON format.
+class JsonConfigParser {
+ public:
+ android::base::Result<std::unordered_map<int32_t, ConfigDeclaration>> parseJsonConfig(
+ std::istream& is);
+
+ private:
+ JsonValueParser mValueParser;
+
+ // Parses configuration for each property.
+ std::optional<ConfigDeclaration> parseEachProperty(const Json::Value& propJsonValue,
+ std::vector<std::string>* errors);
+ // Tries to parse a JSON value to a specific type.
+ //
+ // If fieldIsOptional is True, then if the field specified by "fieldName" does not exist,
+ // this method will return true without doing anything, otherwise, it will return false.
+ //
+ // @param parentJsonNode The parent node of the field you are going to parse.
+ // @param fieldName The name for the field.
+ // @param fieldIsOptional Whether the field is optional.
+ // @param outPtr The pointer to output to if the field exists and parsing succeeded.
+ // @param errors The error array to append error to if errors are found.
+ // @return true if the field is optional and does not exist or parsed successfully.
+ template <class T>
+ bool tryParseJsonValueToVariable(const Json::Value& parentJsonNode,
+ const std::string& fieldName, bool fieldIsOptional, T* outPtr,
+ std::vector<std::string>* errors);
+ // Tries to parse a JSON value to an array of specific type.
+ //
+ // If fieldIsOptional is True, then if the field specified by "fieldName" does not exist,
+ // this method will return true without doing anything, otherwise, it will return false.
+ //
+ // @param parentJsonNode The parent node of the field you are going to parse.
+ // @param fieldName The name for the field.
+ // @param fieldIsOptional Whether the field is optional.
+ // @param outPtr The pointer to output to if the field exists and parsing succeeded.
+ // @param errors The error array to append error to if errors are found.
+ // @return true if the field is optional and does not exist or parsed successfully.
+ template <class T>
+ bool tryParseJsonArrayToVariable(const Json::Value& parentJsonNode,
+ const std::string& fieldName, bool fieldIsOptional,
+ std::vector<T>* outPtr, std::vector<std::string>* errors);
+ // Parses a JSON field to VehiclePropertyAccess or VehiclePropertyChangeMode.
+ template <class T>
+ void parseAccessChangeMode(
+ const Json::Value& parentJsonNode, const std::string& fieldName, int propId,
+ const std::string& propStr,
+ const std::unordered_map<aidl::android::hardware::automotive::vehicle::VehicleProperty,
+ T>& defaultMap,
+ T* outPtr, std::vector<std::string>* errors);
+
+ // Parses a JSON field to RawPropValues.
+ //
+ // @return True if the field exist and can be parsed to a RawPropValues.
+ bool parsePropValues(const Json::Value& parentJsonNode, const std::string& fieldName,
+ aidl::android::hardware::automotive::vehicle::RawPropValues* outPtr,
+ std::vector<std::string>* errors);
+
+ // Prase a JSON field as an array of area configs.
+ void parseAreas(const Json::Value& parentJsonNode, const std::string& fieldName,
+ ConfigDeclaration* outPtr, std::vector<std::string>* errors);
+};
+
+} // namespace jsonconfigloader_impl
+
+// A class to load vehicle property configs and initial values in JSON format.
+class JsonConfigLoader final {
+ public:
+ JsonConfigLoader();
+
+ // Loads a JSON file stream and parses it to a map from propId to ConfigDeclarations.
+ android::base::Result<std::unordered_map<int32_t, ConfigDeclaration>> loadPropConfig(
+ std::istream& is);
+
+ // Loads a JSON config file and parses it to a map from propId to ConfigDeclarations.
+ android::base::Result<std::unordered_map<int32_t, ConfigDeclaration>> loadPropConfig(
+ const std::string& configPath);
+
+ private:
+ std::unique_ptr<jsonconfigloader_impl::JsonConfigParser> mParser;
+};
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_JsonConfigLoader_H_
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
new file mode 100644
index 0000000..e4f13e8
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
@@ -0,0 +1,566 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include <JsonConfigLoader.h>
+
+#include <AccessForVehicleProperty.h>
+#include <ChangeModeForVehicleProperty.h>
+#include <PropertyUtils.h>
+
+#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES
+#include <TestPropertyUtils.h>
+#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES
+
+#include <android-base/strings.h>
+#include <fstream>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+namespace jsonconfigloader_impl {
+
+using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty;
+using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty;
+using ::aidl::android::hardware::automotive::vehicle::EvConnectorType;
+using ::aidl::android::hardware::automotive::vehicle::EvsServiceState;
+using ::aidl::android::hardware::automotive::vehicle::EvsServiceType;
+using ::aidl::android::hardware::automotive::vehicle::FuelType;
+using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType;
+using ::aidl::android::hardware::automotive::vehicle::RawPropValues;
+using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
+using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq;
+using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig;
+using ::aidl::android::hardware::automotive::vehicle::VehicleAreaMirror;
+using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow;
+using ::aidl::android::hardware::automotive::vehicle::VehicleGear;
+using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection;
+using ::aidl::android::hardware::automotive::vehicle::VehicleIgnitionState;
+using ::aidl::android::hardware::automotive::vehicle::VehicleOilLevel;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig;
+using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode;
+using ::aidl::android::hardware::automotive::vehicle::VehicleSeatOccupancyState;
+using ::aidl::android::hardware::automotive::vehicle::VehicleTurnSignal;
+using ::aidl::android::hardware::automotive::vehicle::VehicleUnit;
+using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission;
+
+using ::android::base::Error;
+using ::android::base::Result;
+
+// Defines a map from constant names to constant values, the values defined here corresponds to
+// the "Constants::XXXX" used in JSON config file.
+const std::unordered_map<std::string, int> CONSTANTS_BY_NAME = {
+ {"DOOR_1_RIGHT", DOOR_1_RIGHT},
+ {"DOOR_1_LEFT", DOOR_1_LEFT},
+ {"DOOR_2_RIGHT", DOOR_2_RIGHT},
+ {"DOOR_2_LEFT", DOOR_2_LEFT},
+ {"DOOR_REAR", DOOR_REAR},
+ {"HVAC_ALL", HVAC_ALL},
+ {"HVAC_LEFT", HVAC_LEFT},
+ {"HVAC_RIGHT", HVAC_RIGHT},
+ {"VENDOR_EXTENSION_INT_PROPERTY", VENDOR_EXTENSION_INT_PROPERTY},
+ {"VENDOR_EXTENSION_BOOLEAN_PROPERTY", VENDOR_EXTENSION_BOOLEAN_PROPERTY},
+ {"VENDOR_EXTENSION_STRING_PROPERTY", VENDOR_EXTENSION_STRING_PROPERTY},
+ {"VENDOR_EXTENSION_FLOAT_PROPERTY", VENDOR_EXTENSION_FLOAT_PROPERTY},
+ {"WINDOW_1_LEFT", WINDOW_1_LEFT},
+ {"WINDOW_1_RIGHT", WINDOW_1_RIGHT},
+ {"WINDOW_2_LEFT", WINDOW_2_LEFT},
+ {"WINDOW_2_RIGHT", WINDOW_2_RIGHT},
+ {"WINDOW_ROOF_TOP_1", WINDOW_ROOF_TOP_1},
+ {"WINDOW_1_RIGHT_2_LEFT_2_RIGHT", WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT},
+ {"SEAT_1_LEFT", SEAT_1_LEFT},
+ {"SEAT_1_RIGHT", SEAT_1_RIGHT},
+ {"SEAT_2_LEFT", SEAT_2_LEFT},
+ {"SEAT_2_RIGHT", SEAT_2_RIGHT},
+ {"SEAT_2_CENTER", SEAT_2_CENTER},
+ {"WHEEL_REAR_RIGHT", WHEEL_REAR_RIGHT},
+ {"WHEEL_REAR_LEFT", WHEEL_REAR_LEFT},
+ {"WHEEL_FRONT_RIGHT", WHEEL_FRONT_RIGHT},
+ {"WHEEL_FRONT_LEFT", WHEEL_FRONT_LEFT},
+ {"CHARGE_PORT_FRONT_LEFT", CHARGE_PORT_FRONT_LEFT},
+ {"CHARGE_PORT_REAR_LEFT", CHARGE_PORT_REAR_LEFT},
+ {"FAN_DIRECTION_FLOOR", FAN_DIRECTION_FLOOR},
+ {"FAN_DIRECTION_FACE", FAN_DIRECTION_FACE},
+ {"FAN_DIRECTION_DEFROST", FAN_DIRECTION_DEFROST},
+ {"FAN_DIRECTION_FACE_FLOOR", FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR},
+ {"FAN_DIRECTION_FACE_DEFROST", FAN_DIRECTION_FACE | FAN_DIRECTION_DEFROST},
+ {"FAN_DIRECTION_FLOOR_DEFROST", FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST},
+ {"FAN_DIRECTION_FLOOR_DEFROST_FACE",
+ FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST | FAN_DIRECTION_FACE},
+ {"FUEL_DOOR_REAR_LEFT", FUEL_DOOR_REAR_LEFT},
+ {"LIGHT_STATE_ON", LIGHT_STATE_ON},
+ {"LIGHT_SWITCH_OFF", LIGHT_SWITCH_OFF},
+ {"LIGHT_SWITCH_AUTO", LIGHT_SWITCH_AUTO},
+ {"MIRROR_DRIVER_LEFT_RIGHT",
+ toInt(VehicleAreaMirror::DRIVER_LEFT) | toInt(VehicleAreaMirror::DRIVER_RIGHT)},
+#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES
+ // Following are test properties:
+ {"ECHO_REVERSE_BYTES", ECHO_REVERSE_BYTES},
+ {"kMixedTypePropertyForTest", kMixedTypePropertyForTest},
+ {"VENDOR_CLUSTER_NAVIGATION_STATE", VENDOR_CLUSTER_NAVIGATION_STATE},
+ {"VENDOR_CLUSTER_REQUEST_DISPLAY", VENDOR_CLUSTER_REQUEST_DISPLAY},
+ {"VENDOR_CLUSTER_SWITCH_UI", VENDOR_CLUSTER_SWITCH_UI},
+ {"VENDOR_CLUSTER_DISPLAY_STATE", VENDOR_CLUSTER_DISPLAY_STATE},
+ {"VENDOR_CLUSTER_REPORT_STATE", VENDOR_CLUSTER_REPORT_STATE},
+ {"PLACEHOLDER_PROPERTY_INT", PLACEHOLDER_PROPERTY_INT},
+ {"PLACEHOLDER_PROPERTY_FLOAT", PLACEHOLDER_PROPERTY_FLOAT},
+ {"PLACEHOLDER_PROPERTY_BOOLEAN", PLACEHOLDER_PROPERTY_BOOLEAN},
+ {"PLACEHOLDER_PROPERTY_STRING", PLACEHOLDER_PROPERTY_STRING}
+#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES
+};
+
+// A class to parse constant values for type T.
+template <class T>
+class ConstantParser final : public ConstantParserInterface {
+ public:
+ ConstantParser() {
+ for (const T& v : ndk::enum_range<T>()) {
+ std::string name = aidl::android::hardware::automotive::vehicle::toString(v);
+ // We use the same constant for both VehicleUnit::GALLON and VehicleUnit::US_GALLON,
+ // which caused toString() not work properly for US_GALLON. So we explicitly add the
+ // map here.
+ if (name == "GALLON") {
+ mValueByName["US_GALLON"] = toInt(v);
+ }
+ mValueByName[name] = toInt(v);
+ }
+ }
+
+ ~ConstantParser() = default;
+
+ Result<int> parseValue(const std::string& name) const override {
+ auto it = mValueByName.find(name);
+ if (it == mValueByName.end()) {
+ return Error() << "Constant name: " << name << " is not defined";
+ }
+ return it->second;
+ }
+
+ private:
+ std::unordered_map<std::string, int> mValueByName;
+};
+
+// A class to parse constant values defined in CONSTANTS_BY_NAME map.
+class LocalVariableParser final : public ConstantParserInterface {
+ public:
+ ~LocalVariableParser() = default;
+
+ Result<int> parseValue(const std::string& name) const override {
+ auto constantsIt = CONSTANTS_BY_NAME.find(name);
+ if (constantsIt == CONSTANTS_BY_NAME.end()) {
+ return Error() << "Constant variable name: " << name << " is not defined";
+ }
+ return constantsIt->second;
+ }
+};
+
+JsonValueParser::JsonValueParser() {
+ mConstantParsersByType["VehiclePropertyAccess"] =
+ std::make_unique<ConstantParser<VehiclePropertyAccess>>();
+ mConstantParsersByType["VehiclePropertyChangeMode"] =
+ std::make_unique<ConstantParser<VehiclePropertyChangeMode>>();
+ mConstantParsersByType["VehicleGear"] = std::make_unique<ConstantParser<VehicleGear>>();
+ mConstantParsersByType["VehicleAreaWindow"] =
+ std::make_unique<ConstantParser<VehicleAreaWindow>>();
+ mConstantParsersByType["VehicleAreaMirror"] =
+ std::make_unique<ConstantParser<VehicleAreaMirror>>();
+ mConstantParsersByType["VehicleOilLevel"] = std::make_unique<ConstantParser<VehicleOilLevel>>();
+ mConstantParsersByType["VehicleUnit"] = std::make_unique<ConstantParser<VehicleUnit>>();
+ mConstantParsersByType["VehicleSeatOccupancyState"] =
+ std::make_unique<ConstantParser<VehicleSeatOccupancyState>>();
+ mConstantParsersByType["VehicleHvacFanDirection"] =
+ std::make_unique<ConstantParser<VehicleHvacFanDirection>>();
+ mConstantParsersByType["VehicleApPowerStateReport"] =
+ std::make_unique<ConstantParser<VehicleApPowerStateReport>>();
+ mConstantParsersByType["VehicleTurnSignal"] =
+ std::make_unique<ConstantParser<VehicleTurnSignal>>();
+ mConstantParsersByType["VehicleVendorPermission"] =
+ std::make_unique<ConstantParser<VehicleVendorPermission>>();
+ mConstantParsersByType["EvsServiceType"] = std::make_unique<ConstantParser<EvsServiceType>>();
+ mConstantParsersByType["EvsServiceState"] = std::make_unique<ConstantParser<EvsServiceState>>();
+ mConstantParsersByType["EvConnectorType"] = std::make_unique<ConstantParser<EvConnectorType>>();
+ mConstantParsersByType["VehicleProperty"] = std::make_unique<ConstantParser<VehicleProperty>>();
+ mConstantParsersByType["GsrComplianceRequirementType"] =
+ std::make_unique<ConstantParser<GsrComplianceRequirementType>>();
+ mConstantParsersByType["VehicleIgnitionState"] =
+ std::make_unique<ConstantParser<VehicleIgnitionState>>();
+ mConstantParsersByType["FuelType"] = std::make_unique<ConstantParser<FuelType>>();
+ mConstantParsersByType["Constants"] = std::make_unique<LocalVariableParser>();
+}
+
+template <>
+Result<int32_t> JsonValueParser::convertValueToType<int32_t>(const std::string& fieldName,
+ const Json::Value& value) {
+ if (!value.isInt()) {
+ return Error() << "The value: " << value << " for field: " << fieldName
+ << " is not in correct type, expect int";
+ }
+ return static_cast<int32_t>(value.asInt());
+}
+
+template <>
+Result<float> JsonValueParser::convertValueToType<float>(const std::string& fieldName,
+ const Json::Value& value) {
+ // isFloat value does not exist, so we use isDouble here.
+ if (!value.isDouble()) {
+ return Error() << "The value: " << value << " for field: " << fieldName
+ << " is not in correct type, expect float";
+ }
+ return value.asFloat();
+}
+
+template <>
+Result<int64_t> JsonValueParser::convertValueToType<int64_t>(const std::string& fieldName,
+ const Json::Value& value) {
+ if (!value.isInt64()) {
+ return Error() << "The value: " << value << " for field: " << fieldName
+ << " is not in correct type, expect int64";
+ }
+ return static_cast<int64_t>(value.asInt64());
+}
+
+template <>
+Result<std::string> JsonValueParser::convertValueToType<std::string>(const std::string& fieldName,
+ const Json::Value& value) {
+ if (!value.isString()) {
+ return Error() << "The value: " << value << " for field: " << fieldName
+ << " is not in correct type, expect string";
+ }
+ return value.asString();
+}
+
+Result<std::string> JsonValueParser::parseStringValue(const std::string& fieldName,
+ const Json::Value& value) const {
+ return convertValueToType<std::string>(fieldName, value);
+}
+
+template <class T>
+Result<T> JsonValueParser::parseValue(const std::string& fieldName,
+ const Json::Value& value) const {
+ if (!value.isString()) {
+ return convertValueToType<T>(fieldName, value);
+ }
+ auto maybeTypeAndValue = maybeGetTypeAndValueName(value.asString());
+ if (!maybeTypeAndValue.has_value()) {
+ return Error() << "Invalid constant value: " << value << " for field: " << fieldName;
+ }
+ auto constantParseResult = parseConstantValue(maybeTypeAndValue.value());
+ if (!constantParseResult.ok()) {
+ return constantParseResult.error();
+ }
+ int constantValue = constantParseResult.value();
+ return static_cast<T>(constantValue);
+}
+
+template <>
+Result<std::string> JsonValueParser::parseValue<std::string>(const std::string& fieldName,
+ const Json::Value& value) const {
+ return parseStringValue(fieldName, value);
+}
+
+template <class T>
+Result<std::vector<T>> JsonValueParser::parseArray(const std::string& fieldName,
+ const Json::Value& value) const {
+ if (!value.isArray()) {
+ return Error() << "The value: " << value << " for field: " << fieldName
+ << " is not in correct type, expect array";
+ }
+ std::vector<T> parsedValues;
+ for (unsigned int i = 0; i < value.size(); i++) {
+ auto result = parseValue<T>(fieldName, value[i]);
+ if (!result.ok()) {
+ return result.error();
+ }
+ parsedValues.push_back(result.value());
+ }
+ return std::move(parsedValues);
+}
+
+std::optional<std::pair<std::string, std::string>> JsonValueParser::maybeGetTypeAndValueName(
+ const std::string& jsonFieldValue) const {
+ size_t pos = jsonFieldValue.find(DELIMITER);
+ if (pos == std::string::npos) {
+ return {};
+ }
+ std::string type = jsonFieldValue.substr(0, pos);
+ std::string valueName = jsonFieldValue.substr(pos + DELIMITER.length(), std::string::npos);
+ if (type != "Constants" && mConstantParsersByType.find(type) == mConstantParsersByType.end()) {
+ return {};
+ }
+ return std::make_pair(type, valueName);
+}
+
+Result<int> JsonValueParser::parseConstantValue(
+ const std::pair<std::string, std::string>& typeValueName) const {
+ const std::string& type = typeValueName.first;
+ const std::string& valueName = typeValueName.second;
+ auto it = mConstantParsersByType.find(type);
+ if (it == mConstantParsersByType.end()) {
+ return Error() << "Unrecognized type: " << type;
+ }
+ auto result = it->second->parseValue(valueName);
+ if (!result.ok()) {
+ return Error() << type << "::" << valueName << " undefined";
+ }
+ return result;
+}
+
+template <class T>
+bool JsonConfigParser::tryParseJsonValueToVariable(const Json::Value& parentJsonNode,
+ const std::string& fieldName,
+ bool fieldIsOptional, T* outPtr,
+ std::vector<std::string>* errors) {
+ if (!parentJsonNode.isObject()) {
+ errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object");
+ return false;
+ }
+ if (!parentJsonNode.isMember(fieldName)) {
+ if (!fieldIsOptional) {
+ errors->push_back("Missing required field: " + fieldName +
+ " in node: " + parentJsonNode.toStyledString());
+ return false;
+ }
+ return true;
+ }
+ auto result = mValueParser.parseValue<T>(fieldName, parentJsonNode[fieldName]);
+ if (!result.ok()) {
+ errors->push_back(result.error().message());
+ return false;
+ }
+ *outPtr = std::move(result.value());
+ return true;
+}
+
+template <class T>
+bool JsonConfigParser::tryParseJsonArrayToVariable(const Json::Value& parentJsonNode,
+ const std::string& fieldName,
+ bool fieldIsOptional, std::vector<T>* outPtr,
+ std::vector<std::string>* errors) {
+ if (!parentJsonNode.isObject()) {
+ errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object");
+ return false;
+ }
+ if (!parentJsonNode.isMember(fieldName)) {
+ if (!fieldIsOptional) {
+ errors->push_back("Missing required field: " + fieldName +
+ " in node: " + parentJsonNode.toStyledString());
+ return false;
+ }
+ return true;
+ }
+ auto result = mValueParser.parseArray<T>(fieldName, parentJsonNode[fieldName]);
+ if (!result.ok()) {
+ errors->push_back(result.error().message());
+ return false;
+ }
+ *outPtr = std::move(result.value());
+ return true;
+}
+
+template <class T>
+void JsonConfigParser::parseAccessChangeMode(
+ const Json::Value& parentJsonNode, const std::string& fieldName, int propId,
+ const std::string& propStr, const std::unordered_map<VehicleProperty, T>& defaultMap,
+ T* outPtr, std::vector<std::string>* errors) {
+ if (!parentJsonNode.isObject()) {
+ errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object");
+ return;
+ }
+ if (parentJsonNode.isMember(fieldName)) {
+ auto result = mValueParser.parseValue<int32_t>(fieldName, parentJsonNode[fieldName]);
+ if (!result.ok()) {
+ errors->push_back(result.error().message());
+ return;
+ }
+ *outPtr = static_cast<T>(result.value());
+ return;
+ }
+ auto it = defaultMap.find(static_cast<VehicleProperty>(propId));
+ if (it == defaultMap.end()) {
+ errors->push_back("No " + fieldName + " specified for property: " + propStr);
+ return;
+ }
+ *outPtr = it->second;
+ return;
+}
+
+bool JsonConfigParser::parsePropValues(const Json::Value& parentJsonNode,
+ const std::string& fieldName, RawPropValues* outPtr,
+ std::vector<std::string>* errors) {
+ if (!parentJsonNode.isObject()) {
+ errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object");
+ return false;
+ }
+ if (!parentJsonNode.isMember(fieldName)) {
+ return false;
+ }
+ const Json::Value& jsonValue = parentJsonNode[fieldName];
+ bool success = true;
+ success &= tryParseJsonArrayToVariable(jsonValue, "int32Values",
+ /*optional=*/true, &(outPtr->int32Values), errors);
+ success &= tryParseJsonArrayToVariable(jsonValue, "floatValues",
+ /*optional=*/true, &(outPtr->floatValues), errors);
+ success &= tryParseJsonArrayToVariable(jsonValue, "int64Values",
+ /*optional=*/true, &(outPtr->int64Values), errors);
+ // We don't support "byteValues" yet.
+ success &= tryParseJsonValueToVariable(jsonValue, "stringValue",
+ /*optional=*/true, &(outPtr->stringValue), errors);
+ return success;
+}
+
+void JsonConfigParser::parseAreas(const Json::Value& parentJsonNode, const std::string& fieldName,
+ ConfigDeclaration* config, std::vector<std::string>* errors) {
+ if (!parentJsonNode.isObject()) {
+ errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object");
+ return;
+ }
+ if (!parentJsonNode.isMember(fieldName)) {
+ return;
+ }
+ const Json::Value& jsonValue = parentJsonNode[fieldName];
+
+ if (!jsonValue.isArray()) {
+ errors->push_back("Field: " + fieldName + " is not an array");
+ return;
+ }
+ for (unsigned int i = 0; i < jsonValue.size(); i++) {
+ int32_t areaId;
+ const Json::Value& jsonAreaConfig = jsonValue[i];
+ if (!tryParseJsonValueToVariable(jsonAreaConfig, "areaId",
+ /*optional=*/false, &areaId, errors)) {
+ continue;
+ }
+ VehicleAreaConfig areaConfig = {};
+ areaConfig.areaId = areaId;
+ tryParseJsonValueToVariable(jsonAreaConfig, "minInt32Value", /*optional=*/true,
+ &areaConfig.minInt32Value, errors);
+ tryParseJsonValueToVariable(jsonAreaConfig, "maxInt32Value", /*optional=*/true,
+ &areaConfig.maxInt32Value, errors);
+ tryParseJsonValueToVariable(jsonAreaConfig, "minInt64Value", /*optional=*/true,
+ &areaConfig.minInt64Value, errors);
+ tryParseJsonValueToVariable(jsonAreaConfig, "maxInt64Value", /*optional=*/true,
+ &areaConfig.maxInt64Value, errors);
+ tryParseJsonValueToVariable(jsonAreaConfig, "minFloatValue", /*optional=*/true,
+ &areaConfig.minFloatValue, errors);
+ tryParseJsonValueToVariable(jsonAreaConfig, "maxFloatValue", /*optional=*/true,
+ &areaConfig.maxFloatValue, errors);
+ config->config.areaConfigs.push_back(std::move(areaConfig));
+
+ RawPropValues areaValue = {};
+ if (parsePropValues(jsonAreaConfig, "defaultValue", &areaValue, errors)) {
+ config->initialAreaValues[areaId] = std::move(areaValue);
+ }
+ }
+}
+
+std::optional<ConfigDeclaration> JsonConfigParser::parseEachProperty(
+ const Json::Value& propJsonValue, std::vector<std::string>* errors) {
+ size_t initialErrorCount = errors->size();
+ ConfigDeclaration configDecl = {};
+ int32_t propId;
+
+ if (!tryParseJsonValueToVariable(propJsonValue, "property", /*optional=*/false, &propId,
+ errors)) {
+ return std::nullopt;
+ }
+
+ configDecl.config.prop = propId;
+ std::string propStr = propJsonValue["property"].toStyledString();
+
+ parseAccessChangeMode(propJsonValue, "access", propId, propStr, AccessForVehicleProperty,
+ &configDecl.config.access, errors);
+
+ parseAccessChangeMode(propJsonValue, "changeMode", propId, propStr,
+ ChangeModeForVehicleProperty, &configDecl.config.changeMode, errors);
+
+ tryParseJsonValueToVariable(propJsonValue, "configString", /*optional=*/true,
+ &configDecl.config.configString, errors);
+
+ tryParseJsonArrayToVariable(propJsonValue, "configArray", /*optional=*/true,
+ &configDecl.config.configArray, errors);
+
+ parsePropValues(propJsonValue, "defaultValue", &configDecl.initialValue, errors);
+
+ tryParseJsonValueToVariable(propJsonValue, "minSampleRate", /*optional=*/true,
+ &configDecl.config.minSampleRate, errors);
+
+ tryParseJsonValueToVariable(propJsonValue, "maxSampleRate", /*optional=*/true,
+ &configDecl.config.maxSampleRate, errors);
+
+ parseAreas(propJsonValue, "areas", &configDecl, errors);
+
+ if (errors->size() != initialErrorCount) {
+ return std::nullopt;
+ }
+ return configDecl;
+}
+
+Result<std::unordered_map<int32_t, ConfigDeclaration>> JsonConfigParser::parseJsonConfig(
+ std::istream& is) {
+ Json::CharReaderBuilder builder;
+ Json::Value root;
+ std::unordered_map<int32_t, ConfigDeclaration> configsByPropId;
+ std::string errs;
+ if (!Json::parseFromStream(builder, is, &root, &errs)) {
+ return Error() << "Failed to parse property config file as JSON, error: " << errs;
+ }
+ if (!root.isObject()) {
+ return Error() << "root element must be an object";
+ }
+ if (!root.isMember("properties") || !root["properties"].isArray()) {
+ return Error() << "Missing 'properties' field in root or the field is not an array";
+ }
+ Json::Value properties = root["properties"];
+ std::vector<std::string> errors;
+ for (unsigned int i = 0; i < properties.size(); i++) {
+ if (auto maybeConfig = parseEachProperty(properties[i], &errors); maybeConfig.has_value()) {
+ configsByPropId[maybeConfig.value().config.prop] = std::move(maybeConfig.value());
+ }
+ }
+ if (!errors.empty()) {
+ return Error() << android::base::Join(errors, '\n');
+ }
+ return configsByPropId;
+}
+
+} // namespace jsonconfigloader_impl
+
+JsonConfigLoader::JsonConfigLoader() {
+ mParser = std::make_unique<jsonconfigloader_impl::JsonConfigParser>();
+}
+
+android::base::Result<std::unordered_map<int32_t, ConfigDeclaration>>
+JsonConfigLoader::loadPropConfig(std::istream& is) {
+ return mParser->parseJsonConfig(is);
+}
+
+android::base::Result<std::unordered_map<int32_t, ConfigDeclaration>>
+JsonConfigLoader::loadPropConfig(const std::string& configPath) {
+ std::ifstream ifs(configPath.c_str());
+ if (!ifs) {
+ return android::base::Error() << "couldn't open " << configPath << " for parsing.";
+ }
+
+ return loadPropConfig(ifs);
+}
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp
new file mode 100644
index 0000000..dae37b9
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2022 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_test {
+ name: "JsonConfigLoaderUnitTest",
+ vendor: true,
+ srcs: ["*.cpp"],
+ static_libs: [
+ "VehicleHalJsonConfigLoader",
+ "VehicleHalUtils",
+ "libgtest",
+ ],
+ shared_libs: [
+ "libjsoncpp",
+ ],
+ defaults: ["VehicleHalDefaults"],
+ test_suites: ["device-tests"],
+}
+
+cc_test {
+ name: "JsonConfigLoaderUnitTestEnableTestProperties",
+ vendor: true,
+ srcs: ["*.cpp"],
+ static_libs: [
+ "VehicleHalJsonConfigLoaderEnableTestProperties",
+ "VehicleHalUtils",
+ "libgtest",
+ ],
+ shared_libs: [
+ "libjsoncpp",
+ ],
+ defaults: ["VehicleHalDefaults"],
+ test_suites: ["device-tests"],
+}
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp
new file mode 100644
index 0000000..9ff8c1b
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp
@@ -0,0 +1,622 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include <JsonConfigLoader.h>
+
+#include <PropertyUtils.h>
+
+#include <gtest/gtest.h>
+#include <sstream>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+using ::aidl::android::hardware::automotive::vehicle::RawPropValues;
+using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig;
+using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess;
+using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode;
+
+class JsonConfigLoaderUnitTest : public ::testing::Test {
+ protected:
+ JsonConfigLoader mLoader;
+};
+
+TEST_F(JsonConfigLoaderUnitTest, testBasic) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": 291504388
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+ ASSERT_EQ(configs.begin()->second.config.prop, 291504388);
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testRootNotObject) {
+ std::istringstream iss(R"(
+ []
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) << "root is not an object must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testMissingPropertiesField) {
+ std::istringstream iss(R"(
+ {
+ "abcd": 1234
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) << "Missing 'properties' field must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testPropertiesFieldNotArray) {
+ std::istringstream iss(R"(
+ {
+ "properties': {'a': 'b'}
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "'properties' field is not an array must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testPropertyIsEnum) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY"
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+ ASSERT_EQ(configs.begin()->second.config.prop, toInt(VehicleProperty::INFO_FUEL_CAPACITY));
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testPropertyEnum_FailInvalidEnum) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::BLAH"
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "Invalid VehicleProperty enum must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testPropertyEnum_FailInvalidType) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "test"
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "Invalid VehicleProperty type must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testProperty_FailInvalidJson) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) << "Invalid JSON format must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testConfigArray) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "configArray": [1, 2, 3]
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+ ASSERT_EQ(configs.begin()->second.config.configArray, std::vector<int>({1, 2, 3}));
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testConfigArrayConstants) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "configArray": [1, 2, "Constants::FUEL_DOOR_REAR_LEFT"]
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+ ASSERT_EQ(configs.begin()->second.config.configArray,
+ std::vector<int>({1, 2, FUEL_DOOR_REAR_LEFT}));
+}
+
+// We have special logic to deal with GALLON and US_GALLON since they share the same value.
+TEST_F(JsonConfigLoaderUnitTest, testConfigArrayUnitGallon) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "configArray": [1, 2, "VehicleUnit::GALLON"]
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testConfigArrayUnitUsGallon) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "configArray": [1, 2, "VehicleUnit::US_GALLON"]
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testConfigArray_FailInvalidEnum) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "configArray": [1, 2, "VehicleUnits::BLAH"]
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "Invalid enum in ConfigArray must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testConfigArray_FailNotArray) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "configArray": "123"
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "ConfigArray is not an array must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testConfigString) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "configString": "test"
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+ ASSERT_EQ(configs.begin()->second.config.configString, "test");
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testConfigString_FailNotString) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "configString": 1234
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "ConfigString is not a String must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testCheckDefaultAccessChangeMode) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY"
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+
+ const VehiclePropConfig& propConfig = configs.begin()->second.config;
+ ASSERT_EQ(propConfig.access, VehiclePropertyAccess::READ);
+ ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::STATIC);
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testAccessOverride) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "access": "VehiclePropertyAccess::WRITE"
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+
+ const VehiclePropConfig& propConfig = configs.begin()->second.config;
+ ASSERT_EQ(propConfig.access, VehiclePropertyAccess::WRITE);
+ ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::STATIC);
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testChangeModeOverride) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+
+ const VehiclePropConfig& propConfig = configs.begin()->second.config;
+ ASSERT_EQ(propConfig.access, VehiclePropertyAccess::READ);
+ ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::ON_CHANGE);
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testCustomProp) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": 1234,
+ "access": "VehiclePropertyAccess::WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+
+ const VehiclePropConfig& propConfig = configs.begin()->second.config;
+ ASSERT_EQ(propConfig.access, VehiclePropertyAccess::WRITE);
+ ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::ON_CHANGE);
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testCustomProp_FailMissingAccess) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": 1234,
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "Missing access for custom property must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testCustomProp_FailMissingChangeMode) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": 1234,
+ "access": "VehiclePropertyAccess::WRITE"
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "Missing change mode for custom property must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testMinSampleRate) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "minSampleRate": 1,
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+ ASSERT_EQ(configs.begin()->second.config.minSampleRate, 1);
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testMinSampleRate_FailInvalidType) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "minSampleRate": "abcd",
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "Wrong type for MinSampleRate must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testMaxSampleRate) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "maxSampleRate": 1,
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+ ASSERT_EQ(configs.begin()->second.config.maxSampleRate, 1);
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testMaxSampleRate_FailInvalidType) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "maxSampleRate": "abcd",
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "Wrong type for MaxSampleRate must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testDefaultValue_Simple) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "defaultValue": {
+ "int32Values": [1, 2]
+ }
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+ ASSERT_EQ(configs.begin()->second.initialValue.int32Values, std::vector<int32_t>({1, 2}));
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testDefaultValue_Mixed) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "defaultValue": {
+ "int32Values": [1, "Constants::FUEL_DOOR_REAR_LEFT"],
+ "int64Values": [2, "Constants::FUEL_DOOR_REAR_LEFT"],
+ "floatValues": [3.0, "Constants::FUEL_DOOR_REAR_LEFT"],
+ "stringValue": "abcd"
+ }
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+
+ const RawPropValues& initialValue = configs.begin()->second.initialValue;
+ ASSERT_EQ(initialValue.int32Values, std::vector<int32_t>({1, FUEL_DOOR_REAR_LEFT}));
+ ASSERT_EQ(initialValue.int64Values,
+ std::vector<int64_t>({2, static_cast<int64_t>(FUEL_DOOR_REAR_LEFT)}));
+ ASSERT_EQ(initialValue.floatValues,
+ std::vector<float>({3.0, static_cast<float>(FUEL_DOOR_REAR_LEFT)}));
+ ASSERT_EQ(initialValue.stringValue, "abcd");
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testDefaultValue_FailNotObject) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "defaultValue": []
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "DefaultValue is not an object must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testDefaultValue_FailInvalidType) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "defaultValue": {
+ "int32Values": [1.1]
+ }
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "Wrong type for DefaultValue must cause error";
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testAreas_Simple) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "areas": [{
+ "areaId": "Constants::HVAC_ALL",
+ "minInt32Value": 1,
+ "maxInt32Value": 7
+ }]
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+
+ const VehiclePropConfig& config = configs.begin()->second.config;
+ ASSERT_EQ(config.areaConfigs.size(), 1u);
+ const VehicleAreaConfig& areaConfig = config.areaConfigs[0];
+ ASSERT_EQ(areaConfig.minInt32Value, 1);
+ ASSERT_EQ(areaConfig.maxInt32Value, 7);
+ ASSERT_EQ(areaConfig.areaId, HVAC_ALL);
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testAreas_DefaultValueForEachArea) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "areas": [{
+ "areaId": "Constants::HVAC_LEFT",
+ "defaultValue": {
+ "int32Values": [1]
+ }
+ }, {
+ "areaId": "Constants::HVAC_RIGHT",
+ "defaultValue": {
+ "int32Values": [2]
+ }
+ }]
+ }]
+ }
+ )");
+
+ auto result = mLoader.loadPropConfig(iss);
+
+ auto configs = result.value();
+ ASSERT_EQ(configs.size(), 1u);
+
+ const VehiclePropConfig& config = configs.begin()->second.config;
+ ASSERT_EQ(config.areaConfigs.size(), 2u);
+ ASSERT_EQ(config.areaConfigs[0].areaId, HVAC_LEFT);
+ ASSERT_EQ(config.areaConfigs[1].areaId, HVAC_RIGHT);
+ ASSERT_EQ(configs.begin()->second.initialAreaValues[HVAC_LEFT],
+ RawPropValues{.int32Values = {1}});
+ ASSERT_EQ(configs.begin()->second.initialAreaValues[HVAC_RIGHT],
+ RawPropValues{.int32Values = {2}});
+}
+
+TEST_F(JsonConfigLoaderUnitTest, testAreas_FailInvalidTypeForOneAreaValue) {
+ std::istringstream iss(R"(
+ {
+ "properties": [{
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "areas": [{
+ "areaId": "Constants::HVAC_LEFT",
+ "defaultValue": {
+ "int32Values": [1]
+ }
+ }, {
+ "areaId": "Constants::HVAC_RIGHT",
+ "defaultValue": {
+ "int32Values": [2.1]
+ }
+ }]
+ }]
+ }
+ )");
+
+ ASSERT_FALSE(mLoader.loadPropConfig(iss).ok())
+ << "Wrong type for DefaultValue for one area must cause error";
+}
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/automotive/vehicle/aidl/impl/default_config/config/Android.bp b/automotive/vehicle/aidl/impl/default_config/config/Android.bp
new file mode 100644
index 0000000..8f1c7d1
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/config/Android.bp
@@ -0,0 +1,47 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+filegroup {
+ name: "VehicleHalDefaultProperties_JSON",
+ srcs: ["DefaultProperties.json"],
+}
+
+filegroup {
+ name: "VehicleHalTestProperties_JSON",
+ srcs: ["TestProperties.json"],
+}
+
+filegroup {
+ name: "VehicleHalVendorClusterTestProperties_JSON",
+ srcs: ["VendorClusterTestProperties.json"],
+}
+
+prebuilt_etc {
+ name: "Prebuilt_VehicleHalDefaultProperties_JSON",
+ filename_from_src: true,
+ src: "DefaultProperties.json",
+ sub_dir: "automotive/vhalconfig/",
+ vendor: true,
+}
+
+prebuilt_etc {
+ name: "Prebuilt_VehicleHalTestProperties_JSON",
+ filename_from_src: true,
+ src: "TestProperties.json",
+ sub_dir: "automotive/vhalconfig/",
+ vendor: true,
+}
+
+prebuilt_etc {
+ name: "Prebuilt_VehicleHalVendorClusterTestProperties_JSON",
+ filename_from_src: true,
+ src: "VendorClusterTestProperties.json",
+ sub_dir: "automotive/vhalconfig/",
+ vendor: true,
+}
diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
new file mode 100644
index 0000000..7b471e1
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
@@ -0,0 +1,2551 @@
+{
+ "apiVersion": 1,
+ "properties": [
+ {
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ "defaultValue": {
+ "floatValues": [
+ 15000.0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_FUEL_TYPE",
+ "defaultValue": {
+ "int32Values": [
+ "FuelType::FUEL_TYPE_UNLEADED"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_EV_BATTERY_CAPACITY",
+ "defaultValue": {
+ "floatValues": [
+ 150000.0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_EV_CONNECTOR_TYPE",
+ "defaultValue": {
+ "int32Values": [
+ "EvConnectorType::IEC_TYPE_1_AC"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_FUEL_DOOR_LOCATION",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::FUEL_DOOR_REAR_LEFT"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_EV_PORT_LOCATION",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::CHARGE_PORT_FRONT_LEFT"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::CHARGE_PORT_FRONT_LEFT",
+ "Constants::CHARGE_PORT_REAR_LEFT"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_VIN",
+ "defaultValue": {
+ "stringValue": "1GCARVIN123456789"
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_MAKE",
+ "defaultValue": {
+ "stringValue": "Toy Vehicle"
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_MODEL",
+ "defaultValue": {
+ "stringValue": "Speedy Model"
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_MODEL_YEAR",
+ "defaultValue": {
+ "int32Values": [
+ 2020
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::INFO_EXTERIOR_DIMENSIONS",
+ "defaultValue": {
+ "int32Values": [
+ 1776,
+ 4950,
+ 2008,
+ 2140,
+ 2984,
+ 1665,
+ 1667,
+ 11800
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::PERF_VEHICLE_SPEED",
+ "defaultValue": {
+ "floatValues": [
+ 0.0
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY",
+ "defaultValue": {
+ "floatValues": [
+ 0.0
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleUnit::KILOMETERS_PER_HOUR"
+ ]
+ },
+ "configArray": [
+ "VehicleUnit::METER_PER_SEC",
+ "VehicleUnit::MILES_PER_HOUR",
+ "VehicleUnit::KILOMETERS_PER_HOUR"
+ ]
+ },
+ {
+ "property": "VehicleProperty::EV_BATTERY_DISPLAY_UNITS",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleUnit::KILOWATT_HOUR"
+ ]
+ },
+ "configArray": [
+ "VehicleUnit::WATT_HOUR",
+ "VehicleUnit::AMPERE_HOURS",
+ "VehicleUnit::KILOWATT_HOUR"
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_MEMORY_SELECT",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_MEMORY_SET",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_BELT_BUCKLED",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_BELT_HEIGHT_POS",
+ "defaultValue": {
+ "int32Values": [
+ 10
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": 0,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_BELT_HEIGHT_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_FORE_AFT_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_FORE_AFT_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_BACKREST_ANGLE_1_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_BACKREST_ANGLE_2_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_HEIGHT_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_HEIGHT_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_DEPTH_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_DEPTH_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_TILT_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_TILT_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_HEADREST_ANGLE_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_HEADREST_ANGLE_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_HEADREST_FORE_AFT_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::SEAT_OCCUPANCY",
+ "areas": [
+ {
+ "defaultValue": {
+ "int32Values": [
+ "VehicleSeatOccupancyState::VACANT"
+ ]
+ },
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "defaultValue": {
+ "int32Values": [
+ "VehicleSeatOccupancyState::VACANT"
+ ]
+ },
+ "areaId": "Constants::SEAT_1_RIGHT"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::INFO_DRIVER_SEAT",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::SEAT_1_LEFT"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::PERF_ODOMETER",
+ "defaultValue": {
+ "floatValues": [
+ 0.0
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::PERF_STEERING_ANGLE",
+ "defaultValue": {
+ "floatValues": [
+ 0.0
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::PERF_REAR_STEERING_ANGLE",
+ "defaultValue": {
+ "floatValues": [
+ 0.0
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::ENGINE_RPM",
+ "defaultValue": {
+ "floatValues": [
+ 0.0
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::FUEL_LEVEL",
+ "defaultValue": {
+ "floatValues": [
+ 15000.0
+ ]
+ },
+ "maxSampleRate": 100.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::FUEL_DOOR_OPEN",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::EV_BATTERY_LEVEL",
+ "defaultValue": {
+ "floatValues": [
+ 150000.0
+ ]
+ },
+ "maxSampleRate": 100.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::EV_CHARGE_PORT_OPEN",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::EV_CHARGE_PORT_CONNECTED",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE",
+ "defaultValue": {
+ "floatValues": [
+ 0.0
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT",
+ "defaultValue": {
+ "floatValues": [
+ 12.5
+ ]
+ },
+ "comment": "ConfigArray specifies Max current draw allowed by vehicle in amperes",
+ "configArray": [
+ 20
+ ]
+ },
+ {
+ "property": "VehicleProperty::EV_CHARGE_PERCENT_LIMIT",
+ "defaultValue": {
+ "floatValues": [
+ 40.0
+ ]
+ },
+ "configArray": [
+ 20,
+ 40,
+ 60,
+ 80,
+ 100
+ ]
+ },
+ {
+ "property": "VehicleProperty::EV_CHARGE_STATE",
+ "defaultValue": {
+ "int32Values": [
+ 2
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::EV_CHARGE_SWITCH",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::EV_CHARGE_TIME_REMAINING",
+ "defaultValue": {
+ "int32Values": [
+ 20
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::EV_REGENERATIVE_BRAKING_STATE",
+ "defaultValue": {
+ "int32Values": [
+ 2
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::TRAILER_PRESENT",
+ "defaultValue": {
+ "int32Values": [
+ 2
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::VEHICLE_CURB_WEIGHT",
+ "defaultValue": {
+ "int32Values": [
+ 2211
+ ]
+ },
+ "configArray": [
+ 2948
+ ],
+ "comment": "unit is kg"
+ },
+ {
+ "property": "VehicleProperty::RANGE_REMAINING",
+ "defaultValue": {
+ "floatValues": [
+ 50000.0
+ ]
+ },
+ "comment": "units in meter",
+ "maxSampleRate": 2.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::TIRE_PRESSURE",
+ "defaultValue": {
+ "floatValues": [
+ 200.0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::WHEEL_FRONT_LEFT",
+ "minFloatValue": 193.0,
+ "maxFloatValue": 300.0
+ },
+ {
+ "areaId": "Constants::WHEEL_FRONT_RIGHT",
+ "minFloatValue": 193.0,
+ "maxFloatValue": 300.0
+ },
+ {
+ "areaId": "Constants::WHEEL_REAR_LEFT",
+ "minFloatValue": 193.0,
+ "maxFloatValue": 300.0
+ },
+ {
+ "areaId": "Constants::WHEEL_REAR_RIGHT",
+ "minFloatValue": 193.0,
+ "maxFloatValue": 300.0
+ }
+ ],
+ "comment": "Units in kpa",
+ "maxSampleRate": 2.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE",
+ "areas": [
+ {
+ "defaultValue": {
+ "floatValues": [
+ 137.0
+ ]
+ },
+ "areaId": "Constants::WHEEL_FRONT_LEFT"
+ },
+ {
+ "defaultValue": {
+ "floatValues": [
+ 137.0
+ ]
+ },
+ "areaId": "Constants::WHEEL_FRONT_RIGHT"
+ },
+ {
+ "defaultValue": {
+ "floatValues": [
+ 137.0
+ ]
+ },
+ "areaId": "Constants::WHEEL_REAR_RIGHT"
+ },
+ {
+ "defaultValue": {
+ "floatValues": [
+ 137.0
+ ]
+ },
+ "areaId": "Constants::WHEEL_REAR_LEFT"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleUnit::PSI"
+ ]
+ },
+ "configArray": [
+ "VehicleUnit::KILOPASCAL",
+ "VehicleUnit::PSI",
+ "VehicleUnit::BAR"
+ ]
+ },
+ {
+ "property": "VehicleProperty::CURRENT_GEAR",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleGear::GEAR_PARK"
+ ]
+ },
+ "configArray": [
+ "VehicleGear::GEAR_PARK",
+ "VehicleGear::GEAR_NEUTRAL",
+ "VehicleGear::GEAR_REVERSE",
+ "VehicleGear::GEAR_1",
+ "VehicleGear::GEAR_2",
+ "VehicleGear::GEAR_3",
+ "VehicleGear::GEAR_4",
+ "VehicleGear::GEAR_5"
+ ]
+ },
+ {
+ "property": "VehicleProperty::PARKING_BRAKE_ON",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::PARKING_BRAKE_AUTO_APPLY",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::FUEL_LEVEL_LOW",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleUnit::LITER"
+ ]
+ },
+ "configArray": [
+ "VehicleUnit::LITER",
+ "VehicleUnit::US_GALLON"
+ ]
+ },
+ {
+ "property": "VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::HW_KEY_INPUT",
+ "defaultValue": {
+ "int32Values": [
+ 0,
+ 0,
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::HW_ROTARY_INPUT",
+ "defaultValue": {
+ "int32Values": [
+ 0,
+ 0,
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::HW_CUSTOM_INPUT",
+ "defaultValue": {
+ "int32Values": [
+ 0,
+ 0,
+ 0
+ ]
+ },
+ "configArray": [
+ 0,
+ 0,
+ 0,
+ 3,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM",
+ "defaultValue": {
+ "int32Values": [
+ 50
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_POWER_ON",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ],
+ "configArray": [
+ "VehicleProperty::HVAC_FAN_SPEED",
+ "VehicleProperty::HVAC_FAN_DIRECTION"
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_DEFROSTER",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD"
+ },
+ {
+ "areaId": "VehicleAreaWindow::REAR_WINDSHIELD"
+ }
+ ],
+ "comment": "0 means using for all areas"
+ },
+ {
+ "property": "VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD"
+ },
+ {
+ "areaId": "VehicleAreaWindow::REAR_WINDSHIELD"
+ }
+ ],
+ "comment": "0 means using for all areas"
+ },
+ {
+ "property": "VehicleProperty::HVAC_MAX_DEFROST_ON",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_RECIRC_ON",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_AUTO_RECIRC_ON",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_AC_ON",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_MAX_AC_ON",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_AUTO_ON",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_DUAL_ON",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_FAN_SPEED",
+ "defaultValue": {
+ "int32Values": [
+ 3
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL",
+ "minInt32Value": 1,
+ "maxInt32Value": 7
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_FAN_DIRECTION",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleHvacFanDirection::FACE"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::FAN_DIRECTION_FACE",
+ "Constants::FAN_DIRECTION_FLOOR",
+ "Constants::FAN_DIRECTION_FACE_FLOOR",
+ "Constants::FAN_DIRECTION_DEFROST",
+ "Constants::FAN_DIRECTION_FACE_DEFROST",
+ "Constants::FAN_DIRECTION_FLOOR_DEFROST",
+ "Constants::FAN_DIRECTION_FLOOR_DEFROST_FACE"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::HVAC_ALL"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_SEAT_VENTILATION",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 3
+ }
+ ],
+ "comment": "0 is off and +ve values indicate ventilation level."
+ },
+ {
+ "property": "VehicleProperty::HVAC_STEERING_WHEEL_HEAT",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "minInt32Value": -2,
+ "maxInt32Value": 2
+ }
+ ],
+ "comment": "+ve values for heating and -ve for cooling"
+ },
+ {
+ "property": "VehicleProperty::HVAC_SEAT_TEMPERATURE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT",
+ "minInt32Value": -2,
+ "maxInt32Value": 2
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT",
+ "minInt32Value": -2,
+ "maxInt32Value": 2
+ }
+ ],
+ "comment": "+ve values for heating and -ve for cooling"
+ },
+ {
+ "property": "VehicleProperty::HVAC_SIDE_MIRROR_HEAT",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::MIRROR_DRIVER_LEFT_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 2
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_TEMPERATURE_CURRENT",
+ "areas": [
+ {
+ "defaultValue": {
+ "floatValues": [
+ 17.3
+ ]
+ },
+ "areaId": 49
+ },
+ {
+ "defaultValue": {
+ "floatValues": [
+ 19.1
+ ]
+ },
+ "areaId": 68
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_TEMPERATURE_SET",
+ "areas": [
+ {
+ "defaultValue": {
+ "floatValues": [
+ 16.0
+ ]
+ },
+ "areaId": 49,
+ "minFloatValue": 16.0,
+ "maxFloatValue": 32.0
+ },
+ {
+ "defaultValue": {
+ "floatValues": [
+ 20.0
+ ]
+ },
+ "areaId": 68,
+ "minFloatValue": 16.0,
+ "maxFloatValue": 32.0
+ }
+ ],
+ "configArray": [
+ 160,
+ 280,
+ 5,
+ 605,
+ 825,
+ 10
+ ]
+ },
+ {
+ "property": "VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION",
+ "defaultValue": {
+ "floatValues": [
+ 66.19999694824219,
+ "VehicleUnit::FAHRENHEIT",
+ 19.0,
+ 66.5
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::ENV_OUTSIDE_TEMPERATURE",
+ "defaultValue": {
+ "floatValues": [
+ 25.0
+ ]
+ },
+ "maxSampleRate": 2.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleUnit::FAHRENHEIT"
+ ]
+ },
+ "configArray": [
+ "VehicleUnit::FAHRENHEIT",
+ "VehicleUnit::CELSIUS"
+ ]
+ },
+ {
+ "property": "VehicleProperty::DISTANCE_DISPLAY_UNITS",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleUnit::MILE"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0
+ }
+ ],
+ "configArray": [
+ "VehicleUnit::KILOMETER",
+ "VehicleUnit::MILE"
+ ]
+ },
+ {
+ "property": "VehicleProperty::NIGHT_MODE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::GEAR_SELECTION",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleGear::GEAR_PARK"
+ ]
+ },
+ "configArray": [
+ "VehicleGear::GEAR_PARK",
+ "VehicleGear::GEAR_NEUTRAL",
+ "VehicleGear::GEAR_REVERSE",
+ "VehicleGear::GEAR_DRIVE",
+ "VehicleGear::GEAR_1",
+ "VehicleGear::GEAR_2",
+ "VehicleGear::GEAR_3",
+ "VehicleGear::GEAR_4",
+ "VehicleGear::GEAR_5"
+ ]
+ },
+ {
+ "property": "VehicleProperty::TURN_SIGNAL_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleTurnSignal::NONE"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::IGNITION_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleIgnitionState::ON"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::ENGINE_COOLANT_TEMP",
+ "defaultValue": {
+ "floatValues": [
+ 75.0
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::ENGINE_OIL_LEVEL",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleOilLevel::NORMAL"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::ENGINE_OIL_TEMP",
+ "defaultValue": {
+ "floatValues": [
+ 101.0
+ ]
+ },
+ "maxSampleRate": 10.0,
+ "minSampleRate": 0.10000000149011612
+ },
+ {
+ "property": "VehicleProperty::DOOR_LOCK",
+ "areas": [
+ {
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areaId": "Constants::DOOR_1_LEFT"
+ },
+ {
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areaId": "Constants::DOOR_1_RIGHT"
+ },
+ {
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areaId": "Constants::DOOR_2_LEFT"
+ },
+ {
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areaId": "Constants::DOOR_2_RIGHT"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::DOOR_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::DOOR_1_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::DOOR_1_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::DOOR_2_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::DOOR_2_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::DOOR_REAR",
+ "minInt32Value": 0,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::DOOR_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::DOOR_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::DOOR_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::DOOR_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::DOOR_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::MIRROR_Z_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_LEFT",
+ "minInt32Value": -3,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_RIGHT",
+ "minInt32Value": -3,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_CENTER",
+ "minInt32Value": -3,
+ "maxInt32Value": 3
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::MIRROR_Z_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::MIRROR_Y_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_LEFT",
+ "minInt32Value": -3,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_RIGHT",
+ "minInt32Value": -3,
+ "maxInt32Value": 3
+ },
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_CENTER",
+ "minInt32Value": -3,
+ "maxInt32Value": 3
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::MIRROR_Y_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "VehicleAreaMirror::DRIVER_CENTER",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::MIRROR_LOCK",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::MIRROR_FOLD",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::WINDOW_LOCK",
+ "areas": [
+ {
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areaId": "Constants::WINDOW_1_RIGHT_2_LEFT_2_RIGHT"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::WINDOW_POS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::WINDOW_1_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::WINDOW_1_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::WINDOW_2_LEFT",
+ "minInt32Value": 0,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::WINDOW_2_RIGHT",
+ "minInt32Value": 0,
+ "maxInt32Value": 10
+ },
+ {
+ "areaId": "Constants::WINDOW_ROOF_TOP_1",
+ "minInt32Value": -10,
+ "maxInt32Value": 10
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::WINDOW_MOVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::WINDOW_1_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::WINDOW_1_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::WINDOW_2_LEFT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::WINDOW_2_RIGHT",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ },
+ {
+ "areaId": "Constants::WINDOW_ROOF_TOP_1",
+ "minInt32Value": -1,
+ "maxInt32Value": 1
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::WHEEL_TICK",
+ "defaultValue": {
+ "int64Values": [
+ 0,
+ 100000,
+ 200000,
+ 300000,
+ 400000
+ ]
+ },
+ "configArray": [
+ 15,
+ 50000,
+ 50000,
+ 50000,
+ 50000
+ ],
+ "maxSampleRate": 10.0,
+ "minSampleRate": 1.0
+ },
+ {
+ "property": "VehicleProperty::ABS_ACTIVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::TRACTION_CONTROL_ACTIVE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::AP_POWER_STATE_REQ",
+ "configArray": [
+ 0
+ ]
+ },
+ {
+ "property": "VehicleProperty::AP_POWER_STATE_REPORT",
+ "defaultValue": {
+ "int32Values": [
+ "VehicleApPowerStateReport::WAIT_FOR_VHAL",
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::DISPLAY_BRIGHTNESS",
+ "defaultValue": {
+ "int32Values": [
+ 100
+ ]
+ },
+ "areas": [
+ {
+ "areaId": 0,
+ "minInt32Value": 0,
+ "maxInt32Value": 100
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::OBD2_LIVE_FRAME",
+ "configArray": [
+ 0,
+ 0
+ ]
+ },
+ {
+ "property": "VehicleProperty::OBD2_FREEZE_FRAME",
+ "configArray": [
+ 0,
+ 0
+ ]
+ },
+ {
+ "property": "VehicleProperty::OBD2_FREEZE_FRAME_INFO"
+ },
+ {
+ "property": "VehicleProperty::OBD2_FREEZE_FRAME_CLEAR",
+ "configArray": [
+ 1
+ ]
+ },
+ {
+ "property": "VehicleProperty::HEADLIGHTS_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_STATE_ON"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::HIGH_BEAM_LIGHTS_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_STATE_ON"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::FRONT_FOG_LIGHTS_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_STATE_ON"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::REAR_FOG_LIGHTS_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_STATE_ON"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::HAZARD_LIGHTS_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_STATE_ON"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::CABIN_LIGHTS_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_STATE_ON"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::READING_LIGHTS_STATE",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_STATE_ON"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::HEADLIGHTS_SWITCH",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_SWITCH_AUTO"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_SWITCH_AUTO"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::FRONT_FOG_LIGHTS_SWITCH",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_SWITCH_AUTO"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::REAR_FOG_LIGHTS_SWITCH",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_SWITCH_AUTO"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::HAZARD_LIGHTS_SWITCH",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_SWITCH_AUTO"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::CABIN_LIGHTS_SWITCH",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_SWITCH_OFF"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::READING_LIGHTS_SWITCH",
+ "defaultValue": {
+ "int32Values": [
+ "Constants::LIGHT_SWITCH_OFF"
+ ]
+ },
+ "areas": [
+ {
+ "areaId": "Constants::SEAT_1_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_1_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_LEFT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_RIGHT"
+ },
+ {
+ "areaId": "Constants::SEAT_2_CENTER"
+ }
+ ]
+ },
+ {
+ "property": "VehicleProperty::EVS_SERVICE_REQUEST",
+ "defaultValue": {
+ "int32Values": [
+ "EvsServiceType::REARVIEW",
+ "EvsServiceState::OFF"
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::VEHICLE_MAP_SERVICE"
+ },
+ {
+ "property": "VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ }
+ },
+ {
+ "property": "VehicleProperty::INITIAL_USER_INFO"
+ },
+ {
+ "property": "VehicleProperty::SWITCH_USER"
+ },
+ {
+ "property": "VehicleProperty::CREATE_USER"
+ },
+ {
+ "property": "VehicleProperty::REMOVE_USER"
+ },
+ {
+ "property": "VehicleProperty::USER_IDENTIFICATION_ASSOCIATION"
+ },
+ {
+ "property": "VehicleProperty::POWER_POLICY_REQ"
+ },
+ {
+ "property": "VehicleProperty::POWER_POLICY_GROUP_REQ"
+ },
+ {
+ "property": "VehicleProperty::CURRENT_POWER_POLICY"
+ },
+ {
+ "property": "VehicleProperty::ANDROID_EPOCH_TIME"
+ },
+ {
+ "property": "VehicleProperty::WATCHDOG_ALIVE"
+ },
+ {
+ "property": "VehicleProperty::WATCHDOG_TERMINATED_PROCESS"
+ },
+ {
+ "property": "VehicleProperty::VHAL_HEARTBEAT"
+ },
+ {
+ "property": "VehicleProperty::CLUSTER_SWITCH_UI",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "comment": "0 means ClusterHome"
+ },
+ {
+ "property": "VehicleProperty::CLUSTER_DISPLAY_STATE",
+ "defaultValue": {
+ "int32Values": [
+ 0,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1
+ ]
+ },
+ "comment":
+ "Value means: 0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, -1, -1 /* Insets */"
+ },
+ {
+ "property": "VehicleProperty::CLUSTER_REPORT_STATE",
+ "configArray": [
+ 0,
+ 0,
+ 0,
+ 11,
+ 0,
+ 0,
+ 0,
+ 0,
+ 16
+ ]
+ },
+ {
+ "property": "VehicleProperty::CLUSTER_REQUEST_DISPLAY"
+ },
+ {
+ "property": "VehicleProperty::CLUSTER_NAVIGATION_STATE"
+ },
+ {
+ "property": "VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT",
+ "defaultValue": {
+ "int32Values": [
+ "GsrComplianceRequirementType::GSR_COMPLIANCE_REQUIRED_V1"
+ ]
+ }
+ }
+ ]
+}
diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md
new file mode 100644
index 0000000..0e3fc5e
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/config/README.md
@@ -0,0 +1,151 @@
+# Property Configuration Files
+
+Each JSON file in this folder is a property configuration file for reference
+Vehicle HAL. They contain VehiclePropConfig information along with initial
+value information.
+
+## JSON schema
+
+Each JSON file must be in a schema like the following example:
+(The comment starting with "//" is for documentation only and must be removed
+from the actual JSON file. The "comment" field is used for comment in the
+actual JSON file and will be ignored by the parser)
+
+```
+{
+ // (number) The version for the JSON schema.
+ "apiVersion": 1,
+ // (non-empty array of objects) The property configuration list.
+ //
+ // Each object is a configuration for one property.
+ "properties": [
+ {
+ // (number/string) The ID for the property.
+ // This value is defined in a string value
+ // which represents a constant value, see the "JSON Number-type
+ // Field Values" section for detail.
+ "property": "VehicleProperty::INFO_FUEL_CAPACITY",
+ // (optional, number/string) The access mode for the property.
+ // If specified, this overwrite the default access mode specified in
+ // VehicleProperty.aidl. Must be specified for vendor properties.
+ "access": "VehiclePropertyAccess::READ",
+ // (optional, number/string) The change mode for the property.
+ // If specified, this overwrite the default change mode specified in
+ // VehicleProperty.aidl. Must be specified for vendor properties.
+ "changeMode": "VehiclePropertyChangeMode::STATIC",
+ // (optional, string) The config string.
+ "configString": "blahblah",
+ // (optional, array of number/string) The config array.
+ "configArray": [1, 2, "Constants::HVAC_ALL"],
+ // (optional, object) The default value for the property.
+ // If not specified, the property will be shown as unavailable
+ // until its value is set.
+ "defaultValue": {
+ // (optional, array of int number/string) Int values.
+ "int32Values": [1, 2, "Constants::HVAC_ALL"],
+ // (optional, array of int number/string) Long values.
+ "int64Values": [1, 2],
+ // (optional, array of float number/string) Float values.
+ "floatValues": [1.1, 2.2],
+ // (optional, string) String value.
+ "stringValue": "test"
+ },
+ // (optional, number/string) The minimum sample rate in HZ.
+ // Only work for VehiclePropertyChangeMode::CONTINUOUS property.
+ // Must be specified for continuous property.
+ "minSampleRate": 1,
+ // (optional, number/string) The maximum sample rate in HZ.
+ // Only work for VehiclePropertyChangeMode::CONTINUOUS property.
+ // Must be specified for continuous property.
+ "maxSampleRate": 10,
+ // (optional, array of objects) The area configs.
+ "areas:" [
+ {
+ // (number/string) The area ID.
+ "areaId": "Constants::DOOR_1_LEFT",
+ // (optional number/string) The minimum int value.
+ "minInt32Value": 1,
+ // (optional number/string) The maximum int value.
+ "maxInt32Value": 10,
+ // (optional number/string) The minimum long value.
+ "minInt64Value": 1,
+ // (optional number/string) The maximum long value.
+ "maxInt64Value": 10,
+ // (optional number/string) The minimum float value.
+ "minFloatValue": 1,
+ // (optional number/string) The maximum float value.
+ "maxFloatValue": 10,
+ // (optional object) The default value for this area.
+ // Uses the same format as the "defaultValue" field for
+ // property object. If specified, this overwrite the global
+ // defaultValue.
+ "defaultValue": {
+ "int32Values": [1, 2, "Constants::HVAC_ALL"],
+ "int64Values": [1, 2],
+ "floatValues": [1.1, 2.2],
+ "stringValue": "test"
+ }
+ }
+ ]
+ }
+ ]
+}
+```
+
+## JSON Number-type Field Values
+
+For number type field values, they can either be defined as a numeric number,
+e.g., `{"minInt32Value": 1}` or be defined as a string which represents a
+defined constant value, e.g.,
+`{"property": "VehicleProperty::INFO_FUEL_CAPACITY"}`.
+
+For constant values, they must be a string in the format of `XXX::XXX`, where
+the field before `::` is the constant type, and the field after `::` is the
+variable name.
+
+We support the following constant types:
+
+* VehiclePropertyAccess
+
+* VehiclePropertyChangeMode
+
+* VehicleGear
+
+* VehicleAreaWindow
+
+* VehicleOilLevel
+
+* VehicleUnit
+
+* VehicleSeatOccupancyState
+
+* VehicleHvacFanDirection
+
+* VehicleApPowerStateReport
+
+* VehicleTurnSignal
+
+* VehicleVendorPermission
+
+* EvsServiceType
+
+* EvsServiceState
+
+* EvConnectorType
+
+* VehicleProperty
+
+* GsrComplianceRequirementType
+
+* VehicleIgnitionState
+
+* FuelType
+
+* Constants
+
+Every constant type except "Constants" corresponds to a enum defined in Vehicle
+HAL interfac. E.g. "VehicleProperty" corresponds to the enums defined in
+"VehicleProperty.aidl".
+
+"Constants" type refers to the constant variables defined in the paresr.
+Specifically, the "CONSTANTS_BY_NAME" map defined in "JsonConfigLoader.cpp".
diff --git a/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json
new file mode 100644
index 0000000..33c6cc2
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json
@@ -0,0 +1,204 @@
+{
+ "properties": [
+ {
+ "property": "Constants::kMixedTypePropertyForTest",
+ "defaultValue": {
+ "floatValues": [
+ 4.5
+ ],
+ "int32Values": [
+ 1,
+ 2,
+ 3
+ ],
+ "stringValue": "MIXED property"
+ },
+ "configArray": [
+ 1,
+ 1,
+ 0,
+ 2,
+ 0,
+ 0,
+ 1,
+ 0,
+ 0
+ ],
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::VENDOR_EXTENSION_BOOLEAN_PROPERTY",
+ "areas": [
+ {
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areaId": "Constants::DOOR_1_LEFT"
+ },
+ {
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areaId": "Constants::DOOR_1_RIGHT"
+ },
+ {
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areaId": "Constants::DOOR_2_LEFT"
+ },
+ {
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areaId": "Constants::DOOR_2_RIGHT"
+ }
+ ],
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::VENDOR_EXTENSION_FLOAT_PROPERTY",
+ "areas": [
+ {
+ "defaultValue": {
+ "floatValues": [
+ 1.0
+ ]
+ },
+ "areaId": "Constants::HVAC_LEFT",
+ "minFloatValue": -10.0,
+ "maxFloatValue": 10.0
+ },
+ {
+ "defaultValue": {
+ "floatValues": [
+ 2.0
+ ]
+ },
+ "areaId": "Constants::HVAC_RIGHT",
+ "minFloatValue": -10.0,
+ "maxFloatValue": 10.0
+ }
+ ],
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::VENDOR_EXTENSION_INT_PROPERTY",
+ "areas": [
+ {
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD",
+ "minInt32Value": -100,
+ "maxInt32Value": 100
+ },
+ {
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "areaId": "VehicleAreaWindow::REAR_WINDSHIELD",
+ "minInt32Value": -100,
+ "maxInt32Value": 100
+ },
+ {
+ "defaultValue": {
+ "int32Values": [
+ -1
+ ]
+ },
+ "areaId": "VehicleAreaWindow::ROOF_TOP_1",
+ "minInt32Value": -100,
+ "maxInt32Value": 100
+ }
+ ],
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::VENDOR_EXTENSION_STRING_PROPERTY",
+ "defaultValue": {
+ "stringValue": "Vendor String Property"
+ },
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::PLACEHOLDER_PROPERTY_INT",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::PLACEHOLDER_PROPERTY_FLOAT",
+ "defaultValue": {
+ "floatValues": [
+ 0.0
+ ]
+ },
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::PLACEHOLDER_PROPERTY_BOOLEAN",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::PLACEHOLDER_PROPERTY_STRING",
+ "defaultValue": {
+ "stringValue": "Test"
+ },
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::ECHO_REVERSE_BYTES",
+ "access": "VehiclePropertyAccess::READ_WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION",
+ "defaultValue": {
+ "int32Values": [
+ 1
+ ]
+ },
+ "configArray": [
+ "Constants::kMixedTypePropertyForTest",
+ "VehicleVendorPermission::PERMISSION_GET_VENDOR_CATEGORY_INFO",
+ "VehicleVendorPermission::PERMISSION_SET_VENDOR_CATEGORY_INFO",
+ "Constants::VENDOR_EXTENSION_INT_PROPERTY",
+ "VehicleVendorPermission::PERMISSION_GET_VENDOR_CATEGORY_SEAT",
+ "VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE",
+ "Constants::VENDOR_EXTENSION_FLOAT_PROPERTY",
+ "VehicleVendorPermission::PERMISSION_DEFAULT",
+ "VehicleVendorPermission::PERMISSION_DEFAULT"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json b/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json
new file mode 100644
index 0000000..3a1a783
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json
@@ -0,0 +1,63 @@
+{
+ "properties": [
+ {
+ "property": "Constants::VENDOR_CLUSTER_SWITCH_UI",
+ "access": "VehiclePropertyAccess::WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::VENDOR_CLUSTER_DISPLAY_STATE",
+ "access": "VehiclePropertyAccess::WRITE",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ },
+ {
+ "property": "Constants::VENDOR_CLUSTER_REPORT_STATE",
+ "defaultValue": {
+ "int32Values": [
+ 0,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ -1,
+ 0,
+ -1
+ ]
+ },
+ "configArray": [
+ 0,
+ 0,
+ 0,
+ 11,
+ 0,
+ 0,
+ 0,
+ 0,
+ 16
+ ],
+ "access": "VehiclePropertyAccess::READ",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE",
+ "comment":
+ "Value means 0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, -1, -1 /* Insets */, 0 /* ClusterHome */, -1 /* ClusterNone */"
+ },
+ {
+ "property": "Constants::VENDOR_CLUSTER_REQUEST_DISPLAY",
+ "defaultValue": {
+ "int32Values": [
+ 0
+ ]
+ },
+ "access": "VehiclePropertyAccess::READ",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE",
+ "comment": "0 means ClusterHome"
+ },
+ {
+ "property": "Constants::VENDOR_CLUSTER_NAVIGATION_STATE",
+ "access": "VehiclePropertyAccess::READ",
+ "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h
deleted file mode 100644
index 622846a..0000000
--- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h
+++ /dev/null
@@ -1,2032 +0,0 @@
-/*
- * Copyright (C) 2021 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.
- */
-
-#ifndef android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_
-#define android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_
-
-#include <PropertyUtils.h>
-#include <TestPropertyUtils.h>
-#include <VehicleHalTypes.h>
-
-#include <map>
-#include <vector>
-
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace vehicle {
-
-// Types used in configs, not to be exposed as public API.
-namespace defaultconfig_impl {
-
-using ::aidl::android::hardware::automotive::vehicle::EvConnectorType;
-using ::aidl::android::hardware::automotive::vehicle::EvsServiceState;
-using ::aidl::android::hardware::automotive::vehicle::EvsServiceType;
-using ::aidl::android::hardware::automotive::vehicle::FuelType;
-using ::aidl::android::hardware::automotive::vehicle::RawPropValues;
-using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
-using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq;
-using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig;
-using ::aidl::android::hardware::automotive::vehicle::VehicleAreaMirror;
-using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow;
-using ::aidl::android::hardware::automotive::vehicle::VehicleGear;
-using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection;
-using ::aidl::android::hardware::automotive::vehicle::VehicleIgnitionState;
-using ::aidl::android::hardware::automotive::vehicle::VehicleOilLevel;
-using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig;
-using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
-using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess;
-using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode;
-using ::aidl::android::hardware::automotive::vehicle::VehicleSeatOccupancyState;
-using ::aidl::android::hardware::automotive::vehicle::VehicleTurnSignal;
-using ::aidl::android::hardware::automotive::vehicle::VehicleUnit;
-using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission;
-
-struct ConfigDeclaration {
- VehiclePropConfig config;
-
- // This value will be used as an initial value for the property. If this field is specified for
- // property that supports multiple areas then it will be used for all areas unless particular
- // area is overridden in initialAreaValue field.
- RawPropValues initialValue;
- // Use initialAreaValues if it is necessary to specify different values per each area.
- std::map<int32_t, RawPropValues> initialAreaValues;
-};
-
-const std::vector<ConfigDeclaration> kVehicleProperties = {
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.floatValues = {15000.0f}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_FUEL_TYPE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.int32Values = {toInt(FuelType::FUEL_TYPE_UNLEADED)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_EV_BATTERY_CAPACITY),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.floatValues = {150000.0f}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_EV_CONNECTOR_TYPE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.int32Values = {toInt(EvConnectorType::IEC_TYPE_1_AC)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_FUEL_DOOR_LOCATION),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.int32Values = {FUEL_DOOR_REAR_LEFT}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_EV_PORT_LOCATION),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT, CHARGE_PORT_REAR_LEFT}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_VIN),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.stringValue = "1GCARVIN123456789"}},
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_MAKE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.stringValue = "Toy Vehicle"}},
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_MODEL),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.stringValue = "Speedy Model"}},
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_MODEL_YEAR),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.int32Values = {2020}}},
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_EXTERIOR_DIMENSIONS),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- },
- .initialValue = {.int32Values = {1776, 4950, 2008, 2140, 2984, 1665, 1667, 11800}}},
- {.config =
- {
- .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 10.0f,
- },
- .initialValue = {.floatValues = {0.0f}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(VehicleUnit::METER_PER_SEC),
- toInt(VehicleUnit::MILES_PER_HOUR),
- toInt(VehicleUnit::KILOMETERS_PER_HOUR)},
- },
- .initialValue = {.int32Values = {toInt(VehicleUnit::KILOMETERS_PER_HOUR)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_BATTERY_DISPLAY_UNITS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(VehicleUnit::WATT_HOUR),
- toInt(VehicleUnit::AMPERE_HOURS),
- toInt(VehicleUnit::KILOWATT_HOUR)},
- },
- .initialValue = {.int32Values = {toInt(VehicleUnit::KILOWATT_HOUR)}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_MEMORY_SELECT),
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 3}}},
- .initialValue = {.int32Values = {1}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_MEMORY_SET),
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 3}}},
- .initialValue = {.int32Values = {1}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_BUCKLED),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER}}},
- .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}},
- {SEAT_1_RIGHT, {.int32Values = {0}}},
- {SEAT_2_LEFT, {.int32Values = {0}}},
- {SEAT_2_RIGHT, {.int32Values = {0}}},
- {SEAT_2_CENTER, {.int32Values = {0}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_HEIGHT_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = 0,
- .maxInt32Value = 10}}},
- .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {10}}},
- {SEAT_1_RIGHT, {.int32Values = {10}}},
- {SEAT_2_LEFT, {.int32Values = {10}}},
- {SEAT_2_RIGHT, {.int32Values = {10}}},
- {SEAT_2_CENTER, {.int32Values = {10}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_HEIGHT_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}},
- {SEAT_1_RIGHT, {.int32Values = {0}}},
- {SEAT_2_LEFT, {.int32Values = {0}}},
- {SEAT_2_RIGHT, {.int32Values = {0}}},
- {SEAT_2_CENTER, {.int32Values = {0}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_FORE_AFT_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -10,
- .maxInt32Value = 10}}},
- .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}},
- {SEAT_1_RIGHT, {.int32Values = {0}}},
- {SEAT_2_LEFT, {.int32Values = {0}}},
- {SEAT_2_RIGHT, {.int32Values = {0}}},
- {SEAT_2_CENTER, {.int32Values = {0}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_FORE_AFT_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}},
- {SEAT_1_RIGHT, {.int32Values = {0}}},
- {SEAT_2_LEFT, {.int32Values = {0}}},
- {SEAT_2_RIGHT, {.int32Values = {0}}},
- {SEAT_2_CENTER, {.int32Values = {0}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_1_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -10,
- .maxInt32Value = 10}}},
- .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}},
- {SEAT_1_RIGHT, {.int32Values = {0}}},
- {SEAT_2_LEFT, {.int32Values = {0}}},
- {SEAT_2_RIGHT, {.int32Values = {0}}},
- {SEAT_2_CENTER, {.int32Values = {0}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}},
- {SEAT_1_RIGHT, {.int32Values = {0}}},
- {SEAT_2_LEFT, {.int32Values = {0}}},
- {SEAT_2_RIGHT, {.int32Values = {0}}},
- {SEAT_2_CENTER, {.int32Values = {0}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_2_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -10,
- .maxInt32Value = 10}}},
- .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}},
- {SEAT_1_RIGHT, {.int32Values = {0}}},
- {SEAT_2_LEFT, {.int32Values = {0}}},
- {SEAT_2_RIGHT, {.int32Values = {0}}},
- {SEAT_2_CENTER, {.int32Values = {0}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}},
- {SEAT_1_RIGHT, {.int32Values = {0}}},
- {SEAT_2_LEFT, {.int32Values = {0}}},
- {SEAT_2_RIGHT, {.int32Values = {0}}},
- {SEAT_2_CENTER, {.int32Values = {0}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_HEIGHT_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -10,
- .maxInt32Value = 10}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_HEIGHT_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_DEPTH_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -10,
- .maxInt32Value = 10}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_DEPTH_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_TILT_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -10,
- .maxInt32Value = 10}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_TILT_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -10,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -10,
- .maxInt32Value = 10}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = 0,
- .maxInt32Value = 10}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_ANGLE_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = 0,
- .maxInt32Value = 10}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_ANGLE_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_FORE_AFT_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = 0,
- .maxInt32Value = 10}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::SEAT_OCCUPANCY),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = (SEAT_1_LEFT)},
- VehicleAreaConfig{.areaId = (SEAT_1_RIGHT)}},
- },
- .initialAreaValues = {{SEAT_1_LEFT,
- {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}},
- {SEAT_1_RIGHT,
- {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::INFO_DRIVER_SEAT),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- // this was a zoned property on an old vhal, but it is meant to be global
- .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
- },
- .initialValue = {.int32Values = {SEAT_1_LEFT}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::PERF_ODOMETER),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 10.0f,
- },
- .initialValue = {.floatValues = {0.0f}}},
- {.config =
- {
- .prop = toInt(VehicleProperty::PERF_STEERING_ANGLE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 10.0f,
- },
- .initialValue = {.floatValues = {0.0f}}},
- {.config =
- {
- .prop = toInt(VehicleProperty::PERF_REAR_STEERING_ANGLE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 10.0f,
- },
- .initialValue = {.floatValues = {0.0f}}},
- {
- .config =
- {
- .prop = toInt(VehicleProperty::ENGINE_RPM),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 10.0f,
- },
- .initialValue = {.floatValues = {0.0f}},
- },
-
- {.config =
- {
- .prop = toInt(VehicleProperty::FUEL_LEVEL),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 100.0f,
- },
- .initialValue = {.floatValues = {15000.0f}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::FUEL_DOOR_OPEN),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_BATTERY_LEVEL),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 100.0f,
- },
- .initialValue = {.floatValues = {150000.0f}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_CHARGE_PORT_OPEN),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_CHARGE_PORT_CONNECTED),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 10.0f,
- },
- .initialValue = {.floatValues = {0.0f}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {/*max current draw allowed by vehicle in amperes=*/20},
- },
- .initialValue = {.floatValues = {(float)12.5}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_CHARGE_PERCENT_LIMIT),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {20, 40, 60, 80, 100},
- },
- .initialValue = {.floatValues = {40}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_CHARGE_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {2}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_CHARGE_SWITCH),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0 /* false */}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_CHARGE_TIME_REMAINING),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 10.0f,
- },
- .initialValue = {.int32Values = {20}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EV_REGENERATIVE_BRAKING_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {2}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::TRAILER_PRESENT),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {2}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::VEHICLE_CURB_WEIGHT),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- .configArray = {/*gross weight kg=*/2948},
- },
- .initialValue = {.int32Values = {2211 /*kg*/}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::RANGE_REMAINING),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 2.0f,
- },
- .initialValue = {.floatValues = {50000.0f}}}, // units in meters
-
- {.config =
- {
- .prop = toInt(VehicleProperty::TIRE_PRESSURE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .areaConfigs = {VehicleAreaConfig{
- .areaId = WHEEL_FRONT_LEFT,
- .minFloatValue = 193.0f,
- .maxFloatValue = 300.0f,
- },
- VehicleAreaConfig{
- .areaId = WHEEL_FRONT_RIGHT,
- .minFloatValue = 193.0f,
- .maxFloatValue = 300.0f,
- },
- VehicleAreaConfig{
- .areaId = WHEEL_REAR_LEFT,
- .minFloatValue = 193.0f,
- .maxFloatValue = 300.0f,
- },
- VehicleAreaConfig{
- .areaId = WHEEL_REAR_RIGHT,
- .minFloatValue = 193.0f,
- .maxFloatValue = 300.0f,
- }},
- .minSampleRate = 1.0f,
- .maxSampleRate = 2.0f,
- },
- .initialValue = {.floatValues = {200.0f}}}, // units in kPa
-
- {.config =
- {
- .prop = toInt(VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- .areaConfigs = {VehicleAreaConfig{.areaId = WHEEL_FRONT_LEFT},
- VehicleAreaConfig{.areaId = WHEEL_FRONT_RIGHT},
- VehicleAreaConfig{.areaId = WHEEL_REAR_RIGHT},
- VehicleAreaConfig{.areaId = WHEEL_REAR_LEFT}},
- },
- .initialAreaValues = {{WHEEL_FRONT_LEFT, {.floatValues = {137.0f}}},
- {WHEEL_FRONT_RIGHT, {.floatValues = {137.0f}}},
- {WHEEL_REAR_RIGHT, {.floatValues = {137.0f}}},
- {WHEEL_REAR_LEFT, {.floatValues = {137.0f}}}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(VehicleUnit::KILOPASCAL), toInt(VehicleUnit::PSI),
- toInt(VehicleUnit::BAR)},
- },
- .initialValue = {.int32Values = {toInt(VehicleUnit::PSI)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::CURRENT_GEAR),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(VehicleGear::GEAR_PARK),
- toInt(VehicleGear::GEAR_NEUTRAL),
- toInt(VehicleGear::GEAR_REVERSE),
- toInt(VehicleGear::GEAR_1), toInt(VehicleGear::GEAR_2),
- toInt(VehicleGear::GEAR_3), toInt(VehicleGear::GEAR_4),
- toInt(VehicleGear::GEAR_5)},
- },
- .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::PARKING_BRAKE_ON),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {1}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::PARKING_BRAKE_AUTO_APPLY),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {1}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::FUEL_LEVEL_LOW),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {(int)VehicleUnit::LITER, (int)VehicleUnit::US_GALLON},
- },
- .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}},
-
- {.config =
- {
- .prop = toInt(
- VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {1}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HW_KEY_INPUT),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0, 0, 0}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HW_ROTARY_INPUT),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0, 0, 0}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HW_CUSTOM_INPUT),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {0, 0, 0, 3, 0, 0, 0, 0, 0},
- },
- .initialValue =
- {
- .int32Values = {0, 0, 0},
- }},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {50}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_POWER_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}},
- // TODO(bryaneyler): Ideally, this is generated dynamically from
- // kHvacPowerProperties.
- .configArray = {toInt(VehicleProperty::HVAC_FAN_SPEED),
- toInt(VehicleProperty::HVAC_FAN_DIRECTION)}},
- .initialValue = {.int32Values = {1}}},
-
- {
- .config = {.prop = toInt(VehicleProperty::HVAC_DEFROSTER),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs =
- {VehicleAreaConfig{
- .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)},
- VehicleAreaConfig{
- .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}},
- .initialValue = {.int32Values = {0}} // Will be used for all areas.
- },
- {
- .config = {.prop = toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs =
- {VehicleAreaConfig{
- .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)},
- VehicleAreaConfig{
- .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}},
- .initialValue = {.int32Values = {0}} // Will be used for all areas.
- },
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_DEFROST_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_RECIRC_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {1}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_AC_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {1}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_AC_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {1}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_DUAL_ON),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{
- .areaId = HVAC_ALL, .minInt32Value = 1, .maxInt32Value = 7}}},
- .initialValue = {.int32Values = {3}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {toInt(VehicleHvacFanDirection::FACE)}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::STATIC,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}},
- .initialValue = {.int32Values = {FAN_DIRECTION_FACE, FAN_DIRECTION_FLOOR,
- FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR,
- FAN_DIRECTION_DEFROST,
- FAN_DIRECTION_FACE | FAN_DIRECTION_DEFROST,
- FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST,
- FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST |
- FAN_DIRECTION_FACE}}},
- {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_VENTILATION),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{
- .areaId = SEAT_1_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 3,
- },
- VehicleAreaConfig{
- .areaId = SEAT_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 3,
- }}},
- .initialValue =
- {.int32Values = {0}}}, // 0 is off and +ve values indicate ventilation level.
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_STEERING_WHEEL_HEAT),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{
- .areaId = (0), .minInt32Value = -2, .maxInt32Value = 2}}},
- .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_TEMPERATURE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{
- .areaId = SEAT_1_LEFT,
- .minInt32Value = -2,
- .maxInt32Value = 2,
- },
- VehicleAreaConfig{
- .areaId = SEAT_1_RIGHT,
- .minInt32Value = -2,
- .maxInt32Value = 2,
- }}},
- .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_SIDE_MIRROR_HEAT),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{
- .areaId = toInt(VehicleAreaMirror::DRIVER_LEFT) |
- toInt(VehicleAreaMirror::DRIVER_RIGHT),
- .minInt32Value = 0,
- .maxInt32Value = 2,
- }}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_CURRENT),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_LEFT},
- VehicleAreaConfig{.areaId = HVAC_RIGHT}}},
- .initialAreaValues = {{HVAC_LEFT, {.floatValues = {17.3f}}},
- {HVAC_RIGHT, {.floatValues = {19.1f}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {160, 280, 5, 605, 825, 10},
- .areaConfigs = {VehicleAreaConfig{
- .areaId = HVAC_LEFT,
- .minFloatValue = 16,
- .maxFloatValue = 32,
- },
- VehicleAreaConfig{
- .areaId = HVAC_RIGHT,
- .minFloatValue = 16,
- .maxFloatValue = 32,
- }}},
- .initialAreaValues = {{HVAC_LEFT, {.floatValues = {16}}},
- {HVAC_RIGHT, {.floatValues = {20}}}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.floatValues = {66.2f, (float)VehicleUnit::FAHRENHEIT, 19.0f, 66.5f}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE),
- .access = VehiclePropertyAccess::READ,
- // TODO(bryaneyler): Support ON_CHANGE as well.
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 2.0f,
- },
- .initialValue = {.floatValues = {25.0f}}},
-
- {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(VehicleUnit::FAHRENHEIT), toInt(VehicleUnit::CELSIUS)}},
- .initialValue = {.int32Values = {toInt(VehicleUnit::FAHRENHEIT)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::DISTANCE_DISPLAY_UNITS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = (0)}},
- .configArray = {toInt(VehicleUnit::KILOMETER), toInt(VehicleUnit::MILE)},
- },
- .initialValue = {.int32Values = {toInt(VehicleUnit::MILE)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::NIGHT_MODE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::GEAR_SELECTION),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {toInt(VehicleGear::GEAR_PARK),
- toInt(VehicleGear::GEAR_NEUTRAL),
- toInt(VehicleGear::GEAR_REVERSE),
- toInt(VehicleGear::GEAR_DRIVE), toInt(VehicleGear::GEAR_1),
- toInt(VehicleGear::GEAR_2), toInt(VehicleGear::GEAR_3),
- toInt(VehicleGear::GEAR_4), toInt(VehicleGear::GEAR_5)},
- },
- .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::TURN_SIGNAL_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {toInt(VehicleTurnSignal::NONE)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::IGNITION_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {toInt(VehicleIgnitionState::ON)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::ENGINE_COOLANT_TEMP),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 1.0f,
- .maxSampleRate = 10.0f,
- },
- .initialValue = {.floatValues = {75.0f}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {toInt(VehicleOilLevel::NORMAL)}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::ENGINE_OIL_TEMP),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .minSampleRate = 0.1, // 0.1 Hz, every 10 seconds
- .maxSampleRate = 10, // 10 Hz, every 100 ms
- },
- .initialValue = {.floatValues = {101.0f}}},
-
- {
- .config = {.prop = kMixedTypePropertyForTest,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {1, 1, 0, 2, 0, 0, 1, 0, 0}},
- .initialValue =
- {
- .int32Values = {1 /* indicate TRUE boolean value */, 2, 3},
- .floatValues = {4.5f},
- .stringValue = "MIXED property",
- },
- },
-
- {.config = {.prop = toInt(VehicleProperty::DOOR_LOCK),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT},
- VehicleAreaConfig{.areaId = DOOR_1_RIGHT},
- VehicleAreaConfig{.areaId = DOOR_2_LEFT},
- VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}},
- .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}},
- {DOOR_1_RIGHT, {.int32Values = {1}}},
- {DOOR_2_LEFT, {.int32Values = {1}}},
- {DOOR_2_RIGHT, {.int32Values = {1}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::DOOR_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs =
- {VehicleAreaConfig{
- .areaId = DOOR_1_LEFT, .minInt32Value = 0, .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = DOOR_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 1},
- VehicleAreaConfig{
- .areaId = DOOR_2_LEFT, .minInt32Value = 0, .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = DOOR_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 1},
- VehicleAreaConfig{
- .areaId = DOOR_REAR, .minInt32Value = 0, .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::MIRROR_Z_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs =
- {VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_LEFT),
- .minInt32Value = -3,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT),
- .minInt32Value = -3,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_CENTER),
- .minInt32Value = -3,
- .maxInt32Value = 3}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::MIRROR_Z_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs =
- {VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_LEFT),
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT),
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_CENTER),
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::MIRROR_Y_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs =
- {VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_LEFT),
- .minInt32Value = -3,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT),
- .minInt32Value = -3,
- .maxInt32Value = 3},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_CENTER),
- .minInt32Value = -3,
- .maxInt32Value = 3}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::MIRROR_Y_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs =
- {VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_LEFT),
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_RIGHT),
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaMirror::DRIVER_CENTER),
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::MIRROR_LOCK),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
- .initialValue = {.int32Values = {1}}},
-
- {.config = {.prop = toInt(VehicleProperty::MIRROR_FOLD),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
- .initialValue = {.int32Values = {1}}},
-
- {.config = {.prop = toInt(VehicleProperty::WINDOW_LOCK),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_RIGHT | WINDOW_2_LEFT |
- WINDOW_2_RIGHT}}},
- .initialAreaValues = {{WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT,
- {.int32Values = {0}}}}},
-
- {.config = {.prop = toInt(VehicleProperty::WINDOW_POS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = WINDOW_1_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = WINDOW_2_LEFT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = WINDOW_2_RIGHT,
- .minInt32Value = 0,
- .maxInt32Value = 10},
- VehicleAreaConfig{.areaId = WINDOW_ROOF_TOP_1,
- .minInt32Value = -10,
- .maxInt32Value = 10}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::WINDOW_MOVE),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = WINDOW_1_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = WINDOW_2_LEFT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = WINDOW_2_RIGHT,
- .minInt32Value = -1,
- .maxInt32Value = 1},
- VehicleAreaConfig{.areaId = WINDOW_ROOF_TOP_1,
- .minInt32Value = -1,
- .maxInt32Value = 1}}},
- .initialValue = {.int32Values = {0}}},
-
- {.config =
- {
- .prop = WHEEL_TICK,
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
- .configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000},
- .minSampleRate = 1.0f,
- .maxSampleRate = 10.0f,
- },
- .initialValue = {.int64Values = {0, 100000, 200000, 300000, 400000}}},
-
- {.config = {.prop = ABS_ACTIVE,
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = TRACTION_CONTROL_ACTIVE,
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {3}}},
-
- {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
- .initialValue = {.int32Values = {toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL), 0}}},
-
- {.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.minInt32Value = 0, .maxInt32Value = 100}}},
- .initialValue = {.int32Values = {100}}},
-
- {
- .config = {.prop = OBD2_LIVE_FRAME,
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {0, 0}},
- },
-
- {
- .config = {.prop = OBD2_FREEZE_FRAME,
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {0, 0}},
- },
-
- {
- .config = {.prop = OBD2_FREEZE_FRAME_INFO,
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
- },
-
- {
- .config = {.prop = OBD2_FREEZE_FRAME_CLEAR,
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {1}},
- },
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HEADLIGHTS_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::FRONT_FOG_LIGHTS_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::REAR_FOG_LIGHTS_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HAZARD_LIGHTS_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::CABIN_LIGHTS_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
-
- {.config = {.prop = toInt(VehicleProperty::READING_LIGHTS_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER}}},
- .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HEADLIGHTS_SWITCH),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
-
- // FOG_LIGHTS_SWITCH must not be implemented when FRONT_FOG_LIGHTS_SWITCH is implemented
- {.config =
- {
- .prop = toInt(VehicleProperty::FRONT_FOG_LIGHTS_SWITCH),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
-
- // FOG_LIGHTS_SWITCH must not be implemented when REAR_FOG_LIGHTS_SWITCH is implemented
- {.config =
- {
- .prop = toInt(VehicleProperty::REAR_FOG_LIGHTS_SWITCH),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::HAZARD_LIGHTS_SWITCH),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::CABIN_LIGHTS_SWITCH),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
-
- {.config = {.prop = toInt(VehicleProperty::READING_LIGHTS_SWITCH),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT},
- VehicleAreaConfig{.areaId = SEAT_1_RIGHT},
- VehicleAreaConfig{.areaId = SEAT_2_LEFT},
- VehicleAreaConfig{.areaId = SEAT_2_RIGHT},
- VehicleAreaConfig{.areaId = SEAT_2_CENTER}}},
- .initialValue = {.int32Values = {LIGHT_STATE_ON}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::EVS_SERVICE_REQUEST),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {toInt(EvsServiceType::REARVIEW),
- toInt(EvsServiceState::OFF)}}},
-
- {.config = {.prop = VEHICLE_MAP_SERVICE,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE}},
-
- // Example Vendor Extension properties for testing
- {.config = {.prop = VENDOR_EXTENSION_BOOLEAN_PROPERTY,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT},
- VehicleAreaConfig{.areaId = DOOR_1_RIGHT},
- VehicleAreaConfig{.areaId = DOOR_2_LEFT},
- VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}},
- .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}},
- {DOOR_1_RIGHT, {.int32Values = {1}}},
- {DOOR_2_LEFT, {.int32Values = {0}}},
- {DOOR_2_RIGHT, {.int32Values = {0}}}}},
-
- {.config = {.prop = VENDOR_EXTENSION_FLOAT_PROPERTY,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_LEFT,
- .minFloatValue = -10,
- .maxFloatValue = 10},
- VehicleAreaConfig{.areaId = HVAC_RIGHT,
- .minFloatValue = -10,
- .maxFloatValue = 10}}},
- .initialAreaValues = {{HVAC_LEFT, {.floatValues = {1}}},
- {HVAC_RIGHT, {.floatValues = {2}}}}},
-
- {.config = {.prop = VENDOR_EXTENSION_INT_PROPERTY,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .areaConfigs =
- {VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD),
- .minInt32Value = -100,
- .maxInt32Value = 100},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD),
- .minInt32Value = -100,
- .maxInt32Value = 100},
- VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::ROOF_TOP_1),
- .minInt32Value = -100,
- .maxInt32Value = 100}}},
- .initialAreaValues = {{toInt(VehicleAreaWindow::FRONT_WINDSHIELD), {.int32Values = {1}}},
- {toInt(VehicleAreaWindow::REAR_WINDSHIELD), {.int32Values = {0}}},
- {toInt(VehicleAreaWindow::ROOF_TOP_1), {.int32Values = {-1}}}}},
-
- {.config = {.prop = VENDOR_EXTENSION_STRING_PROPERTY,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
- .initialValue = {.stringValue = "Vendor String Property"}},
-
- {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
- .initialValue = {.int32Values = {0}}},
-
- {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE},
- .initialValue = {.int32Values = {0}}},
-
- {.config =
- {
- .prop = toInt(VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {kMixedTypePropertyForTest,
- toInt(VehicleVendorPermission::
- PERMISSION_GET_VENDOR_CATEGORY_INFO),
- toInt(VehicleVendorPermission::
- PERMISSION_SET_VENDOR_CATEGORY_INFO),
- VENDOR_EXTENSION_INT_PROPERTY,
- toInt(VehicleVendorPermission::
- PERMISSION_GET_VENDOR_CATEGORY_SEAT),
- toInt(VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE),
- VENDOR_EXTENSION_FLOAT_PROPERTY,
- toInt(VehicleVendorPermission::PERMISSION_DEFAULT),
- toInt(VehicleVendorPermission::PERMISSION_DEFAULT)},
- },
- .initialValue = {.int32Values = {1}}},
-
- {
- .config =
- {
- .prop = toInt(VehicleProperty::INITIAL_USER_INFO),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::SWITCH_USER),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::CREATE_USER),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::REMOVE_USER),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::POWER_POLICY_REQ),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::POWER_POLICY_GROUP_REQ),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::CURRENT_POWER_POLICY),
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::ANDROID_EPOCH_TIME),
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::WATCHDOG_ALIVE),
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::WATCHDOG_TERMINATED_PROCESS),
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::VHAL_HEARTBEAT),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::CLUSTER_SWITCH_UI),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0 /* ClusterHome */}},
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::CLUSTER_DISPLAY_STATE),
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1,
- -1, -1 /* Insets */}},
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::CLUSTER_REPORT_STATE),
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16},
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY),
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE),
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = PLACEHOLDER_PROPERTY_INT,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0}},
- },
- {
- .config =
- {
- .prop = PLACEHOLDER_PROPERTY_FLOAT,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.floatValues = {0.0f}},
- },
- {
- .config =
- {
- .prop = PLACEHOLDER_PROPERTY_BOOLEAN,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0 /* false */}},
- },
- {
- .config =
- {
- .prop = PLACEHOLDER_PROPERTY_STRING,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.stringValue = {"Test"}},
- },
- {
- .config =
- {
- .prop = ECHO_REVERSE_BYTES,
- .access = VehiclePropertyAccess::READ_WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
-#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
- // Vendor propetry for E2E ClusterHomeService testing.
- {
- .config =
- {
- .prop = VENDOR_CLUSTER_SWITCH_UI,
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = VENDOR_CLUSTER_DISPLAY_STATE,
- .access = VehiclePropertyAccess::WRITE,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
- {
- .config =
- {
- .prop = VENDOR_CLUSTER_REPORT_STATE,
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16},
- },
- .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1,
- -1, -1 /* Insets */, 0 /* ClusterHome */,
- -1 /* ClusterNone */}},
- },
- {
- .config =
- {
- .prop = VENDOR_CLUSTER_REQUEST_DISPLAY,
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- .initialValue = {.int32Values = {0 /* ClusterHome */}},
- },
- {
- .config =
- {
- .prop = VENDOR_CLUSTER_NAVIGATION_STATE,
- .access = VehiclePropertyAccess::READ,
- .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
- },
- },
-#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
-};
-
-} // namespace defaultconfig_impl
-
-// public namespace
-namespace defaultconfig {
-
-typedef defaultconfig_impl::ConfigDeclaration ConfigDeclaration;
-
-inline constexpr const std::vector<ConfigDeclaration>& getDefaultConfigs() {
- return defaultconfig_impl::kVehicleProperties;
-}
-
-} // namespace defaultconfig
-
-} // namespace vehicle
-} // namespace automotive
-} // namespace hardware
-} // namespace android
-
-#endif // android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_
diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
index 771472c..8702eae 100644
--- a/automotive/vehicle/aidl/impl/default_config/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
@@ -24,11 +24,47 @@
defaults: ["VehicleHalDefaults"],
srcs: ["*.cpp"],
static_libs: [
+ "VehicleHalJsonConfigLoader",
"VehicleHalUtils",
+ "libgmock",
"libgtest",
],
header_libs: [
- "VehicleHalDefaultConfig",
+ "IVehicleGeneratedHeaders",
+ ],
+ shared_libs: [
+ "libjsoncpp",
+ ],
+ data: [
+ ":VehicleHalDefaultProperties_JSON",
+ ],
+ test_suites: ["device-tests"],
+}
+
+cc_test {
+ name: "VehicleHalDefaultConfigTestEnableTestProperties",
+ vendor: true,
+ defaults: ["VehicleHalDefaults"],
+ srcs: ["*.cpp"],
+ static_libs: [
+ "VehicleHalJsonConfigLoaderEnableTestProperties",
+ "VehicleHalUtils",
+ "libgmock",
+ "libgtest",
+ ],
+ cflags: [
+ "-DENABLE_VEHICLE_HAL_TEST_PROPERTIES",
+ ],
+ header_libs: [
+ "IVehicleGeneratedHeaders",
+ ],
+ shared_libs: [
+ "libjsoncpp",
+ ],
+ data: [
+ ":VehicleHalDefaultProperties_JSON",
+ ":VehicleHalTestProperties_JSON",
+ ":VehicleHalVendorClusterTestProperties_JSON",
],
test_suites: ["device-tests"],
}
diff --git a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp
index baaae75..95fecfe 100644
--- a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp
+++ b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp
@@ -14,27 +14,75 @@
* limitations under the License.
*/
-#include <DefaultConfig.h>
+#include <JsonConfigLoader.h>
#include <VehicleUtils.h>
+#include <android-base/file.h>
+#include <gmock/gmock.h>
#include <gtest/gtest.h>
+#include <fstream>
+#include <unordered_map>
namespace android {
namespace hardware {
namespace automotive {
namespace vehicle {
-namespace defaultconfig {
namespace test {
-TEST(DefaultConfigTest, loadDefaultConfigs) {
- for (ConfigDeclaration config : getDefaultConfigs()) {
- ASSERT_NE(0, config.config.prop);
- }
+using ::android::base::Error;
+using ::android::base::Result;
+using ::testing::UnorderedElementsAreArray;
+
+constexpr char kDefaultPropertiesConfigFile[] = "DefaultProperties.json";
+
+#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES
+constexpr char kTestPropertiesConfigFile[] = "TestProperties.json";
+constexpr char kVendorClusterTestPropertiesConfigFile[] = "VendorClusterTestProperties.json";
+#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES
+
+std::string getTestFilePath(const char* filename) {
+ static std::string baseDir = android::base::GetExecutableDirectory();
+ return baseDir + "/" + filename;
}
+Result<std::unordered_map<int32_t, ConfigDeclaration>> loadConfig(JsonConfigLoader& loader,
+ const char* path) {
+ std::string configPath = getTestFilePath(path);
+ std::ifstream ifs(configPath.c_str());
+ if (!ifs) {
+ return Error() << "couldn't open %s for parsing." << configPath;
+ }
+
+ return loader.loadPropConfig(ifs);
+}
+
+TEST(DefaultConfigTest, TestloadDefaultProperties) {
+ JsonConfigLoader loader;
+ auto result = loadConfig(loader, kDefaultPropertiesConfigFile);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+}
+
+#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES
+
+TEST(DefaultConfigTest, TestloadTestProperties) {
+ JsonConfigLoader loader;
+ auto result = loadConfig(loader, kTestPropertiesConfigFile);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+}
+
+TEST(DefaultConfigTest, TestloadVendorClusterTestProperties) {
+ JsonConfigLoader loader;
+ auto result = loadConfig(loader, kVendorClusterTestPropertiesConfigFile);
+
+ ASSERT_TRUE(result.ok()) << result.error().message();
+}
+
+#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES
+
} // namespace test
-} // namespace defaultconfig
} // namespace vehicle
} // namespace automotive
} // namespace hardware
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h
index 9f112ae..f96b6ec 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h
@@ -54,8 +54,8 @@
void registerGenerator(int32_t generatorId, std::unique_ptr<FakeValueGenerator> generator);
// Unregister a generator with the generatorId. If no registered generator is found, this
- // function does nothing.
- void unregisterGenerator(int32_t generatorId);
+ // function does nothing. Returns true if the generator is unregistered.
+ bool unregisterGenerator(int32_t generatorId);
private:
struct VhalEvent {
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h
index d421ac5..42b1bd3 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h
@@ -45,6 +45,9 @@
// Create a new JSON fake value generator using the specified JSON file path. All the events
// in the JSON file would be generated once.
explicit JsonFakeValueGenerator(const std::string& path);
+ // Create a new JSON fake value generator using the JSON content. The first argument is just
+ // used to differentiate this function with the one that takes path as input.
+ explicit JsonFakeValueGenerator(bool unused, const std::string& content, int32_t iteration);
~JsonFakeValueGenerator() = default;
@@ -53,6 +56,9 @@
const std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropValue>&
getAllEvents();
+ // Whether there are events left to replay for this generator.
+ bool hasNext();
+
private:
size_t mEventIndex = 0;
std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropValue> mEvents;
@@ -60,7 +66,8 @@
int32_t mNumOfIterations = 0;
void setBit(std::vector<uint8_t>& bytes, size_t idx);
- void init(const std::string& path, int32_t iteration);
+ void initWithPath(const std::string& path, int32_t iteration);
+ void initWithStream(std::istream& is, int32_t iteration);
};
} // namespace fake
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp
index 0c182d9..d815456 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp
@@ -29,11 +29,18 @@
using ::android::base::ScopedLockAssertion;
-GeneratorHub::GeneratorHub(OnHalEvent&& onHalEvent)
- : mOnHalEvent(onHalEvent), mThread(&GeneratorHub::run, this) {}
+GeneratorHub::GeneratorHub(OnHalEvent&& onHalEvent) : mOnHalEvent(onHalEvent) {
+ mThread = std::thread(&GeneratorHub::run, this);
+}
GeneratorHub::~GeneratorHub() {
- mShuttingDownFlag.store(true);
+ {
+ // Even if the shared variable is atomic, it must be modified under the
+ // mutex in order to correctly publish the modification to the waiting
+ // thread.
+ std::unique_lock<std::mutex> lock(mGeneratorsLock);
+ mShuttingDownFlag.store(true);
+ }
mCond.notify_all();
if (mThread.joinable()) {
mThread.join();
@@ -58,13 +65,15 @@
mCond.notify_one();
}
-void GeneratorHub::unregisterGenerator(int32_t id) {
+bool GeneratorHub::unregisterGenerator(int32_t id) {
+ bool removed;
{
std::scoped_lock<std::mutex> lockGuard(mGeneratorsLock);
- mGenerators.erase(id);
+ removed = mGenerators.erase(id);
}
mCond.notify_one();
ALOGI("%s: Unregistered generator, id: %d", __func__, id);
+ return removed;
}
void GeneratorHub::run() {
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp
index d4d52a5..cb42317 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp
@@ -173,12 +173,11 @@
} // namespace
-JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path) {
- init(path, 1);
-}
+JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path)
+ : JsonFakeValueGenerator(path, /*iteration=*/1) {}
JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path, int32_t iteration) {
- init(path, iteration);
+ initWithPath(path, iteration);
}
JsonFakeValueGenerator::JsonFakeValueGenerator(const VehiclePropValue& request) {
@@ -186,16 +185,26 @@
// Iterate infinitely if iteration number is not provided
int32_t numOfIterations = v.int32Values.size() < 2 ? -1 : v.int32Values[1];
- init(v.stringValue, numOfIterations);
+ initWithPath(v.stringValue, numOfIterations);
}
-void JsonFakeValueGenerator::init(const std::string& path, int32_t iteration) {
+JsonFakeValueGenerator::JsonFakeValueGenerator([[maybe_unused]] bool unused,
+ const std::string& content, int32_t iteration) {
+ std::istringstream iss(content);
+ initWithStream(iss, iteration);
+}
+
+void JsonFakeValueGenerator::initWithPath(const std::string& path, int32_t iteration) {
std::ifstream ifs(path);
if (!ifs) {
ALOGE("%s: couldn't open %s for parsing.", __func__, path.c_str());
return;
}
- mEvents = parseFakeValueJson(ifs);
+ initWithStream(ifs, iteration);
+}
+
+void JsonFakeValueGenerator::initWithStream(std::istream& is, int32_t iteration) {
+ mEvents = parseFakeValueJson(is);
mNumOfIterations = iteration;
}
@@ -235,12 +244,15 @@
mNumOfIterations--;
}
}
-
generatedValue.timestamp = mLastEventTimestamp;
return generatedValue;
}
+bool JsonFakeValueGenerator::hasNext() {
+ return mNumOfIterations != 0 && mEvents.size() > 0;
+}
+
} // namespace fake
} // namespace vehicle
} // namespace automotive
diff --git a/automotive/vehicle/aidl/impl/fake_impl/README.md b/automotive/vehicle/aidl/impl/fake_impl/README.md
new file mode 100644
index 0000000..e86dcee
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/fake_impl/README.md
@@ -0,0 +1,28 @@
+# Fake reference AIDL VHAL implementation libraries
+---
+
+This directory stores libraries for implementing a fake reference AIDL VHAL.
+
+WARNING: All the libraries here are for TEST ONLY.
+
+## GeneratorHub
+
+Defines a library `FakeVehicleHalValueGenerators` that could generate fake
+vehicle property values for testing.
+
+## hardware
+
+Defines a fake implementation for device-specifc interface `IVehicleHardware`:
+`FakeVehicleHardware`. This implementation uses a in-memory map for storing
+property values and does not communicate with or depending on any specific
+vehicle bus.
+
+## obd2frame
+
+Defines a library `FakeObd2Frame` that generates fake OBD2 frame for OBD2
+properties.
+
+## userhal
+
+Defines a library `FakeUserHal` that emulates a real User HAL behavior by
+parsing debug commands.
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp
index dcd9208..4c17cde 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp
@@ -24,6 +24,7 @@
srcs: ["src/*.cpp"],
local_include_dirs: ["include"],
export_include_dirs: ["include"],
+ cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"],
defaults: [
"VehicleHalDefaults",
"FakeVehicleHardwareDefaults",
@@ -32,18 +33,23 @@
cc_defaults {
name: "FakeVehicleHardwareDefaults",
- cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"],
header_libs: [
"IVehicleHardware",
- "VehicleHalDefaultConfig",
+ "VehicleHalTestUtilHeaders",
],
export_header_lib_headers: ["IVehicleHardware"],
static_libs: [
+ "VehicleHalJsonConfigLoaderEnableTestProperties",
"VehicleHalUtils",
"FakeVehicleHalValueGenerators",
"FakeObd2Frame",
"FakeUserHal",
],
+ required: [
+ "Prebuilt_VehicleHalDefaultProperties_JSON",
+ "Prebuilt_VehicleHalTestProperties_JSON",
+ "Prebuilt_VehicleHalVendorClusterTestProperties_JSON",
+ ],
shared_libs: [
"libjsoncpp",
],
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
index 34b2b24..1636cb6 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
@@ -18,21 +18,24 @@
#define android_hardware_automotive_vehicle_aidl_impl_fake_impl_hardware_include_FakeVehicleHardware_H_
#include <ConcurrentQueue.h>
-#include <DefaultConfig.h>
+#include <ConfigDeclaration.h>
#include <FakeObd2Frame.h>
#include <FakeUserHal.h>
+#include <GeneratorHub.h>
#include <IVehicleHardware.h>
+#include <JsonConfigLoader.h>
#include <RecurrentTimer.h>
#include <VehicleHalTypes.h>
#include <VehiclePropertyStore.h>
+#include <aidl/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.h>
#include <android-base/parseint.h>
#include <android-base/result.h>
#include <android-base/stringprintf.h>
#include <android-base/thread_annotations.h>
-#include <map>
#include <memory>
#include <mutex>
+#include <unordered_map>
#include <vector>
namespace android {
@@ -47,7 +50,8 @@
FakeVehicleHardware();
- explicit FakeVehicleHardware(std::unique_ptr<VehiclePropValuePool> valuePool);
+ FakeVehicleHardware(std::string defaultConfigDir, std::string overrideConfigDir,
+ bool forceOverride);
~FakeVehicleHardware();
@@ -132,11 +136,15 @@
const std::unique_ptr<FakeUserHal> mFakeUserHal;
// RecurrentTimer is thread-safe.
std::unique_ptr<RecurrentTimer> mRecurrentTimer;
+ // GeneratorHub is thread-safe.
+ std::unique_ptr<GeneratorHub> mGeneratorHub;
std::mutex mLock;
std::unique_ptr<const PropertyChangeCallback> mOnPropertyChangeCallback GUARDED_BY(mLock);
std::unique_ptr<const PropertySetErrorCallback> mOnPropertySetErrorCallback GUARDED_BY(mLock);
std::unordered_map<PropIdAreaId, std::shared_ptr<RecurrentTimer::Callback>, PropIdAreaIdHash>
mRecurrentActions GUARDED_BY(mLock);
+ std::unordered_map<PropIdAreaId, VehiclePropValuePool::RecyclableType, PropIdAreaIdHash>
+ mSavedProps GUARDED_BY(mLock);
// PendingRequestHandler is thread-safe.
mutable PendingRequestHandler<GetValuesCallback,
aidl::android::hardware::automotive::vehicle::GetValueRequest>
@@ -145,17 +153,27 @@
aidl::android::hardware::automotive::vehicle::SetValueRequest>
mPendingSetValueRequests;
+ const std::string mDefaultConfigDir;
+ const std::string mOverrideConfigDir;
+ const bool mForceOverride;
+
+ // Only used during initialization.
+ JsonConfigLoader mLoader;
+
void init();
// Stores the initial value to property store.
- void storePropInitialValue(const defaultconfig::ConfigDeclaration& config);
+ void storePropInitialValue(const ConfigDeclaration& config);
// The callback that would be called when a vehicle property value change happens.
void onValueChangeCallback(
const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
- // If property "persist.vendor.vhal_init_value_override" is set to true, override the properties
- // using config files in 'overrideDir'.
- void maybeOverrideProperties(const char* overrideDir);
- // Override the properties using config files in 'overrideDir'.
- void overrideProperties(const char* overrideDir);
+ // Load the config files in format '*.json' from the directory and parse the config files
+ // into a map from property ID to ConfigDeclarations.
+ void loadPropConfigsFromDir(const std::string& dirPath,
+ std::unordered_map<int32_t, ConfigDeclaration>* configs);
+ // Function to be called when a value change event comes from vehicle bus. In our fake
+ // implementation, this function is only called during "--inject-event" dump command.
+ void eventFromVehicleBus(
+ const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);
VhalResult<void> maybeSetSpecialValue(
const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value,
@@ -175,6 +193,8 @@
const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
bool isHvacPropAndHvacNotAvailable(int32_t propId);
+ std::unordered_map<int32_t, ConfigDeclaration> loadConfigDeclarations();
+
std::string dumpAllProperties();
std::string dumpOnePropertyByConfig(
int rowNumber,
@@ -184,6 +204,10 @@
std::string dumpListProperties();
std::string dumpSpecificProperty(const std::vector<std::string>& options);
std::string dumpSetProperties(const std::vector<std::string>& options);
+ std::string dumpGetPropertyWithArg(const std::vector<std::string>& options);
+ std::string dumpSaveProperty(const std::vector<std::string>& options);
+ std::string dumpRestoreProperty(const std::vector<std::string>& options);
+ std::string dumpInjectEvent(const std::vector<std::string>& options);
template <typename T>
android::base::Result<T> safelyParseInt(int index, const std::string& s) {
@@ -198,7 +222,7 @@
std::vector<std::string> getOptionValues(const std::vector<std::string>& options,
size_t* index);
android::base::Result<aidl::android::hardware::automotive::vehicle::VehiclePropValue>
- parseSetPropOptions(const std::vector<std::string>& options);
+ parsePropOptions(const std::vector<std::string>& options);
android::base::Result<std::vector<uint8_t>> parseHexString(const std::string& s);
android::base::Result<void> checkArgumentsSize(const std::vector<std::string>& options,
@@ -207,6 +231,14 @@
const aidl::android::hardware::automotive::vehicle::GetValueRequest& request);
aidl::android::hardware::automotive::vehicle::SetValueResult handleSetValueRequest(
const aidl::android::hardware::automotive::vehicle::SetValueRequest& request);
+
+ std::string genFakeDataCommand(const std::vector<std::string>& options);
+
+ static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp(
+ aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action,
+ int32_t keyCode, int32_t targetDisplay);
+ static std::string genFakeDataHelp();
+ static std::string parseErrMsg(std::string fieldName, std::string value, std::string type);
};
} // namespace fake
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
index 20c34aa..d87e5aa 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
@@ -19,13 +19,15 @@
#include "FakeVehicleHardware.h"
-#include <DefaultConfig.h>
#include <FakeObd2Frame.h>
#include <JsonFakeValueGenerator.h>
+#include <LinearFakeValueGenerator.h>
#include <PropertyUtils.h>
#include <TestPropertyUtils.h>
#include <VehicleHalTypes.h>
#include <VehicleUtils.h>
+
+#include <android-base/file.h>
#include <android-base/parsedouble.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
@@ -33,6 +35,7 @@
#include <utils/SystemClock.h>
#include <dirent.h>
+#include <inttypes.h>
#include <sys/types.h>
#include <fstream>
#include <regex>
@@ -55,6 +58,7 @@
using ::aidl::android::hardware::automotive::vehicle::StatusCode;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq;
+using ::aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig;
using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup;
@@ -64,14 +68,23 @@
using ::android::base::EqualsIgnoreCase;
using ::android::base::Error;
+using ::android::base::GetIntProperty;
using ::android::base::ParseFloat;
using ::android::base::Result;
using ::android::base::ScopedLockAssertion;
using ::android::base::StartsWith;
using ::android::base::StringPrintf;
-const char* VENDOR_OVERRIDE_DIR = "/vendor/etc/automotive/vhaloverride/";
-const char* OVERRIDE_PROPERTY = "persist.vendor.vhal_init_value_override";
+// The directory for default property configuration file.
+// For config file format, see impl/default_config/config/README.md.
+constexpr char DEFAULT_CONFIG_DIR[] = "/vendor/etc/automotive/vhalconfig/";
+// The directory for property configuration file that overrides the default configuration file.
+// For config file format, see impl/default_config/config/README.md.
+constexpr char OVERRIDE_CONFIG_DIR[] = "/vendor/etc/automotive/vhaloverride/";
+// If OVERRIDE_PROPERTY is set, we will use the configuration files from OVERRIDE_CONFIG_DIR to
+// overwrite the default configs.
+constexpr char OVERRIDE_PROPERTY[] = "persist.vendor.vhal_init_value_override";
+constexpr char POWER_STATE_REQ_CONFIG_PROPERTY[] = "ro.vendor.fake_vhal.ap_power_state_req.config";
// A list of supported options for "--set" command.
const std::unordered_set<std::string> SET_PROP_OPTIONS = {
@@ -86,11 +99,13 @@
// bytes in hex format, e.g. 0xDEADBEEF.
"-b",
// Area id in integer.
- "-a"};
+ "-a",
+ // Timestamp in int64.
+ "-t"};
} // namespace
-void FakeVehicleHardware::storePropInitialValue(const defaultconfig::ConfigDeclaration& config) {
+void FakeVehicleHardware::storePropInitialValue(const ConfigDeclaration& config) {
const VehiclePropConfig& vehiclePropConfig = config.config;
int propId = vehiclePropConfig.prop;
@@ -132,30 +147,50 @@
}
FakeVehicleHardware::FakeVehicleHardware()
- : FakeVehicleHardware(std::make_unique<VehiclePropValuePool>()) {}
+ : FakeVehicleHardware(DEFAULT_CONFIG_DIR, OVERRIDE_CONFIG_DIR, false) {}
-FakeVehicleHardware::FakeVehicleHardware(std::unique_ptr<VehiclePropValuePool> valuePool)
- : mValuePool(std::move(valuePool)),
+FakeVehicleHardware::FakeVehicleHardware(std::string defaultConfigDir,
+ std::string overrideConfigDir, bool forceOverride)
+ : mValuePool(std::make_unique<VehiclePropValuePool>()),
mServerSidePropStore(new VehiclePropertyStore(mValuePool)),
mFakeObd2Frame(new obd2frame::FakeObd2Frame(mServerSidePropStore)),
mFakeUserHal(new FakeUserHal(mValuePool)),
mRecurrentTimer(new RecurrentTimer()),
+ mGeneratorHub(new GeneratorHub(
+ [this](const VehiclePropValue& value) { eventFromVehicleBus(value); })),
mPendingGetValueRequests(this),
- mPendingSetValueRequests(this) {
+ mPendingSetValueRequests(this),
+ mDefaultConfigDir(defaultConfigDir),
+ mOverrideConfigDir(overrideConfigDir),
+ mForceOverride(forceOverride) {
init();
}
FakeVehicleHardware::~FakeVehicleHardware() {
mPendingGetValueRequests.stop();
mPendingSetValueRequests.stop();
+ mGeneratorHub.reset();
+}
+
+std::unordered_map<int32_t, ConfigDeclaration> FakeVehicleHardware::loadConfigDeclarations() {
+ std::unordered_map<int32_t, ConfigDeclaration> configsByPropId;
+ loadPropConfigsFromDir(mDefaultConfigDir, &configsByPropId);
+ if (mForceOverride ||
+ android::base::GetBoolProperty(OVERRIDE_PROPERTY, /*default_value=*/false)) {
+ loadPropConfigsFromDir(mOverrideConfigDir, &configsByPropId);
+ }
+ return configsByPropId;
}
void FakeVehicleHardware::init() {
- for (auto& it : defaultconfig::getDefaultConfigs()) {
- VehiclePropConfig cfg = it.config;
+ for (auto& [_, configDeclaration] : loadConfigDeclarations()) {
+ VehiclePropConfig cfg = configDeclaration.config;
VehiclePropertyStore::TokenFunction tokenFunction = nullptr;
- if (cfg.prop == OBD2_FREEZE_FRAME) {
+ if (cfg.prop == toInt(VehicleProperty::AP_POWER_STATE_REQ)) {
+ int config = GetIntProperty(POWER_STATE_REQ_CONFIG_PROPERTY, /*default_value=*/0);
+ cfg.configArray[0] = config;
+ } else if (cfg.prop == OBD2_FREEZE_FRAME) {
tokenFunction = [](const VehiclePropValue& propValue) { return propValue.timestamp; };
}
@@ -165,15 +200,18 @@
// logic.
continue;
}
- storePropInitialValue(it);
+ storePropInitialValue(configDeclaration);
}
- maybeOverrideProperties(VENDOR_OVERRIDE_DIR);
-
// OBD2_LIVE_FRAME and OBD2_FREEZE_FRAME must be configured in default configs.
- mFakeObd2Frame->initObd2LiveFrame(*mServerSidePropStore->getConfig(OBD2_LIVE_FRAME).value());
- mFakeObd2Frame->initObd2FreezeFrame(
- *mServerSidePropStore->getConfig(OBD2_FREEZE_FRAME).value());
+ auto maybeObd2LiveFrame = mServerSidePropStore->getConfig(OBD2_LIVE_FRAME);
+ if (maybeObd2LiveFrame.has_value()) {
+ mFakeObd2Frame->initObd2LiveFrame(*maybeObd2LiveFrame.value());
+ }
+ auto maybeObd2FreezeFrame = mServerSidePropStore->getConfig(OBD2_FREEZE_FRAME);
+ if (maybeObd2FreezeFrame.has_value()) {
+ mFakeObd2Frame->initObd2FreezeFrame(*maybeObd2FreezeFrame.value());
+ }
mServerSidePropStore->setOnValueChangeCallback(
[this](const VehiclePropValue& value) { return onValueChangeCallback(value); });
@@ -395,7 +433,7 @@
*isSpecialValue = true;
return mFakeObd2Frame->clearObd2FreezeFrames(value);
-#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
+#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES
case toInt(VehicleProperty::CLUSTER_REPORT_STATE):
[[fallthrough]];
case toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY):
@@ -423,7 +461,7 @@
<< getErrorMsg(writeResult);
}
return {};
-#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
+#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES
default:
break;
@@ -574,34 +612,237 @@
result.buffer = dumpListProperties();
} else if (EqualsIgnoreCase(option, "--get")) {
result.buffer = dumpSpecificProperty(options);
+ } else if (EqualsIgnoreCase(option, "--getWithArg")) {
+ result.buffer = dumpGetPropertyWithArg(options);
} else if (EqualsIgnoreCase(option, "--set")) {
result.buffer = dumpSetProperties(options);
+ } else if (EqualsIgnoreCase(option, "--save-prop")) {
+ result.buffer = dumpSaveProperty(options);
+ } else if (EqualsIgnoreCase(option, "--restore-prop")) {
+ result.buffer = dumpRestoreProperty(options);
+ } else if (EqualsIgnoreCase(option, "--inject-event")) {
+ result.buffer = dumpInjectEvent(options);
} else if (EqualsIgnoreCase(option, kUserHalDumpOption)) {
if (options.size() == 1) {
result.buffer = mFakeUserHal->showDumpHelp();
} else {
result.buffer = mFakeUserHal->dump(options[1]);
}
+ } else if (EqualsIgnoreCase(option, "--genfakedata")) {
+ result.buffer = genFakeDataCommand(options);
} else {
result.buffer = StringPrintf("Invalid option: %s\n", option.c_str());
}
return result;
}
+std::string FakeVehicleHardware::genFakeDataHelp() {
+ return R"(
+Generate Fake Data Usage:
+--genfakedata --startlinear [propID] [mValue] [cValue] [dispersion] [increment] [interval]: "
+Start a linear generator that generates event with floatValue within range:
+[mValue - disperson, mValue + dispersion].
+propID(int32): ID for the property to generate event for.
+mValue(float): The middle of the possible values for the property.
+cValue(float): The start value for the property, must be within the range.
+dispersion(float): The range the value can change.
+increment(float): The step the value would increase by for each generated event,
+if exceed the range, the value would loop back.
+interval(int64): The interval in nanoseconds the event would generate by.
+
+--genfakedata --stoplinear [propID(int32)]: Stop a linear generator
+
+--genfakedata --startjson --path [jsonFilePath] [repetition]:
+Start a JSON generator that would generate events according to a JSON file.
+jsonFilePath(string): The path to a JSON file. The JSON content must be in the format of
+[{
+ "timestamp": 1000000,
+ "areaId": 0,
+ "value": 8,
+ "prop": 289408000
+}, {...}]
+Each event in the JSON file would be generated by the same interval their timestamp is relative to
+the first event's timestamp.
+repetition(int32, optional): how many iterations the events would be generated. If it is not
+provided, it would iterate indefinitely.
+
+--genfakedata --startjson --content [jsonContent]: Start a JSON generator using the content.
+
+--genfakedata --stopjson [generatorID(string)]: Stop a JSON generator.
+
+--genfakedata --keypress [keyCode(int32)] [display[int32]]: Generate key press.
+
+)";
+}
+
+std::string FakeVehicleHardware::parseErrMsg(std::string fieldName, std::string value,
+ std::string type) {
+ return StringPrintf("failed to parse %s as %s: \"%s\"\n%s", fieldName.c_str(), type.c_str(),
+ value.c_str(), genFakeDataHelp().c_str());
+}
+
+std::string FakeVehicleHardware::genFakeDataCommand(const std::vector<std::string>& options) {
+ if (options.size() < 2) {
+ return "No subcommand specified for genfakedata\n" + genFakeDataHelp();
+ }
+
+ std::string command = options[1];
+ if (command == "--startlinear") {
+ // --genfakedata --startlinear [propID(int32)] [middleValue(float)]
+ // [currentValue(float)] [dispersion(float)] [increment(float)] [interval(int64)]
+ if (options.size() != 8) {
+ return "incorrect argument count, need 8 arguments for --genfakedata --startlinear\n" +
+ genFakeDataHelp();
+ }
+ int32_t propId;
+ float middleValue;
+ float currentValue;
+ float dispersion;
+ float increment;
+ int64_t interval;
+ if (!android::base::ParseInt(options[2], &propId)) {
+ return parseErrMsg("propId", options[2], "int");
+ }
+ if (!android::base::ParseFloat(options[3], &middleValue)) {
+ return parseErrMsg("middleValue", options[3], "float");
+ }
+ if (!android::base::ParseFloat(options[4], ¤tValue)) {
+ return parseErrMsg("currentValue", options[4], "float");
+ }
+ if (!android::base::ParseFloat(options[5], &dispersion)) {
+ return parseErrMsg("dispersion", options[5], "float");
+ }
+ if (!android::base::ParseFloat(options[6], &increment)) {
+ return parseErrMsg("increment", options[6], "float");
+ }
+ if (!android::base::ParseInt(options[7], &interval)) {
+ return parseErrMsg("interval", options[7], "int");
+ }
+ auto generator = std::make_unique<LinearFakeValueGenerator>(
+ propId, middleValue, currentValue, dispersion, increment, interval);
+ mGeneratorHub->registerGenerator(propId, std::move(generator));
+ return "Linear event generator started successfully";
+ } else if (command == "--stoplinear") {
+ // --genfakedata --stoplinear [propID(int32)]
+ if (options.size() != 3) {
+ return "incorrect argument count, need 3 arguments for --genfakedata --stoplinear\n" +
+ genFakeDataHelp();
+ }
+ int32_t propId;
+ if (!android::base::ParseInt(options[2], &propId)) {
+ return parseErrMsg("propId", options[2], "int");
+ }
+ if (mGeneratorHub->unregisterGenerator(propId)) {
+ return "Linear event generator stopped successfully";
+ }
+ return StringPrintf("No linear event generator found for property: %d", propId);
+ } else if (command == "--startjson") {
+ // --genfakedata --startjson --path path repetition
+ // or
+ // --genfakedata --startjson --content content repetition.
+ if (options.size() != 4 && options.size() != 5) {
+ return "incorrect argument count, need 4 or 5 arguments for --genfakedata "
+ "--startjson\n";
+ }
+ // Iterate infinitely if repetition number is not provided
+ int32_t repetition = -1;
+ if (options.size() == 5) {
+ if (!android::base::ParseInt(options[4], &repetition)) {
+ return parseErrMsg("repetition", options[4], "int");
+ }
+ }
+ std::unique_ptr<JsonFakeValueGenerator> generator;
+ if (options[2] == "--path") {
+ const std::string& fileName = options[3];
+ generator = std::make_unique<JsonFakeValueGenerator>(fileName, repetition);
+ if (!generator->hasNext()) {
+ return "invalid JSON file, no events";
+ }
+ } else if (options[2] == "--content") {
+ const std::string& content = options[3];
+ generator =
+ std::make_unique<JsonFakeValueGenerator>(/*unused=*/true, content, repetition);
+ if (!generator->hasNext()) {
+ return "invalid JSON content, no events";
+ }
+ }
+ int32_t cookie = std::hash<std::string>()(options[3]);
+ mGeneratorHub->registerGenerator(cookie, std::move(generator));
+ return StringPrintf("JSON event generator started successfully, ID: %" PRId32, cookie);
+ } else if (command == "--stopjson") {
+ // --genfakedata --stopjson [generatorID(string)]
+ if (options.size() != 3) {
+ return "incorrect argument count, need 3 arguments for --genfakedata --stopjson\n";
+ }
+ int32_t cookie;
+ if (!android::base::ParseInt(options[2], &cookie)) {
+ return parseErrMsg("cookie", options[2], "int");
+ }
+ if (mGeneratorHub->unregisterGenerator(cookie)) {
+ return "JSON event generator stopped successfully";
+ } else {
+ return StringPrintf("No JSON event generator found for ID: %s", options[2].c_str());
+ }
+ } else if (command == "--keypress") {
+ int32_t keyCode;
+ int32_t display;
+ // --genfakedata --keypress [keyCode(int32)] [display[int32]]
+ if (options.size() != 4) {
+ return "incorrect argument count, need 4 arguments for --genfakedata --keypress\n";
+ }
+ if (!android::base::ParseInt(options[2], &keyCode)) {
+ return parseErrMsg("keyCode", options[2], "int");
+ }
+ if (!android::base::ParseInt(options[3], &display)) {
+ return parseErrMsg("display", options[3], "int");
+ }
+ // Send back to HAL
+ onValueChangeCallback(
+ createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_DOWN, keyCode, display));
+ onValueChangeCallback(
+ createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_UP, keyCode, display));
+ return "keypress event generated successfully";
+ }
+
+ return StringPrintf("Unknown command: \"%s\"\n%s", command.c_str(), genFakeDataHelp().c_str());
+}
+
+VehiclePropValue FakeVehicleHardware::createHwInputKeyProp(VehicleHwKeyInputAction action,
+ int32_t keyCode, int32_t targetDisplay) {
+ VehiclePropValue value = {
+ .prop = toInt(VehicleProperty::HW_KEY_INPUT),
+ .areaId = 0,
+ .timestamp = elapsedRealtimeNano(),
+ .status = VehiclePropertyStatus::AVAILABLE,
+ .value.int32Values = {toInt(action), keyCode, targetDisplay},
+ };
+ return value;
+}
+
+void FakeVehicleHardware::eventFromVehicleBus(const VehiclePropValue& value) {
+ mServerSidePropStore->writeValue(mValuePool->obtain(value));
+}
+
std::string FakeVehicleHardware::dumpHelp() {
return "Usage: \n\n"
"[no args]: dumps (id and value) all supported properties \n"
"--help: shows this help\n"
"--list: lists the ids of all supported properties\n"
- "--get <PROP1> [PROP2] [PROPN]: dumps the value of specific properties \n"
- "--set <PROP> [-i INT_VALUE [INT_VALUE ...]] [-i64 INT64_VALUE [INT64_VALUE ...]] "
- "[-f FLOAT_VALUE [FLOAT_VALUE ...]] [-s STR_VALUE] "
- "[-b BYTES_VALUE] [-a AREA_ID] : sets the value of property PROP. "
+ "--get <PROP1> [PROP2] [PROPN]: dumps the value of specific properties. \n"
+ "--getWithArg <PROP> [ValueArguments]: gets the value for a specific property with "
+ "arguments. \n"
+ "--set <PROP> [ValueArguments]: sets the value of property PROP. \n"
+ "--save-prop <prop> [-a AREA_ID]: saves the current value for PROP, integration test"
+ " that modifies prop value must call this before test and restore-prop after test. \n"
+ "--restore-prop <prop> [-a AREA_ID]: restores a previously saved property value. \n"
+ "--inject-event <PROP> [ValueArguments]: inject a property update event from car\n\n"
+ "ValueArguments are in the format of [-i INT_VALUE [INT_VALUE ...]] "
+ "[-i64 INT64_VALUE [INT64_VALUE ...]] [-f FLOAT_VALUE [FLOAT_VALUE ...]] [-s STR_VALUE] "
+ "[-b BYTES_VALUE] [-a AREA_ID].\n"
"Notice that the string, bytes and area value can be set just once, while the other can"
" have multiple values (so they're used in the respective array), "
- "BYTES_VALUE is in the form of 0xXXXX, e.g. 0xdeadbeef.\n\n"
- "Fake user HAL usage: \n" +
- mFakeUserHal->showDumpHelp();
+ "BYTES_VALUE is in the form of 0xXXXX, e.g. 0xdeadbeef.\n" +
+ genFakeDataHelp() + "Fake user HAL usage: \n" + mFakeUserHal->showDumpHelp();
}
std::string FakeVehicleHardware::dumpAllProperties() {
@@ -719,10 +960,11 @@
return std::move(values);
}
-Result<VehiclePropValue> FakeVehicleHardware::parseSetPropOptions(
+Result<VehiclePropValue> FakeVehicleHardware::parsePropOptions(
const std::vector<std::string>& options) {
// Options format:
- // --set PROP [-f f1 f2...] [-i i1 i2...] [-i64 i1 i2...] [-s s1 s2...] [-b b1 b2...] [-a a]
+ // --set/get/inject-event PROP [-f f1 f2...] [-i i1 i2...] [-i64 i1 i2...] [-s s1 s2...]
+ // [-b b1 b2...] [-a a] [-t timestamp]
size_t optionIndex = 1;
auto result = safelyParseInt<int32_t>(optionIndex, options[optionIndex]);
if (!result.ok()) {
@@ -736,83 +978,98 @@
std::unordered_set<std::string> parsedOptions;
while (optionIndex < options.size()) {
- std::string type = options[optionIndex];
+ std::string argType = options[optionIndex];
optionIndex++;
+
size_t currentIndex = optionIndex;
- std::vector<std::string> values = getOptionValues(options, &optionIndex);
- if (parsedOptions.find(type) != parsedOptions.end()) {
- return Error() << StringPrintf("Duplicate \"%s\" options\n", type.c_str());
+ std::vector<std::string> argValues = getOptionValues(options, &optionIndex);
+ if (parsedOptions.find(argType) != parsedOptions.end()) {
+ return Error() << StringPrintf("Duplicate \"%s\" options\n", argType.c_str());
}
- parsedOptions.insert(type);
- if (EqualsIgnoreCase(type, "-i")) {
- if (values.size() == 0) {
+ parsedOptions.insert(argType);
+ size_t argValuesSize = argValues.size();
+ if (EqualsIgnoreCase(argType, "-i")) {
+ if (argValuesSize == 0) {
return Error() << "No values specified when using \"-i\"\n";
}
- prop.value.int32Values.resize(values.size());
- for (size_t i = 0; i < values.size(); i++) {
- auto int32Result = safelyParseInt<int32_t>(currentIndex + i, values[i]);
+ prop.value.int32Values.resize(argValuesSize);
+ for (size_t i = 0; i < argValuesSize; i++) {
+ auto int32Result = safelyParseInt<int32_t>(currentIndex + i, argValues[i]);
if (!int32Result.ok()) {
return Error()
<< StringPrintf("Value: \"%s\" is not a valid int: %s\n",
- values[i].c_str(), getErrorMsg(int32Result).c_str());
+ argValues[i].c_str(), getErrorMsg(int32Result).c_str());
}
prop.value.int32Values[i] = int32Result.value();
}
- } else if (EqualsIgnoreCase(type, "-i64")) {
- if (values.size() == 0) {
+ } else if (EqualsIgnoreCase(argType, "-i64")) {
+ if (argValuesSize == 0) {
return Error() << "No values specified when using \"-i64\"\n";
}
- prop.value.int64Values.resize(values.size());
- for (size_t i = 0; i < values.size(); i++) {
- auto int64Result = safelyParseInt<int64_t>(currentIndex + i, values[i]);
+ prop.value.int64Values.resize(argValuesSize);
+ for (size_t i = 0; i < argValuesSize; i++) {
+ auto int64Result = safelyParseInt<int64_t>(currentIndex + i, argValues[i]);
if (!int64Result.ok()) {
return Error()
<< StringPrintf("Value: \"%s\" is not a valid int64: %s\n",
- values[i].c_str(), getErrorMsg(int64Result).c_str());
+ argValues[i].c_str(), getErrorMsg(int64Result).c_str());
}
prop.value.int64Values[i] = int64Result.value();
}
- } else if (EqualsIgnoreCase(type, "-f")) {
- if (values.size() == 0) {
+ } else if (EqualsIgnoreCase(argType, "-f")) {
+ if (argValuesSize == 0) {
return Error() << "No values specified when using \"-f\"\n";
}
- prop.value.floatValues.resize(values.size());
- for (size_t i = 0; i < values.size(); i++) {
- auto floatResult = safelyParseFloat(currentIndex + i, values[i]);
+ prop.value.floatValues.resize(argValuesSize);
+ for (size_t i = 0; i < argValuesSize; i++) {
+ auto floatResult = safelyParseFloat(currentIndex + i, argValues[i]);
if (!floatResult.ok()) {
return Error()
<< StringPrintf("Value: \"%s\" is not a valid float: %s\n",
- values[i].c_str(), getErrorMsg(floatResult).c_str());
+ argValues[i].c_str(), getErrorMsg(floatResult).c_str());
}
prop.value.floatValues[i] = floatResult.value();
}
- } else if (EqualsIgnoreCase(type, "-s")) {
- if (values.size() != 1) {
+ } else if (EqualsIgnoreCase(argType, "-s")) {
+ if (argValuesSize != 1) {
return Error() << "Expect exact one value when using \"-s\"\n";
}
- prop.value.stringValue = values[0];
- } else if (EqualsIgnoreCase(type, "-b")) {
- if (values.size() != 1) {
+ prop.value.stringValue = argValues[0];
+ } else if (EqualsIgnoreCase(argType, "-b")) {
+ if (argValuesSize != 1) {
return Error() << "Expect exact one value when using \"-b\"\n";
}
- auto bytesResult = parseHexString(values[0]);
+ auto bytesResult = parseHexString(argValues[0]);
if (!bytesResult.ok()) {
return Error() << StringPrintf("value: \"%s\" is not a valid hex string: %s\n",
- values[0].c_str(), getErrorMsg(bytesResult).c_str());
+ argValues[0].c_str(),
+ getErrorMsg(bytesResult).c_str());
}
prop.value.byteValues = std::move(bytesResult.value());
- } else if (EqualsIgnoreCase(type, "-a")) {
- if (values.size() != 1) {
+ } else if (EqualsIgnoreCase(argType, "-a")) {
+ if (argValuesSize != 1) {
return Error() << "Expect exact one value when using \"-a\"\n";
}
- auto int32Result = safelyParseInt<int32_t>(currentIndex, values[0]);
+ auto int32Result = safelyParseInt<int32_t>(currentIndex, argValues[0]);
if (!int32Result.ok()) {
return Error() << StringPrintf("Area ID: \"%s\" is not a valid int: %s\n",
- values[0].c_str(), getErrorMsg(int32Result).c_str());
+ argValues[0].c_str(),
+ getErrorMsg(int32Result).c_str());
}
prop.areaId = int32Result.value();
+ } else if (EqualsIgnoreCase(argType, "-t")) {
+ if (argValuesSize != 1) {
+ return Error() << "Expect exact one value when using \"-t\"\n";
+ }
+ auto int64Result = safelyParseInt<int64_t>(currentIndex, argValues[0]);
+ if (!int64Result.ok()) {
+ return Error() << StringPrintf("Timestamp: \"%s\" is not a valid int64: %s\n",
+ argValues[0].c_str(),
+ getErrorMsg(int64Result).c_str());
+ }
+ prop.timestamp = int64Result.value();
} else {
- return Error() << StringPrintf("Unknown option: %s\n", type.c_str());
+ return Error() << StringPrintf("Unknown option: %s\n", argType.c_str());
}
}
@@ -824,7 +1081,7 @@
return getErrorMsg(result);
}
- auto parseResult = parseSetPropOptions(options);
+ auto parseResult = parsePropOptions(options);
if (!parseResult.ok()) {
return getErrorMsg(parseResult);
}
@@ -847,6 +1104,123 @@
getErrorMsg(setResult).c_str());
}
+std::string FakeVehicleHardware::dumpGetPropertyWithArg(const std::vector<std::string>& options) {
+ if (auto result = checkArgumentsSize(options, 3); !result.ok()) {
+ return getErrorMsg(result);
+ }
+
+ auto parseResult = parsePropOptions(options);
+ if (!parseResult.ok()) {
+ return getErrorMsg(parseResult);
+ }
+ VehiclePropValue prop = std::move(parseResult.value());
+ ALOGD("Dump: Getting property: %s", prop.toString().c_str());
+
+ bool isSpecialValue = false;
+ auto result = maybeGetSpecialValue(prop, &isSpecialValue);
+
+ if (!isSpecialValue) {
+ result = mServerSidePropStore->readValue(prop);
+ }
+
+ if (!result.ok()) {
+ return StringPrintf("failed to read property value: %d, error: %s, code: %d\n", prop.prop,
+ getErrorMsg(result).c_str(), getIntErrorCode(result));
+ }
+ return StringPrintf("Get property result: %s\n", result.value()->toString().c_str());
+}
+
+std::string FakeVehicleHardware::dumpSaveProperty(const std::vector<std::string>& options) {
+ // Format: --save-prop PROP [-a areaID]
+ if (auto result = checkArgumentsSize(options, 2); !result.ok()) {
+ return getErrorMsg(result);
+ }
+
+ auto parseResult = parsePropOptions(options);
+ if (!parseResult.ok()) {
+ return getErrorMsg(parseResult);
+ }
+ // We are only using the prop and areaId option.
+ VehiclePropValue value = std::move(parseResult.value());
+ int32_t propId = value.prop;
+ int32_t areaId = value.areaId;
+
+ auto readResult = mServerSidePropStore->readValue(value);
+ if (!readResult.ok()) {
+ return StringPrintf("Failed to save current property value, error: %s",
+ getErrorMsg(readResult).c_str());
+ }
+
+ std::scoped_lock<std::mutex> lockGuard(mLock);
+ mSavedProps[PropIdAreaId{
+ .propId = propId,
+ .areaId = areaId,
+ }] = std::move(readResult.value());
+
+ return StringPrintf("Property: %" PRId32 ", areaID: %" PRId32 " saved", propId, areaId);
+}
+
+std::string FakeVehicleHardware::dumpRestoreProperty(const std::vector<std::string>& options) {
+ // Format: --restore-prop PROP [-a areaID]
+ if (auto result = checkArgumentsSize(options, 2); !result.ok()) {
+ return getErrorMsg(result);
+ }
+
+ auto parseResult = parsePropOptions(options);
+ if (!parseResult.ok()) {
+ return getErrorMsg(parseResult);
+ }
+ // We are only using the prop and areaId option.
+ VehiclePropValue value = std::move(parseResult.value());
+ int32_t propId = value.prop;
+ int32_t areaId = value.areaId;
+ VehiclePropValuePool::RecyclableType savedValue;
+
+ {
+ std::scoped_lock<std::mutex> lockGuard(mLock);
+ auto it = mSavedProps.find(PropIdAreaId{
+ .propId = propId,
+ .areaId = areaId,
+ });
+ if (it == mSavedProps.end()) {
+ return StringPrintf("No saved property for property: %" PRId32 ", areaID: %" PRId32,
+ propId, areaId);
+ }
+
+ savedValue = std::move(it->second);
+ // Remove the saved property after restoring it.
+ mSavedProps.erase(it);
+ }
+
+ // Update timestamp.
+ savedValue->timestamp = elapsedRealtimeNano();
+
+ auto writeResult = mServerSidePropStore->writeValue(std::move(savedValue));
+ if (!writeResult.ok()) {
+ return StringPrintf("Failed to restore property value, error: %s",
+ getErrorMsg(writeResult).c_str());
+ }
+
+ return StringPrintf("Property: %" PRId32 ", areaID: %" PRId32 " restored", propId, areaId);
+}
+
+std::string FakeVehicleHardware::dumpInjectEvent(const std::vector<std::string>& options) {
+ if (auto result = checkArgumentsSize(options, 3); !result.ok()) {
+ return getErrorMsg(result);
+ }
+
+ auto parseResult = parsePropOptions(options);
+ if (!parseResult.ok()) {
+ return getErrorMsg(parseResult);
+ }
+ VehiclePropValue prop = std::move(parseResult.value());
+ ALOGD("Dump: Injecting event from vehicle bus: %s", prop.toString().c_str());
+
+ eventFromVehicleBus(prop);
+
+ return StringPrintf("Event for property: %d injected", prop.prop);
+}
+
StatusCode FakeVehicleHardware::checkHealth() {
// Always return OK for checkHealth.
return StatusCode::OK;
@@ -915,33 +1289,26 @@
(*mOnPropertyChangeCallback)(std::move(updatedValues));
}
-void FakeVehicleHardware::maybeOverrideProperties(const char* overrideDir) {
- if (android::base::GetBoolProperty(OVERRIDE_PROPERTY, false)) {
- overrideProperties(overrideDir);
- }
-}
-
-void FakeVehicleHardware::overrideProperties(const char* overrideDir) {
- ALOGI("loading vendor override properties from %s", overrideDir);
- if (auto dir = opendir(overrideDir); dir != NULL) {
+void FakeVehicleHardware::loadPropConfigsFromDir(
+ const std::string& dirPath,
+ std::unordered_map<int32_t, ConfigDeclaration>* configsByPropId) {
+ ALOGI("loading properties from %s", dirPath.c_str());
+ if (auto dir = opendir(dirPath.c_str()); dir != NULL) {
std::regex regJson(".*[.]json", std::regex::icase);
while (auto f = readdir(dir)) {
if (!std::regex_match(f->d_name, regJson)) {
continue;
}
- std::string file = overrideDir + std::string(f->d_name);
- JsonFakeValueGenerator tmpGenerator(file);
-
- std::vector<VehiclePropValue> propValues = tmpGenerator.getAllEvents();
- for (const VehiclePropValue& prop : propValues) {
- auto propToStore = mValuePool->obtain(prop);
- propToStore->timestamp = elapsedRealtimeNano();
- if (auto result = mServerSidePropStore->writeValue(std::move(propToStore),
- /*updateStatus=*/true);
- !result.ok()) {
- ALOGW("failed to write vendor override properties: %d, error: %s, code: %d",
- prop.prop, getErrorMsg(result).c_str(), getIntErrorCode(result));
- }
+ std::string filePath = dirPath + "/" + std::string(f->d_name);
+ ALOGI("loading properties from %s", filePath.c_str());
+ auto result = mLoader.loadPropConfig(filePath);
+ if (!result.ok()) {
+ ALOGE("failed to load config file: %s, error: %s", filePath.c_str(),
+ result.error().message().c_str());
+ continue;
+ }
+ for (auto& [propId, configDeclaration] : result.value()) {
+ (*configsByPropId)[propId] = std::move(configDeclaration);
}
}
closedir(dir);
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
index 90d1516..8d8fcf5 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
@@ -22,13 +22,13 @@
name: "FakeVehicleHardwareTest",
vendor: true,
srcs: ["*.cpp"],
- cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"],
+ cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"],
header_libs: [
"IVehicleHardware",
- "VehicleHalDefaultConfig",
"VehicleHalTestUtilHeaders",
],
static_libs: [
+ "VehicleHalJsonConfigLoaderEnableTestProperties",
"VehicleHalUtils",
"FakeVehicleHardware",
"FakeVehicleHalValueGenerators",
@@ -41,7 +41,11 @@
"libjsoncpp",
],
data: [
+ ":VehicleHalDefaultProperties_JSON",
+ ":VehicleHalTestProperties_JSON",
+ ":VehicleHalVendorClusterTestProperties_JSON",
":FakeVehicleHardwareTestOverrideJson",
+ ":FakeVehicleHardwareTestPropJson",
],
defaults: ["VehicleHalDefaults"],
test_suites: ["device-tests"],
@@ -51,3 +55,8 @@
name: "FakeVehicleHardwareTestOverrideJson",
srcs: ["override/*"],
}
+
+filegroup {
+ name: "FakeVehicleHardwareTestPropJson",
+ srcs: ["fakedata/prop.json"],
+}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
index 3e8f634..c230c51 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
@@ -16,7 +16,6 @@
#include <FakeVehicleHardware.h>
-#include <DefaultConfig.h>
#include <FakeObd2Frame.h>
#include <FakeUserHal.h>
#include <PropertyUtils.h>
@@ -53,6 +52,7 @@
using ::aidl::android::hardware::automotive::vehicle::StatusCode;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq;
+using ::aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig;
using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus;
@@ -64,6 +64,7 @@
using ::testing::ContainerEq;
using ::testing::ContainsRegex;
using ::testing::Eq;
+using ::testing::HasSubstr;
using ::testing::WhenSortedBy;
using std::chrono::milliseconds;
@@ -78,7 +79,9 @@
public:
FakeVehicleHardwareTestHelper(FakeVehicleHardware* hardware) { mHardware = hardware; }
- void overrideProperties(const char* overrideDir) { mHardware->overrideProperties(overrideDir); }
+ std::unordered_map<int32_t, ConfigDeclaration> loadConfigDeclarations() {
+ return mHardware->loadConfigDeclarations();
+ }
private:
FakeVehicleHardware* mHardware;
@@ -87,6 +90,9 @@
class FakeVehicleHardwareTest : public ::testing::Test {
protected:
void SetUp() override {
+ mHardware = std::make_unique<FakeVehicleHardware>(android::base::GetExecutableDirectory(),
+ /*overrideConfigDir=*/"",
+ /*forceOverride=*/false);
auto callback = std::make_unique<IVehicleHardware::PropertyChangeCallback>(
[this](const std::vector<VehiclePropValue>& values) {
onPropertyChangeEvent(values);
@@ -98,7 +104,17 @@
[this](std::vector<GetValueResult> results) { onGetValues(results); });
}
- FakeVehicleHardware* getHardware() { return &mHardware; }
+ void TearDown() override {
+ // mHardware uses callback which contains reference to 'this', so it has to be destroyed
+ // before 'this'.
+ mHardware.reset();
+ }
+
+ FakeVehicleHardware* getHardware() { return mHardware.get(); }
+
+ void setHardware(std::unique_ptr<FakeVehicleHardware> hardware) {
+ mHardware = std::move(hardware);
+ }
StatusCode setValues(const std::vector<SetValueRequest>& requests) {
{
@@ -251,6 +267,14 @@
return mChangedProperties;
}
+ bool waitForChangedProperties(size_t count, milliseconds timeout) {
+ std::unique_lock<std::mutex> lk(mLock);
+ return mCv.wait_for(lk, timeout, [this, count] {
+ ScopedLockAssertion lockAssertion(mLock);
+ return mChangedProperties.size() >= count;
+ });
+ }
+
bool waitForChangedProperties(int32_t propId, int32_t areaId, size_t count,
milliseconds timeout) {
PropIdAreaId propIdAreaId{
@@ -270,6 +294,15 @@
mChangedProperties.clear();
}
+ size_t getEventCount(int32_t propId, int32_t areaId) {
+ PropIdAreaId propIdAreaId{
+ .propId = propId,
+ .areaId = areaId,
+ };
+ std::scoped_lock<std::mutex> lockGuard(mLock);
+ return mEventCount[propIdAreaId];
+ }
+
static void addSetValueRequest(std::vector<SetValueRequest>& requests,
std::vector<SetValueResult>& expectedResults, int64_t requestId,
const VehiclePropValue& value, StatusCode expectedStatus) {
@@ -332,7 +365,7 @@
} mPropValueCmp;
private:
- FakeVehicleHardware mHardware;
+ std::unique_ptr<FakeVehicleHardware> mHardware;
std::shared_ptr<IVehicleHardware::SetValuesCallback> mSetValuesCallback;
std::shared_ptr<IVehicleHardware::GetValuesCallback> mGetValuesCallback;
std::condition_variable mCv;
@@ -348,7 +381,8 @@
TEST_F(FakeVehicleHardwareTest, testGetAllPropertyConfigs) {
std::vector<VehiclePropConfig> configs = getHardware()->getAllPropertyConfigs();
- ASSERT_EQ(configs.size(), defaultconfig::getDefaultConfigs().size());
+ FakeVehicleHardwareTestHelper helper(getHardware());
+ ASSERT_EQ(configs.size(), helper.loadConfigDeclarations().size());
}
TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) {
@@ -356,7 +390,8 @@
std::vector<GetValueResult> expectedGetValueResults;
int64_t requestId = 1;
- for (auto& config : defaultconfig::getDefaultConfigs()) {
+ FakeVehicleHardwareTestHelper helper(getHardware());
+ for (auto& [propId, config] : helper.loadConfigDeclarations()) {
if (obd2frame::FakeObd2Frame::isDiagnosticProperty(config.config)) {
// Ignore storing default value for diagnostic property. They have special get/set
// logic.
@@ -368,12 +403,11 @@
continue;
}
- if (config.config.prop == ECHO_REVERSE_BYTES) {
+ if (propId == ECHO_REVERSE_BYTES) {
// Ignore ECHO_REVERSE_BYTES, it has special logic.
continue;
}
- int propId = config.config.prop;
if (isGlobalProp(propId)) {
if (config.initialValue == RawPropValues{}) {
addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++,
@@ -631,10 +665,12 @@
}
TEST_F(FakeVehicleHardwareTest, testVendorOverrideProperties) {
- std::string overrideDir = android::base::GetExecutableDirectory() + "/override/";
+ std::string currentDir = android::base::GetExecutableDirectory();
+ std::string overrideDir = currentDir + "/override/";
// Set vendor override directory.
- FakeVehicleHardwareTestHelper helper(getHardware());
- helper.overrideProperties(overrideDir.c_str());
+ std::unique_ptr<FakeVehicleHardware> hardware =
+ std::make_unique<FakeVehicleHardware>(currentDir, overrideDir, /*forceOverride=*/true);
+ setHardware(std::move(hardware));
// This is the same as the prop in 'gear_selection.json'.
int gearProp = toInt(VehicleProperty::GEAR_SELECTION);
@@ -669,10 +705,12 @@
}
TEST_F(FakeVehicleHardwareTest, testVendorOverridePropertiesMultipleAreas) {
- std::string overrideDir = android::base::GetExecutableDirectory() + "/override/";
+ std::string currentDir = android::base::GetExecutableDirectory();
+ std::string overrideDir = currentDir + "/override/";
// Set vendor override directory.
- FakeVehicleHardwareTestHelper helper(getHardware());
- helper.overrideProperties(overrideDir.c_str());
+ std::unique_ptr<FakeVehicleHardware> hardware =
+ std::make_unique<FakeVehicleHardware>(currentDir, overrideDir, /*forceOverride=*/true);
+ setHardware(std::move(hardware));
// This is the same as the prop in 'hvac_temperature_set.json'.
int hvacProp = toInt(VehicleProperty::HVAC_TEMPERATURE_SET);
@@ -685,22 +723,16 @@
ASSERT_TRUE(result.ok()) << "expect to get the overridden property ok: " << getStatus(result);
ASSERT_EQ(static_cast<size_t>(1), result.value().value.floatValues.size());
ASSERT_EQ(30.0f, result.value().value.floatValues[0]);
-
- // HVAC_RIGHT should not be affected and return the default value.
- result = getValue(VehiclePropValue{
- .prop = hvacProp,
- .areaId = HVAC_RIGHT,
- });
-
- ASSERT_TRUE(result.ok()) << "expect to get the default property ok: " << getStatus(result);
- ASSERT_EQ(static_cast<size_t>(1), result.value().value.floatValues.size());
- ASSERT_EQ(20.0f, result.value().value.floatValues[0]);
}
TEST_F(FakeVehicleHardwareTest, testVendorOverridePropertiesDirDoesNotExist) {
- // Set vendor override directory to a non-existing dir
- FakeVehicleHardwareTestHelper helper(getHardware());
- helper.overrideProperties("123");
+ std::string currentDir = android::base::GetExecutableDirectory();
+ std::string overrideDir = currentDir + "/override/";
+ // Set vendor override directory to a non-existing dir.
+ std::unique_ptr<FakeVehicleHardware> hardware =
+ std::make_unique<FakeVehicleHardware>(currentDir, "1234", /*forceOverride=*/true);
+ setHardware(std::move(hardware));
+
auto result = getValue(VehiclePropValue{
.prop = toInt(VehicleProperty::GEAR_SELECTION),
});
@@ -1395,6 +1427,85 @@
ASSERT_THAT(result.buffer, ContainsRegex("Invalid number of arguments"));
}
+TEST_F(FakeVehicleHardwareTest, testDumpSpecificPropertyWithArg) {
+ auto getValueResult = getValue(VehiclePropValue{.prop = OBD2_FREEZE_FRAME_INFO});
+ ASSERT_TRUE(getValueResult.ok());
+ auto propValue = getValueResult.value();
+ ASSERT_EQ(propValue.value.int64Values.size(), static_cast<size_t>(3))
+ << "expect 3 obd2 freeze frames stored";
+
+ std::string propIdStr = StringPrintf("%d", OBD2_FREEZE_FRAME);
+ DumpResult result;
+ for (int64_t timestamp : propValue.value.int64Values) {
+ result = getHardware()->dump(
+ {"--getWithArg", propIdStr, "-i64", StringPrintf("%" PRId64, timestamp)});
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_NE(result.buffer, "");
+ ASSERT_THAT(result.buffer, ContainsRegex("Get property result:"));
+ }
+
+ // Set the timestamp argument to 0.
+ result = getHardware()->dump({"--getWithArg", propIdStr, "-i64", "0"});
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ // There is no freeze obd2 frame at timestamp 0.
+ ASSERT_THAT(result.buffer, ContainsRegex("failed to read property value"));
+}
+
+TEST_F(FakeVehicleHardwareTest, testSaveRestoreProp) {
+ int32_t prop = toInt(VehicleProperty::TIRE_PRESSURE);
+ std::string propIdStr = std::to_string(prop);
+ std::string areaIdStr = std::to_string(WHEEL_FRONT_LEFT);
+
+ DumpResult result = getHardware()->dump({"--save-prop", propIdStr, "-a", areaIdStr});
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, ContainsRegex("saved"));
+
+ ASSERT_EQ(setValue(VehiclePropValue{
+ .prop = prop,
+ .areaId = WHEEL_FRONT_LEFT,
+ .value =
+ {
+ .floatValues = {210.0},
+ },
+ }),
+ StatusCode::OK);
+
+ result = getHardware()->dump({"--restore-prop", propIdStr, "-a", areaIdStr});
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, ContainsRegex("restored"));
+
+ auto getResult = getValue(VehiclePropValue{.prop = prop, .areaId = WHEEL_FRONT_LEFT});
+
+ ASSERT_TRUE(getResult.ok());
+ // The default value is 200.0.
+ ASSERT_EQ(getResult.value().value.floatValues, std::vector<float>{200.0});
+}
+
+TEST_F(FakeVehicleHardwareTest, testDumpInjectEvent) {
+ int32_t prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED);
+ std::string propIdStr = std::to_string(prop);
+
+ int64_t timestamp = elapsedRealtimeNano();
+ // Inject an event with float value 123.4 and timestamp.
+ DumpResult result = getHardware()->dump(
+ {"--inject-event", propIdStr, "-f", "123.4", "-t", std::to_string(timestamp)});
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer,
+ ContainsRegex(StringPrintf("Event for property: %d injected", prop)));
+ ASSERT_TRUE(waitForChangedProperties(prop, 0, /*count=*/1, milliseconds(1000)))
+ << "No changed event received for injected event from vehicle bus";
+ auto events = getChangedProperties();
+ ASSERT_EQ(events.size(), 1u);
+ auto event = events[0];
+ ASSERT_EQ(event.timestamp, timestamp);
+ ASSERT_EQ(event.value.floatValues, std::vector<float>({123.4}));
+}
+
TEST_F(FakeVehicleHardwareTest, testDumpInvalidOptions) {
std::vector<std::string> options;
options.push_back("--invalid");
@@ -1606,6 +1717,260 @@
ASSERT_EQ(3.402823466E+38f, value.value.floatValues[2]);
}
+struct OptionsTestCase {
+ std::string name;
+ std::vector<std::string> options;
+ std::string expectMsg;
+};
+
+class FakeVehicleHardwareOptionsTest : public FakeVehicleHardwareTest,
+ public testing::WithParamInterface<OptionsTestCase> {};
+
+std::vector<OptionsTestCase> GenInvalidOptions() {
+ return {{"unknown_command", {"--unknown"}, "Invalid option: --unknown"},
+ {"help", {"--help"}, "Usage:"},
+ {"genfakedata_no_subcommand",
+ {"--genfakedata"},
+ "No subcommand specified for genfakedata"},
+ {"genfakedata_unknown_subcommand",
+ {"--genfakedata", "--unknown"},
+ "Unknown command: \"--unknown\""},
+ {"genfakedata_start_linear_no_args",
+ {"--genfakedata", "--startlinear"},
+ "incorrect argument count"},
+ {"genfakedata_start_linear_invalid_propId",
+ {"--genfakedata", "--startlinear", "abcd", "0.1", "0.1", "0.1", "0.1", "100000000"},
+ "failed to parse propId as int: \"abcd\""},
+ {"genfakedata_start_linear_invalid_middleValue",
+ {"--genfakedata", "--startlinear", "1", "abcd", "0.1", "0.1", "0.1", "100000000"},
+ "failed to parse middleValue as float: \"abcd\""},
+ {"genfakedata_start_linear_invalid_currentValue",
+ {"--genfakedata", "--startlinear", "1", "0.1", "abcd", "0.1", "0.1", "100000000"},
+ "failed to parse currentValue as float: \"abcd\""},
+ {"genfakedata_start_linear_invalid_dispersion",
+ {"--genfakedata", "--startlinear", "1", "0.1", "0.1", "abcd", "0.1", "100000000"},
+ "failed to parse dispersion as float: \"abcd\""},
+ {"genfakedata_start_linear_invalid_increment",
+ {"--genfakedata", "--startlinear", "1", "0.1", "0.1", "0.1", "abcd", "100000000"},
+ "failed to parse increment as float: \"abcd\""},
+ {"genfakedata_start_linear_invalid_interval",
+ {"--genfakedata", "--startlinear", "1", "0.1", "0.1", "0.1", "0.1", "0.1"},
+ "failed to parse interval as int: \"0.1\""},
+ {"genfakedata_stop_linear_no_args",
+ {"--genfakedata", "--stoplinear"},
+ "incorrect argument count"},
+ {"genfakedata_stop_linear_invalid_propId",
+ {"--genfakedata", "--stoplinear", "abcd"},
+ "failed to parse propId as int: \"abcd\""},
+ {"genfakedata_startjson_no_args",
+ {"--genfakedata", "--startjson"},
+ "incorrect argument count"},
+ {"genfakedata_startjson_invalid_repetition",
+ {"--genfakedata", "--startjson", "--path", "file", "0.1"},
+ "failed to parse repetition as int: \"0.1\""},
+ {"genfakedata_startjson_invalid_json_file",
+ {"--genfakedata", "--startjson", "--path", "file", "1"},
+ "invalid JSON file"},
+ {"genfakedata_stopjson_no_args",
+ {"--genfakedata", "--stopjson"},
+ "incorrect argument count"},
+ {"genfakedata_keypress_no_args",
+ {"--genfakedata", "--keypress"},
+ "incorrect argument count"},
+ {"genfakedata_keypress_invalid_keyCode",
+ {"--genfakedata", "--keypress", "0.1", "1"},
+ "failed to parse keyCode as int: \"0.1\""},
+ {"genfakedata_keypress_invalid_display",
+ {"--genfakedata", "--keypress", "1", "0.1"},
+ "failed to parse display as int: \"0.1\""}};
+}
+
+TEST_P(FakeVehicleHardwareOptionsTest, testInvalidOptions) {
+ auto tc = GetParam();
+
+ DumpResult result = getHardware()->dump(tc.options);
+
+ EXPECT_FALSE(result.callerShouldDumpState);
+ EXPECT_THAT(result.buffer, HasSubstr(tc.expectMsg));
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ FakeVehicleHardwareOptionsTests, FakeVehicleHardwareOptionsTest,
+ testing::ValuesIn(GenInvalidOptions()),
+ [](const testing::TestParamInfo<FakeVehicleHardwareOptionsTest::ParamType>& info) {
+ return info.param.name;
+ });
+
+TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataLinear) {
+ // Start a fake linear data generator for vehicle speed at 0.1s interval.
+ // range: 0 - 100, current value: 30, step: 20.
+ std::string propIdString = StringPrintf("%d", toInt(VehicleProperty::PERF_VEHICLE_SPEED));
+ std::vector<std::string> options = {"--genfakedata", "--startlinear", propIdString,
+ /*middleValue=*/"50",
+ /*currentValue=*/"30",
+ /*dispersion=*/"50",
+ /*increment=*/"20",
+ /*interval=*/"100000000"};
+
+ DumpResult result = getHardware()->dump(options);
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("successfully"));
+
+ ASSERT_TRUE(waitForChangedProperties(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 0, /*count=*/5,
+ milliseconds(1000)))
+ << "not enough events generated for linear data generator";
+
+ int32_t value = 30;
+ auto events = getChangedProperties();
+ for (size_t i = 0; i < 5; i++) {
+ ASSERT_EQ(1u, events[i].value.floatValues.size());
+ EXPECT_EQ(static_cast<float>(value), events[i].value.floatValues[0]);
+ value = (value + 20) % 100;
+ }
+
+ // Stop the linear generator.
+ options = {"--genfakedata", "--stoplinear", propIdString};
+
+ result = getHardware()->dump(options);
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("successfully"));
+
+ clearChangedProperties();
+ std::this_thread::sleep_for(std::chrono::milliseconds(200));
+
+ // There should be no new events generated.
+ EXPECT_EQ(0u, getEventCount(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 0));
+}
+
+std::string getTestFilePath(const char* filename) {
+ static std::string baseDir = android::base::GetExecutableDirectory();
+ return baseDir + "/fakedata/" + filename;
+}
+
+TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJson) {
+ std::vector<std::string> options = {"--genfakedata", "--startjson", "--path",
+ getTestFilePath("prop.json"), "2"};
+
+ DumpResult result = getHardware()->dump(options);
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("successfully"));
+
+ ASSERT_TRUE(waitForChangedProperties(/*count=*/8, milliseconds(1000)))
+ << "not enough events generated for JSON data generator";
+
+ auto events = getChangedProperties();
+ ASSERT_EQ(8u, events.size());
+ // First set of events, we test 1st and the last.
+ EXPECT_EQ(1u, events[0].value.int32Values.size());
+ EXPECT_EQ(8, events[0].value.int32Values[0]);
+ EXPECT_EQ(1u, events[3].value.int32Values.size());
+ EXPECT_EQ(10, events[3].value.int32Values[0]);
+ // Second set of the same events.
+ EXPECT_EQ(1u, events[4].value.int32Values.size());
+ EXPECT_EQ(8, events[4].value.int32Values[0]);
+ EXPECT_EQ(1u, events[7].value.int32Values.size());
+ EXPECT_EQ(10, events[7].value.int32Values[0]);
+}
+
+TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonByContent) {
+ std::vector<std::string> options = {
+ "--genfakedata", "--startjson", "--content",
+ "[{\"timestamp\":1000000,\"areaId\":0,\"value\":8,\"prop\":289408000}]", "1"};
+
+ DumpResult result = getHardware()->dump(options);
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("successfully"));
+
+ ASSERT_TRUE(waitForChangedProperties(/*count=*/1, milliseconds(1000)))
+ << "not enough events generated for JSON data generator";
+
+ auto events = getChangedProperties();
+ ASSERT_EQ(1u, events.size());
+ EXPECT_EQ(1u, events[0].value.int32Values.size());
+ EXPECT_EQ(8, events[0].value.int32Values[0]);
+}
+
+TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonInvalidContent) {
+ std::vector<std::string> options = {"--genfakedata", "--startjson", "--content", "[{", "2"};
+
+ DumpResult result = getHardware()->dump(options);
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("invalid JSON content"));
+}
+
+TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonInvalidFile) {
+ std::vector<std::string> options = {"--genfakedata", "--startjson", "--path",
+ getTestFilePath("blahblah.json"), "2"};
+
+ DumpResult result = getHardware()->dump(options);
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("invalid JSON file"));
+}
+
+TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStop) {
+ // No iteration number provided, would loop indefinitely.
+ std::vector<std::string> options = {"--genfakedata", "--startjson", "--path",
+ getTestFilePath("prop.json")};
+
+ DumpResult result = getHardware()->dump(options);
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("successfully"));
+
+ std::string id = result.buffer.substr(result.buffer.find("ID: ") + 4);
+
+ result = getHardware()->dump({"--genfakedata", "--stopjson", id});
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("successfully"));
+}
+
+TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStopInvalidFile) {
+ // No iteration number provided, would loop indefinitely.
+ std::vector<std::string> options = {"--genfakedata", "--startjson", "--path",
+ getTestFilePath("prop.json")};
+
+ DumpResult result = getHardware()->dump(options);
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("successfully"));
+
+ result = getHardware()->dump({"--genfakedata", "--stopjson", "1234"});
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("No JSON event generator found"));
+
+ // TearDown function should destroy the generator which stops the iteration.
+}
+
+TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataKeyPress) {
+ std::vector<std::string> options = {"--genfakedata", "--keypress", "1", "2"};
+
+ DumpResult result = getHardware()->dump(options);
+
+ ASSERT_FALSE(result.callerShouldDumpState);
+ ASSERT_THAT(result.buffer, HasSubstr("successfully"));
+
+ auto events = getChangedProperties();
+ ASSERT_EQ(2u, events.size());
+ EXPECT_EQ(toInt(VehicleProperty::HW_KEY_INPUT), events[0].prop);
+ EXPECT_EQ(toInt(VehicleProperty::HW_KEY_INPUT), events[1].prop);
+ ASSERT_EQ(3u, events[0].value.int32Values.size());
+ ASSERT_EQ(3u, events[1].value.int32Values.size());
+ EXPECT_EQ(toInt(VehicleHwKeyInputAction::ACTION_DOWN), events[0].value.int32Values[0]);
+ EXPECT_EQ(1, events[0].value.int32Values[1]);
+ EXPECT_EQ(2, events[0].value.int32Values[2]);
+ EXPECT_EQ(toInt(VehicleHwKeyInputAction::ACTION_UP), events[1].value.int32Values[0]);
+ EXPECT_EQ(1, events[1].value.int32Values[1]);
+ EXPECT_EQ(2, events[1].value.int32Values[2]);
+}
+
TEST_F(FakeVehicleHardwareTest, testGetEchoReverseBytes) {
ASSERT_EQ(setValue(VehiclePropValue{
.prop = ECHO_REVERSE_BYTES,
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/fakedata/prop.json b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/fakedata/prop.json
new file mode 100644
index 0000000..7123a00
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/fakedata/prop.json
@@ -0,0 +1,26 @@
+[
+ {
+ "timestamp": 1000000,
+ "areaId": 0,
+ "value": 8,
+ "prop": 289408000
+ },
+ {
+ "timestamp": 2000000,
+ "areaId": 0,
+ "value": 4,
+ "prop": 289408000
+ },
+ {
+ "timestamp": 3000000,
+ "areaId": 0,
+ "value": 16,
+ "prop": 289408000
+ },
+ {
+ "timestamp": 4000000,
+ "areaId": 0,
+ "value": 10,
+ "prop": 289408000
+ }
+]
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json
index 59666b8..693f1e2 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json
@@ -1,9 +1,13 @@
-[
- {
- "timestamp": 1000000,
- "areaId": 0,
- "value": 8,
- // GEAR_SELECTION
- "prop": 289408000
- }
-]
+{
+ "apiVersion": 1,
+ "properties": [
+ {
+ "property": "VehicleProperty::GEAR_SELECTION",
+ "defaultValue": {
+ "int32Values": [
+ 8
+ ]
+ }
+ }
+ ]
+}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json
index 93a97ed..07cfebb 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json
@@ -1,10 +1,20 @@
-[
- {
- "timestamp": 1000000,
- // HVAC_LEFT
- "areaId": 49,
- "value": 30,
- // HVAC_TEMPERATURE_SET
- "prop": 358614275
- }
-]
+{
+ "apiVersion": 1,
+ "properties": [
+ {
+ "property": "VehicleProperty::HVAC_TEMPERATURE_SET",
+ "areas": [
+ {
+ "defaultValue": {
+ "floatValues": [
+ 30.0
+ ]
+ },
+ "areaId": 49,
+ "minFloatValue": 16.0,
+ "maxFloatValue": 32.0
+ }
+ ]
+ }
+ ]
+}
diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
index 7670c25..2b4059c 100644
--- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
+++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
@@ -47,13 +47,19 @@
],
vendor: true,
defaults: ["VehicleHalDefaults"],
- shared_libs: ["libprotobuf-cpp-full"],
+ shared_libs: [
+ "libprotobuf-cpp-full",
+ "libjsoncpp",
+ ],
static_libs: [
+ "VehicleHalJsonConfigLoaderEnableTestProperties",
"VehicleHalProtoMessageConverter",
"VehicleHalProtos",
"VehicleHalUtils",
"libgtest",
],
- header_libs: ["VehicleHalDefaultConfig"],
+ data: [
+ ":VehicleHalDefaultProperties_JSON",
+ ],
test_suites: ["device-tests"],
}
diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp
index c742db5..308be46 100644
--- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp
+++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp
@@ -16,9 +16,11 @@
#include <vector>
-#include <DefaultConfig.h>
+#include <JsonConfigLoader.h>
#include <ProtoMessageConverter.h>
#include <VehicleHalTypes.h>
+
+#include <android-base/file.h>
#include <android-base/format.h>
#include <android/hardware/automotive/vehicle/VehiclePropConfig.pb.h>
#include <android/hardware/automotive/vehicle/VehiclePropValue.pb.h>
@@ -35,23 +37,39 @@
namespace proto = ::android::hardware::automotive::vehicle::proto;
namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle;
+constexpr char DEFAULT_PROPERTIES_CONFIG[] = "DefaultProperties.json";
+
+inline std::string getConfigPath(const std::string& name) {
+ return android::base::GetExecutableDirectory() + "/" + name;
+}
+
std::vector<aidl_vehicle::VehiclePropConfig> prepareTestConfigs() {
+ JsonConfigLoader loader;
+ auto result = loader.loadPropConfig(getConfigPath(DEFAULT_PROPERTIES_CONFIG));
+ if (!result.ok()) {
+ return {};
+ }
std::vector<aidl_vehicle::VehiclePropConfig> configs;
- for (auto& property : defaultconfig::getDefaultConfigs()) {
- configs.push_back(property.config);
+ for (auto& [_, configDeclaration] : result.value()) {
+ configs.push_back(configDeclaration.config);
}
return configs;
}
std::vector<aidl_vehicle::VehiclePropValue> prepareTestValues() {
+ JsonConfigLoader loader;
+ auto result = loader.loadPropConfig(getConfigPath(DEFAULT_PROPERTIES_CONFIG));
+ if (!result.ok()) {
+ return {};
+ }
std::vector<aidl_vehicle::VehiclePropValue> values;
int64_t timestamp = 1;
- for (auto& property : defaultconfig::getDefaultConfigs()) {
+ for (auto& [_, configDeclaration] : result.value()) {
values.push_back({
.timestamp = timestamp,
.areaId = 123,
- .prop = property.config.prop,
- .value = property.initialValue,
+ .prop = configDeclaration.config.prop,
+ .value = configDeclaration.initialValue,
.status = aidl_vehicle::VehiclePropertyStatus::ERROR,
});
}
diff --git a/automotive/vehicle/aidl/impl/utils/README.md b/automotive/vehicle/aidl/impl/utils/README.md
new file mode 100644
index 0000000..87bb7e3
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/utils/README.md
@@ -0,0 +1,62 @@
+# Utility classes for VHAL implementation
+---
+
+This directory stores utility classes for VHAL implementation. Vendor
+implementation could use utility classes from `common` folder in their
+VHAL implementation.
+
+## common
+
+Defines common utility libraries.
+
+### ConcurrentQueue
+
+Provides a thread-safe concurrent queue object. Useful for adding object to
+a queue in one thread (usually binder thread) and handle the objects in a
+separate handler thread.
+
+### ParcelableUtils
+
+Provides functions to convert between a regular parcelable and a
+`LargeParcelabe`.
+
+A `LargeParcelable` is a parcelable that marshals the payload
+into a shared memory file if the payload is too large to pass across binder.
+It is used to pass large data across binder. Before sending the data, VHAL
+impl should convert a regular parcelabe to a `LargeParcelable`. After receving
+data, VHAL impl should convert a `LargeParcelable` back to regular parcelabe.
+
+### PendingRequestPool
+
+Defines A class for managing pending requests and automatically call timeout
+callback if the request timed-out.
+
+### PropertyUtils
+
+Defines some useful constants.
+
+### RecurrentTimer
+
+Defines a thread-safe recurrent timer that can call a function periodically.
+
+### VehicleHalTypes
+
+Provides a header file that includes many commonly used header files. Useful
+when you are using multiple types defined in VHAL interface.
+
+### VehicleObjectPool
+
+Defines a reusable in-memory pool for `VehiclePropValue`.
+
+### VehiclePropertyStore
+
+Defines an in-memory map for storing vehicle properties. Allows easier insert,
+delete and lookup.
+
+### VehicleUtils
+
+Defines many useful utility functions.
+
+## test
+
+Defines utility libraries for test only.
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h b/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h
index 3f8db93..28cf08e 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h
@@ -21,7 +21,6 @@
#include <android-base/result.h>
#include <android-base/thread_annotations.h>
-#include <atomic>
#include <list>
#include <mutex>
#include <thread>
@@ -85,7 +84,7 @@
std::unordered_map<const void*, std::list<PendingRequest>> mPendingRequestsByClient
GUARDED_BY(mLock);
std::thread mThread;
- std::atomic<bool> mThreadStop = false;
+ bool mThreadStop = false;
std::condition_variable mCv;
std::mutex mCvLock;
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h
index 2743578..caf17e8 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h
@@ -96,6 +96,7 @@
constexpr int CHARGE_PORT_FRONT_LEFT = toInt(propertyutils_impl::PortLocationType::FRONT_LEFT);
constexpr int CHARGE_PORT_REAR_LEFT = toInt(propertyutils_impl::PortLocationType::REAR_LEFT);
constexpr int LIGHT_STATE_ON = toInt(propertyutils_impl::VehicleLightState::ON);
+constexpr int LIGHT_SWITCH_OFF = toInt(propertyutils_impl::VehicleLightSwitch::OFF);
constexpr int LIGHT_SWITCH_AUTO = toInt(propertyutils_impl::VehicleLightSwitch::AUTOMATIC);
constexpr int WHEEL_FRONT_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_FRONT);
constexpr int WHEEL_FRONT_RIGHT = toInt(propertyutils_impl::VehicleAreaWheel::RIGHT_FRONT);
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
index 8bc3c20..08e1990 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
@@ -26,6 +26,7 @@
#include <aidl/android/hardware/automotive/vehicle/GetValueRequest.h>
#include <aidl/android/hardware/automotive/vehicle/GetValueResult.h>
#include <aidl/android/hardware/automotive/vehicle/GetValueResults.h>
+#include <aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.h>
#include <aidl/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.h>
#include <aidl/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.h>
#include <aidl/android/hardware/automotive/vehicle/Obd2FuelType.h>
diff --git a/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp b/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp
index 0196edd..ab50499 100644
--- a/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp
+++ b/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp
@@ -39,20 +39,27 @@
} // namespace
-PendingRequestPool::PendingRequestPool(int64_t timeoutInNano)
- : mTimeoutInNano(timeoutInNano), mThread([this] {
- // [this] must be alive within this thread because destructor would wait for this thread
- // to exit.
- int64_t sleepTime = std::min(mTimeoutInNano, static_cast<int64_t>(CHECK_TIME_IN_NANO));
- std::unique_lock<std::mutex> lk(mCvLock);
- while (!mCv.wait_for(lk, std::chrono::nanoseconds(sleepTime),
- [this] { return mThreadStop.load(); })) {
- checkTimeout();
- }
- }) {}
+PendingRequestPool::PendingRequestPool(int64_t timeoutInNano) : mTimeoutInNano(timeoutInNano) {
+ mThread = std::thread([this] {
+ // [this] must be alive within this thread because destructor would wait for this thread
+ // to exit.
+ int64_t sleepTime = std::min(mTimeoutInNano, static_cast<int64_t>(CHECK_TIME_IN_NANO));
+ std::unique_lock<std::mutex> lk(mCvLock);
+ while (!mCv.wait_for(lk, std::chrono::nanoseconds(sleepTime),
+ [this] { return mThreadStop; })) {
+ checkTimeout();
+ }
+ });
+}
PendingRequestPool::~PendingRequestPool() {
- mThreadStop = true;
+ {
+ // Even if the shared variable is atomic, it must be modified under the
+ // mutex in order to correctly publish the modification to the waiting
+ // thread.
+ std::unique_lock<std::mutex> lk(mCvLock);
+ mThreadStop = true;
+ }
mCv.notify_all();
if (mThread.joinable()) {
mThread.join();
diff --git a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp
index 2eca6b7..43f5d69 100644
--- a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp
+++ b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp
@@ -29,7 +29,9 @@
using ::android::base::ScopedLockAssertion;
-RecurrentTimer::RecurrentTimer() : mThread(&RecurrentTimer::loop, this) {}
+RecurrentTimer::RecurrentTimer() {
+ mThread = std::thread(&RecurrentTimer::loop, this);
+}
RecurrentTimer::~RecurrentTimer() {
{
diff --git a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h
index d512713..e6ea6fe 100644
--- a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h
+++ b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h
@@ -35,7 +35,6 @@
} // namespace testpropertyutils_impl
-#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
// Converts the system property to the vendor property.
// WARNING: This is only for the end-to-end testing, Should NOT include in the user build.
inline constexpr int32_t toVendor(
@@ -55,7 +54,6 @@
toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_REQUEST_DISPLAY);
constexpr int32_t VENDOR_CLUSTER_NAVIGATION_STATE =
toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_NAVIGATION_STATE);
-#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING
// These properties are placeholder properties for developers to test new features without
// implementing a real property.
diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp
index 5abcaf6..4feea79 100644
--- a/automotive/vehicle/aidl/impl/vhal/Android.bp
+++ b/automotive/vehicle/aidl/impl/vhal/Android.bp
@@ -66,3 +66,25 @@
"libbinder_ndk",
],
}
+
+cc_fuzz {
+ name: "android.hardware.automotive.vehicle@V1-default-service_fuzzer",
+ vendor: true,
+ defaults: [
+ "FakeVehicleHardwareDefaults",
+ "VehicleHalDefaults",
+ "android-automotive-large-parcelable-defaults",
+ "service_fuzzer_defaults",
+ ],
+ static_libs: [
+ "DefaultVehicleHal",
+ "FakeVehicleHardware",
+ "VehicleHalUtils",
+ ],
+ srcs: ["src/fuzzer.cpp"],
+ fuzz_config: {
+ cc: [
+ "keithmok@google.com",
+ ],
+ },
+}
diff --git a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h
index 9c29816..0439ac6 100644
--- a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h
+++ b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h
@@ -123,10 +123,10 @@
std::shared_ptr<PendingRequestPool> mPendingRequestPool;
};
- // A wrapper for binder operations to enable stubbing for test.
- class IBinder {
+ // A wrapper for binder lifecycle operations to enable stubbing for test.
+ class BinderLifecycleInterface {
public:
- virtual ~IBinder() = default;
+ virtual ~BinderLifecycleInterface() = default;
virtual binder_status_t linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient,
void* cookie) = 0;
@@ -134,8 +134,8 @@
virtual bool isAlive(const AIBinder* binder) = 0;
};
- // A real implementation for IBinder.
- class AIBinderImpl final : public IBinder {
+ // A real implementation for BinderLifecycleInterface.
+ class BinderLifecycleHandler final : public BinderLifecycleInterface {
public:
binder_status_t linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient,
void* cookie) override;
@@ -154,7 +154,7 @@
// BinderDiedUnlinkedEvent represents either an onBinderDied or an onBinderUnlinked event.
struct BinderDiedUnlinkedEvent {
// true for onBinderDied, false for onBinderUnlinked.
- bool onBinderDied;
+ bool forOnBinderDied;
const AIBinder* clientId;
};
@@ -186,8 +186,8 @@
GUARDED_BY(mLock);
// SubscriptionClients is thread-safe.
std::shared_ptr<SubscriptionClients> mSubscriptionClients;
- // mBinderImpl is only going to be changed in test.
- std::unique_ptr<IBinder> mBinderImpl;
+ // mBinderLifecycleHandler is only going to be changed in test.
+ std::unique_ptr<BinderLifecycleInterface> mBinderLifecycleHandler;
// Only initialized once.
std::shared_ptr<std::function<void()>> mRecurrentAction;
@@ -263,7 +263,7 @@
void setTimeout(int64_t timeoutInNano);
// Test-only
- void setBinderImpl(std::unique_ptr<IBinder> impl);
+ void setBinderLifecycleHandler(std::unique_ptr<BinderLifecycleInterface> impl);
};
} // namespace vehicle
diff --git a/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h
index 7c8f1b4..14799d9 100644
--- a/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h
+++ b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h
@@ -41,15 +41,15 @@
public:
using ClientIdType = const AIBinder*;
- void addClient(const ClientIdType& clientId, float sampleRate);
+ void addClient(const ClientIdType& clientId, float sampleRateHz);
void removeClient(const ClientIdType& clientId);
- float getMaxSampleRate();
+ float getMaxSampleRateHz() const;
private:
- float mMaxSampleRate = 0.;
- std::unordered_map<ClientIdType, float> mSampleRates;
+ float mMaxSampleRateHz = 0.;
+ std::unordered_map<ClientIdType, float> mSampleRateHzByClient;
- void refreshMaxSampleRate();
+ void refreshMaxSampleRateHz();
};
// A thread-safe subscription manager that manages all VHAL subscriptions.
@@ -59,7 +59,7 @@
using CallbackType =
std::shared_ptr<aidl::android::hardware::automotive::vehicle::IVehicleCallback>;
- explicit SubscriptionManager(IVehicleHardware* hardware);
+ explicit SubscriptionManager(IVehicleHardware* vehicleHardware);
~SubscriptionManager();
// Subscribes to properties according to {@code SubscribeOptions}. Note that all option must
@@ -99,13 +99,8 @@
const std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropValue>&
updatedValues);
- // Gets the sample rate for the continuous property. Returns {@code std::nullopt} if the
- // property has not been subscribed before or is not a continuous property.
- std::optional<float> getSampleRate(const ClientIdType& clientId, int32_t propId,
- int32_t areaId);
-
// Checks whether the sample rate is valid.
- static bool checkSampleRate(float sampleRate);
+ static bool checkSampleRateHz(float sampleRateHz);
private:
// Friend class for testing.
@@ -122,17 +117,21 @@
std::unordered_map<PropIdAreaId, ContSubConfigs, PropIdAreaIdHash> mContSubConfigsByPropIdArea
GUARDED_BY(mLock);
- VhalResult<void> updateSampleRateLocked(const ClientIdType& clientId,
- const PropIdAreaId& propIdAreaId, float sampleRate)
+ VhalResult<void> addContinuousSubscriberLocked(const ClientIdType& clientId,
+ const PropIdAreaId& propIdAreaId,
+ float sampleRateHz) REQUIRES(mLock);
+ VhalResult<void> removeContinuousSubscriberLocked(const ClientIdType& clientId,
+ const PropIdAreaId& propIdAreaId)
REQUIRES(mLock);
- VhalResult<void> removeSampleRateLocked(const ClientIdType& clientId,
- const PropIdAreaId& propIdAreaId) REQUIRES(mLock);
+
+ VhalResult<void> updateContSubConfigs(const PropIdAreaId& PropIdAreaId,
+ const ContSubConfigs& newConfig) REQUIRES(mLock);
// Checks whether the manager is empty. For testing purpose.
bool isEmpty();
// Get the interval in nanoseconds accroding to sample rate.
- static android::base::Result<int64_t> getInterval(float sampleRate);
+ static android::base::Result<int64_t> getIntervalNanos(float sampleRateHz);
};
} // namespace vehicle
diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
index b191aef..d447bf8 100644
--- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
@@ -78,14 +78,14 @@
return str;
}
-float getDefaultSampleRate(float sampleRate, float minSampleRate, float maxSampleRate) {
- if (sampleRate < minSampleRate) {
- return minSampleRate;
+float getDefaultSampleRateHz(float sampleRateHz, float minSampleRateHz, float maxSampleRateHz) {
+ if (sampleRateHz < minSampleRateHz) {
+ return minSampleRateHz;
}
- if (sampleRate > maxSampleRate) {
- return maxSampleRate;
+ if (sampleRateHz > maxSampleRateHz) {
+ return maxSampleRateHz;
}
- return sampleRate;
+ return sampleRateHz;
}
} // namespace
@@ -123,8 +123,8 @@
return mClients.size();
}
-DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr<IVehicleHardware> hardware)
- : mVehicleHardware(std::move(hardware)),
+DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr<IVehicleHardware> vehicleHardware)
+ : mVehicleHardware(std::move(vehicleHardware)),
mPendingRequestPool(std::make_shared<PendingRequestPool>(TIMEOUT_IN_NANO)) {
auto configs = mVehicleHardware->getAllPropertyConfigs();
for (auto& config : configs) {
@@ -144,11 +144,10 @@
}
mSubscriptionClients = std::make_shared<SubscriptionClients>(mPendingRequestPool);
- mSubscriptionClients = std::make_shared<SubscriptionClients>(mPendingRequestPool);
auto subscribeIdByClient = std::make_shared<SubscribeIdByClient>();
- IVehicleHardware* hardwarePtr = mVehicleHardware.get();
- mSubscriptionManager = std::make_shared<SubscriptionManager>(hardwarePtr);
+ IVehicleHardware* vehicleHardwarePtr = mVehicleHardware.get();
+ mSubscriptionManager = std::make_shared<SubscriptionManager>(vehicleHardwarePtr);
std::weak_ptr<SubscriptionManager> subscriptionManagerCopy = mSubscriptionManager;
mVehicleHardware->registerOnPropertyChangeEvent(
@@ -158,13 +157,13 @@
}));
// Register heartbeat event.
- mRecurrentAction =
- std::make_shared<std::function<void()>>([hardwarePtr, subscriptionManagerCopy]() {
- checkHealth(hardwarePtr, subscriptionManagerCopy);
+ mRecurrentAction = std::make_shared<std::function<void()>>(
+ [vehicleHardwarePtr, subscriptionManagerCopy]() {
+ checkHealth(vehicleHardwarePtr, subscriptionManagerCopy);
});
mRecurrentTimer.registerTimerCallback(HEART_BEAT_INTERVAL_IN_NANO, mRecurrentAction);
- mBinderImpl = std::make_unique<AIBinderImpl>();
+ mBinderLifecycleHandler = std::make_unique<BinderLifecycleHandler>();
mOnBinderDiedUnlinkedHandlerThread = std::thread([this] { onBinderDiedUnlinkedHandler(); });
mDeathRecipient = ScopedAIBinder_DeathRecipient(
AIBinder_DeathRecipient_new(&DefaultVehicleHal::onBinderDied));
@@ -220,7 +219,7 @@
bool DefaultVehicleHal::monitorBinderLifeCycleLocked(const AIBinder* clientId) {
OnBinderDiedContext* contextPtr = nullptr;
if (mOnBinderDiedContexts.find(clientId) != mOnBinderDiedContexts.end()) {
- return mBinderImpl->isAlive(clientId);
+ return mBinderLifecycleHandler->isAlive(clientId);
} else {
std::unique_ptr<OnBinderDiedContext> context = std::make_unique<OnBinderDiedContext>(
OnBinderDiedContext{.vhal = this, .clientId = clientId});
@@ -232,7 +231,7 @@
}
// If this function fails, onBinderUnlinked would be called to remove the added context.
- binder_status_t status = mBinderImpl->linkToDeath(
+ binder_status_t status = mBinderLifecycleHandler->linkToDeath(
const_cast<AIBinder*>(clientId), mDeathRecipient.get(), static_cast<void*>(contextPtr));
if (status == STATUS_OK) {
return true;
@@ -246,7 +245,8 @@
OnBinderDiedContext* context = reinterpret_cast<OnBinderDiedContext*>(cookie);
// To be handled in mOnBinderDiedUnlinkedHandlerThread. We cannot handle the event in the same
// thread because we might be holding the mLock the handler requires.
- context->vhal->mBinderEvents.push(BinderDiedUnlinkedEvent{true, context->clientId});
+ context->vhal->mBinderEvents.push(
+ BinderDiedUnlinkedEvent{/*forOnBinderDied=*/true, context->clientId});
}
void DefaultVehicleHal::onBinderDiedWithContext(const AIBinder* clientId) {
@@ -262,7 +262,8 @@
OnBinderDiedContext* context = reinterpret_cast<OnBinderDiedContext*>(cookie);
// To be handled in mOnBinderDiedUnlinkedHandlerThread. We cannot handle the event in the same
// thread because we might be holding the mLock the handler requires.
- context->vhal->mBinderEvents.push(BinderDiedUnlinkedEvent{false, context->clientId});
+ context->vhal->mBinderEvents.push(
+ BinderDiedUnlinkedEvent{/*forOnBinderDied=*/false, context->clientId});
}
void DefaultVehicleHal::onBinderUnlinkedWithContext(const AIBinder* clientId) {
@@ -275,7 +276,7 @@
void DefaultVehicleHal::onBinderDiedUnlinkedHandler() {
while (mBinderEvents.waitForItems()) {
for (BinderDiedUnlinkedEvent& event : mBinderEvents.flush()) {
- if (event.onBinderDied) {
+ if (event.forOnBinderDied) {
onBinderDiedWithContext(event.clientId);
} else {
onBinderUnlinkedWithContext(event.clientId);
@@ -349,6 +350,9 @@
ScopedAStatus DefaultVehicleHal::getValues(const CallbackType& callback,
const GetValueRequests& requests) {
+ if (callback == nullptr) {
+ return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER);
+ }
expected<LargeParcelableBase::BorrowedOwnedObject<GetValueRequests>, ScopedAStatus>
deserializedResults = fromStableLargeParcelable(requests);
if (!deserializedResults.ok()) {
@@ -432,6 +436,9 @@
ScopedAStatus DefaultVehicleHal::setValues(const CallbackType& callback,
const SetValueRequests& requests) {
+ if (callback == nullptr) {
+ return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER);
+ }
expected<LargeParcelableBase::BorrowedOwnedObject<SetValueRequests>, ScopedAStatus>
deserializedResults = fromStableLargeParcelable(requests);
if (!deserializedResults.ok()) {
@@ -589,18 +596,20 @@
}
if (config.changeMode == VehiclePropertyChangeMode::CONTINUOUS) {
- float sampleRate = option.sampleRate;
- float minSampleRate = config.minSampleRate;
- float maxSampleRate = config.maxSampleRate;
- if (sampleRate < minSampleRate || sampleRate > maxSampleRate) {
- float defaultRate = getDefaultSampleRate(sampleRate, minSampleRate, maxSampleRate);
- ALOGW("sample rate: %f out of range, must be within %f and %f, set to %f",
- sampleRate, minSampleRate, maxSampleRate, defaultRate);
- sampleRate = defaultRate;
+ float sampleRateHz = option.sampleRate;
+ float minSampleRateHz = config.minSampleRate;
+ float maxSampleRateHz = config.maxSampleRate;
+ float defaultRateHz =
+ getDefaultSampleRateHz(sampleRateHz, minSampleRateHz, maxSampleRateHz);
+ if (sampleRateHz != defaultRateHz) {
+ ALOGW("sample rate: %f HZ out of range, must be within %f HZ and %f HZ , set to %f "
+ "HZ",
+ sampleRateHz, minSampleRateHz, maxSampleRateHz, defaultRateHz);
+ sampleRateHz = defaultRateHz;
}
- if (!SubscriptionManager::checkSampleRate(sampleRate)) {
+ if (!SubscriptionManager::checkSampleRateHz(sampleRateHz)) {
return StatusError(StatusCode::INVALID_ARG)
- << "invalid sample rate: " << sampleRate;
+ << "invalid sample rate: " << sampleRateHz << " HZ";
}
}
@@ -625,11 +634,13 @@
const std::vector<SubscribeOptions>& options,
[[maybe_unused]] int32_t maxSharedMemoryFileCount) {
// TODO(b/205189110): Use shared memory file count.
+ if (callback == nullptr) {
+ return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER);
+ }
if (auto result = checkSubscribeOptions(options); !result.ok()) {
ALOGE("subscribe: invalid subscribe options: %s", getErrorMsg(result).c_str());
return toScopedAStatus(result);
}
-
std::vector<SubscribeOptions> onChangeSubscriptions;
std::vector<SubscribeOptions> continuousSubscriptions;
for (const auto& option : options) {
@@ -650,7 +661,7 @@
}
if (config.changeMode == VehiclePropertyChangeMode::CONTINUOUS) {
- optionCopy.sampleRate = getDefaultSampleRate(
+ optionCopy.sampleRate = getDefaultSampleRateHz(
optionCopy.sampleRate, config.minSampleRate, config.maxSampleRate);
continuousSubscriptions.push_back(std::move(optionCopy));
} else {
@@ -685,6 +696,9 @@
ScopedAStatus DefaultVehicleHal::unsubscribe(const CallbackType& callback,
const std::vector<int32_t>& propIds) {
+ if (callback == nullptr) {
+ return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER);
+ }
return toScopedAStatus(mSubscriptionManager->unsubscribe(callback->asBinder().get(), propIds));
}
@@ -729,9 +743,9 @@
return {};
}
-void DefaultVehicleHal::checkHealth(IVehicleHardware* hardware,
+void DefaultVehicleHal::checkHealth(IVehicleHardware* vehicleHardware,
std::weak_ptr<SubscriptionManager> subscriptionManager) {
- StatusCode status = hardware->checkHealth();
+ StatusCode status = vehicleHardware->checkHealth();
if (status != StatusCode::OK) {
ALOGE("VHAL check health returns non-okay status");
return;
@@ -746,18 +760,18 @@
return;
}
-binder_status_t DefaultVehicleHal::AIBinderImpl::linkToDeath(AIBinder* binder,
- AIBinder_DeathRecipient* recipient,
- void* cookie) {
+binder_status_t DefaultVehicleHal::BinderLifecycleHandler::linkToDeath(
+ AIBinder* binder, AIBinder_DeathRecipient* recipient, void* cookie) {
return AIBinder_linkToDeath(binder, recipient, cookie);
}
-bool DefaultVehicleHal::AIBinderImpl::isAlive(const AIBinder* binder) {
+bool DefaultVehicleHal::BinderLifecycleHandler::isAlive(const AIBinder* binder) {
return AIBinder_isAlive(binder);
}
-void DefaultVehicleHal::setBinderImpl(std::unique_ptr<IBinder> impl) {
- mBinderImpl = std::move(impl);
+void DefaultVehicleHal::setBinderLifecycleHandler(
+ std::unique_ptr<BinderLifecycleInterface> handler) {
+ mBinderLifecycleHandler = std::move(handler);
}
bool DefaultVehicleHal::checkDumpPermission() {
diff --git a/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp
index 2694401..bba730f 100644
--- a/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp
@@ -42,7 +42,8 @@
using ::android::base::StringPrintf;
using ::ndk::ScopedAStatus;
-SubscriptionManager::SubscriptionManager(IVehicleHardware* hardware) : mVehicleHardware(hardware) {}
+SubscriptionManager::SubscriptionManager(IVehicleHardware* vehicleHardware)
+ : mVehicleHardware(vehicleHardware) {}
SubscriptionManager::~SubscriptionManager() {
std::scoped_lock<std::mutex> lockGuard(mLock);
@@ -51,94 +52,82 @@
mSubscribedPropsByClient.clear();
}
-bool SubscriptionManager::checkSampleRate(float sampleRate) {
- return getInterval(sampleRate).ok();
+bool SubscriptionManager::checkSampleRateHz(float sampleRateHz) {
+ return getIntervalNanos(sampleRateHz).ok();
}
-Result<int64_t> SubscriptionManager::getInterval(float sampleRate) {
- int64_t interval = 0;
- if (sampleRate <= 0) {
+Result<int64_t> SubscriptionManager::getIntervalNanos(float sampleRateHz) {
+ int64_t intervalNanos = 0;
+ if (sampleRateHz <= 0) {
return Error() << "invalid sample rate, must be a positive number";
}
- if (sampleRate <= (ONE_SECOND_IN_NANO / static_cast<float>(INT64_MAX))) {
- return Error() << "invalid sample rate: " << sampleRate << ", too small";
+ if (sampleRateHz <= (ONE_SECOND_IN_NANO / static_cast<float>(INT64_MAX))) {
+ return Error() << "invalid sample rate: " << sampleRateHz << ", too small";
}
- interval = static_cast<int64_t>(ONE_SECOND_IN_NANO / sampleRate);
- return interval;
+ intervalNanos = static_cast<int64_t>(ONE_SECOND_IN_NANO / sampleRateHz);
+ return intervalNanos;
}
-void ContSubConfigs::refreshMaxSampleRate() {
- float maxSampleRate = 0.;
+void ContSubConfigs::refreshMaxSampleRateHz() {
+ float maxSampleRateHz = 0.;
// This is not called frequently so a brute-focre is okay. More efficient way exists but this
// is simpler.
- for (const auto& [_, sampleRate] : mSampleRates) {
- if (sampleRate > maxSampleRate) {
- maxSampleRate = sampleRate;
+ for (const auto& [_, sampleRateHz] : mSampleRateHzByClient) {
+ if (sampleRateHz > maxSampleRateHz) {
+ maxSampleRateHz = sampleRateHz;
}
}
- mMaxSampleRate = maxSampleRate;
+ mMaxSampleRateHz = maxSampleRateHz;
}
-void ContSubConfigs::addClient(const ClientIdType& clientId, float sampleRate) {
- mSampleRates[clientId] = sampleRate;
- refreshMaxSampleRate();
+void ContSubConfigs::addClient(const ClientIdType& clientId, float sampleRateHz) {
+ mSampleRateHzByClient[clientId] = sampleRateHz;
+ refreshMaxSampleRateHz();
}
void ContSubConfigs::removeClient(const ClientIdType& clientId) {
- mSampleRates.erase(clientId);
- refreshMaxSampleRate();
+ mSampleRateHzByClient.erase(clientId);
+ refreshMaxSampleRateHz();
}
-float ContSubConfigs::getMaxSampleRate() {
- return mMaxSampleRate;
+float ContSubConfigs::getMaxSampleRateHz() const {
+ return mMaxSampleRateHz;
}
-VhalResult<void> SubscriptionManager::updateSampleRateLocked(const ClientIdType& clientId,
- const PropIdAreaId& propIdAreaId,
- float sampleRate) {
+VhalResult<void> SubscriptionManager::addContinuousSubscriberLocked(
+ const ClientIdType& clientId, const PropIdAreaId& propIdAreaId, float sampleRateHz) {
// Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases.
- ContSubConfigs infoCopy = mContSubConfigsByPropIdArea[propIdAreaId];
- infoCopy.addClient(clientId, sampleRate);
- if (infoCopy.getMaxSampleRate() ==
- mContSubConfigsByPropIdArea[propIdAreaId].getMaxSampleRate()) {
- mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy;
+ ContSubConfigs newConfig = mContSubConfigsByPropIdArea[propIdAreaId];
+ newConfig.addClient(clientId, sampleRateHz);
+ return updateContSubConfigs(propIdAreaId, newConfig);
+}
+
+VhalResult<void> SubscriptionManager::removeContinuousSubscriberLocked(
+ const ClientIdType& clientId, const PropIdAreaId& propIdAreaId) {
+ // Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases.
+ ContSubConfigs newConfig = mContSubConfigsByPropIdArea[propIdAreaId];
+ newConfig.removeClient(clientId);
+ return updateContSubConfigs(propIdAreaId, newConfig);
+}
+
+VhalResult<void> SubscriptionManager::updateContSubConfigs(const PropIdAreaId& propIdAreaId,
+ const ContSubConfigs& newConfig) {
+ if (newConfig.getMaxSampleRateHz() ==
+ mContSubConfigsByPropIdArea[propIdAreaId].getMaxSampleRateHz()) {
+ mContSubConfigsByPropIdArea[propIdAreaId] = newConfig;
return {};
}
- float newRate = infoCopy.getMaxSampleRate();
+ float newRateHz = newConfig.getMaxSampleRateHz();
int32_t propId = propIdAreaId.propId;
int32_t areaId = propIdAreaId.areaId;
- if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRate);
+ if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRateHz);
status != StatusCode::OK) {
return StatusError(status) << StringPrintf("failed to update sample rate for prop: %" PRId32
", area"
- ": %" PRId32 ", sample rate: %f",
- propId, areaId, newRate);
+ ": %" PRId32 ", sample rate: %f HZ",
+ propId, areaId, newRateHz);
}
- mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy;
- return {};
-}
-
-VhalResult<void> SubscriptionManager::removeSampleRateLocked(const ClientIdType& clientId,
- const PropIdAreaId& propIdAreaId) {
- // Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases.
- ContSubConfigs infoCopy = mContSubConfigsByPropIdArea[propIdAreaId];
- infoCopy.removeClient(clientId);
- if (infoCopy.getMaxSampleRate() ==
- mContSubConfigsByPropIdArea[propIdAreaId].getMaxSampleRate()) {
- mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy;
- return {};
- }
- float newRate = infoCopy.getMaxSampleRate();
- int32_t propId = propIdAreaId.propId;
- int32_t areaId = propIdAreaId.areaId;
- if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRate);
- status != StatusCode::OK) {
- return StatusError(status) << StringPrintf("failed to update sample rate for prop: %" PRId32
- ", area"
- ": %" PRId32 ", sample rate: %f",
- propId, areaId, newRate);
- }
- mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy;
+ mContSubConfigsByPropIdArea[propIdAreaId] = newConfig;
return {};
}
@@ -147,14 +136,12 @@
bool isContinuousProperty) {
std::scoped_lock<std::mutex> lockGuard(mLock);
- std::vector<int64_t> intervals;
for (const auto& option : options) {
- float sampleRate = option.sampleRate;
+ float sampleRateHz = option.sampleRate;
if (isContinuousProperty) {
- auto intervalResult = getInterval(sampleRate);
- if (!intervalResult.ok()) {
- return StatusError(StatusCode::INVALID_ARG) << intervalResult.error().message();
+ if (auto result = getIntervalNanos(sampleRateHz); !result.ok()) {
+ return StatusError(StatusCode::INVALID_ARG) << result.error().message();
}
}
@@ -176,7 +163,8 @@
.areaId = areaId,
};
if (isContinuousProperty) {
- if (auto result = updateSampleRateLocked(clientId, propIdAreaId, option.sampleRate);
+ if (auto result = addContinuousSubscriberLocked(clientId, propIdAreaId,
+ option.sampleRate);
!result.ok()) {
return result;
}
@@ -214,7 +202,7 @@
while (it != propIdAreaIds.end()) {
int32_t propId = it->propId;
if (std::find(propIds.begin(), propIds.end(), propId) != propIds.end()) {
- if (auto result = removeSampleRateLocked(clientId, *it); !result.ok()) {
+ if (auto result = removeContinuousSubscriberLocked(clientId, *it); !result.ok()) {
return result;
}
@@ -244,7 +232,7 @@
auto& subscriptions = mSubscribedPropsByClient[clientId];
for (auto const& propIdAreaId : subscriptions) {
- if (auto result = removeSampleRateLocked(clientId, propIdAreaId); !result.ok()) {
+ if (auto result = removeContinuousSubscriberLocked(clientId, propIdAreaId); !result.ok()) {
return result;
}
diff --git a/automotive/vehicle/aidl/impl/vhal/src/fuzzer.cpp b/automotive/vehicle/aidl/impl/vhal/src/fuzzer.cpp
new file mode 100644
index 0000000..ac1e3b1
--- /dev/null
+++ b/automotive/vehicle/aidl/impl/vhal/src/fuzzer.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include <DefaultVehicleHal.h>
+#include <FakeVehicleHardware.h>
+#include <fuzzbinder/libbinder_ndk_driver.h>
+#include <fuzzer/FuzzedDataProvider.h>
+
+using ::android::fuzzService;
+using ::android::hardware::automotive::vehicle::DefaultVehicleHal;
+using ::android::hardware::automotive::vehicle::fake::FakeVehicleHardware;
+using ::ndk::SharedRefBase;
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ std::unique_ptr<FakeVehicleHardware> hardware = std::make_unique<FakeVehicleHardware>();
+ std::shared_ptr<DefaultVehicleHal> vhal =
+ ::ndk::SharedRefBase::make<DefaultVehicleHal>(std::move(hardware));
+
+ fuzzService(vhal->asBinder().get(), FuzzedDataProvider(data, size));
+
+ return 0;
+}
diff --git a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
index f48b906..36fa5e6 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp
@@ -324,9 +324,9 @@
mCallbackClient = IVehicleCallback::fromBinder(mBinder);
// Set the linkToDeath to a fake implementation that always returns OK.
- auto binderImpl = std::make_unique<TestBinderImpl>();
- mBinderImpl = binderImpl.get();
- mVhal->setBinderImpl(std::move(binderImpl));
+ auto handler = std::make_unique<TestBinderLifecycleHandler>();
+ mBinderLifecycleHandler = handler.get();
+ mVhal->setBinderLifecycleHandler(std::move(handler));
}
void TearDown() override {
@@ -370,7 +370,7 @@
bool hasNoSubscriptions() { return mVhal->mSubscriptionManager->isEmpty(); }
- void setBinderAlive(bool isAlive) { mBinderImpl->setAlive(isAlive); };
+ void setBinderAlive(bool isAlive) { mBinderLifecycleHandler->setAlive(isAlive); };
static Result<void> getValuesTestCases(size_t size, GetValueRequests& requests,
std::vector<GetValueResult>& expectedResults,
@@ -444,7 +444,7 @@
}
private:
- class TestBinderImpl final : public DefaultVehicleHal::IBinder {
+ class TestBinderLifecycleHandler final : public DefaultVehicleHal::BinderLifecycleInterface {
public:
binder_status_t linkToDeath(AIBinder*, AIBinder_DeathRecipient*, void*) override {
if (mIsAlive) {
@@ -468,7 +468,7 @@
std::shared_ptr<MockVehicleCallback> mCallback;
std::shared_ptr<IVehicleCallback> mCallbackClient;
SpAIBinder mBinder;
- TestBinderImpl* mBinderImpl;
+ TestBinderLifecycleHandler* mBinderLifecycleHandler;
};
TEST_F(DefaultVehicleHalTest, testGetAllPropConfigsSmall) {
diff --git a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp
index 3f59363..eb3c663 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp
@@ -477,16 +477,16 @@
ASSERT_THAT(clients[getCallbackClient()], ElementsAre(&updatedValues[1]));
}
-TEST_F(SubscriptionManagerTest, testCheckSampleRateValid) {
- ASSERT_TRUE(SubscriptionManager::checkSampleRate(1.0));
+TEST_F(SubscriptionManagerTest, testCheckSampleRateHzValid) {
+ ASSERT_TRUE(SubscriptionManager::checkSampleRateHz(1.0));
}
-TEST_F(SubscriptionManagerTest, testCheckSampleRateInvalidTooSmall) {
- ASSERT_FALSE(SubscriptionManager::checkSampleRate(FLT_MIN));
+TEST_F(SubscriptionManagerTest, testCheckSampleRateHzInvalidTooSmall) {
+ ASSERT_FALSE(SubscriptionManager::checkSampleRateHz(FLT_MIN));
}
-TEST_F(SubscriptionManagerTest, testCheckSampleRateInvalidZero) {
- ASSERT_FALSE(SubscriptionManager::checkSampleRate(0));
+TEST_F(SubscriptionManagerTest, testCheckSampleRateHzInvalidZero) {
+ ASSERT_FALSE(SubscriptionManager::checkSampleRateHz(0));
}
} // namespace vehicle
diff --git a/automotive/vehicle/tools/generate_annotation_enums.py b/automotive/vehicle/tools/generate_annotation_enums.py
new file mode 100644
index 0000000..fc6f157
--- /dev/null
+++ b/automotive/vehicle/tools/generate_annotation_enums.py
@@ -0,0 +1,243 @@
+#!/usr/bin/python
+
+# Copyright (C) 2022 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.
+#
+"""A script to generate Java files and CPP header files based on annotations in VehicleProperty.aidl
+
+ Need ANDROID_BUILD_TOP environmental variable to be set. This script will update
+ ChangeModeForVehicleProperty.h and AccessForVehicleProperty.h under generated_lib/cpp and
+ ChangeModeForVehicleProperty.java and AccessForVehicleProperty.java under generated_lib/java.
+
+ Usage:
+ $ python generate_annotation_enums.py
+"""
+import os
+import re
+import sys
+
+PROP_AIDL_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/android/hardware/automotive/" +
+ "vehicle/VehicleProperty.aidl")
+CHANGE_MODE_CPP_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/" +
+ "ChangeModeForVehicleProperty.h")
+ACCESS_CPP_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/" +
+ "AccessForVehicleProperty.h")
+CHANGE_MODE_JAVA_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/" +
+ "ChangeModeForVehicleProperty.java")
+ACCESS_JAVA_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/" +
+ "AccessForVehicleProperty.java")
+
+TAB = " "
+RE_ENUM_START = re.compile("\s*enum VehicleProperty \{")
+RE_ENUM_END = re.compile("\s*\}\;")
+RE_COMMENT_BEGIN = re.compile("\s*\/\*\*?")
+RE_COMMENT_END = re.compile("\s*\*\/")
+RE_CHANGE_MODE = re.compile("\s*\* @change_mode (\S+)\s*")
+RE_ACCESS = re.compile("\s*\* @access (\S+)\s*")
+RE_VALUE = re.compile("\s*(\w+)\s*=(.*)")
+
+LICENSE = """/*
+ * Copyright (C) 2022 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.
+ */
+
+/**
+ * DO NOT EDIT MANUALLY!!!
+ *
+ * Generated by tools/generate_annotation_enums.py.
+ */
+
+"""
+
+CHANGE_MODE_CPP_HEADER = """#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
+#define android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
+
+#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
+#include <aidl/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.h>
+
+#include <unordered_map>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+std::unordered_map<VehicleProperty, VehiclePropertyChangeMode> ChangeModeForVehicleProperty = {
+"""
+
+CHANGE_MODE_CPP_FOOTER = """
+};
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+} // aidl
+
+#endif // android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
+"""
+
+ACCESS_CPP_HEADER = """#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
+#define android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
+
+#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
+#include <aidl/android/hardware/automotive/vehicle/VehiclePropertyAccess.h>
+
+#include <unordered_map>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+std::unordered_map<VehicleProperty, VehiclePropertyAccess> AccessForVehicleProperty = {
+"""
+
+ACCESS_CPP_FOOTER = """
+};
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+} // aidl
+
+#endif // android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
+"""
+
+CHANGE_MODE_JAVA_HEADER = """package android.hardware.automotive.vehicle;
+
+import java.util.Map;
+
+public final class ChangeModeForVehicleProperty {
+
+ public static final Map<Integer, Integer> values = Map.ofEntries(
+"""
+
+CHANGE_MODE_JAVA_FOOTER = """
+ );
+
+}
+"""
+
+ACCESS_JAVA_HEADER = """package android.hardware.automotive.vehicle;
+
+import java.util.Map;
+
+public final class AccessForVehicleProperty {
+
+ public static final Map<Integer, Integer> values = Map.ofEntries(
+"""
+
+ACCESS_JAVA_FOOTER = """
+ );
+
+}
+"""
+
+
+class Converter:
+
+ def __init__(self, name, annotation_re):
+ self.name = name
+ self.annotation_re = annotation_re
+
+ def convert(self, input, output, header, footer, cpp):
+ processing = False
+ in_comment = False
+ content = LICENSE + header
+ annotation = None
+ id = 0
+ with open(input, 'r') as f:
+ for line in f.readlines():
+ if RE_ENUM_START.match(line):
+ processing = True
+ annotation = None
+ elif RE_ENUM_END.match(line):
+ processing = False
+ if not processing:
+ continue
+ if RE_COMMENT_BEGIN.match(line):
+ in_comment = True
+ if RE_COMMENT_END.match(line):
+ in_comment = False
+ if in_comment:
+ match = self.annotation_re.match(line)
+ if match:
+ annotation = match.group(1)
+ else:
+ match = RE_VALUE.match(line)
+ if match:
+ prop_name = match.group(1)
+ if prop_name == "INVALID":
+ continue
+ if not annotation:
+ print("No @" + self.name + " annotation for property: " + prop_name)
+ sys.exit(1)
+ if id != 0:
+ content += "\n"
+ if cpp:
+ annotation = annotation.replace(".", "::")
+ content += (TAB + TAB + "{VehicleProperty::" + prop_name + ", " +
+ annotation + "},")
+ else:
+ content += (TAB + TAB + "Map.entry(VehicleProperty." + prop_name + ", " +
+ annotation + "),")
+ id += 1
+
+ # Remove the additional "," at the end for the Java file.
+ if not cpp:
+ content = content[:-1]
+
+ content += footer
+
+ with open(output, 'w') as f:
+ f.write(content)
+
+
+def main():
+ android_top = os.environ['ANDROID_BUILD_TOP']
+ if not android_top:
+ print("ANDROID_BUILD_TOP is not in envorinmental variable, please run source and lunch " +
+ "at the android root")
+
+ aidl_file = os.path.join(android_top, PROP_AIDL_FILE_PATH)
+ change_mode_cpp_output = os.path.join(android_top, CHANGE_MODE_CPP_FILE_PATH);
+ access_cpp_output = os.path.join(android_top, ACCESS_CPP_FILE_PATH);
+ change_mode_java_output = os.path.join(android_top, CHANGE_MODE_JAVA_FILE_PATH);
+ access_java_output = os.path.join(android_top, ACCESS_JAVA_FILE_PATH);
+
+ c = Converter("change_mode", RE_CHANGE_MODE);
+ c.convert(aidl_file, change_mode_cpp_output, CHANGE_MODE_CPP_HEADER, CHANGE_MODE_CPP_FOOTER, True)
+ c.convert(aidl_file, change_mode_java_output, CHANGE_MODE_JAVA_HEADER, CHANGE_MODE_JAVA_FOOTER, False)
+ c = Converter("access", RE_ACCESS)
+ c.convert(aidl_file, access_cpp_output, ACCESS_CPP_HEADER, ACCESS_CPP_FOOTER, True)
+ c.convert(aidl_file, access_java_output, ACCESS_JAVA_HEADER, ACCESS_JAVA_FOOTER, False)
+
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
diff --git a/automotive/vehicle/vts/Android.bp b/automotive/vehicle/vts/Android.bp
index b78e0ff..736787b 100644
--- a/automotive/vehicle/vts/Android.bp
+++ b/automotive/vehicle/vts/Android.bp
@@ -44,6 +44,8 @@
test_suites: [
"general-tests",
"vts",
+ "automotive-tests",
+ "automotive-general-tests",
],
require_root: true,
}
diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
index c431d85..5de206b 100644
--- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
+++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
@@ -48,6 +48,7 @@
using ::android::getAidlHalInstanceNames;
using ::android::base::ScopedLockAssertion;
using ::android::base::StringPrintf;
+using ::android::frameworks::automotive::vhal::ErrorCode;
using ::android::frameworks::automotive::vhal::HalPropError;
using ::android::frameworks::automotive::vhal::IHalPropConfig;
using ::android::frameworks::automotive::vhal::IHalPropValue;
@@ -287,7 +288,7 @@
auto setValueResult = mVhalClient->setValueSync(*getValueResult.value());
ASSERT_FALSE(setValueResult.ok()) << "Expect set a read-only value to fail";
- ASSERT_EQ(setValueResult.error().code(), StatusCode::ACCESS_DENIED);
+ ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL);
}
// Test subscribe() and unsubscribe().
diff --git a/biometrics/common/thread/Android.bp b/biometrics/common/thread/Android.bp
new file mode 100644
index 0000000..a497d01
--- /dev/null
+++ b/biometrics/common/thread/Android.bp
@@ -0,0 +1,26 @@
+cc_library {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ name: "android.hardware.biometrics.common.thread",
+ export_include_dirs: ["include"],
+ vendor: true,
+ srcs: [
+ "WorkerThread.cpp",
+ ],
+}
+
+cc_test_host {
+ name: "android.hardware.biometrics.common.WorkerThreadTest",
+ local_include_dirs: ["include"],
+ srcs: [
+ "tests/WorkerThreadTest.cpp",
+ "WorkerThread.cpp",
+ ],
+ shared_libs: [
+ "libcutils",
+ ],
+ test_suites: ["general-tests"],
+}
diff --git a/biometrics/fingerprint/aidl/default/WorkerThread.cpp b/biometrics/common/thread/WorkerThread.cpp
similarity index 89%
rename from biometrics/fingerprint/aidl/default/WorkerThread.cpp
rename to biometrics/common/thread/WorkerThread.cpp
index d1a63d0..61d1a13 100644
--- a/biometrics/fingerprint/aidl/default/WorkerThread.cpp
+++ b/biometrics/common/thread/WorkerThread.cpp
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#include "WorkerThread.h"
+#include "thread/WorkerThread.h"
-namespace aidl::android::hardware::biometrics::fingerprint {
+namespace aidl::android::hardware::biometrics {
// It's important that mThread is initialized after everything else because it runs a member
// function that may use any member of this class.
@@ -31,7 +31,10 @@
WorkerThread::~WorkerThread() {
// This is a signal for threadFunc to terminate as soon as possible, and a hint for schedule
// that it doesn't need to do any work.
- mIsDestructing = true;
+ {
+ std::unique_lock<std::mutex> lock(mQueueMutex);
+ mIsDestructing = true;
+ }
mQueueCond.notify_all();
mThread.join();
}
@@ -65,4 +68,4 @@
}
}
-} // namespace aidl::android::hardware::biometrics::fingerprint
+} // namespace aidl::android::hardware::biometrics
diff --git a/biometrics/fingerprint/aidl/default/include/Callable.h b/biometrics/common/thread/include/thread/Callable.h
similarity index 92%
rename from biometrics/fingerprint/aidl/default/include/Callable.h
rename to biometrics/common/thread/include/thread/Callable.h
index c629511..6eeff76 100644
--- a/biometrics/fingerprint/aidl/default/include/Callable.h
+++ b/biometrics/common/thread/include/thread/Callable.h
@@ -16,7 +16,7 @@
#pragma once
-namespace aidl::android::hardware::biometrics::fingerprint {
+namespace aidl::android::hardware::biometrics {
// Interface for representing parameterless functions. Unlike std::function<void()>, this can also
// represent move-only lambdas.
@@ -51,4 +51,4 @@
return std::make_unique<AnyFuncWrapper<T>>(std::move(func));
}
-} // namespace aidl::android::hardware::biometrics::fingerprint
\ No newline at end of file
+} // namespace aidl::android::hardware::biometrics
\ No newline at end of file
diff --git a/biometrics/fingerprint/aidl/default/include/WorkerThread.h b/biometrics/common/thread/include/thread/WorkerThread.h
similarity index 95%
rename from biometrics/fingerprint/aidl/default/include/WorkerThread.h
rename to biometrics/common/thread/include/thread/WorkerThread.h
index 6fff4f2..5f89a7f 100644
--- a/biometrics/fingerprint/aidl/default/include/WorkerThread.h
+++ b/biometrics/common/thread/include/thread/WorkerThread.h
@@ -23,7 +23,7 @@
#include "Callable.h"
-namespace aidl::android::hardware::biometrics::fingerprint {
+namespace aidl::android::hardware::biometrics {
// A class that encapsulates a worker thread and a task queue, and provides a convenient interface
// for a Session to schedule its tasks for asynchronous execution.
@@ -76,4 +76,4 @@
std::thread mThread;
};
-} // namespace aidl::android::hardware::biometrics::fingerprint
+} // namespace aidl::android::hardware::biometrics
diff --git a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp b/biometrics/common/thread/tests/WorkerThreadTest.cpp
similarity index 96%
rename from biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp
rename to biometrics/common/thread/tests/WorkerThreadTest.cpp
index 902fb40..5bb9e7e 100644
--- a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp
+++ b/biometrics/common/thread/tests/WorkerThreadTest.cpp
@@ -21,12 +21,11 @@
#include <gtest/gtest.h>
-#include "WorkerThread.h"
+#include "thread/WorkerThread.h"
namespace {
-using aidl::android::hardware::biometrics::fingerprint::Callable;
-using aidl::android::hardware::biometrics::fingerprint::WorkerThread;
+using namespace aidl::android::hardware::biometrics;
using namespace std::chrono_literals;
TEST(WorkerThreadTest, ScheduleReturnsTrueWhenQueueHasSpace) {
diff --git a/biometrics/common/util/Android.bp b/biometrics/common/util/Android.bp
new file mode 100644
index 0000000..918ef72
--- /dev/null
+++ b/biometrics/common/util/Android.bp
@@ -0,0 +1,18 @@
+cc_library {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ name: "android.hardware.biometrics.common.util",
+ export_include_dirs: ["include"],
+ vendor: true,
+ srcs: [
+ "CancellationSignal.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ "libbinder_ndk",
+ "android.hardware.biometrics.common-V2-ndk",
+ ],
+}
diff --git a/biometrics/fingerprint/aidl/default/CancellationSignal.cpp b/biometrics/common/util/CancellationSignal.cpp
similarity index 87%
rename from biometrics/fingerprint/aidl/default/CancellationSignal.cpp
rename to biometrics/common/util/CancellationSignal.cpp
index 6598316..7888838 100644
--- a/biometrics/fingerprint/aidl/default/CancellationSignal.cpp
+++ b/biometrics/common/util/CancellationSignal.cpp
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#include "CancellationSignal.h"
+#include "util/CancellationSignal.h"
#include <android-base/logging.h>
#include <chrono>
-namespace aidl::android::hardware::biometrics::fingerprint {
+namespace aidl::android::hardware::biometrics {
CancellationSignal::CancellationSignal(std::promise<void>&& cancellationPromise)
: mCancellationPromise(std::move(cancellationPromise)) {}
@@ -34,4 +34,4 @@
return f.wait_for(std::chrono::seconds(0)) == std::future_status::ready;
}
-} // namespace aidl::android::hardware::biometrics::fingerprint
+} // namespace aidl::android::hardware::biometrics
diff --git a/biometrics/fingerprint/aidl/default/include/CancellationSignal.h b/biometrics/common/util/include/util/CancellationSignal.h
similarity index 83%
rename from biometrics/fingerprint/aidl/default/include/CancellationSignal.h
rename to biometrics/common/util/include/util/CancellationSignal.h
index 99f2fba..be77e29 100644
--- a/biometrics/fingerprint/aidl/default/include/CancellationSignal.h
+++ b/biometrics/common/util/include/util/CancellationSignal.h
@@ -17,13 +17,10 @@
#pragma once
#include <aidl/android/hardware/biometrics/common/BnCancellationSignal.h>
-#include <aidl/android/hardware/biometrics/fingerprint/ISessionCallback.h>
#include <functional>
#include <future>
-#include "WorkerThread.h"
-
-namespace aidl::android::hardware::biometrics::fingerprint {
+namespace aidl::android::hardware::biometrics {
class CancellationSignal : public common::BnCancellationSignal {
public:
@@ -39,4 +36,4 @@
// to this future should be cancelled.
bool shouldCancel(const std::future<void>& cancellationFuture);
-} // namespace aidl::android::hardware::biometrics::fingerprint
+} // namespace aidl::android::hardware::biometrics
diff --git a/biometrics/common/util/include/util/Util.h b/biometrics/common/util/include/util/Util.h
new file mode 100644
index 0000000..29ec0f8
--- /dev/null
+++ b/biometrics/common/util/include/util/Util.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+
+#include <android-base/logging.h>
+
+#include <chrono>
+#include <regex>
+#include <thread>
+#include <vector>
+
+namespace aidl::android::hardware::biometrics {
+
+#define SLEEP_MS(x) \
+ if (x > 0) std::this_thread::sleep_for(std::chrono::milliseconds(x))
+#define BEGIN_OP(x) \
+ do { \
+ LOG(INFO) << __func__; \
+ SLEEP_MS(x); \
+ } while (0)
+#define IS_TRUE(x) ((x == "1") || (x == "true"))
+
+// This is for non-test situations, such as casual cuttlefish users, that don't
+// set an explicit value.
+// Some operations (i.e. enroll, authenticate) will be executed in tight loops
+// by parts of the UI or fail if there is no latency. For example, the
+// Face settings page constantly runs auth and the enrollment UI uses a
+// cancel/restart cycle that requires some latency while the activities change.
+#define DEFAULT_LATENCY 800
+
+class Util {
+ public:
+ static int64_t getSystemNanoTime() {
+ timespec now;
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ return now.tv_sec * 1000000000LL + now.tv_nsec;
+ }
+
+ static bool hasElapsed(int64_t start, int64_t durationMillis) {
+ auto now = getSystemNanoTime();
+ if (now < start) return true;
+ if (durationMillis <= 0) return true;
+ return ((now - start) / 1000000LL) > durationMillis;
+ }
+
+ static std::vector<std::string> split(const std::string& str, const std::string& sep) {
+ std::regex regex(sep);
+ std::vector<std::string> parts(
+ std::sregex_token_iterator(str.begin(), str.end(), regex, -1),
+ std::sregex_token_iterator());
+ return parts;
+ }
+};
+
+} // namespace aidl::android::hardware::biometrics
\ No newline at end of file
diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp
index 7f66eca..63a3645 100644
--- a/biometrics/face/aidl/default/Android.bp
+++ b/biometrics/face/aidl/default/Android.bp
@@ -18,10 +18,43 @@
"libbinder_ndk",
"android.hardware.biometrics.face-V2-ndk",
"android.hardware.biometrics.common-V2-ndk",
+ "android.hardware.biometrics.common.thread",
+ "android.hardware.biometrics.common.util",
],
srcs: [
"main.cpp",
"Face.cpp",
+ "FakeFaceEngine.cpp",
"Session.cpp",
],
+ static_libs: ["libandroid.hardware.biometrics.face.VirtualProps"],
+}
+
+sysprop_library {
+ name: "android.hardware.biometrics.face.VirtualProps",
+ srcs: ["face.sysprop"],
+ property_owner: "Vendor",
+ vendor: true,
+}
+
+cc_test {
+ name: "android.hardware.biometrics.face.FakeFaceEngineTest",
+ srcs: [
+ "tests/FakeFaceEngineTest.cpp",
+ "FakeFaceEngine.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ "libbinder_ndk",
+ ],
+ static_libs: [
+ "libandroid.hardware.biometrics.face.VirtualProps",
+ "android.hardware.biometrics.face-V2-ndk",
+ "android.hardware.biometrics.common-V2-ndk",
+ "android.hardware.keymaster-V3-ndk",
+ "android.hardware.biometrics.common.util",
+ ],
+ vendor: true,
+ test_suites: ["general-tests"],
+ require_root: true,
}
diff --git a/biometrics/face/aidl/default/Face.cpp b/biometrics/face/aidl/default/Face.cpp
index aca3e13..652a7e1 100644
--- a/biometrics/face/aidl/default/Face.cpp
+++ b/biometrics/face/aidl/default/Face.cpp
@@ -17,12 +17,14 @@
#include "Face.h"
#include "Session.h"
+#include "FakeFaceEngine.h"
+
namespace aidl::android::hardware::biometrics::face {
const int kSensorId = 4;
-const common::SensorStrength kSensorStrength = common::SensorStrength::STRONG;
+const common::SensorStrength kSensorStrength = FakeFaceEngine::GetSensorStrength();
const int kMaxEnrollmentsPerUser = 5;
-const FaceSensorType kSensorType = FaceSensorType::RGB;
+const FaceSensorType kSensorType = FakeFaceEngine::GetSensorType();
const bool kHalControlsPreview = true;
const std::string kHwComponentId = "faceSensor";
const std::string kHardwareVersion = "vendor/model/revision";
@@ -69,7 +71,7 @@
ndk::ScopedAStatus Face::createSession(int32_t /*sensorId*/, int32_t /*userId*/,
const std::shared_ptr<ISessionCallback>& cb,
std::shared_ptr<ISession>* return_val) {
- *return_val = SharedRefBase::make<Session>(cb);
+ *return_val = SharedRefBase::make<Session>(std::make_unique<FakeFaceEngine>(), cb);
return ndk::ScopedAStatus::ok();
}
diff --git a/biometrics/face/aidl/default/FakeFaceEngine.cpp b/biometrics/face/aidl/default/FakeFaceEngine.cpp
new file mode 100644
index 0000000..0f088f4
--- /dev/null
+++ b/biometrics/face/aidl/default/FakeFaceEngine.cpp
@@ -0,0 +1,318 @@
+#include "FakeFaceEngine.h"
+
+#include <android-base/logging.h>
+
+#include <face.sysprop.h>
+
+#include "util/CancellationSignal.h"
+#include "util/Util.h"
+
+using namespace ::android::face::virt;
+
+namespace aidl::android::hardware::biometrics::face {
+
+FaceSensorType FakeFaceEngine::GetSensorType() {
+ std::string type = FaceHalProperties::type().value_or("");
+ if (type == "IR") {
+ return FaceSensorType::IR;
+ } else {
+ FaceHalProperties::type("RGB");
+ return FaceSensorType::RGB;
+ }
+}
+
+common::SensorStrength FakeFaceEngine::GetSensorStrength() {
+ std::string strength = FaceHalProperties::strength().value_or("");
+ if (strength == "convenience") {
+ return common::SensorStrength::CONVENIENCE;
+ } else if (strength == "weak") {
+ return common::SensorStrength::WEAK;
+ } else {
+ FaceHalProperties::strength("strong");
+ return common::SensorStrength::STRONG;
+ }
+}
+
+void FakeFaceEngine::generateChallengeImpl(ISessionCallback* cb) {
+ BEGIN_OP(0);
+ std::uniform_int_distribution<int64_t> dist;
+ auto challenge = dist(mRandom);
+ FaceHalProperties::challenge(challenge);
+ cb->onChallengeGenerated(challenge);
+}
+
+void FakeFaceEngine::revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) {
+ BEGIN_OP(0);
+ FaceHalProperties::challenge({});
+ cb->onChallengeRevoked(challenge);
+}
+void FakeFaceEngine::getEnrollmentConfigImpl(ISessionCallback* /*cb*/,
+ std::vector<EnrollmentStageConfig>* /*return_val*/) {}
+void FakeFaceEngine::enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat,
+ EnrollmentType /*enrollmentType*/,
+ const std::vector<Feature>& /*features*/,
+ const std::future<void>& cancel) {
+ BEGIN_OP(FaceHalProperties::operation_start_enroll_latency().value_or(0));
+ // format is "<id>,<bucket_id>:<delay>:<succeeds>,<bucket_id>:<delay>:<succeeds>...
+ auto nextEnroll = FaceHalProperties::next_enrollment().value_or("");
+ // Erase the next enrollment
+ FaceHalProperties::next_enrollment({});
+
+ AuthenticationFrame frame;
+ frame.data.acquiredInfo = AcquiredInfo::START;
+ frame.data.vendorCode = 0;
+ cb->onAuthenticationFrame(frame);
+
+ // Do proper HAT verification in the real implementation.
+ if (hat.mac.empty()) {
+ LOG(ERROR) << "Fail: hat";
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
+ return;
+ }
+
+ if (FaceHalProperties::operation_enroll_fails().value_or(false)) {
+ LOG(ERROR) << "Fail: operation_enroll_fails";
+ cb->onError(Error::VENDOR, 0 /* vendorError */);
+ return;
+ }
+
+ auto parts = Util::split(nextEnroll, ",");
+ if (parts.size() < 2) {
+ LOG(ERROR) << "Fail: invalid next_enrollment for : " << nextEnroll;
+ cb->onError(Error::VENDOR, 0 /* vendorError */);
+ return;
+ }
+
+ auto enrollmentId = std::stoi(parts[0]);
+ const int numBuckets = parts.size() - 1;
+ for (size_t i = 1; i < parts.size(); i++) {
+ auto enrollHit = Util::split(parts[i], ":");
+ if (enrollHit.size() != 3) {
+ LOG(ERROR) << "Error when unpacking enrollment hit: " << parts[i];
+ cb->onError(Error::VENDOR, 0 /* vendorError */);
+ }
+ std::string bucket = enrollHit[0];
+ std::string delay = enrollHit[1];
+ std::string succeeds = enrollHit[2];
+
+ SLEEP_MS(std::stoi(delay));
+
+ if (shouldCancel(cancel)) {
+ LOG(ERROR) << "Fail: cancel";
+ cb->onError(Error::CANCELED, 0 /* vendorCode */);
+ return;
+ }
+
+ if (!IS_TRUE(succeeds)) { // end and failed
+ LOG(ERROR) << "Fail: requested by caller: " << parts[i];
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
+ return;
+ }
+
+ EnrollmentFrame frame;
+
+ frame.data.acquiredInfo = AcquiredInfo::GOOD;
+ frame.data.vendorCode = 0;
+ cb->onEnrollmentFrame(frame);
+
+ frame.data.acquiredInfo = AcquiredInfo::VENDOR;
+ frame.data.vendorCode = std::stoi(bucket);
+ cb->onEnrollmentFrame(frame);
+
+ int remainingBuckets = numBuckets - i;
+ if (remainingBuckets > 0) {
+ cb->onEnrollmentProgress(enrollmentId, remainingBuckets);
+ }
+ }
+
+ auto enrollments = FaceHalProperties::enrollments();
+ enrollments.push_back(enrollmentId);
+ FaceHalProperties::enrollments(enrollments);
+ LOG(INFO) << "enrolled : " << enrollmentId;
+ cb->onEnrollmentProgress(enrollmentId, 0);
+}
+
+void FakeFaceEngine::authenticateImpl(ISessionCallback* cb, int64_t /*operationId*/,
+ const std::future<void>& cancel) {
+ BEGIN_OP(FaceHalProperties::operation_authenticate_latency().value_or(0));
+
+ // Signal to the framework that we have begun authenticating.
+ AuthenticationFrame frame;
+ frame.data.acquiredInfo = AcquiredInfo::START;
+ frame.data.vendorCode = 0;
+ cb->onAuthenticationFrame(frame);
+
+ // Also signal that we have opened the camera.
+ frame = {};
+ frame.data.acquiredInfo = AcquiredInfo::FIRST_FRAME_RECEIVED;
+ frame.data.vendorCode = 0;
+ cb->onAuthenticationFrame(frame);
+
+ auto now = Util::getSystemNanoTime();
+ int64_t duration = FaceHalProperties::operation_authenticate_duration().value_or(0);
+ if (duration > 0) {
+ do {
+ SLEEP_MS(5);
+ } while (!Util::hasElapsed(now, duration));
+ }
+
+ if (FaceHalProperties::operation_authenticate_fails().value_or(false)) {
+ LOG(ERROR) << "Fail: operation_authenticate_fails";
+ cb->onError(Error::VENDOR, 0 /* vendorError */);
+ return;
+ }
+
+ if (FaceHalProperties::lockout().value_or(false)) {
+ LOG(ERROR) << "Fail: lockout";
+ cb->onLockoutPermanent();
+ cb->onError(Error::HW_UNAVAILABLE, 0 /* vendorError */);
+ return;
+ }
+
+ if (shouldCancel(cancel)) {
+ LOG(ERROR) << "Fail: cancel";
+ cb->onError(Error::CANCELED, 0 /* vendorCode */);
+ return;
+ }
+
+ auto id = FaceHalProperties::enrollment_hit().value_or(0);
+ auto enrolls = FaceHalProperties::enrollments();
+ auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end();
+ if (id < 0 || !isEnrolled) {
+ LOG(ERROR) << (isEnrolled ? "invalid enrollment hit" : "Fail: not enrolled");
+ cb->onAuthenticationFailed();
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
+ return;
+ }
+
+ cb->onAuthenticationSucceeded(id, {} /* hat */);
+}
+
+void FakeFaceEngine::detectInteractionImpl(ISessionCallback* cb, const std::future<void>& cancel) {
+ BEGIN_OP(FaceHalProperties::operation_detect_interaction_latency().value_or(0));
+
+ if (FaceHalProperties::operation_detect_interaction_fails().value_or(false)) {
+ LOG(ERROR) << "Fail: operation_detect_interaction_fails";
+ cb->onError(Error::VENDOR, 0 /* vendorError */);
+ return;
+ }
+
+ if (shouldCancel(cancel)) {
+ LOG(ERROR) << "Fail: cancel";
+ cb->onError(Error::CANCELED, 0 /* vendorCode */);
+ return;
+ }
+
+ auto id = FaceHalProperties::enrollment_hit().value_or(0);
+ auto enrolls = FaceHalProperties::enrollments();
+ auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end();
+ if (id <= 0 || !isEnrolled) {
+ LOG(ERROR) << "Fail: not enrolled";
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
+ return;
+ }
+
+ cb->onInteractionDetected();
+}
+
+void FakeFaceEngine::enumerateEnrollmentsImpl(ISessionCallback* cb) {
+ BEGIN_OP(0);
+ std::vector<int32_t> enrollments;
+ for (const auto& enrollmentId : FaceHalProperties::enrollments()) {
+ if (enrollmentId) {
+ enrollments.push_back(*enrollmentId);
+ }
+ }
+ cb->onEnrollmentsEnumerated(enrollments);
+}
+
+void FakeFaceEngine::removeEnrollmentsImpl(ISessionCallback* cb,
+ const std::vector<int32_t>& enrollmentIds) {
+ BEGIN_OP(0);
+
+ std::vector<std::optional<int32_t>> newEnrollments;
+ for (const auto& enrollment : FaceHalProperties::enrollments()) {
+ auto id = enrollment.value_or(0);
+ if (std::find(enrollmentIds.begin(), enrollmentIds.end(), id) == enrollmentIds.end()) {
+ newEnrollments.emplace_back(id);
+ }
+ }
+ FaceHalProperties::enrollments(newEnrollments);
+ cb->onEnrollmentsRemoved(enrollmentIds);
+}
+
+void FakeFaceEngine::getFeaturesImpl(ISessionCallback* cb) {
+ BEGIN_OP(0);
+
+ if (FaceHalProperties::enrollments().empty()) {
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
+ return;
+ }
+
+ std::vector<Feature> featuresToReturn = {};
+ for (const auto& feature : FaceHalProperties::features()) {
+ if (feature) {
+ featuresToReturn.push_back((Feature)(*feature));
+ }
+ }
+ cb->onFeaturesRetrieved(featuresToReturn);
+}
+
+void FakeFaceEngine::setFeatureImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat,
+ Feature feature, bool enabled) {
+ BEGIN_OP(0);
+
+ if (FaceHalProperties::enrollments().empty()) {
+ LOG(ERROR) << "Unable to set feature, enrollments are empty";
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
+ return;
+ }
+
+ if (hat.mac.empty()) {
+ LOG(ERROR) << "Unable to set feature, invalid hat";
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
+ return;
+ }
+
+ auto features = FaceHalProperties::features();
+
+ auto itr = std::find_if(features.begin(), features.end(), [feature](const auto& theFeature) {
+ return *theFeature == (int)feature;
+ });
+
+ if (!enabled && (itr != features.end())) {
+ features.erase(itr);
+ } else if (enabled && (itr == features.end())) {
+ features.push_back((int)feature);
+ }
+
+ FaceHalProperties::features(features);
+ cb->onFeatureSet(feature);
+}
+
+void FakeFaceEngine::getAuthenticatorIdImpl(ISessionCallback* cb) {
+ BEGIN_OP(0);
+ // If this is a weak HAL return 0 per the spec.
+ if (GetSensorStrength() != common::SensorStrength::STRONG) {
+ cb->onAuthenticatorIdRetrieved(0);
+ } else {
+ cb->onAuthenticatorIdRetrieved(FaceHalProperties::authenticator_id().value_or(0));
+ }
+}
+
+void FakeFaceEngine::invalidateAuthenticatorIdImpl(ISessionCallback* cb) {
+ BEGIN_OP(0);
+ int64_t authenticatorId = FaceHalProperties::authenticator_id().value_or(0);
+ int64_t newId = authenticatorId + 1;
+ FaceHalProperties::authenticator_id(newId);
+ cb->onAuthenticatorIdInvalidated(newId);
+}
+
+void FakeFaceEngine::resetLockoutImpl(ISessionCallback* cb,
+ const keymaster::HardwareAuthToken& /*hat*/) {
+ BEGIN_OP(0);
+ FaceHalProperties::lockout(false);
+ cb->onLockoutCleared();
+}
+
+} // namespace aidl::android::hardware::biometrics::face
\ No newline at end of file
diff --git a/biometrics/face/aidl/default/FakeFaceEngine.h b/biometrics/face/aidl/default/FakeFaceEngine.h
new file mode 100644
index 0000000..edb54ce
--- /dev/null
+++ b/biometrics/face/aidl/default/FakeFaceEngine.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/biometrics/common/SensorStrength.h>
+#include <aidl/android/hardware/biometrics/face/BnSession.h>
+#include <aidl/android/hardware/biometrics/face/FaceSensorType.h>
+#include <aidl/android/hardware/biometrics/face/ISessionCallback.h>
+
+#include <random>
+
+#include <future>
+#include <vector>
+
+namespace aidl::android::hardware::biometrics::face {
+
+namespace face = aidl::android::hardware::biometrics::face;
+namespace common = aidl::android::hardware::biometrics::common;
+namespace keymaster = aidl::android::hardware::keymaster;
+
+using aidl::android::hardware::common::NativeHandle;
+// A fake engine that is backed by system properties instead of hardware.
+class FakeFaceEngine {
+ public:
+ FakeFaceEngine() : mRandom(std::mt19937::default_seed) {}
+
+ static face::FaceSensorType GetSensorType();
+ static common::SensorStrength GetSensorStrength();
+ void generateChallengeImpl(ISessionCallback* cb);
+ void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge);
+ void getEnrollmentConfigImpl(ISessionCallback* cb,
+ std::vector<EnrollmentStageConfig>* return_val);
+ void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat,
+ EnrollmentType enrollmentType, const std::vector<Feature>& features,
+ const std::future<void>& cancel);
+ void authenticateImpl(ISessionCallback* cb, int64_t operationId,
+ const std::future<void>& cancel);
+ void detectInteractionImpl(ISessionCallback* cb, const std::future<void>& cancel);
+ void enumerateEnrollmentsImpl(ISessionCallback* cb);
+ void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector<int32_t>& enrollmentIds);
+ void getFeaturesImpl(ISessionCallback* cb);
+ void setFeatureImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat,
+ Feature feature, bool enabled);
+ void getAuthenticatorIdImpl(ISessionCallback* cb);
+ void invalidateAuthenticatorIdImpl(ISessionCallback* cb);
+ void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/);
+
+ std::mt19937 mRandom;
+};
+
+} // namespace aidl::android::hardware::biometrics::face
\ No newline at end of file
diff --git a/biometrics/face/aidl/default/README.md b/biometrics/face/aidl/default/README.md
new file mode 100644
index 0000000..1655973
--- /dev/null
+++ b/biometrics/face/aidl/default/README.md
@@ -0,0 +1,77 @@
+# Virtual Face HAL
+
+This is a virtual HAL implementation that is backed by system properties
+instead of actual hardware. It's intended for testing and UI development
+on debuggable builds to allow devices to masquerade as alternative device
+types and for emulators.
+
+## Device Selection
+
+You can either run the FakeFaceEngine on a [real device](#actual-device) or a [virtual device/cuttlefish](#getting-started-on-a-virtual-device-cuttlefish). This document should
+help you to get started on either one.
+
+After setting up a device, go ahead and try out [enrolling](#enrolling) & [authenticating](#authenticating)
+
+### Getting started on a Virtual Device (cuttlefish)
+
+
+Note, I'm running this via a cloudtop virtual device.
+
+1. Setup cuttlefish on cloudtop, See [this](https://g3doc.corp.google.com/company/teams/android/teampages/acloud/getting_started.md?cl=head) for more details.
+2. acloud create --local-image
+3. Enter in the shell command to disable hidl
+
+```shell
+$ adb root
+$ adb shell settings put secure com.android.server.biometrics.AuthService.hidlDisabled 1
+$ adb reboot
+```
+4. You should now be able to do fake enrollments and authentications (as seen down below)
+
+### Actual Device
+
+1. Modify your real devices make file (I.E. vendor/google/products/{YOUR_DEVICE}.mk)
+2. Ensure that there is no other face HAL that is being included by the device
+3. Add the following
+```
+PRODUCT_COPY_FILES += \
+ frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/android.hardware.biometrics.face.xml
+
+PRODUCT_PACKAGES += \
+ android.hardware.biometrics.face-service.example \
+
+```
+4. Now build and flash m -j120 && flash
+5. Run the following commands
+
+```shell
+# This is a temporary workaround
+$ adb root
+$ adb shell setprop persist.vendor.face.virtual.type RGB
+$ adb shell setprop persist.vendor.face.virtual.strength strong
+$ adb shell locksettings set-pin 0000
+$ adb reboot
+```
+
+## Enrolling
+
+```shell
+# authenticar_id,bucket_id:duration:(true|false)....
+$ adb shell setprop vendor.face.virtual.next_enrollment 1,0:500:true,5:250:true,10:150:true,15:500:true
+$ adb shell am start -n com.android.settings/.biometrics.face.FaceEnrollIntroduction
+# If you would like to get rid of the enrollment, run the follwoing command
+$ adb shell setprop persist.vendor.face.virtual.enrollments \"\"
+```
+
+## Authenticating
+
+```shell
+# If enrollment hasn't been setup
+$ adb shell setprop persist.vendor.face.virtual.enrollments 1
+$ adb shell cmd face sync
+# After enrollment has been setup
+$ adb shell setprop vendor.face.virtual.operation_authenticate_duration 800
+$ adb shell setprop vendor.face.virtual.enrollment_hit 1
+# Power button press to simulate auth
+$ adb shell input keyevent 26
+```
diff --git a/biometrics/face/aidl/default/Session.cpp b/biometrics/face/aidl/default/Session.cpp
index 984a1a9..1188459 100644
--- a/biometrics/face/aidl/default/Session.cpp
+++ b/biometrics/face/aidl/default/Session.cpp
@@ -14,139 +14,135 @@
* limitations under the License.
*/
-#include <aidl/android/hardware/biometrics/common/BnCancellationSignal.h>
#include <android-base/logging.h>
#include "Session.h"
namespace aidl::android::hardware::biometrics::face {
-class CancellationSignal : public common::BnCancellationSignal {
- private:
- std::shared_ptr<ISessionCallback> cb_;
+constexpr size_t MAX_WORKER_QUEUE_SIZE = 5;
- public:
- explicit CancellationSignal(std::shared_ptr<ISessionCallback> cb) : cb_(std::move(cb)) {}
-
- ndk::ScopedAStatus cancel() override {
- cb_->onError(Error::CANCELED, 0 /* vendorCode */);
- return ndk::ScopedAStatus::ok();
- }
-};
-
-Session::Session(std::shared_ptr<ISessionCallback> cb)
- : cb_(std::move(cb)), mRandom(std::mt19937::default_seed) {}
+Session::Session(std::unique_ptr<FakeFaceEngine> engine, std::shared_ptr<ISessionCallback> cb)
+ : mEngine(std::move(engine)), mCb(std::move(cb)), mRandom(std::mt19937::default_seed) {
+ mThread = std::make_unique<WorkerThread>(MAX_WORKER_QUEUE_SIZE);
+}
ndk::ScopedAStatus Session::generateChallenge() {
LOG(INFO) << "generateChallenge";
- if (cb_) {
- std::uniform_int_distribution<int64_t> dist;
- auto challenge = dist(mRandom);
- cb_->onChallengeGenerated(challenge);
- }
+ mThread->schedule(Callable::from([this] { mEngine->generateChallengeImpl(mCb.get()); }));
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::revokeChallenge(int64_t challenge) {
LOG(INFO) << "revokeChallenge";
- if (cb_) {
- cb_->onChallengeRevoked(challenge);
- }
+ mThread->schedule(Callable::from(
+ [this, challenge] { mEngine->revokeChallengeImpl(mCb.get(), challenge); }));
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus Session::getEnrollmentConfig(EnrollmentType /*enrollmentType*/,
- std::vector<EnrollmentStageConfig>* return_val) {
- *return_val = {};
+ndk::ScopedAStatus Session::getEnrollmentConfig(
+ EnrollmentType /*enrollmentType*/, std::vector<EnrollmentStageConfig>* cancellationSignal) {
+ *cancellationSignal = {};
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::enroll(
- const keymaster::HardwareAuthToken& /*hat*/, EnrollmentType /*enrollmentType*/,
- const std::vector<Feature>& /*features*/,
- const std::optional<NativeHandle>& /*previewSurface*/,
- std::shared_ptr<biometrics::common::ICancellationSignal>* /*return_val*/) {
+ const keymaster::HardwareAuthToken& hat, EnrollmentType enrollmentType,
+ const std::vector<Feature>& features, const std::optional<NativeHandle>& /*previewSurface*/,
+ std::shared_ptr<biometrics::common::ICancellationSignal>* cancellationSignal) {
LOG(INFO) << "enroll";
- if (cb_) {
- cb_->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
- }
+ std::promise<void> cancellationPromise;
+ auto cancFuture = cancellationPromise.get_future();
+
+ mThread->schedule(Callable::from(
+ [this, hat, enrollmentType, features, cancFuture = std::move(cancFuture)] {
+ mEngine->enrollImpl(mCb.get(), hat, enrollmentType, features, cancFuture);
+ }));
+
+ *cancellationSignal = SharedRefBase::make<CancellationSignal>(std::move(cancellationPromise));
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus Session::authenticate(int64_t /*keystoreOperationId*/,
- std::shared_ptr<common::ICancellationSignal>* return_val) {
+ndk::ScopedAStatus Session::authenticate(
+ int64_t keystoreOperationId,
+ std::shared_ptr<common::ICancellationSignal>* cancellationSignal) {
LOG(INFO) << "authenticate";
- if (cb_) {
- cb_->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
- }
- *return_val = SharedRefBase::make<CancellationSignal>(cb_);
+ std::promise<void> cancellationPromise;
+ auto cancFuture = cancellationPromise.get_future();
+
+ mThread->schedule(
+ Callable::from([this, keystoreOperationId, cancFuture = std::move(cancFuture)] {
+ mEngine->authenticateImpl(mCb.get(), keystoreOperationId, cancFuture);
+ }));
+
+ *cancellationSignal = SharedRefBase::make<CancellationSignal>(std::move(cancellationPromise));
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::detectInteraction(
- std::shared_ptr<common::ICancellationSignal>* /*return_val*/) {
+ std::shared_ptr<common::ICancellationSignal>* cancellationSignal) {
LOG(INFO) << "detectInteraction";
+ std::promise<void> cancellationPromise;
+ auto cancFuture = cancellationPromise.get_future();
+
+ mThread->schedule(Callable::from([this, cancFuture = std::move(cancFuture)] {
+ mEngine->detectInteractionImpl(mCb.get(), cancFuture);
+ }));
+
+ *cancellationSignal = SharedRefBase::make<CancellationSignal>(std::move(cancellationPromise));
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::enumerateEnrollments() {
LOG(INFO) << "enumerateEnrollments";
- if (cb_) {
- cb_->onEnrollmentsEnumerated(std::vector<int32_t>());
- }
+ mThread->schedule(Callable::from([this] { mEngine->enumerateEnrollmentsImpl(mCb.get()); }));
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& /*enrollmentIds*/) {
+ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& enrollmentIds) {
LOG(INFO) << "removeEnrollments";
- if (cb_) {
- cb_->onEnrollmentsRemoved(std::vector<int32_t>());
- }
+ mThread->schedule(Callable::from(
+ [this, enrollmentIds] { mEngine->removeEnrollmentsImpl(mCb.get(), enrollmentIds); }));
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::getFeatures() {
LOG(INFO) << "getFeatures";
- if (cb_) {
- // Must error out with UNABLE_TO_PROCESS when no faces are enrolled.
- cb_->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
- }
+ mThread->schedule(Callable::from([this] { mEngine->getFeaturesImpl(mCb.get()); }));
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus Session::setFeature(const keymaster::HardwareAuthToken& /*hat*/,
- Feature /*feature*/, bool /*enabled*/) {
+ndk::ScopedAStatus Session::setFeature(const keymaster::HardwareAuthToken& hat, Feature feature,
+ bool enabled) {
LOG(INFO) << "setFeature";
+ mThread->schedule(Callable::from([this, hat, feature, enabled] {
+ mEngine->setFeatureImpl(mCb.get(), hat, feature, enabled);
+ }));
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::getAuthenticatorId() {
LOG(INFO) << "getAuthenticatorId";
- if (cb_) {
- cb_->onAuthenticatorIdRetrieved(0 /* authenticatorId */);
- }
+ mThread->schedule(Callable::from([this] { mEngine->getAuthenticatorIdImpl(mCb.get()); }));
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::invalidateAuthenticatorId() {
LOG(INFO) << "invalidateAuthenticatorId";
- if (cb_) {
- cb_->onAuthenticatorIdInvalidated(0);
- }
+ mThread->schedule(
+ Callable::from([this] { mEngine->invalidateAuthenticatorIdImpl(mCb.get()); }));
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus Session::resetLockout(const keymaster::HardwareAuthToken& /*hat*/) {
+ndk::ScopedAStatus Session::resetLockout(const keymaster::HardwareAuthToken& hat) {
LOG(INFO) << "resetLockout";
- if (cb_) {
- cb_->onLockoutCleared();
- }
+ mThread->schedule(Callable::from([this, hat] { mEngine->resetLockoutImpl(mCb.get(), hat); }));
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::close() {
- if (cb_) {
- cb_->onSessionClosed();
+ if (mCb) {
+ mCb->onSessionClosed();
}
return ndk::ScopedAStatus::ok();
}
diff --git a/biometrics/face/aidl/default/Session.h b/biometrics/face/aidl/default/Session.h
index 9db17d2..7ca6a1f 100644
--- a/biometrics/face/aidl/default/Session.h
+++ b/biometrics/face/aidl/default/Session.h
@@ -21,6 +21,10 @@
#include <aidl/android/hardware/biometrics/face/BnSession.h>
#include <aidl/android/hardware/biometrics/face/ISessionCallback.h>
+#include "FakeFaceEngine.h"
+#include "thread/WorkerThread.h"
+#include "util/CancellationSignal.h"
+
namespace aidl::android::hardware::biometrics::face {
namespace common = aidl::android::hardware::biometrics::common;
@@ -30,7 +34,7 @@
class Session : public BnSession {
public:
- explicit Session(std::shared_ptr<ISessionCallback> cb);
+ explicit Session(std::unique_ptr<FakeFaceEngine> engine, std::shared_ptr<ISessionCallback> cb);
ndk::ScopedAStatus generateChallenge() override;
@@ -85,8 +89,11 @@
ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override;
private:
- std::shared_ptr<ISessionCallback> cb_;
+ std::unique_ptr<FakeFaceEngine> mEngine;
+ std::shared_ptr<ISessionCallback> mCb;
std::mt19937 mRandom;
+ std::unique_ptr<WorkerThread> mThread;
+ std::shared_ptr<CancellationSignal> mCancellationSignal;
};
} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt b/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt
new file mode 100644
index 0000000..9548920
--- /dev/null
+++ b/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt
@@ -0,0 +1,98 @@
+props {
+ owner: Vendor
+ module: "android.face.virt.FaceHalProperties"
+ prop {
+ api_name: "authenticator_id"
+ type: Long
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.authenticator_id"
+ }
+ prop {
+ api_name: "challenge"
+ type: Long
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.challenge"
+ }
+ prop {
+ api_name: "enrollment_hit"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.enrollment_hit"
+ }
+ prop {
+ api_name: "enrollments"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.enrollments"
+ }
+ prop {
+ api_name: "features"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.features"
+ }
+ prop {
+ api_name: "lockout"
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.lockout"
+ }
+ prop {
+ api_name: "next_enrollment"
+ type: String
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.next_enrollment"
+ }
+ prop {
+ api_name: "operation_authenticate_duration"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_authenticate_duration"
+ }
+ prop {
+ api_name: "operation_authenticate_fails"
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_authenticate_fails"
+ }
+ prop {
+ api_name: "operation_authenticate_latency"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_authenticate_latency"
+ }
+ prop {
+ api_name: "operation_detect_interaction_fails"
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_detect_interaction_fails"
+ }
+ prop {
+ api_name: "operation_detect_interaction_latency"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_detect_interaction_latency"
+ }
+ prop {
+ api_name: "operation_enroll_fails"
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_enroll_fails"
+ }
+ prop {
+ api_name: "operation_start_enroll_latency"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_start_enroll_latency"
+ }
+ prop {
+ api_name: "strength"
+ type: String
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.strength"
+ enum_values: "convenience|weak|strong"
+ }
+ prop {
+ api_name: "type"
+ type: String
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.type"
+ enum_values: "IR|RGB"
+ }
+}
diff --git a/biometrics/face/aidl/default/face.sysprop b/biometrics/face/aidl/default/face.sysprop
new file mode 100644
index 0000000..6b0f37f
--- /dev/null
+++ b/biometrics/face/aidl/default/face.sysprop
@@ -0,0 +1,159 @@
+# face.sysprop
+# module becomes static class (Java) / namespace (C++) for serving API
+module: "android.face.virt.FaceHalProperties"
+owner: Vendor
+
+# type of face sensor
+prop {
+ prop_name: "persist.vendor.face.virtual.type"
+ type: String
+ scope: Public
+ access: ReadWrite
+ enum_values: "IR|RGB"
+ api_name: "type"
+}
+
+# the strength of the sensor
+prop {
+ prop_name: "persist.vendor.face.virtual.strength"
+ type: String
+ scope: Public
+ access: ReadWrite
+ enum_values: "convenience|weak|strong"
+ api_name: "strength"
+}
+
+# ids of current enrollments
+prop {
+ prop_name: "persist.vendor.face.virtual.enrollments"
+ type: IntegerList
+ scope: Public
+ access: ReadWrite
+ api_name: "enrollments"
+}
+
+# List of features
+prop {
+ prop_name: "persist.vendor.face.virtual.features"
+ type: IntegerList
+ scope: Public
+ access: ReadWrite
+ api_name: "features"
+}
+
+# authenticate and detectInteraction will succeed with this
+# enrollment id, when present, otherwise they will error
+prop {
+ prop_name: "vendor.face.virtual.enrollment_hit"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "enrollment_hit"
+}
+
+# The initial latency for enrollment
+prop {
+ prop_name: "vendor.face.virtual.operation_start_enroll_latency"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_start_enroll_latency"
+}
+
+# the next enrollment in the format:
+# "<id>,<bucket_id>:<delay>:<succeeds>,<bucket_id>..."
+# for example: "0:1,0:100:1,1:200:1" indicating that bucket 0 took
+# 50 milliseconds, bucket 1 took 100 milliseconds, bucket 2 took 200 milliseconds.
+# Note that it is up to the configuration to determine how many buckets are required
+# to complete an enrollment
+prop {
+ prop_name: "vendor.face.virtual.next_enrollment"
+ type: String
+ scope: Public
+ access: ReadWrite
+ api_name: "next_enrollment"
+}
+
+# value for getAuthenticatorId or 0
+prop {
+ prop_name: "vendor.face.virtual.authenticator_id"
+ type: Long
+ scope: Public
+ access: ReadWrite
+ api_name: "authenticator_id"
+}
+
+# value for generateChallenge
+prop {
+ prop_name: "vendor.face.virtual.challenge"
+ type: Long
+ scope: Public
+ access: ReadWrite
+ api_name: "challenge"
+}
+
+# if locked out
+prop {
+ prop_name: "vendor.face.virtual.lockout"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "lockout"
+}
+
+# force all authenticate operations to fail
+prop {
+ prop_name: "vendor.face.virtual.operation_authenticate_fails"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_authenticate_fails"
+}
+
+# force all detectInteraction operations to fail
+prop {
+ prop_name: "vendor.face.virtual.operation_detect_interaction_fails"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_detect_interaction_fails"
+}
+
+# force all enroll operations to fail
+prop {
+ prop_name: "vendor.face.virtual.operation_enroll_fails"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_enroll_fails"
+}
+
+# add a latency to authentication operations
+# Note that this latency is the initial authentication latency that occurs before
+# the HAL will send AcquiredInfo::START and AcquiredInfo::FIRST_FRAME_RECEIVED
+prop {
+ prop_name: "vendor.face.virtual.operation_authenticate_latency"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_authenticate_latency"
+}
+
+# add a latency to detectInteraction operations
+prop {
+ prop_name: "vendor.face.virtual.operation_detect_interaction_latency"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_detect_interaction_latency"
+}
+
+# millisecond duration for authenticate operations
+# (waits for changes to enrollment_hit)
+prop {
+ prop_name: "vendor.face.virtual.operation_authenticate_duration"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_authenticate_duration"
+}
diff --git a/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp b/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp
new file mode 100644
index 0000000..c8ad6b7
--- /dev/null
+++ b/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp
@@ -0,0 +1,383 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include <android/binder_process.h>
+#include <face.sysprop.h>
+#include <gtest/gtest.h>
+
+#include <aidl/android/hardware/biometrics/face/BnSessionCallback.h>
+#include <android-base/logging.h>
+
+#include "FakeFaceEngine.h"
+
+using namespace ::android::face::virt;
+using namespace ::aidl::android::hardware::biometrics::face;
+using namespace ::aidl::android::hardware::keymaster;
+
+namespace aidl::android::hardware::biometrics::face {
+
+class TestSessionCallback : public BnSessionCallback {
+ public:
+ ndk::ScopedAStatus onChallengeGenerated(int64_t challenge) override {
+ mLastChallenge = challenge;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onChallengeRevoked(int64_t challenge) override {
+ mLastChallengeRevoked = challenge;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onError(Error error, int32_t) override {
+ mError = error;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onEnrollmentProgress(int32_t enrollmentId, int32_t remaining) override {
+ if (remaining == 0) mLastEnrolled = enrollmentId;
+ return ndk::ScopedAStatus::ok();
+ };
+
+ ::ndk::ScopedAStatus onAuthenticationSucceeded(int32_t enrollmentId,
+ const HardwareAuthToken&) override {
+ mLastAuthenticated = enrollmentId;
+ mAuthenticateFailed = false;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticationFailed() override {
+ mLastAuthenticated = 0;
+ mAuthenticateFailed = true;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onInteractionDetected() override {
+ mInteractionDetectedCount++;
+ return ndk::ScopedAStatus::ok();
+ };
+
+ ::ndk::ScopedAStatus onEnrollmentFrame(const EnrollmentFrame& frame) override {
+ mEnrollmentFrames.push_back(frame.data.vendorCode);
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ::ndk::ScopedAStatus onEnrollmentsEnumerated(
+ const std::vector<int32_t>& enrollmentIds) override {
+ mLastEnrollmentsEnumerated = enrollmentIds;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onEnrollmentsRemoved(const std::vector<int32_t>& enrollmentIds) override {
+ mLastEnrollmentRemoved = enrollmentIds;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticatorIdRetrieved(int64_t authenticatorId) override {
+ mLastAuthenticatorId = authenticatorId;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticatorIdInvalidated(int64_t authenticatorId) override {
+ mLastAuthenticatorId = authenticatorId;
+ mAuthenticatorIdInvalidated = true;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticationFrame(const AuthenticationFrame& /*authFrame*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+ ::ndk::ScopedAStatus onLockoutPermanent() override {
+ mLockoutPermanent = true;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onLockoutTimed(int64_t /* timeout */) override {
+ return ndk::ScopedAStatus::ok();
+ }
+ ::ndk::ScopedAStatus onLockoutCleared() override {
+ mLockoutPermanent = false;
+ return ndk::ScopedAStatus::ok();
+ }
+ ::ndk::ScopedAStatus onSessionClosed() override { return ndk::ScopedAStatus::ok(); }
+
+ ::ndk::ScopedAStatus onFeaturesRetrieved(const std::vector<Feature>& features) override {
+ mFeatures = features;
+ return ndk::ScopedAStatus::ok();
+ }
+
+ ::ndk::ScopedAStatus onFeatureSet(Feature feature) override {
+ mLastFeatureSet = feature;
+ return ndk::ScopedAStatus::ok();
+ }
+
+ Error mError = Error::UNKNOWN;
+ int64_t mLastChallenge = -1;
+ int64_t mLastChallengeRevoked = -1;
+ int32_t mLastEnrolled = -1;
+ int32_t mLastAuthenticated = -1;
+ int64_t mLastAuthenticatorId = -1;
+ std::vector<int32_t> mLastEnrollmentsEnumerated;
+ std::vector<int32_t> mLastEnrollmentRemoved;
+ std::vector<Feature> mFeatures;
+ Feature mLastFeatureSet;
+ std::vector<int32_t> mEnrollmentFrames;
+ bool mAuthenticateFailed = false;
+ bool mAuthenticatorIdInvalidated = false;
+ bool mLockoutPermanent = false;
+ int mInteractionDetectedCount = 0;
+};
+
+class FakeFaceEngineTest : public ::testing::Test {
+ protected:
+ void SetUp() override {
+ LOG(ERROR) << "JRM SETUP";
+ mCallback = ndk::SharedRefBase::make<TestSessionCallback>();
+ FaceHalProperties::enrollments({});
+ FaceHalProperties::challenge({});
+ FaceHalProperties::features({});
+ FaceHalProperties::authenticator_id({});
+ FaceHalProperties::strength("");
+ }
+
+ FakeFaceEngine mEngine;
+ std::shared_ptr<TestSessionCallback> mCallback;
+ std::promise<void> mCancel;
+};
+
+TEST_F(FakeFaceEngineTest, one_eq_one) {
+ ASSERT_EQ(1, 1);
+}
+
+TEST_F(FakeFaceEngineTest, GenerateChallenge) {
+ mEngine.generateChallengeImpl(mCallback.get());
+ ASSERT_EQ(FaceHalProperties::challenge().value(), mCallback->mLastChallenge);
+}
+
+TEST_F(FakeFaceEngineTest, RevokeChallenge) {
+ auto challenge = FaceHalProperties::challenge().value_or(10);
+ mEngine.revokeChallengeImpl(mCallback.get(), challenge);
+ ASSERT_FALSE(FaceHalProperties::challenge().has_value());
+ ASSERT_EQ(challenge, mCallback->mLastChallengeRevoked);
+}
+
+TEST_F(FakeFaceEngineTest, ResetLockout) {
+ FaceHalProperties::lockout(true);
+ mEngine.resetLockoutImpl(mCallback.get(), {});
+ ASSERT_FALSE(mCallback->mLockoutPermanent);
+ ASSERT_FALSE(FaceHalProperties::lockout().value_or(true));
+}
+
+TEST_F(FakeFaceEngineTest, AuthenticatorId) {
+ FaceHalProperties::authenticator_id(50);
+ mEngine.getAuthenticatorIdImpl(mCallback.get());
+ ASSERT_EQ(50, mCallback->mLastAuthenticatorId);
+ ASSERT_FALSE(mCallback->mAuthenticatorIdInvalidated);
+}
+
+TEST_F(FakeFaceEngineTest, GetAuthenticatorIdWeakReturnsZero) {
+ FaceHalProperties::strength("weak");
+ FaceHalProperties::authenticator_id(500);
+ mEngine.getAuthenticatorIdImpl(mCallback.get());
+ ASSERT_EQ(0, mCallback->mLastAuthenticatorId);
+ ASSERT_FALSE(mCallback->mAuthenticatorIdInvalidated);
+}
+
+TEST_F(FakeFaceEngineTest, AuthenticatorIdInvalidate) {
+ FaceHalProperties::authenticator_id(500);
+ mEngine.invalidateAuthenticatorIdImpl(mCallback.get());
+ ASSERT_NE(500, FaceHalProperties::authenticator_id().value());
+ ASSERT_TRUE(mCallback->mAuthenticatorIdInvalidated);
+}
+
+TEST_F(FakeFaceEngineTest, Enroll) {
+ FaceHalProperties::next_enrollment("1,0:30:true,1:0:true,2:0:true,3:0:true,4:0:true");
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/,
+ mCancel.get_future());
+ ASSERT_FALSE(FaceHalProperties::next_enrollment().has_value());
+ ASSERT_EQ(1, FaceHalProperties::enrollments().size());
+ ASSERT_EQ(1, FaceHalProperties::enrollments()[0].value());
+ ASSERT_EQ(1, mCallback->mLastEnrolled);
+}
+
+TEST_F(FakeFaceEngineTest, EnrollFails) {
+ FaceHalProperties::next_enrollment("1,0:30:true,1:0:true,2:0:true,3:0:true,4:0:false");
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/,
+ mCancel.get_future());
+ ASSERT_FALSE(FaceHalProperties::next_enrollment().has_value());
+ ASSERT_EQ(0, FaceHalProperties::enrollments().size());
+}
+
+TEST_F(FakeFaceEngineTest, EnrollCancel) {
+ FaceHalProperties::next_enrollment("1,0:30:true,1:0:true,2:0:true,3:0:true,4:0:false");
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mCancel.set_value();
+ mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/,
+ mCancel.get_future());
+ ASSERT_EQ(Error::CANCELED, mCallback->mError);
+ ASSERT_EQ(-1, mCallback->mLastEnrolled);
+ ASSERT_EQ(0, FaceHalProperties::enrollments().size());
+ ASSERT_FALSE(FaceHalProperties::next_enrollment().has_value());
+}
+
+TEST_F(FakeFaceEngineTest, Authenticate) {
+ FaceHalProperties::enrollments({100});
+ FaceHalProperties::enrollment_hit(100);
+ mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future());
+
+ ASSERT_EQ(100, mCallback->mLastAuthenticated);
+ ASSERT_FALSE(mCallback->mAuthenticateFailed);
+}
+
+TEST_F(FakeFaceEngineTest, AuthenticateCancel) {
+ FaceHalProperties::enrollments({100});
+ FaceHalProperties::enrollment_hit(100);
+ mCancel.set_value();
+ mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future());
+ ASSERT_EQ(Error::CANCELED, mCallback->mError);
+}
+
+TEST_F(FakeFaceEngineTest, AuthenticateFailedForUnEnrolled) {
+ FaceHalProperties::enrollments({3});
+ FaceHalProperties::enrollment_hit(100);
+ mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future());
+ ASSERT_EQ(Error::UNABLE_TO_PROCESS, mCallback->mError);
+ ASSERT_TRUE(mCallback->mAuthenticateFailed);
+}
+
+TEST_F(FakeFaceEngineTest, DetectInteraction) {
+ FaceHalProperties::enrollments({100});
+ FaceHalProperties::enrollment_hit(100);
+ ASSERT_EQ(0, mCallback->mInteractionDetectedCount);
+ mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
+ ASSERT_EQ(1, mCallback->mInteractionDetectedCount);
+}
+
+TEST_F(FakeFaceEngineTest, DetectInteractionCancel) {
+ FaceHalProperties::enrollments({100});
+ FaceHalProperties::enrollment_hit(100);
+ mCancel.set_value();
+ mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
+ ASSERT_EQ(Error::CANCELED, mCallback->mError);
+}
+
+TEST_F(FakeFaceEngineTest, GetFeatureEmpty) {
+ mEngine.getFeaturesImpl(mCallback.get());
+ ASSERT_TRUE(mCallback->mFeatures.empty());
+}
+
+TEST_F(FakeFaceEngineTest, SetFeature) {
+ FaceHalProperties::enrollments({1});
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true);
+ auto features = mCallback->mFeatures;
+ ASSERT_TRUE(features.empty());
+ ASSERT_EQ(Feature::REQUIRE_ATTENTION, mCallback->mLastFeatureSet);
+
+ mEngine.getFeaturesImpl(mCallback.get());
+ features = mCallback->mFeatures;
+ ASSERT_FALSE(features.empty());
+ ASSERT_NE(features.end(),
+ std::find(features.begin(), features.end(), Feature::REQUIRE_ATTENTION));
+}
+
+TEST_F(FakeFaceEngineTest, ToggleFeature) {
+ FaceHalProperties::enrollments({1});
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true);
+ mEngine.getFeaturesImpl(mCallback.get());
+ auto features = mCallback->mFeatures;
+ ASSERT_FALSE(features.empty());
+ ASSERT_NE(features.end(),
+ std::find(features.begin(), features.end(), Feature::REQUIRE_ATTENTION));
+
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, false);
+ mEngine.getFeaturesImpl(mCallback.get());
+ features = mCallback->mFeatures;
+ ASSERT_TRUE(features.empty());
+}
+
+TEST_F(FakeFaceEngineTest, TurningOffNonExistentFeatureDoesNothing) {
+ FaceHalProperties::enrollments({1});
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, false);
+ mEngine.getFeaturesImpl(mCallback.get());
+ auto features = mCallback->mFeatures;
+ ASSERT_TRUE(features.empty());
+}
+
+TEST_F(FakeFaceEngineTest, SetMultipleFeatures) {
+ FaceHalProperties::enrollments({1});
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true);
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_DIVERSE_POSES, true);
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::DEBUG, true);
+ mEngine.getFeaturesImpl(mCallback.get());
+ auto features = mCallback->mFeatures;
+ ASSERT_EQ(3, features.size());
+ ASSERT_NE(features.end(),
+ std::find(features.begin(), features.end(), Feature::REQUIRE_ATTENTION));
+ ASSERT_NE(features.end(),
+ std::find(features.begin(), features.end(), Feature::REQUIRE_DIVERSE_POSES));
+ ASSERT_NE(features.end(), std::find(features.begin(), features.end(), Feature::DEBUG));
+}
+
+TEST_F(FakeFaceEngineTest, SetMultipleFeaturesAndTurnOffSome) {
+ FaceHalProperties::enrollments({1});
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true);
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_DIVERSE_POSES, true);
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::DEBUG, true);
+ mEngine.setFeatureImpl(mCallback.get(), hat, Feature::DEBUG, false);
+ mEngine.getFeaturesImpl(mCallback.get());
+ auto features = mCallback->mFeatures;
+ ASSERT_EQ(2, features.size());
+ ASSERT_NE(features.end(),
+ std::find(features.begin(), features.end(), Feature::REQUIRE_ATTENTION));
+ ASSERT_NE(features.end(),
+ std::find(features.begin(), features.end(), Feature::REQUIRE_DIVERSE_POSES));
+ ASSERT_EQ(features.end(), std::find(features.begin(), features.end(), Feature::DEBUG));
+}
+
+TEST_F(FakeFaceEngineTest, Enumerate) {
+ FaceHalProperties::enrollments({120, 3});
+ mEngine.enumerateEnrollmentsImpl(mCallback.get());
+ auto enrolls = mCallback->mLastEnrollmentsEnumerated;
+ ASSERT_FALSE(enrolls.empty());
+ ASSERT_NE(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 120));
+ ASSERT_NE(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 3));
+}
+
+TEST_F(FakeFaceEngineTest, RemoveEnrollments) {
+ FaceHalProperties::enrollments({120, 3, 100});
+ mEngine.removeEnrollmentsImpl(mCallback.get(), {120, 100});
+ mEngine.enumerateEnrollmentsImpl(mCallback.get());
+ auto enrolls = mCallback->mLastEnrollmentsEnumerated;
+ ASSERT_FALSE(enrolls.empty());
+ ASSERT_EQ(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 120));
+ ASSERT_NE(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 3));
+ ASSERT_EQ(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 100));
+}
+
+TEST_F(FakeFaceEngineTest, ResetLockoutWithAuth) {
+ FaceHalProperties::lockout(true);
+ FaceHalProperties::enrollments({33});
+ FaceHalProperties::enrollment_hit(33);
+ auto cancelFuture = mCancel.get_future();
+ mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, cancelFuture);
+
+ ASSERT_TRUE(mCallback->mLockoutPermanent);
+
+ mEngine.resetLockoutImpl(mCallback.get(), {} /* hat */);
+ ASSERT_FALSE(mCallback->mLockoutPermanent);
+ FaceHalProperties::enrollment_hit(33);
+ mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, cancelFuture);
+ ASSERT_EQ(33, mCallback->mLastAuthenticated);
+ ASSERT_FALSE(mCallback->mAuthenticateFailed);
+}
+
+} // namespace aidl::android::hardware::biometrics::face
\ No newline at end of file
diff --git a/biometrics/fingerprint/aidl/OWNERS b/biometrics/fingerprint/aidl/OWNERS
index 36d7261..e162d2d 100644
--- a/biometrics/fingerprint/aidl/OWNERS
+++ b/biometrics/fingerprint/aidl/OWNERS
@@ -1,2 +1,4 @@
ilyamaty@google.com
-kchyn@google.com
+jeffpu@google.com
+jbolinger@google.com
+joshmccloskey@google.com
diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp
index 430bf3c..dc0199c 100644
--- a/biometrics/fingerprint/aidl/default/Android.bp
+++ b/biometrics/fingerprint/aidl/default/Android.bp
@@ -11,14 +11,16 @@
name: "android.hardware.biometrics.fingerprint-service.example",
vendor: true,
relative_install_path: "hw",
- init_rc: ["fingerprint-default.rc"],
- vintf_fragments: ["fingerprint-default.xml"],
+ init_rc: ["fingerprint-example.rc"],
+ vintf_fragments: ["fingerprint-example.xml"],
local_include_dirs: ["include"],
srcs: [
- "CancellationSignal.cpp",
+ "FakeFingerprintEngine.cpp",
+ "FakeFingerprintEngineRear.cpp",
+ "FakeFingerprintEngineUdfps.cpp",
+ "FakeFingerprintEngineSide.cpp",
"Fingerprint.cpp",
"Session.cpp",
- "WorkerThread.cpp",
"main.cpp",
],
shared_libs: [
@@ -26,18 +28,64 @@
"libbinder_ndk",
"android.hardware.biometrics.fingerprint-V2-ndk",
"android.hardware.biometrics.common-V2-ndk",
+ "android.hardware.biometrics.common.thread",
+ "android.hardware.biometrics.common.util",
],
+ static_libs: ["libandroid.hardware.biometrics.fingerprint.VirtualProps"],
}
-cc_test_host {
- name: "android.hardware.biometrics.fingerprint.WorkerThreadTest",
+cc_test {
+ name: "android.hardware.biometrics.fingerprint.FakeFingerprintEngineTest",
local_include_dirs: ["include"],
srcs: [
- "tests/WorkerThreadTest.cpp",
- "WorkerThread.cpp",
+ "tests/FakeFingerprintEngineTest.cpp",
+ "FakeFingerprintEngine.cpp",
],
shared_libs: [
- "libcutils",
+ "libbase",
+ "libbinder_ndk",
+ "android.hardware.biometrics.common.thread",
],
+ static_libs: [
+ "libandroid.hardware.biometrics.fingerprint.VirtualProps",
+ "android.hardware.biometrics.fingerprint-V2-ndk",
+ "android.hardware.biometrics.common-V2-ndk",
+ "android.hardware.keymaster-V3-ndk",
+ "android.hardware.biometrics.common.util",
+ ],
+ vendor: true,
test_suites: ["general-tests"],
+ require_root: true,
+}
+
+cc_test {
+ name: "android.hardware.biometrics.fingerprint.FakeFingerprintEngineUdfpsTest",
+ local_include_dirs: ["include"],
+ srcs: [
+ "tests/FakeFingerprintEngineUdfpsTest.cpp",
+ "FakeFingerprintEngineUdfps.cpp",
+ "FakeFingerprintEngine.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ "libbinder_ndk",
+ "android.hardware.biometrics.common.thread",
+ ],
+ static_libs: [
+ "libandroid.hardware.biometrics.fingerprint.VirtualProps",
+ "android.hardware.biometrics.fingerprint-V2-ndk",
+ "android.hardware.biometrics.common-V2-ndk",
+ "android.hardware.keymaster-V3-ndk",
+ "android.hardware.biometrics.common.util",
+ ],
+ vendor: true,
+ test_suites: ["general-tests"],
+ require_root: true,
+}
+
+sysprop_library {
+ name: "android.hardware.biometrics.fingerprint.VirtualProps",
+ srcs: ["fingerprint.sysprop"],
+ property_owner: "Vendor",
+ vendor: true,
}
diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp
new file mode 100644
index 0000000..651c9dc
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp
@@ -0,0 +1,458 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include "FakeFingerprintEngine.h"
+#include "Fingerprint.h"
+
+#include <android-base/logging.h>
+#include <android-base/parseint.h>
+
+#include <fingerprint.sysprop.h>
+
+#include "util/CancellationSignal.h"
+#include "util/Util.h"
+
+using namespace ::android::fingerprint::virt;
+using ::android::base::ParseInt;
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+void FakeFingerprintEngine::generateChallengeImpl(ISessionCallback* cb) {
+ BEGIN_OP(0);
+ std::uniform_int_distribution<int64_t> dist;
+ auto challenge = dist(mRandom);
+ FingerprintHalProperties::challenge(challenge);
+ cb->onChallengeGenerated(challenge);
+}
+
+void FakeFingerprintEngine::revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) {
+ BEGIN_OP(0);
+ FingerprintHalProperties::challenge({});
+ cb->onChallengeRevoked(challenge);
+}
+
+void FakeFingerprintEngine::enrollImpl(ISessionCallback* cb,
+ const keymaster::HardwareAuthToken& hat,
+ const std::future<void>& cancel) {
+ BEGIN_OP(FingerprintHalProperties::operation_enroll_latency().value_or(DEFAULT_LATENCY));
+
+ // Do proper HAT verification in the real implementation.
+ if (hat.mac.empty()) {
+ LOG(ERROR) << "Fail: hat";
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
+ return;
+ }
+
+ // Force error-out
+ auto err = FingerprintHalProperties::operation_enroll_error().value_or(0);
+ if (err != 0) {
+ LOG(ERROR) << "Fail: operation_enroll_error";
+ auto ec = convertError(err);
+ cb->onError(ec.first, ec.second);
+ return;
+ }
+
+ // Format is "<id>:<progress_ms-[acquiredInfo..]>,...:<result>
+ auto nextEnroll = FingerprintHalProperties::next_enrollment().value_or("");
+ auto parts = Util::split(nextEnroll, ":");
+ if (parts.size() != 3) {
+ LOG(ERROR) << "Fail: invalid next_enrollment:" << nextEnroll;
+ cb->onError(Error::VENDOR, 0 /* vendorError */);
+ return;
+ }
+ auto enrollmentId = std::stoi(parts[0]);
+ auto progress = parseEnrollmentCapture(parts[1]);
+ for (size_t i = 0; i < progress.size(); i += 2) {
+ auto left = (progress.size() - i) / 2 - 1;
+ auto duration = progress[i][0];
+ auto acquired = progress[i + 1];
+ auto N = acquired.size();
+
+ for (int j = 0; j < N; j++) {
+ SLEEP_MS(duration / N);
+
+ if (shouldCancel(cancel)) {
+ LOG(ERROR) << "Fail: cancel";
+ cb->onError(Error::CANCELED, 0 /* vendorCode */);
+ return;
+ }
+ auto ac = convertAcquiredInfo(acquired[j]);
+ cb->onAcquired(ac.first, ac.second);
+ }
+
+ if (left == 0 && !IS_TRUE(parts[2])) { // end and failed
+ LOG(ERROR) << "Fail: requested by caller: " << nextEnroll;
+ FingerprintHalProperties::next_enrollment({});
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
+ } else { // progress and update props if last time
+ LOG(INFO) << "onEnroll: " << enrollmentId << " left: " << left;
+ if (left == 0) {
+ auto enrollments = FingerprintHalProperties::enrollments();
+ enrollments.emplace_back(enrollmentId);
+ FingerprintHalProperties::enrollments(enrollments);
+ FingerprintHalProperties::next_enrollment({});
+ // change authenticatorId after new enrollment
+ auto id = FingerprintHalProperties::authenticator_id().value_or(0);
+ auto newId = id + 1;
+ FingerprintHalProperties::authenticator_id(newId);
+ LOG(INFO) << "Enrolled: " << enrollmentId;
+ }
+ cb->onEnrollmentProgress(enrollmentId, left);
+ }
+ }
+}
+
+void FakeFingerprintEngine::authenticateImpl(ISessionCallback* cb, int64_t /* operationId */,
+ const std::future<void>& cancel) {
+ BEGIN_OP(FingerprintHalProperties::operation_authenticate_latency().value_or(DEFAULT_LATENCY));
+
+ int64_t now = Util::getSystemNanoTime();
+ int64_t duration = FingerprintHalProperties::operation_authenticate_duration().value_or(10);
+ auto acquired = FingerprintHalProperties::operation_authenticate_acquired().value_or("1");
+ auto acquiredInfos = parseIntSequence(acquired);
+ int N = acquiredInfos.size();
+
+ if (N == 0) {
+ LOG(ERROR) << "Fail to parse authentiate acquired info: " + acquired;
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
+ return;
+ }
+
+ int i = 0;
+ do {
+ if (FingerprintHalProperties::operation_authenticate_fails().value_or(false)) {
+ LOG(ERROR) << "Fail: operation_authenticate_fails";
+ cb->onAuthenticationFailed();
+ return;
+ }
+
+ auto err = FingerprintHalProperties::operation_authenticate_error().value_or(0);
+ if (err != 0) {
+ LOG(ERROR) << "Fail: operation_authenticate_error";
+ auto ec = convertError(err);
+ cb->onError(ec.first, ec.second);
+ return;
+ }
+
+ if (FingerprintHalProperties::lockout().value_or(false)) {
+ LOG(ERROR) << "Fail: lockout";
+ cb->onLockoutPermanent();
+ cb->onError(Error::HW_UNAVAILABLE, 0 /* vendorError */);
+ return;
+ }
+
+ if (shouldCancel(cancel)) {
+ LOG(ERROR) << "Fail: cancel";
+ cb->onError(Error::CANCELED, 0 /* vendorCode */);
+ return;
+ }
+
+ if (i < N) {
+ auto ac = convertAcquiredInfo(acquiredInfos[i]);
+ cb->onAcquired(ac.first, ac.second);
+ i++;
+ }
+
+ SLEEP_MS(duration / N);
+ } while (!Util::hasElapsed(now, duration));
+
+ auto id = FingerprintHalProperties::enrollment_hit().value_or(0);
+ auto enrolls = FingerprintHalProperties::enrollments();
+ auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end();
+ if (id > 0 && isEnrolled) {
+ cb->onAuthenticationSucceeded(id, {} /* hat */);
+ return;
+ } else {
+ LOG(ERROR) << "Fail: fingerprint not enrolled";
+ cb->onAuthenticationFailed();
+ }
+}
+
+void FakeFingerprintEngine::detectInteractionImpl(ISessionCallback* cb,
+ const std::future<void>& cancel) {
+ BEGIN_OP(FingerprintHalProperties::operation_detect_interaction_latency().value_or(
+ DEFAULT_LATENCY));
+
+ int64_t duration =
+ FingerprintHalProperties::operation_detect_interaction_duration().value_or(10);
+ auto acquired = FingerprintHalProperties::operation_detect_interaction_acquired().value_or("1");
+ auto acquiredInfos = parseIntSequence(acquired);
+ int N = acquiredInfos.size();
+ int64_t now = Util::getSystemNanoTime();
+
+ if (N == 0) {
+ LOG(ERROR) << "Fail to parse detect interaction acquired info: " + acquired;
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
+ return;
+ }
+
+ int i = 0;
+ do {
+ auto err = FingerprintHalProperties::operation_detect_interaction_error().value_or(0);
+ if (err != 0) {
+ LOG(ERROR) << "Fail: operation_detect_interaction_error";
+ auto ec = convertError(err);
+ cb->onError(ec.first, ec.second);
+ return;
+ }
+
+ if (shouldCancel(cancel)) {
+ LOG(ERROR) << "Fail: cancel";
+ cb->onError(Error::CANCELED, 0 /* vendorCode */);
+ return;
+ }
+
+ if (i < N) {
+ auto ac = convertAcquiredInfo(acquiredInfos[i]);
+ cb->onAcquired(ac.first, ac.second);
+ i++;
+ }
+ SLEEP_MS(duration / N);
+ } while (!Util::hasElapsed(now, duration));
+
+ auto id = FingerprintHalProperties::enrollment_hit().value_or(0);
+ auto enrolls = FingerprintHalProperties::enrollments();
+ auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end();
+ if (id <= 0 || !isEnrolled) {
+ LOG(ERROR) << "Fail: not enrolled";
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
+ return;
+ }
+
+ cb->onInteractionDetected();
+}
+
+void FakeFingerprintEngine::enumerateEnrollmentsImpl(ISessionCallback* cb) {
+ BEGIN_OP(0);
+
+ std::vector<int32_t> ids;
+ // There are some enrollment sync issue with framework, which results in
+ // a single template removal during the very firt sync command after reboot.
+ // This is a workaround for now. TODO(b/243129174)
+ ids.push_back(-1);
+
+ for (auto& enrollment : FingerprintHalProperties::enrollments()) {
+ auto id = enrollment.value_or(0);
+ if (id > 0) {
+ ids.push_back(id);
+ }
+ }
+
+ cb->onEnrollmentsEnumerated(ids);
+}
+
+void FakeFingerprintEngine::removeEnrollmentsImpl(ISessionCallback* cb,
+ const std::vector<int32_t>& enrollmentIds) {
+ BEGIN_OP(0);
+
+ std::vector<std::optional<int32_t>> newEnrollments;
+ std::vector<int32_t> removed;
+ for (auto& enrollment : FingerprintHalProperties::enrollments()) {
+ auto id = enrollment.value_or(0);
+ if (std::find(enrollmentIds.begin(), enrollmentIds.end(), id) != enrollmentIds.end()) {
+ removed.push_back(id);
+ } else if (id > 0) {
+ newEnrollments.emplace_back(id);
+ }
+ }
+ FingerprintHalProperties::enrollments(newEnrollments);
+
+ cb->onEnrollmentsRemoved(enrollmentIds);
+}
+
+void FakeFingerprintEngine::getAuthenticatorIdImpl(ISessionCallback* cb) {
+ BEGIN_OP(0);
+ int64_t authenticatorId;
+ if (FingerprintHalProperties::enrollments().size() == 0) {
+ authenticatorId = 0;
+ } else {
+ authenticatorId = FingerprintHalProperties::authenticator_id().value_or(0);
+ if (authenticatorId == 0) authenticatorId = 1;
+ }
+ cb->onAuthenticatorIdRetrieved(authenticatorId);
+}
+
+void FakeFingerprintEngine::invalidateAuthenticatorIdImpl(ISessionCallback* cb) {
+ BEGIN_OP(0);
+ int64_t newId;
+ if (FingerprintHalProperties::enrollments().size() == 0) {
+ newId = 0;
+ } else {
+ auto id = FingerprintHalProperties::authenticator_id().value_or(0);
+ newId = id + 1;
+ }
+ FingerprintHalProperties::authenticator_id(newId);
+ cb->onAuthenticatorIdInvalidated(newId);
+}
+
+void FakeFingerprintEngine::resetLockoutImpl(ISessionCallback* cb,
+ const keymaster::HardwareAuthToken& hat) {
+ BEGIN_OP(0);
+ if (hat.mac.empty()) {
+ LOG(ERROR) << "Fail: hat in resetLockout()";
+ cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
+ return;
+ }
+ FingerprintHalProperties::lockout(false);
+ cb->onLockoutCleared();
+}
+
+ndk::ScopedAStatus FakeFingerprintEngine::onPointerDownImpl(int32_t /*pointerId*/, int32_t /*x*/,
+ int32_t /*y*/, float /*minor*/,
+ float /*major*/) {
+ BEGIN_OP(0);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus FakeFingerprintEngine::onPointerUpImpl(int32_t /*pointerId*/) {
+ BEGIN_OP(0);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus FakeFingerprintEngine::onUiReadyImpl() {
+ BEGIN_OP(0);
+ return ndk::ScopedAStatus::ok();
+}
+
+bool FakeFingerprintEngine::getSensorLocationConfig(SensorLocation& out) {
+ auto loc = FingerprintHalProperties::sensor_location().value_or("");
+ auto isValidStr = false;
+ auto dim = Util::split(loc, ":");
+
+ if (dim.size() < 3 or dim.size() > 4) {
+ if (!loc.empty()) LOG(WARNING) << "Invalid sensor location input (x:y:radius):" + loc;
+ return false;
+ } else {
+ int32_t x, y, r;
+ std::string d = "";
+ if (dim.size() >= 3) {
+ isValidStr = ParseInt(dim[0], &x) && ParseInt(dim[1], &y) && ParseInt(dim[2], &r);
+ }
+ if (dim.size() >= 4) {
+ d = dim[3];
+ }
+ if (isValidStr) out = {0, x, y, r, d};
+
+ return isValidStr;
+ }
+}
+SensorLocation FakeFingerprintEngine::getSensorLocation() {
+ SensorLocation location;
+
+ if (getSensorLocationConfig(location)) {
+ return location;
+ } else {
+ return defaultSensorLocation();
+ }
+}
+
+SensorLocation FakeFingerprintEngine::defaultSensorLocation() {
+ return {0 /* displayId (not used) */, 0 /* sensorLocationX */, 0 /* sensorLocationY */,
+ 0 /* sensorRadius */, "" /* display */};
+}
+
+std::vector<int32_t> FakeFingerprintEngine::parseIntSequence(const std::string& str,
+ const std::string& sep) {
+ std::vector<std::string> seqs = Util::split(str, sep);
+ std::vector<int32_t> res;
+
+ for (const auto& seq : seqs) {
+ int32_t val;
+ if (ParseInt(seq, &val)) {
+ res.push_back(val);
+ } else {
+ LOG(WARNING) << "Invalid int sequence:" + str;
+ res.clear();
+ break;
+ }
+ }
+
+ return res;
+}
+
+std::vector<std::vector<int32_t>> FakeFingerprintEngine::parseEnrollmentCapture(
+ const std::string& str) {
+ std::vector<int32_t> defaultAcquiredInfo = {(int32_t)AcquiredInfo::GOOD};
+ std::vector<std::vector<int32_t>> res;
+ int i = 0, N = str.length();
+ std::size_t found = 0;
+ bool aborted = true;
+
+ while (found != std::string::npos) {
+ std::string durationStr, acquiredStr;
+ found = str.find_first_of("-,", i);
+ if (found == std::string::npos) {
+ if (N - i < 1) break;
+ durationStr = str.substr(i, N - i);
+ } else {
+ durationStr = str.substr(i, found - i);
+ if (str[found] == '-') {
+ found = str.find_first_of('[', found + 1);
+ if (found == std::string::npos) break;
+ i = found + 1;
+ found = str.find_first_of(']', found + 1);
+ if (found == std::string::npos) break;
+ acquiredStr = str.substr(i, found - i);
+ found = str.find_first_of(',', found + 1);
+ }
+ }
+ std::vector<int32_t> duration{0};
+ if (!ParseInt(durationStr, &duration[0])) break;
+ res.push_back(duration);
+ if (!acquiredStr.empty()) {
+ std::vector<int32_t> acquiredInfo = parseIntSequence(acquiredStr);
+ if (acquiredInfo.empty()) break;
+ res.push_back(acquiredInfo);
+ } else
+ res.push_back(defaultAcquiredInfo);
+
+ i = found + 1;
+ if (found == std::string::npos || found == N - 1) aborted = false;
+ }
+
+ if (aborted) {
+ LOG(ERROR) << "Failed to parse enrollment captures:" + str;
+ res.clear();
+ }
+
+ return res;
+}
+
+std::pair<AcquiredInfo, int32_t> FakeFingerprintEngine::convertAcquiredInfo(int32_t code) {
+ std::pair<AcquiredInfo, int32_t> res;
+ if (code > FINGERPRINT_ACQUIRED_VENDOR_BASE) {
+ res.first = AcquiredInfo::VENDOR;
+ res.second = code - FINGERPRINT_ACQUIRED_VENDOR_BASE;
+ } else {
+ res.first = (AcquiredInfo)code;
+ res.second = 0;
+ }
+ return res;
+}
+
+std::pair<Error, int32_t> FakeFingerprintEngine::convertError(int32_t code) {
+ std::pair<Error, int32_t> res;
+ if (code > FINGERPRINT_ERROR_VENDOR_BASE) {
+ res.first = Error::VENDOR;
+ res.second = code - FINGERPRINT_ERROR_VENDOR_BASE;
+ } else {
+ res.first = (Error)code;
+ res.second = 0;
+ }
+ return res;
+}
+
+} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineRear.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineRear.cpp
new file mode 100644
index 0000000..eea80d5
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineRear.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "FakeFingerprintEngineRear.h"
+
+#include <android-base/logging.h>
+#include <android-base/parseint.h>
+
+#include <fingerprint.sysprop.h>
+
+#include "util/CancellationSignal.h"
+#include "util/Util.h"
+
+using namespace ::android::fingerprint::virt;
+
+namespace aidl::android::hardware::biometrics::fingerprint {}
diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp
new file mode 100644
index 0000000..9f736e7
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "FakeFingerprintEngineSide.h"
+
+#include <android-base/logging.h>
+
+#include <fingerprint.sysprop.h>
+
+#include "util/CancellationSignal.h"
+#include "util/Util.h"
+
+using namespace ::android::fingerprint::virt;
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+SensorLocation FakeFingerprintEngineSide::defaultSensorLocation() {
+ SensorLocation location;
+
+ return {0 /* displayId (not used) */, defaultSensorLocationX /* sensorLocationX */,
+ defaultSensorLocationY /* sensorLocationY */, defaultSensorRadius /* sensorRadius */,
+ "" /* display */};
+}
+} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp
new file mode 100644
index 0000000..d8579a4
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "FakeFingerprintEngineUdfps.h"
+
+#include <android-base/logging.h>
+
+#include <fingerprint.sysprop.h>
+
+#include "util/CancellationSignal.h"
+#include "util/Util.h"
+
+using namespace ::android::fingerprint::virt;
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+SensorLocation FakeFingerprintEngineUdfps::defaultSensorLocation() {
+ return {0 /* displayId (not used) */, defaultSensorLocationX /* sensorLocationX */,
+ defaultSensorLocationY /* sensorLocationY */, defaultSensorRadius /* sensorRadius */,
+ "" /* display */};
+}
+
+ndk::ScopedAStatus FakeFingerprintEngineUdfps::onPointerDownImpl(int32_t /*pointerId*/,
+ int32_t /*x*/, int32_t /*y*/,
+ float /*minor*/, float /*major*/) {
+ BEGIN_OP(0);
+
+ // TODO(b/230515082): if need to handle display touch events
+
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus FakeFingerprintEngineUdfps::onPointerUpImpl(int32_t /*pointerId*/) {
+ BEGIN_OP(0);
+ // TODO(b/230515082)
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus FakeFingerprintEngineUdfps::onUiReadyImpl() {
+ BEGIN_OP(0);
+ // TODO(b/230515082)
+ return ndk::ScopedAStatus::ok();
+}
+
+} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index 1f14de6..74e7caf 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -16,15 +16,19 @@
#include "Fingerprint.h"
+#include <fingerprint.sysprop.h>
#include "Session.h"
+#include <android-base/logging.h>
+
+using namespace ::android::fingerprint::virt;
+
namespace aidl::android::hardware::biometrics::fingerprint {
namespace {
constexpr size_t MAX_WORKER_QUEUE_SIZE = 5;
-constexpr int SENSOR_ID = 1;
+constexpr int SENSOR_ID = 5;
constexpr common::SensorStrength SENSOR_STRENGTH = common::SensorStrength::STRONG;
constexpr int MAX_ENROLLMENTS_PER_USER = 5;
-constexpr FingerprintSensorType SENSOR_TYPE = FingerprintSensorType::REAR;
constexpr bool SUPPORTS_NAVIGATION_GESTURES = true;
constexpr char HW_COMPONENT_ID[] = "fingerprintSensor";
constexpr char HW_VERSION[] = "vendor/model/revision";
@@ -35,8 +39,25 @@
} // namespace
-Fingerprint::Fingerprint()
- : mEngine(std::make_unique<FakeFingerprintEngine>()), mWorker(MAX_WORKER_QUEUE_SIZE) {}
+Fingerprint::Fingerprint() : mWorker(MAX_WORKER_QUEUE_SIZE) {
+ std::string sensorTypeProp = FingerprintHalProperties::type().value_or("");
+ if (sensorTypeProp == "" || sensorTypeProp == "default" || sensorTypeProp == "rear") {
+ mSensorType = FingerprintSensorType::REAR;
+ mEngine = std::make_unique<FakeFingerprintEngineRear>();
+ } else if (sensorTypeProp == "udfps") {
+ mSensorType = FingerprintSensorType::UNDER_DISPLAY_OPTICAL;
+ mEngine = std::make_unique<FakeFingerprintEngineUdfps>();
+ } else if (sensorTypeProp == "side") {
+ mSensorType = FingerprintSensorType::POWER_BUTTON;
+ mEngine = std::make_unique<FakeFingerprintEngineSide>();
+ } else {
+ mSensorType = FingerprintSensorType::UNKNOWN;
+ mEngine = std::make_unique<FakeFingerprintEngineRear>();
+ UNIMPLEMENTED(FATAL) << "unrecognized or unimplemented fingerprint behavior: "
+ << sensorTypeProp;
+ }
+ LOG(INFO) << "sensorTypeProp:" << sensorTypeProp;
+}
ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* out) {
std::vector<common::ComponentInfo> componentInfo = {
@@ -44,18 +65,30 @@
{SW_COMPONENT_ID, "" /* hardwareVersion */, "" /* firmwareVersion */,
"" /* serialNumber */, SW_VERSION}};
- common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH, MAX_ENROLLMENTS_PER_USER,
- componentInfo};
+ auto sensorId = FingerprintHalProperties::sensor_id().value_or(SENSOR_ID);
+ auto sensorStrength =
+ FingerprintHalProperties::sensor_strength().value_or((int)SENSOR_STRENGTH);
+ auto maxEnrollments =
+ FingerprintHalProperties::max_enrollments().value_or(MAX_ENROLLMENTS_PER_USER);
+ auto navigationGuesture = FingerprintHalProperties::navigation_guesture().value_or(false);
+ auto detectInteraction = FingerprintHalProperties::detect_interaction().value_or(false);
+ auto displayTouch = FingerprintHalProperties::display_touch().value_or(true);
+ auto controlIllumination = FingerprintHalProperties::control_illumination().value_or(false);
- SensorLocation sensorLocation = {0 /* displayId (not used) */, 0 /* sensorLocationX */,
- 0 /* sensorLocationY */, 0 /* sensorRadius */,
- "" /* display */};
+ common::CommonProps commonProps = {sensorId, (common::SensorStrength)sensorStrength,
+ maxEnrollments, componentInfo};
+
+ SensorLocation sensorLocation = mEngine->getSensorLocation();
+
+ LOG(INFO) << "sensor type:" << (int)mSensorType << " location:" << sensorLocation.toString();
*out = {{commonProps,
- SENSOR_TYPE,
+ mSensorType,
{sensorLocation},
- SUPPORTS_NAVIGATION_GESTURES,
- false /* supportsDetectInteraction */}};
+ navigationGuesture,
+ detectInteraction,
+ displayTouch,
+ controlIllumination}};
return ndk::ScopedAStatus::ok();
}
@@ -66,6 +99,8 @@
mSession = SharedRefBase::make<Session>(sensorId, userId, cb, mEngine.get(), &mWorker);
*out = mSession;
+
+ LOG(INFO) << "createSession: sensorId:" << sensorId << " userId:" << userId;
return ndk::ScopedAStatus::ok();
}
diff --git a/biometrics/fingerprint/aidl/default/README.md b/biometrics/fingerprint/aidl/default/README.md
new file mode 100644
index 0000000..ad471f7
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/README.md
@@ -0,0 +1,128 @@
+# Virtual Fingerprint HAL
+
+This is a virtual HAL implementation that is backed by system properties instead
+of actual hardware. It's intended for testing and UI development on debuggable
+builds to allow devices to masquerade as alternative device types and for
+emulators.
+
+## Supported Devices
+
+This HAL can be used on emulators, like cuttlefish, or on real devices. Add the
+following to your device's `.mk` file to include it:
+
+```
+PRODUCT_PACKAGES_DEBUG += android.hardware.biometrics.fingerprint-service.example
+```
+
+The virtual HAL will be ignored if a real HAL is also installed on the target
+device. Set the `biometric_virtual_enabled` settings and reboot the device to
+switch to the virtual HAL. Unset it and reboot again to switch back.
+
+## Getting Started
+
+First, set the type of sensor the device should use, enable the virtual
+extensions in the framework, and reboot.
+
+```shell
+$ adb root
+$ adb shell settings put secure biometric_virtual_enabled 1
+$ adb shell setprop persist.vendor.fingerprint.virtual.type rear
+$ adb reboot
+```
+
+### Enrollments
+
+Next, setup enrollments on the device. This can either be done through the UI,
+or via adb directly.
+
+#### Direct Enrollment
+
+To set enrollment directly without the UI:
+
+```shell
+$ adb root
+$ adb shell locksettings set-pin 0000
+$ adb shell setprop persist.vendor.fingerprint.virtual.enrollments 1
+$ adb shell cmd fingerprint sync
+```
+
+#### UI Enrollment
+
+1. Set pin
+ ```shell
+ $ adb shell locksettings set-pin 0000
+ ```
+2. Tee up the results of the enrollment before starting the process:
+
+ ```shell
+ $ adb shell setprop vendor.fingerprint.virtual.next_enrollment 1:100,100,100:true
+ ```
+3. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the
+ prompts.
+4. Verify the enrollments in the UI:
+
+ ```shell
+ $ adb shell getprop persist.vendor.fingerprint.virtual.enrollments
+ ```
+
+## Authenticate
+
+To authenticate successfully set the enrolled id that should succeed. Unset it
+or change the value to make authenticate operations fail:
+
+````shell
+$ adb shell setprop vendor.fingerprint.virtual.enrollment_hit 1
+````
+
+## Acquired Info Insertion
+
+Fingerprint image acquisition states at HAL are reported to framework via onAcquired() callback. The valid acquired state info for AIDL HAL include
+
+{UNKNOWN(0), GOOD(1), PARTIAL(2), INSUFFICIENT(3), SENSOR_DIRTY(4), TOO_SLOW(5), TOO_FAST(6), VENDOR(7), START(8), TOO_DARK(9), TOO_BRIGHT(10), IMMOBILE(11), RETRYING_CAPTURE(12)}
+
+Refer to [AcquiredInfo.aidl](../android/hardware/biometrics/fingerprint/AcquiredInfo.aidl) for details
+
+
+The states can be specified in sequence for the HAL operations involving fingerprint image captures, namely authenticate, enrollment and detectInteraction
+
+```shell
+$ adb shell setprop vendor.fingerprint.virtual.operation_authenticate_acquired 6,9,1
+$ adb shell setprop vendor.fingerprint.virtual.operation_detect_interaction_acquired 6,1
+$ adb shell setprop vendor.fingerprint.virtual.next_enrollment 2:1000-[5,1],500:true
+
+#next_enrollment format example:
+.---------------------- enrollment id (2)
+| .------------------ the image capture 1 duration (1000ms)
+| | .-------------- acquired info first (TOO_SLOW)
+| | | .------------ acquired info second (GOOD)
+| | | | .-------- the image capture 2 duration (500ms)
+| | | | | .---- enrollment end status (success)
+| | | | | |
+| | | | | |
+| | | | | |
+2:1000-[5,1],500:true
+```
+For vendor specific acquired info, acquiredInfo = 1000 + vendorAcquiredInfo
+
+## Error Insertion
+The valid error codes for AIDL HAL include
+
+{UNKNOWN(0), HW_UNAVAILABLE(1), UNABLE_TO_PROCESS(2), TIMEOUT(3), NO_SPACE(4), CANCELED(5), UNABLE_TO_REMOVE(6), VENDOR(7), BAD_CALIBRATION(8)}
+
+Refer to [Error.aidl](../android/hardware/biometrics/fingerprint/Error.aidl) for details
+
+
+There are many HAL operations which can result in errors, refer to [here](fingerprint.sysprop) file for details.
+
+```shell
+$ adb shell setprop vendor.fingerprint.virtual.operation_authenticate_error 8
+```
+For vendor specific error, errorCode = 1000 + vendorErrorCode
+
+## View HAL State
+
+To view all the properties of the HAL (see `fingerprint.sysprop` file for the API):
+
+```shell
+$ adb shell getprop | grep vendor.fingerprint.virtual
+```
diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp
index 452ed12..e51f677 100644
--- a/biometrics/fingerprint/aidl/default/Session.cpp
+++ b/biometrics/fingerprint/aidl/default/Session.cpp
@@ -18,7 +18,7 @@
#include <android-base/logging.h>
-#include "CancellationSignal.h"
+#include "util/CancellationSignal.h"
namespace aidl::android::hardware::biometrics::fingerprint {
@@ -101,7 +101,7 @@
if (shouldCancel(cancFuture)) {
mCb->onError(Error::CANCELED, 0 /* vendorCode */);
} else {
- mEngine->enrollImpl(mCb.get(), hat);
+ mEngine->enrollImpl(mCb.get(), hat, cancFuture);
}
enterIdling();
}));
@@ -123,7 +123,7 @@
if (shouldCancel(cancFuture)) {
mCb->onError(Error::CANCELED, 0 /* vendorCode */);
} else {
- mEngine->authenticateImpl(mCb.get(), operationId);
+ mEngine->authenticateImpl(mCb.get(), operationId, cancFuture);
}
enterIdling();
}));
@@ -144,7 +144,7 @@
if (shouldCancel(cancFuture)) {
mCb->onError(Error::CANCELED, 0 /* vendorCode */);
} else {
- mEngine->detectInteractionImpl(mCb.get());
+ mEngine->detectInteractionImpl(mCb.get(), cancFuture);
}
enterIdling();
}));
@@ -167,7 +167,7 @@
}
ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& enrollmentIds) {
- LOG(INFO) << "removeEnrollments";
+ LOG(INFO) << "removeEnrollments, size:" << enrollmentIds.size();
scheduleStateOrCrash(SessionState::REMOVING_ENROLLMENTS);
mWorker->schedule(Callable::from([this, enrollmentIds] {
@@ -228,19 +228,31 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus Session::onPointerDown(int32_t /*pointerId*/, int32_t /*x*/, int32_t /*y*/,
- float /*minor*/, float /*major*/) {
+ndk::ScopedAStatus Session::onPointerDown(int32_t pointerId, int32_t x, int32_t y, float minor,
+ float major) {
LOG(INFO) << "onPointerDown";
+ mWorker->schedule(Callable::from([this, pointerId, x, y, minor, major] {
+ mEngine->onPointerDownImpl(pointerId, x, y, minor, major);
+ enterIdling();
+ }));
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus Session::onPointerUp(int32_t /*pointerId*/) {
+ndk::ScopedAStatus Session::onPointerUp(int32_t pointerId) {
LOG(INFO) << "onPointerUp";
+ mWorker->schedule(Callable::from([this, pointerId] {
+ mEngine->onPointerUpImpl(pointerId);
+ enterIdling();
+ }));
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::onUiReady() {
LOG(INFO) << "onUiReady";
+ mWorker->schedule(Callable::from([this] {
+ mEngine->onUiReadyImpl();
+ enterIdling();
+ }));
return ndk::ScopedAStatus::ok();
}
diff --git a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt
new file mode 100644
index 0000000..fa21663
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt
@@ -0,0 +1,155 @@
+props {
+ owner: Vendor
+ module: "android.fingerprint.virt.FingerprintHalProperties"
+ prop {
+ api_name: "authenticator_id"
+ type: Long
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.authenticator_id"
+ }
+ prop {
+ api_name: "challenge"
+ type: Long
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.challenge"
+ }
+ prop {
+ api_name: "control_illumination"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination"
+ }
+ prop {
+ api_name: "detect_interaction"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.detect_interaction"
+ }
+ prop {
+ api_name: "display_touch"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch"
+ }
+ prop {
+ api_name: "enrollment_hit"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.enrollment_hit"
+ }
+ prop {
+ api_name: "enrollments"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.enrollments"
+ }
+ prop {
+ api_name: "lockout"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.lockout"
+ }
+ prop {
+ api_name: "max_enrollments"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.max_enrollments"
+ }
+ prop {
+ api_name: "navigation_guesture"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture"
+ }
+ prop {
+ api_name: "next_enrollment"
+ type: String
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.next_enrollment"
+ }
+ prop {
+ api_name: "operation_authenticate_acquired"
+ type: String
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired"
+ }
+ prop {
+ api_name: "operation_authenticate_duration"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration"
+ }
+ prop {
+ api_name: "operation_authenticate_error"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_error"
+ }
+ prop {
+ api_name: "operation_authenticate_fails"
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails"
+ }
+ prop {
+ api_name: "operation_authenticate_latency"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency"
+ }
+ prop {
+ api_name: "operation_detect_interaction_acquired"
+ type: String
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired"
+ }
+ prop {
+ api_name: "operation_detect_interaction_duration"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration"
+ }
+ prop {
+ api_name: "operation_detect_interaction_error"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error"
+ }
+ prop {
+ api_name: "operation_detect_interaction_latency"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency"
+ }
+ prop {
+ api_name: "operation_enroll_error"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_enroll_error"
+ }
+ prop {
+ api_name: "operation_enroll_latency"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_enroll_latency"
+ }
+ prop {
+ api_name: "sensor_id"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.sensor_id"
+ }
+ prop {
+ api_name: "sensor_location"
+ type: String
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.sensor_location"
+ }
+ prop {
+ api_name: "sensor_strength"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.sensor_strength"
+ }
+ prop {
+ api_name: "type"
+ type: String
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.type"
+ enum_values: "default|rear|udfps|side"
+ }
+}
diff --git a/biometrics/fingerprint/aidl/default/fingerprint-default.rc b/biometrics/fingerprint/aidl/default/fingerprint-default.rc
deleted file mode 100644
index eb62c56..0000000
--- a/biometrics/fingerprint/aidl/default/fingerprint-default.rc
+++ /dev/null
@@ -1,5 +0,0 @@
-service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.example
- class hal
- user nobody
- group nobody
-
diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.rc b/biometrics/fingerprint/aidl/default/fingerprint-example.rc
new file mode 100644
index 0000000..574438e
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/fingerprint-example.rc
@@ -0,0 +1,4 @@
+service vendor.fingerprint-example /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.example
+ class hal
+ user nobody
+ group nobody
diff --git a/biometrics/fingerprint/aidl/default/fingerprint-default.xml b/biometrics/fingerprint/aidl/default/fingerprint-example.xml
similarity index 79%
rename from biometrics/fingerprint/aidl/default/fingerprint-default.xml
rename to biometrics/fingerprint/aidl/default/fingerprint-example.xml
index d322eb6..05d1279 100644
--- a/biometrics/fingerprint/aidl/default/fingerprint-default.xml
+++ b/biometrics/fingerprint/aidl/default/fingerprint-example.xml
@@ -2,6 +2,6 @@
<hal format="aidl">
<name>android.hardware.biometrics.fingerprint</name>
<version>2</version>
- <fqname>IFingerprint/default</fqname>
+ <fqname>IFingerprint/virtual</fqname>
</hal>
</manifest>
diff --git a/biometrics/fingerprint/aidl/default/fingerprint.sysprop b/biometrics/fingerprint/aidl/default/fingerprint.sysprop
new file mode 100644
index 0000000..9b8fada
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/fingerprint.sysprop
@@ -0,0 +1,258 @@
+# fingerprint.sysprop
+# module becomes static class (Java) / namespace (C++) for serving API
+module: "android.fingerprint.virt.FingerprintHalProperties"
+owner: Vendor
+
+# type of fingerprint sensor
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.type"
+ type: String
+ scope: Public
+ access: ReadWrite
+ enum_values: "default|rear|udfps|side"
+ api_name: "type"
+}
+
+# ids of call current enrollments
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.enrollments"
+ type: IntegerList
+ scope: Public
+ access: ReadWrite
+ api_name: "enrollments"
+}
+
+# authenticate and detectInteraction will succeed with this
+# enrollment id, when present, otherwise they will error
+prop {
+ prop_name: "vendor.fingerprint.virtual.enrollment_hit"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "enrollment_hit"
+}
+
+# the next enrollment in the format of:
+# "<id>:<delay>,<delay>,...:<result>"
+# <delay> = <duration-[acquiredInfos]>
+# [acquiredInfos] = [acquiredInfo1, acquiredInfo2, ...]
+# (refer to README.md file for acquiredInfo values)
+# e.g. "2:100,20:true", "2:100-[5,1],20:true"
+# this property is reset after enroll completes
+prop {
+ prop_name: "vendor.fingerprint.virtual.next_enrollment"
+ type: String
+ scope: Public
+ access: ReadWrite
+ api_name: "next_enrollment"
+}
+
+# value for getAuthenticatorId or 0
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.authenticator_id"
+ type: Long
+ scope: Public
+ access: ReadWrite
+ api_name: "authenticator_id"
+}
+
+# value for generateChallenge
+prop {
+ prop_name: "vendor.fingerprint.virtual.challenge"
+ type: Long
+ scope: Public
+ access: ReadWrite
+ api_name: "challenge"
+}
+
+# if locked out
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.lockout"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "lockout"
+}
+
+# force all authenticate operations to fail
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_authenticate_fails"
+}
+
+# force all detectInteraction operations to error out
+# error consists of errorCode and vendorErrorCode
+# valid errorCodes are listed in README.md file
+# vendorErrorCode = (error>1000) ? error-1000 : 0
+# e.g. error(1002) --> errorCode(7) and vendorErrorCode(2)
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_detect_interaction_error"
+}
+
+# force all enroll operations to result in error
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_enroll_error"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_enroll_error"
+}
+
+# add a latency to authentication operations
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_authenticate_latency"
+}
+
+# add a latency to detectInteraction operations
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_detect_interaction_latency"
+}
+
+# add a latency to enroll operations
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_enroll_latency"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_enroll_latency"
+}
+
+# millisecond duration for authenticate operations
+# (waits for changes to enrollment_hit)
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_authenticate_duration"
+}
+
+# insert error for authenticate operations
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_error"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_authenticate_error"
+}
+
+# sensor location
+# <x>:<y>:<radius> in pixel
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.sensor_location"
+ type: String
+ scope: Public
+ access: ReadWrite
+ api_name: "sensor_location"
+}
+
+# acquired info during authentication in format of sequence
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired"
+ type: String
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_authenticate_acquired"
+}
+
+# millisecond duration for detect interaction operations
+# (waits for changes to enrollment_hit)
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_detect_interaction_duration"
+}
+
+# acquired info during detect interaction operation in format of sequence
+# e.g. 5,6,1 (TOO_SLOW, TOO_FAST, GOOD)
+# onAcquired() callback will be invoked in sequence
+# vendorAcquiredCode = (acquired>1000) ? acquired-1000 : 0
+prop {
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired"
+ type: String
+ scope: Public
+ access: ReadWrite
+ api_name: "operation_detect_interaction_acquired"
+}
+
+# sensor id (default: 5)
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.sensor_id"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "sensor_id"
+}
+
+# sensor strength (default: 2)
+# [0=CONVENECE, 1=WEAK, 2=STRONG]
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.sensor_strength"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "sensor_strength"
+}
+
+# max enrollments per user (default: 5)
+#
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.max_enrollments"
+ type: Integer
+ scope: Public
+ access: ReadWrite
+ api_name: "max_enrollments"
+}
+
+# whether support navigation guestures (default: false)
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "navigation_guesture"
+}
+
+# whether support detect interaction (default: false)
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.detect_interaction"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "detect_interaction"
+}
+
+# whether support display touch by hal (default: true)
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "display_touch"
+}
+
+# whether support illumination control by hal (default: false)
+prop {
+ prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination"
+ type: Boolean
+ scope: Public
+ access: ReadWrite
+ api_name: "control_illumination"
+}
diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h
index b927770..22b1744 100644
--- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h
+++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h
@@ -15,74 +15,61 @@
*/
#pragma once
+#include <aidl/android/hardware/biometrics/common/SensorStrength.h>
+#include <aidl/android/hardware/biometrics/fingerprint/ISessionCallback.h>
-#include <android-base/logging.h>
#include <random>
+#include <aidl/android/hardware/biometrics/fingerprint/SensorLocation.h>
+#include <future>
+#include <vector>
+
+using namespace ::aidl::android::hardware::biometrics::common;
+
namespace aidl::android::hardware::biometrics::fingerprint {
+// A fake engine that is backed by system properties instead of hardware.
class FakeFingerprintEngine {
public:
FakeFingerprintEngine() : mRandom(std::mt19937::default_seed) {}
+ virtual ~FakeFingerprintEngine() {}
- void generateChallengeImpl(ISessionCallback* cb) {
- LOG(INFO) << "generateChallengeImpl";
- std::uniform_int_distribution<int64_t> dist;
- auto challenge = dist(mRandom);
- cb->onChallengeGenerated(challenge);
- }
+ void generateChallengeImpl(ISessionCallback* cb);
+ void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge);
+ void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat,
+ const std::future<void>& cancel);
+ void authenticateImpl(ISessionCallback* cb, int64_t operationId,
+ const std::future<void>& cancel);
+ void detectInteractionImpl(ISessionCallback* cb, const std::future<void>& cancel);
+ void enumerateEnrollmentsImpl(ISessionCallback* cb);
+ void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector<int32_t>& enrollmentIds);
+ void getAuthenticatorIdImpl(ISessionCallback* cb);
+ void invalidateAuthenticatorIdImpl(ISessionCallback* cb);
+ void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/);
+ bool getSensorLocationConfig(SensorLocation& out);
- void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) {
- LOG(INFO) << "revokeChallengeImpl";
- cb->onChallengeRevoked(challenge);
- }
+ virtual ndk::ScopedAStatus onPointerDownImpl(int32_t pointerId, int32_t x, int32_t y,
+ float minor, float major);
- void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat) {
- LOG(INFO) << "enrollImpl";
- // Do proper HAT verification in the real implementation.
- if (hat.mac.empty()) {
- cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */);
- return;
- }
- cb->onEnrollmentProgress(0 /* enrollmentId */, 0 /* remaining */);
- }
+ virtual ndk::ScopedAStatus onPointerUpImpl(int32_t pointerId);
- void authenticateImpl(ISessionCallback* cb, int64_t /* operationId */) {
- LOG(INFO) << "authenticateImpl";
- cb->onAuthenticationSucceeded(0 /* enrollmentId */, {} /* hat */);
- }
+ virtual ndk::ScopedAStatus onUiReadyImpl();
- void detectInteractionImpl(ISessionCallback* cb) {
- LOG(INFO) << "detectInteractionImpl";
- cb->onInteractionDetected();
- }
+ virtual SensorLocation getSensorLocation();
- void enumerateEnrollmentsImpl(ISessionCallback* cb) {
- LOG(INFO) << "enumerateEnrollmentsImpl";
- cb->onEnrollmentsEnumerated({} /* enrollmentIds */);
- }
+ virtual SensorLocation defaultSensorLocation();
- void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector<int32_t>& enrollmentIds) {
- LOG(INFO) << "removeEnrollmentsImpl";
- cb->onEnrollmentsRemoved(enrollmentIds);
- }
+ std::vector<int32_t> parseIntSequence(const std::string& str, const std::string& sep = ",");
- void getAuthenticatorIdImpl(ISessionCallback* cb) {
- LOG(INFO) << "getAuthenticatorIdImpl";
- cb->onAuthenticatorIdRetrieved(0 /* authenticatorId */);
- }
-
- void invalidateAuthenticatorIdImpl(ISessionCallback* cb) {
- LOG(INFO) << "invalidateAuthenticatorIdImpl";
- cb->onAuthenticatorIdInvalidated(0 /* newAuthenticatorId */);
- }
-
- void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/) {
- LOG(INFO) << "resetLockoutImpl";
- cb->onLockoutCleared();
- }
+ std::vector<std::vector<int32_t>> parseEnrollmentCapture(const std::string& str);
std::mt19937 mRandom;
+
+ private:
+ static constexpr int32_t FINGERPRINT_ACQUIRED_VENDOR_BASE = 1000;
+ static constexpr int32_t FINGERPRINT_ERROR_VENDOR_BASE = 1000;
+ std::pair<AcquiredInfo, int32_t> convertAcquiredInfo(int32_t code);
+ std::pair<Error, int32_t> convertError(int32_t code);
};
} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h
new file mode 100644
index 0000000..1600a4b
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+#include "FakeFingerprintEngine.h"
+
+using namespace ::aidl::android::hardware::biometrics::common;
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+// A fake engine that is backed by system properties instead of hardware.
+class FakeFingerprintEngineRear : public FakeFingerprintEngine {
+ public:
+ FakeFingerprintEngineRear() : FakeFingerprintEngine() {}
+ ~FakeFingerprintEngineRear() {}
+};
+
+} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h
new file mode 100644
index 0000000..4e44d16
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+#include "FakeFingerprintEngine.h"
+
+using namespace ::aidl::android::hardware::biometrics::common;
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+// A fake engine that is backed by system properties instead of hardware.
+class FakeFingerprintEngineSide : public FakeFingerprintEngine {
+ public:
+ static constexpr int32_t defaultSensorLocationX = 0;
+ static constexpr int32_t defaultSensorLocationY = 600;
+ static constexpr int32_t defaultSensorRadius = 150;
+
+ FakeFingerprintEngineSide() : FakeFingerprintEngine() {}
+ ~FakeFingerprintEngineSide() {}
+
+ virtual SensorLocation defaultSensorLocation() override;
+};
+
+} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h
new file mode 100644
index 0000000..b86af73
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+#include "FakeFingerprintEngine.h"
+
+using namespace ::aidl::android::hardware::biometrics::common;
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+// A fake engine that is backed by system properties instead of hardware.
+class FakeFingerprintEngineUdfps : public FakeFingerprintEngine {
+ public:
+ static constexpr int32_t defaultSensorLocationX = 400;
+ static constexpr int32_t defaultSensorLocationY = 1600;
+ static constexpr int32_t defaultSensorRadius = 150;
+
+ FakeFingerprintEngineUdfps() : FakeFingerprintEngine() {}
+ ~FakeFingerprintEngineUdfps() {}
+
+ virtual ndk::ScopedAStatus onPointerDownImpl(int32_t pointerId, int32_t x, int32_t y,
+ float minor, float major) override;
+
+ virtual ndk::ScopedAStatus onPointerUpImpl(int32_t pointerId) override;
+
+ virtual ndk::ScopedAStatus onUiReadyImpl() override;
+
+ virtual SensorLocation defaultSensorLocation() override;
+};
+
+} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/include/Fingerprint.h b/biometrics/fingerprint/aidl/default/include/Fingerprint.h
index 7bd3d6d..64aafa3 100644
--- a/biometrics/fingerprint/aidl/default/include/Fingerprint.h
+++ b/biometrics/fingerprint/aidl/default/include/Fingerprint.h
@@ -16,11 +16,17 @@
#pragma once
+#define LOG_TAG "FingerprintVirtualHal"
+
#include <aidl/android/hardware/biometrics/fingerprint/BnFingerprint.h>
#include "FakeFingerprintEngine.h"
+#include "FakeFingerprintEngineRear.h"
+#include "FakeFingerprintEngineSide.h"
+#include "FakeFingerprintEngineUdfps.h"
+
#include "Session.h"
-#include "WorkerThread.h"
+#include "thread/WorkerThread.h"
namespace aidl::android::hardware::biometrics::fingerprint {
@@ -38,6 +44,7 @@
std::unique_ptr<FakeFingerprintEngine> mEngine;
WorkerThread mWorker;
std::shared_ptr<Session> mSession;
+ FingerprintSensorType mSensorType;
};
} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h
index acd5def..104d819 100644
--- a/biometrics/fingerprint/aidl/default/include/Session.h
+++ b/biometrics/fingerprint/aidl/default/include/Session.h
@@ -20,7 +20,7 @@
#include <aidl/android/hardware/biometrics/fingerprint/ISessionCallback.h>
#include "FakeFingerprintEngine.h"
-#include "WorkerThread.h"
+#include "thread/WorkerThread.h"
namespace aidl::android::hardware::biometrics::fingerprint {
diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp
index c985201..0e672b1 100644
--- a/biometrics/fingerprint/aidl/default/main.cpp
+++ b/biometrics/fingerprint/aidl/default/main.cpp
@@ -27,7 +27,7 @@
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Fingerprint> hal = ndk::SharedRefBase::make<Fingerprint>();
- const std::string instance = std::string(Fingerprint::descriptor) + "/default";
+ const std::string instance = std::string(Fingerprint::descriptor) + "/virtual";
binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp
new file mode 100644
index 0000000..32d01f4
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp
@@ -0,0 +1,450 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include <android/binder_process.h>
+#include <fingerprint.sysprop.h>
+#include <gtest/gtest.h>
+
+#include <aidl/android/hardware/biometrics/fingerprint/BnSessionCallback.h>
+
+#include "FakeFingerprintEngine.h"
+
+using namespace ::android::fingerprint::virt;
+using namespace ::aidl::android::hardware::biometrics::fingerprint;
+using namespace ::aidl::android::hardware::keymaster;
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+class TestSessionCallback : public BnSessionCallback {
+ public:
+ ndk::ScopedAStatus onChallengeGenerated(int64_t challenge) override {
+ mLastChallenge = challenge;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onChallengeRevoked(int64_t challenge) override {
+ mLastChallengeRevoked = challenge;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onError(fingerprint::Error error, int32_t vendorCode) override {
+ mError = error;
+ mErrorVendorCode = vendorCode;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onEnrollmentProgress(int32_t enrollmentId, int32_t remaining) override {
+ if (remaining == 0) mLastEnrolled = enrollmentId;
+ return ndk::ScopedAStatus::ok();
+ };
+
+ ::ndk::ScopedAStatus onAuthenticationSucceeded(int32_t enrollmentId,
+ const keymaster::HardwareAuthToken&) override {
+ mLastAuthenticated = enrollmentId;
+ mAuthenticateFailed = false;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticationFailed() override {
+ mLastAuthenticated = 0;
+ mAuthenticateFailed = true;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onInteractionDetected() override {
+ mInteractionDetectedCount++;
+ return ndk::ScopedAStatus::ok();
+ };
+ ndk::ScopedAStatus onAcquired(AcquiredInfo info, int32_t vendorCode) override {
+ mLastAcquiredInfo = (int32_t)info;
+ mLastAcquiredVendorCode = vendorCode;
+ mLastAcquiredCount++;
+ return ndk::ScopedAStatus::ok();
+ }
+ ::ndk::ScopedAStatus onEnrollmentsEnumerated(
+ const std::vector<int32_t>& enrollmentIds) override {
+ mLastEnrollmentEnumerated = enrollmentIds;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onEnrollmentsRemoved(const std::vector<int32_t>& enrollmentIds) override {
+ mLastEnrollmentRemoved = enrollmentIds;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticatorIdRetrieved(int64_t authenticatorId) override {
+ mLastAuthenticatorId = authenticatorId;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticatorIdInvalidated(int64_t authenticatorId) override {
+ mLastAuthenticatorId = authenticatorId;
+ mAuthenticatorIdInvalidated = true;
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onLockoutPermanent() override {
+ mLockoutPermanent = true;
+ return ndk::ScopedAStatus::ok();
+ };
+ ndk::ScopedAStatus onLockoutTimed(int64_t /* timeout */) override {
+ return ndk::ScopedAStatus::ok();
+ }
+ ndk::ScopedAStatus onLockoutCleared() override { return ndk::ScopedAStatus::ok(); }
+ ndk::ScopedAStatus onSessionClosed() override { return ndk::ScopedAStatus::ok(); }
+
+ Error mError = Error::UNKNOWN;
+ int32_t mErrorVendorCode = 0;
+ int64_t mLastChallenge = -1;
+ int64_t mLastChallengeRevoked = -1;
+ int32_t mLastEnrolled = -1;
+ int32_t mLastAuthenticated = -1;
+ int64_t mLastAuthenticatorId = -1;
+ std::vector<int32_t> mLastEnrollmentEnumerated;
+ std::vector<int32_t> mLastEnrollmentRemoved;
+ bool mAuthenticateFailed = false;
+ bool mAuthenticatorIdInvalidated = false;
+ bool mLockoutPermanent = false;
+ int mInteractionDetectedCount = 0;
+ int32_t mLastAcquiredInfo = -1;
+ int32_t mLastAcquiredVendorCode = -1;
+ int32_t mLastAcquiredCount = 0;
+};
+
+class FakeFingerprintEngineTest : public ::testing::Test {
+ protected:
+ void SetUp() override {
+ FingerprintHalProperties::operation_enroll_latency(0);
+ FingerprintHalProperties::operation_authenticate_latency(0);
+ FingerprintHalProperties::operation_detect_interaction_latency(0);
+ mCallback = ndk::SharedRefBase::make<TestSessionCallback>();
+ }
+
+ void TearDown() override {
+ FingerprintHalProperties::operation_authenticate_error(0);
+ FingerprintHalProperties::operation_detect_interaction_error(0);
+ FingerprintHalProperties::operation_authenticate_acquired("");
+ }
+
+ FakeFingerprintEngine mEngine;
+ std::shared_ptr<TestSessionCallback> mCallback;
+ std::promise<void> mCancel;
+};
+
+TEST_F(FakeFingerprintEngineTest, GenerateChallenge) {
+ mEngine.generateChallengeImpl(mCallback.get());
+ ASSERT_EQ(FingerprintHalProperties::challenge().value(), mCallback->mLastChallenge);
+}
+
+TEST_F(FakeFingerprintEngineTest, RevokeChallenge) {
+ auto challenge = FingerprintHalProperties::challenge().value_or(10);
+ mEngine.revokeChallengeImpl(mCallback.get(), challenge);
+ ASSERT_FALSE(FingerprintHalProperties::challenge().has_value());
+ ASSERT_EQ(challenge, mCallback->mLastChallengeRevoked);
+}
+
+TEST_F(FakeFingerprintEngineTest, ResetLockout) {
+ FingerprintHalProperties::lockout(true);
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.resetLockoutImpl(mCallback.get(), hat);
+ ASSERT_FALSE(FingerprintHalProperties::lockout().value_or(true));
+}
+
+TEST_F(FakeFingerprintEngineTest, AuthenticatorId) {
+ FingerprintHalProperties::enrollments({1});
+ FingerprintHalProperties::authenticator_id(50);
+ mEngine.getAuthenticatorIdImpl(mCallback.get());
+ ASSERT_EQ(50, mCallback->mLastAuthenticatorId);
+ ASSERT_FALSE(mCallback->mAuthenticatorIdInvalidated);
+}
+
+TEST_F(FakeFingerprintEngineTest, AuthenticatorIdInvalidate) {
+ FingerprintHalProperties::authenticator_id(500);
+ mEngine.invalidateAuthenticatorIdImpl(mCallback.get());
+ ASSERT_NE(500, FingerprintHalProperties::authenticator_id().value());
+ ASSERT_TRUE(mCallback->mAuthenticatorIdInvalidated);
+}
+
+TEST_F(FakeFingerprintEngineTest, Enroll) {
+ FingerprintHalProperties::enrollments({});
+ FingerprintHalProperties::next_enrollment("4:0,0:true");
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.enrollImpl(mCallback.get(), hat, mCancel.get_future());
+ ASSERT_FALSE(FingerprintHalProperties::next_enrollment().has_value());
+ ASSERT_EQ(1, FingerprintHalProperties::enrollments().size());
+ ASSERT_EQ(4, FingerprintHalProperties::enrollments()[0].value());
+ ASSERT_EQ(4, mCallback->mLastEnrolled);
+ ASSERT_EQ(1, mCallback->mLastAcquiredInfo);
+}
+
+TEST_F(FakeFingerprintEngineTest, EnrollCancel) {
+ FingerprintHalProperties::enrollments({});
+ auto next = "4:0,0:true";
+ FingerprintHalProperties::next_enrollment(next);
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mCancel.set_value();
+ mEngine.enrollImpl(mCallback.get(), hat, mCancel.get_future());
+ ASSERT_EQ(Error::CANCELED, mCallback->mError);
+ ASSERT_EQ(-1, mCallback->mLastEnrolled);
+ ASSERT_EQ(0, FingerprintHalProperties::enrollments().size());
+ ASSERT_EQ(next, FingerprintHalProperties::next_enrollment().value_or(""));
+}
+
+TEST_F(FakeFingerprintEngineTest, EnrollFail) {
+ FingerprintHalProperties::enrollments({});
+ auto next = "2:0,0:false";
+ FingerprintHalProperties::next_enrollment(next);
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ mEngine.enrollImpl(mCallback.get(), hat, mCancel.get_future());
+ ASSERT_EQ(Error::UNABLE_TO_PROCESS, mCallback->mError);
+ ASSERT_EQ(-1, mCallback->mLastEnrolled);
+ ASSERT_EQ(0, FingerprintHalProperties::enrollments().size());
+ ASSERT_FALSE(FingerprintHalProperties::next_enrollment().has_value());
+}
+
+TEST_F(FakeFingerprintEngineTest, EnrollAcquired) {
+ FingerprintHalProperties::enrollments({});
+ FingerprintHalProperties::next_enrollment("4:0,5-[12,1013]:true");
+ keymaster::HardwareAuthToken hat{.mac = {2, 4}};
+ int32_t prevCnt = mCallback->mLastAcquiredCount;
+ mEngine.enrollImpl(mCallback.get(), hat, mCancel.get_future());
+ ASSERT_FALSE(FingerprintHalProperties::next_enrollment().has_value());
+ ASSERT_EQ(1, FingerprintHalProperties::enrollments().size());
+ ASSERT_EQ(4, FingerprintHalProperties::enrollments()[0].value());
+ ASSERT_EQ(4, mCallback->mLastEnrolled);
+ ASSERT_EQ(prevCnt + 3, mCallback->mLastAcquiredCount);
+ ASSERT_EQ(7, mCallback->mLastAcquiredInfo);
+ ASSERT_EQ(13, mCallback->mLastAcquiredVendorCode);
+}
+
+TEST_F(FakeFingerprintEngineTest, Authenticate) {
+ FingerprintHalProperties::enrollments({1, 2});
+ FingerprintHalProperties::enrollment_hit(2);
+ mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future());
+ ASSERT_FALSE(mCallback->mAuthenticateFailed);
+ ASSERT_EQ(2, mCallback->mLastAuthenticated);
+ ASSERT_EQ(1, mCallback->mLastAcquiredInfo);
+}
+
+TEST_F(FakeFingerprintEngineTest, AuthenticateCancel) {
+ FingerprintHalProperties::enrollments({2});
+ FingerprintHalProperties::enrollment_hit(2);
+ mCancel.set_value();
+ mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future());
+ ASSERT_EQ(Error::CANCELED, mCallback->mError);
+ ASSERT_EQ(-1, mCallback->mLastAuthenticated);
+}
+
+TEST_F(FakeFingerprintEngineTest, AuthenticateNotSet) {
+ FingerprintHalProperties::enrollments({1, 2});
+ FingerprintHalProperties::enrollment_hit({});
+ mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future());
+ ASSERT_TRUE(mCallback->mAuthenticateFailed);
+}
+
+TEST_F(FakeFingerprintEngineTest, AuthenticateNotEnrolled) {
+ FingerprintHalProperties::enrollments({1, 2});
+ FingerprintHalProperties::enrollment_hit(3);
+ mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future());
+ ASSERT_TRUE(mCallback->mAuthenticateFailed);
+}
+
+TEST_F(FakeFingerprintEngineTest, AuthenticateLockout) {
+ FingerprintHalProperties::enrollments({22, 2});
+ FingerprintHalProperties::enrollment_hit(2);
+ FingerprintHalProperties::lockout(true);
+ mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future());
+ ASSERT_TRUE(mCallback->mLockoutPermanent);
+ ASSERT_NE(mCallback->mError, Error::UNKNOWN);
+}
+
+TEST_F(FakeFingerprintEngineTest, AuthenticateError8) {
+ FingerprintHalProperties::operation_authenticate_error(8);
+ mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future());
+ ASSERT_EQ(mCallback->mError, (Error)8);
+ ASSERT_EQ(mCallback->mErrorVendorCode, 0);
+}
+
+TEST_F(FakeFingerprintEngineTest, AuthenticateError9) {
+ FingerprintHalProperties::operation_authenticate_error(1009);
+ mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future());
+ ASSERT_EQ(mCallback->mError, (Error)7);
+ ASSERT_EQ(mCallback->mErrorVendorCode, 9);
+}
+
+TEST_F(FakeFingerprintEngineTest, AuthenticateAcquired) {
+ FingerprintHalProperties::lockout(false);
+ FingerprintHalProperties::enrollments({1, 2});
+ FingerprintHalProperties::enrollment_hit(2);
+ FingerprintHalProperties::operation_authenticate_acquired("4,1009");
+ int32_t prevCount = mCallback->mLastAcquiredCount;
+ mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future());
+ ASSERT_FALSE(mCallback->mAuthenticateFailed);
+ ASSERT_EQ(2, mCallback->mLastAuthenticated);
+ ASSERT_EQ(prevCount + 2, mCallback->mLastAcquiredCount);
+ ASSERT_EQ(7, mCallback->mLastAcquiredInfo);
+ ASSERT_EQ(9, mCallback->mLastAcquiredVendorCode);
+}
+
+TEST_F(FakeFingerprintEngineTest, InteractionDetect) {
+ FingerprintHalProperties::enrollments({1, 2});
+ FingerprintHalProperties::enrollment_hit(2);
+ FingerprintHalProperties::operation_detect_interaction_acquired("");
+ mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
+ ASSERT_EQ(1, mCallback->mInteractionDetectedCount);
+ ASSERT_EQ(1, mCallback->mLastAcquiredInfo);
+}
+
+TEST_F(FakeFingerprintEngineTest, InteractionDetectCancel) {
+ FingerprintHalProperties::enrollments({1, 2});
+ FingerprintHalProperties::enrollment_hit(2);
+ mCancel.set_value();
+ mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
+ ASSERT_EQ(Error::CANCELED, mCallback->mError);
+ ASSERT_EQ(0, mCallback->mInteractionDetectedCount);
+}
+
+TEST_F(FakeFingerprintEngineTest, InteractionDetectNotSet) {
+ FingerprintHalProperties::enrollments({1, 2});
+ FingerprintHalProperties::enrollment_hit({});
+ mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
+ ASSERT_EQ(0, mCallback->mInteractionDetectedCount);
+}
+
+TEST_F(FakeFingerprintEngineTest, InteractionDetectNotEnrolled) {
+ FingerprintHalProperties::enrollments({1, 2});
+ FingerprintHalProperties::enrollment_hit(25);
+ mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
+ ASSERT_EQ(0, mCallback->mInteractionDetectedCount);
+}
+
+TEST_F(FakeFingerprintEngineTest, InteractionDetectError) {
+ FingerprintHalProperties::operation_detect_interaction_error(8);
+ mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
+ ASSERT_EQ(0, mCallback->mInteractionDetectedCount);
+ ASSERT_EQ(mCallback->mError, (Error)8);
+ ASSERT_EQ(mCallback->mErrorVendorCode, 0);
+}
+
+TEST_F(FakeFingerprintEngineTest, InteractionDetectAcquired) {
+ FingerprintHalProperties::enrollments({1, 2});
+ FingerprintHalProperties::enrollment_hit(2);
+ FingerprintHalProperties::operation_detect_interaction_acquired("4,1013");
+ int32_t prevCount = mCallback->mLastAcquiredCount;
+ mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
+ ASSERT_EQ(1, mCallback->mInteractionDetectedCount);
+ ASSERT_EQ(prevCount + 2, mCallback->mLastAcquiredCount);
+ ASSERT_EQ(7, mCallback->mLastAcquiredInfo);
+ ASSERT_EQ(13, mCallback->mLastAcquiredVendorCode);
+}
+
+TEST_F(FakeFingerprintEngineTest, EnumerateEnrolled) {
+ FingerprintHalProperties::enrollments({2, 4, 8});
+ mEngine.enumerateEnrollmentsImpl(mCallback.get());
+ ASSERT_EQ(
+ 4,
+ mCallback->mLastEnrollmentEnumerated.size()); // Due to workaround. TODO (b/243129174)
+ for (auto id : FingerprintHalProperties::enrollments()) {
+ ASSERT_TRUE(std::find(mCallback->mLastEnrollmentEnumerated.begin(),
+ mCallback->mLastEnrollmentEnumerated.end(),
+ id) != mCallback->mLastEnrollmentEnumerated.end());
+ }
+}
+
+TEST_F(FakeFingerprintEngineTest, RemoveEnrolled) {
+ FingerprintHalProperties::enrollments({2, 4, 8, 1});
+ mEngine.removeEnrollmentsImpl(mCallback.get(), {2, 8});
+ auto enrolls = FingerprintHalProperties::enrollments();
+ ASSERT_EQ(2, mCallback->mLastEnrollmentRemoved.size());
+ for (auto id : {2, 8}) {
+ ASSERT_TRUE(std::find(mCallback->mLastEnrollmentRemoved.begin(),
+ mCallback->mLastEnrollmentRemoved.end(),
+ id) != mCallback->mLastEnrollmentRemoved.end());
+ }
+ ASSERT_EQ(2, enrolls.size());
+ for (auto id : {1, 4}) {
+ ASSERT_TRUE(std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end());
+ }
+}
+
+TEST_F(FakeFingerprintEngineTest, parseIntSequence) {
+ std::vector<int32_t> seqV;
+ seqV = mEngine.parseIntSequence("");
+ ASSERT_EQ(0, seqV.size());
+ seqV = mEngine.parseIntSequence("2");
+ ASSERT_EQ(1, seqV.size());
+ ASSERT_EQ(2, seqV[0]);
+ seqV = mEngine.parseIntSequence("2,3,4");
+ std::vector<int32_t> expV{2, 3, 4};
+ ASSERT_EQ(expV, seqV);
+ seqV = mEngine.parseIntSequence("2,3,a");
+ ASSERT_EQ(0, seqV.size());
+ seqV = mEngine.parseIntSequence("2, 3, 4");
+ ASSERT_EQ(expV, seqV);
+ seqV = mEngine.parseIntSequence("123,456");
+ ASSERT_EQ(2, seqV.size());
+ std::vector<int32_t> expV1{123, 456};
+ ASSERT_EQ(expV1, seqV);
+ seqV = mEngine.parseIntSequence("12f3,456");
+ ASSERT_EQ(0, seqV.size());
+}
+
+TEST_F(FakeFingerprintEngineTest, parseEnrollmentCaptureOk) {
+ std::vector<std::vector<int32_t>> ecV;
+ ecV = mEngine.parseEnrollmentCapture("100,200,300");
+ ASSERT_EQ(6, ecV.size());
+ std::vector<std::vector<int32_t>> expE{{100}, {200}, {300}};
+ std::vector<int32_t> defC{1};
+ for (int i = 0; i < ecV.size(); i += 2) {
+ ASSERT_EQ(expE[i / 2], ecV[i]);
+ ASSERT_EQ(defC, ecV[i + 1]);
+ }
+ ecV = mEngine.parseEnrollmentCapture("100");
+ ASSERT_EQ(2, ecV.size());
+ ASSERT_EQ(expE[0], ecV[0]);
+ ASSERT_EQ(defC, ecV[1]);
+
+ ecV = mEngine.parseEnrollmentCapture("100-[5,6,7]");
+ std::vector<int32_t> expC{5, 6, 7};
+ ASSERT_EQ(2, ecV.size());
+ for (int i = 0; i < ecV.size(); i += 2) {
+ ASSERT_EQ(expE[i / 2], ecV[i]);
+ ASSERT_EQ(expC, ecV[i + 1]);
+ }
+ ecV = mEngine.parseEnrollmentCapture("100-[5,6,7], 200, 300-[9,10]");
+ std::vector<std::vector<int32_t>> expC1{{5, 6, 7}, {1}, {9, 10}};
+ ASSERT_EQ(6, ecV.size());
+ for (int i = 0; i < ecV.size(); i += 2) {
+ ASSERT_EQ(expE[i / 2], ecV[i]);
+ ASSERT_EQ(expC1[i / 2], ecV[i + 1]);
+ }
+ ecV = mEngine.parseEnrollmentCapture("100-[5,6,7], 200-[2,1], 300-[9]");
+ std::vector<std::vector<int32_t>> expC2{{5, 6, 7}, {2, 1}, {9}};
+ ASSERT_EQ(ecV.size(), 6);
+ for (int i = 0; i < ecV.size(); i += 2) {
+ ASSERT_EQ(expE[i / 2], ecV[i]);
+ ASSERT_EQ(expC2[i / 2], ecV[i + 1]);
+ }
+}
+
+TEST_F(FakeFingerprintEngineTest, parseEnrollmentCaptureFail) {
+ std::vector<std::string> badStr{"10c", "100-5", "100-[5,6,7", "100-5,6,7]",
+ "100,2x0,300", "200-[f]", "a,b"};
+ std::vector<std::vector<int32_t>> ecV;
+ for (const auto s : badStr) {
+ ecV = mEngine.parseEnrollmentCapture(s);
+ ASSERT_EQ(ecV.size(), 0);
+ }
+}
+
+} // namespace aidl::android::hardware::biometrics::fingerprint
+
+int main(int argc, char** argv) {
+ testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp
new file mode 100644
index 0000000..7c0021f
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include <android/binder_process.h>
+#include <fingerprint.sysprop.h>
+#include <gtest/gtest.h>
+
+#include <android-base/logging.h>
+
+#include "FakeFingerprintEngine.h"
+#include "FakeFingerprintEngineUdfps.h"
+
+using namespace ::android::fingerprint::virt;
+using namespace ::aidl::android::hardware::biometrics::fingerprint;
+using namespace ::aidl::android::hardware::keymaster;
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+class FakeFingerprintEngineUdfpsTest : public ::testing::Test {
+ protected:
+ void SetUp() override {}
+
+ void TearDown() override {
+ // reset to default
+ FingerprintHalProperties::sensor_location("");
+ }
+
+ FakeFingerprintEngineUdfps mEngine;
+};
+
+bool isDefaultLocation(SensorLocation& sc) {
+ return (sc.sensorLocationX == FakeFingerprintEngineUdfps::defaultSensorLocationX &&
+ sc.sensorLocationY == FakeFingerprintEngineUdfps::defaultSensorLocationY &&
+ sc.sensorRadius == FakeFingerprintEngineUdfps::defaultSensorRadius && sc.display == "");
+}
+
+TEST_F(FakeFingerprintEngineUdfpsTest, getSensorLocationOk) {
+ auto loc = "100:200:30";
+ FingerprintHalProperties::sensor_location(loc);
+ SensorLocation sc = mEngine.getSensorLocation();
+ ASSERT_TRUE(sc.sensorLocationX == 100);
+ ASSERT_TRUE(sc.sensorLocationY == 200);
+ ASSERT_TRUE(sc.sensorRadius == 30);
+
+ loc = "100:200:30:screen1";
+ FingerprintHalProperties::sensor_location(loc);
+ sc = mEngine.getSensorLocation();
+ ASSERT_TRUE(sc.sensorLocationX == 100);
+ ASSERT_TRUE(sc.sensorLocationY == 200);
+ ASSERT_TRUE(sc.sensorRadius == 30);
+ ASSERT_TRUE(sc.display == "screen1");
+}
+
+TEST_F(FakeFingerprintEngineUdfpsTest, getSensorLocationBad) {
+ FingerprintHalProperties::sensor_location("");
+ SensorLocation sc = mEngine.getSensorLocation();
+ ASSERT_TRUE(isDefaultLocation(sc));
+
+ auto loc = "100";
+ FingerprintHalProperties::sensor_location(loc);
+ sc = mEngine.getSensorLocation();
+ ASSERT_TRUE(isDefaultLocation(sc));
+
+ loc = "10:20";
+ FingerprintHalProperties::sensor_location(loc);
+ sc = mEngine.getSensorLocation();
+ ASSERT_TRUE(isDefaultLocation(sc));
+
+ loc = "10,20,5";
+ FingerprintHalProperties::sensor_location(loc);
+ sc = mEngine.getSensorLocation();
+ ASSERT_TRUE(isDefaultLocation(sc));
+
+ loc = "a:b:c";
+ FingerprintHalProperties::sensor_location(loc);
+ sc = mEngine.getSensorLocation();
+ ASSERT_TRUE(isDefaultLocation(sc));
+}
+
+// More
+} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/vts/Android.bp b/biometrics/fingerprint/aidl/vts/Android.bp
index 30d5624..a474f66 100644
--- a/biometrics/fingerprint/aidl/vts/Android.bp
+++ b/biometrics/fingerprint/aidl/vts/Android.bp
@@ -15,8 +15,8 @@
],
srcs: ["VtsHalBiometricsFingerprintTargetTest.cpp"],
static_libs: [
- "android.hardware.biometrics.common-V1-ndk",
- "android.hardware.biometrics.fingerprint-V1-ndk",
+ "android.hardware.biometrics.common-V2-ndk",
+ "android.hardware.biometrics.fingerprint-V2-ndk",
"android.hardware.keymaster-V3-ndk",
],
shared_libs: [
diff --git a/broadcastradio/2.0/default/TunerSession.cpp b/broadcastradio/2.0/default/TunerSession.cpp
index 2ba4d02..cc2f1a5 100644
--- a/broadcastradio/2.0/default/TunerSession.cpp
+++ b/broadcastradio/2.0/default/TunerSession.cpp
@@ -241,13 +241,13 @@
};
std::copy_if(list.begin(), list.end(), std::back_inserter(filteredList), filterCb);
- auto task = [this, list]() {
+ auto task = [this, filteredList]() {
lock_guard<mutex> lk(mMut);
ProgramListChunk chunk = {};
chunk.purge = true;
chunk.complete = true;
- chunk.modified = hidl_vec<ProgramInfo>(list.begin(), list.end());
+ chunk.modified = hidl_vec<ProgramInfo>(filteredList.begin(), filteredList.end());
mCallback->onProgramListUpdated(chunk);
};
diff --git a/broadcastradio/2.0/default/VirtualRadio.cpp b/broadcastradio/2.0/default/VirtualRadio.cpp
index c59fd8f..e6b1017 100644
--- a/broadcastradio/2.0/default/VirtualRadio.cpp
+++ b/broadcastradio/2.0/default/VirtualRadio.cpp
@@ -46,9 +46,9 @@
VirtualRadio gDabRadio(
"DAB radio mock",
{
- {make_selector_dab(12345, 225648), "BBC Radio 1", "Khalid", "Talk"}, // 12B
- {make_selector_dab(22345, 222064), "Classic FM", "Jean Sibelius", "Andante Festivo"}, // 11D
- {make_selector_dab(32345, 222064), "Absolute Radio", "Coldplay", "Clocks"}, // 11D
+ {make_selector_dab(0xA00001u, 0x0001u), "BBC Radio 1", "Khalid", "Talk"},
+ {make_selector_dab(0xB00001u, 0x1001u), "Classic FM", "Jean Sibelius", "Andante Festivo"},
+ {make_selector_dab(0xB00002u, 0x1001u), "Absolute Radio", "Coldplay", "Clocks"},
});
// clang-format on
diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
index 615fde0..5e8a5cf 100644
--- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
+++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
@@ -108,6 +108,7 @@
bool openSession();
bool getAmFmRegionConfig(bool full, AmFmRegionConfig* config);
std::optional<utils::ProgramInfoSet> getProgramList();
+ std::optional<utils::ProgramInfoSet> getProgramList(const ProgramFilter& filter);
sp<IBroadcastRadio> mModule;
Properties mProperties;
@@ -239,9 +240,15 @@
}
std::optional<utils::ProgramInfoSet> BroadcastRadioHalTest::getProgramList() {
+ ProgramFilter emptyFilter = {};
+ return getProgramList(emptyFilter);
+}
+
+std::optional<utils::ProgramInfoSet> BroadcastRadioHalTest::getProgramList(
+ const ProgramFilter& filter) {
EXPECT_TIMEOUT_CALL(*mCallback, onProgramListReady).Times(AnyNumber());
- auto startResult = mSession->startProgramListUpdates({});
+ auto startResult = mSession->startProgramListUpdates(filter);
if (startResult == Result::NOT_SUPPORTED) {
printSkipped("Program list not supported");
return std::nullopt;
@@ -810,20 +817,98 @@
}
/**
- * Test getting program list.
+ * Test getting program list using empty program filter.
*
* Verifies that:
* - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
* - the complete list is fetched within timeout::programListScan;
* - stopProgramListUpdates does not crash.
*/
-TEST_P(BroadcastRadioHalTest, GetProgramList) {
+TEST_P(BroadcastRadioHalTest, GetProgramListFromEmptyFilter) {
ASSERT_TRUE(openSession());
getProgramList();
}
/**
+ * Test getting program list using AMFM frequency program filter.
+ *
+ * Verifies that:
+ * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
+ * - the complete list is fetched within timeout::programListScan;
+ * - stopProgramListUpdates does not crash;
+ * - result for startProgramListUpdates using a filter with AMFM_FREQUENCY value of the first AMFM
+ * program matches the expected result.
+ */
+TEST_P(BroadcastRadioHalTest, GetProgramListFromAmFmFilter) {
+ ASSERT_TRUE(openSession());
+
+ auto completeList = getProgramList();
+ if (!completeList) return;
+
+ ProgramFilter amfmFilter = {};
+ int expectedResultSize = 0;
+ uint64_t expectedFreq = 0;
+ for (auto&& program : *completeList) {
+ auto amfmIds = utils::getAllIds(program.selector, IdentifierType::AMFM_FREQUENCY);
+ EXPECT_LE(amfmIds.size(), 1u);
+ if (amfmIds.size() == 0) continue;
+
+ if (expectedResultSize == 0) {
+ expectedFreq = amfmIds[0];
+ amfmFilter.identifiers = {
+ make_identifier(IdentifierType::AMFM_FREQUENCY, expectedFreq)};
+ expectedResultSize = 1;
+ } else if (amfmIds[0] == expectedFreq) {
+ expectedResultSize++;
+ }
+ }
+
+ if (expectedResultSize == 0) return;
+ auto amfmList = getProgramList(amfmFilter);
+ ASSERT_EQ(expectedResultSize, amfmList->size()) << "amfm filter result size is wrong";
+}
+
+/**
+ * Test getting program list using DAB ensemble program filter.
+ *
+ * Verifies that:
+ * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
+ * - the complete list is fetched within timeout::programListScan;
+ * - stopProgramListUpdates does not crash;
+ * - result for startProgramListUpdates using a filter with DAB_ENSEMBLE value of the first DAB
+ * program matches the expected result.
+ */
+TEST_P(BroadcastRadioHalTest, GetProgramListFromDabFilter) {
+ ASSERT_TRUE(openSession());
+
+ auto completeList = getProgramList();
+ if (!completeList) return;
+
+ ProgramFilter dabFilter = {};
+ int expectedResultSize = 0;
+ uint64_t expectedEnsemble = 0;
+ for (auto&& program : *completeList) {
+ auto dabEnsembles = utils::getAllIds(program.selector, IdentifierType::DAB_ENSEMBLE);
+ EXPECT_LE(dabEnsembles.size(), 1u);
+ if (dabEnsembles.size() == 0) continue;
+
+ if (expectedResultSize == 0) {
+ expectedEnsemble = dabEnsembles[0];
+ dabFilter.identifiers = {
+ make_identifier(IdentifierType::DAB_ENSEMBLE, expectedEnsemble)};
+ expectedResultSize = 1;
+ } else if (dabEnsembles[0] == expectedEnsemble) {
+ expectedResultSize++;
+ }
+ }
+
+ if (expectedResultSize == 0) return;
+ auto dabList = getProgramList(dabFilter);
+ ASSERT_EQ(expectedResultSize, dabList->size()) << "dab filter result size is wrong";
+}
+
+/**
* Test HD_STATION_NAME correctness.
*
* Verifies that if a program on the list contains HD_STATION_NAME identifier:
diff --git a/broadcastradio/aidl/Android.bp b/broadcastradio/aidl/Android.bp
new file mode 100644
index 0000000..2d8078b
--- /dev/null
+++ b/broadcastradio/aidl/Android.bp
@@ -0,0 +1,40 @@
+//
+// Copyright (C) 2022 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 {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+aidl_interface {
+ name: "android.hardware.broadcastradio",
+ vendor_available: true,
+ srcs: ["android/hardware/broadcastradio/*.aidl"],
+ stability: "vintf",
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ sdk_version: "module_current",
+ min_sdk_version: "Tiramisu",
+ },
+ },
+}
diff --git a/broadcastradio/aidl/OWNERS b/broadcastradio/aidl/OWNERS
new file mode 100644
index 0000000..302fdd7
--- /dev/null
+++ b/broadcastradio/aidl/OWNERS
@@ -0,0 +1,4 @@
+xuweilin@google.com
+oscarazu@google.com
+ericjeong@google.com
+keunyoung@google.com
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl
new file mode 100644
index 0000000..ca511aa
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable AmFmBandRange {
+ int lowerBound;
+ int upperBound;
+ int spacing;
+ int seekSpacing;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl
new file mode 100644
index 0000000..f3aecdf
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable AmFmRegionConfig {
+ android.hardware.broadcastradio.AmFmBandRange[] ranges;
+ int fmDeemphasis;
+ int fmRds;
+ const int DEEMPHASIS_D50 = 1;
+ const int DEEMPHASIS_D75 = 2;
+ const int RDS = 1;
+ const int RBDS = 2;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl
new file mode 100644
index 0000000..bbdd86f
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable Announcement {
+ android.hardware.broadcastradio.ProgramSelector selector;
+ android.hardware.broadcastradio.AnnouncementType type = android.hardware.broadcastradio.AnnouncementType.INVALID;
+ android.hardware.broadcastradio.VendorKeyValue[] vendorInfo;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl
new file mode 100644
index 0000000..237b868
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@Backing(type="byte") @JavaDerive(equals=true, toString=true) @VintfStability
+enum AnnouncementType {
+ INVALID = 0,
+ EMERGENCY = 1,
+ WARNING = 2,
+ TRAFFIC = 3,
+ WEATHER = 4,
+ NEWS = 5,
+ EVENT = 6,
+ SPORT = 7,
+ MISC = 8,
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl
new file mode 100644
index 0000000..6fb9a62
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability
+enum ConfigFlag {
+ FORCE_MONO = 1,
+ FORCE_ANALOG = 2,
+ FORCE_DIGITAL = 3,
+ RDS_AF = 4,
+ RDS_REG = 5,
+ DAB_DAB_LINKING = 6,
+ DAB_FM_LINKING = 7,
+ DAB_DAB_SOFT_LINKING = 8,
+ DAB_FM_SOFT_LINKING = 9,
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl
new file mode 100644
index 0000000..162f4abd
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable DabTableEntry {
+ String label;
+ int frequencyKhz;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl
new file mode 100644
index 0000000..346af58
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@VintfStability
+interface IAnnouncementListener {
+ oneway void onListUpdated(in android.hardware.broadcastradio.Announcement[] announcements);
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl
new file mode 100644
index 0000000..39eb04c
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@VintfStability
+interface IBroadcastRadio {
+ android.hardware.broadcastradio.Properties getProperties();
+ android.hardware.broadcastradio.AmFmRegionConfig getAmFmRegionConfig(in boolean full);
+ android.hardware.broadcastradio.DabTableEntry[] getDabRegionConfig();
+ void setTunerCallback(in android.hardware.broadcastradio.ITunerCallback callback);
+ void unsetTunerCallback();
+ void tune(in android.hardware.broadcastradio.ProgramSelector program);
+ void seek(in boolean directionUp, in boolean skipSubChannel);
+ void step(in boolean directionUp);
+ void cancel();
+ void startProgramListUpdates(in android.hardware.broadcastradio.ProgramFilter filter);
+ void stopProgramListUpdates();
+ boolean isConfigFlagSet(in android.hardware.broadcastradio.ConfigFlag flag);
+ void setConfigFlag(in android.hardware.broadcastradio.ConfigFlag flag, in boolean value);
+ android.hardware.broadcastradio.VendorKeyValue[] setParameters(in android.hardware.broadcastradio.VendorKeyValue[] parameters);
+ android.hardware.broadcastradio.VendorKeyValue[] getParameters(in String[] keys);
+ byte[] getImage(in int id);
+ android.hardware.broadcastradio.ICloseHandle registerAnnouncementListener(in android.hardware.broadcastradio.IAnnouncementListener listener, in android.hardware.broadcastradio.AnnouncementType[] enabled);
+ const int INVALID_IMAGE = 0;
+ const int ANTENNA_STATE_CHANGE_TIMEOUT_MS = 100;
+ const int LIST_COMPLETE_TIMEOUT_MS = 300000;
+ const int TUNER_TIMEOUT_MS = 30000;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl
new file mode 100644
index 0000000..75e7f2a
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@VintfStability
+interface ICloseHandle {
+ void close();
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl
new file mode 100644
index 0000000..f5badad
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@VintfStability
+interface ITunerCallback {
+ oneway void onTuneFailed(in android.hardware.broadcastradio.Result result, in android.hardware.broadcastradio.ProgramSelector selector);
+ oneway void onCurrentProgramInfoChanged(in android.hardware.broadcastradio.ProgramInfo info);
+ oneway void onProgramListUpdated(in android.hardware.broadcastradio.ProgramListChunk chunk);
+ oneway void onAntennaStateChange(in boolean connected);
+ oneway void onConfigFlagUpdated(in android.hardware.broadcastradio.ConfigFlag flag, in boolean value);
+ oneway void onParametersUpdated(in android.hardware.broadcastradio.VendorKeyValue[] parameters);
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl
new file mode 100644
index 0000000..4e8296a
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability
+enum IdentifierType {
+ VENDOR_START = 1000,
+ VENDOR_END = 1999,
+ INVALID = 0,
+ AMFM_FREQUENCY_KHZ = 1,
+ RDS_PI = 2,
+ HD_STATION_ID_EXT = 3,
+ HD_STATION_NAME = 4,
+ DAB_SID_EXT = 5,
+ DAB_ENSEMBLE = 6,
+ DAB_SCID = 7,
+ DAB_FREQUENCY_KHZ = 8,
+ DRMO_SERVICE_ID = 9,
+ DRMO_FREQUENCY_KHZ = 10,
+ SXM_SERVICE_ID = 12,
+ SXM_CHANNEL = 13,
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl
new file mode 100644
index 0000000..e02b6b1
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+union Metadata {
+ String rdsPs;
+ int rdsPty;
+ int rbdsPty;
+ String rdsRt;
+ String songTitle;
+ String songArtist;
+ String songAlbum;
+ int stationIcon;
+ int albumArt;
+ String programName;
+ String dabEnsembleName;
+ String dabEnsembleNameShort;
+ String dabServiceName;
+ String dabServiceNameShort;
+ String dabComponentName;
+ String dabComponentNameShort;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl
new file mode 100644
index 0000000..9edeb8d
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable ProgramFilter {
+ android.hardware.broadcastradio.IdentifierType[] identifierTypes;
+ android.hardware.broadcastradio.ProgramIdentifier[] identifiers;
+ boolean includeCategories;
+ boolean excludeModifications;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl
new file mode 100644
index 0000000..6676350
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable ProgramIdentifier {
+ android.hardware.broadcastradio.IdentifierType type = android.hardware.broadcastradio.IdentifierType.INVALID;
+ long value;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl
new file mode 100644
index 0000000..5e662d2
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable ProgramInfo {
+ android.hardware.broadcastradio.ProgramSelector selector;
+ android.hardware.broadcastradio.ProgramIdentifier logicallyTunedTo;
+ android.hardware.broadcastradio.ProgramIdentifier physicallyTunedTo;
+ @nullable android.hardware.broadcastradio.ProgramIdentifier[] relatedContent;
+ int infoFlags;
+ int signalQuality;
+ android.hardware.broadcastradio.Metadata[] metadata;
+ android.hardware.broadcastradio.VendorKeyValue[] vendorInfo;
+ const int FLAG_LIVE = 1;
+ const int FLAG_MUTED = 2;
+ const int FLAG_TRAFFIC_PROGRAM = 4;
+ const int FLAG_TRAFFIC_ANNOUNCEMENT = 8;
+ const int FLAG_TUNABLE = 16;
+ const int FLAG_STEREO = 32;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl
new file mode 100644
index 0000000..5d53b99
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable ProgramListChunk {
+ boolean purge;
+ boolean complete;
+ android.hardware.broadcastradio.ProgramInfo[] modified;
+ @nullable android.hardware.broadcastradio.ProgramIdentifier[] removed;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl
new file mode 100644
index 0000000..9af1dc8
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable ProgramSelector {
+ android.hardware.broadcastradio.ProgramIdentifier primaryId;
+ android.hardware.broadcastradio.ProgramIdentifier[] secondaryIds;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl
new file mode 100644
index 0000000..643b819
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable Properties {
+ String maker;
+ String product;
+ String version;
+ String serial;
+ android.hardware.broadcastradio.IdentifierType[] supportedIdentifierTypes;
+ android.hardware.broadcastradio.VendorKeyValue[] vendorInfo;
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl
new file mode 100644
index 0000000..07edae8
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@Backing(type="int") @VintfStability
+enum Result {
+ OK = 0,
+ INTERNAL_ERROR = 1,
+ INVALID_ARGUMENTS = 2,
+ INVALID_STATE = 3,
+ NOT_SUPPORTED = 4,
+ TIMEOUT = 5,
+ UNKNOWN_ERROR = 6,
+}
diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl
new file mode 100644
index 0000000..3c6b194
--- /dev/null
+++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.broadcastradio;
+@JavaDerive(equals=true, toString=true) @VintfStability
+parcelable VendorKeyValue {
+ String key;
+ String value;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl
new file mode 100644
index 0000000..562631f
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+/**
+ * Defines the AM/FM band range for configuring different regions.
+ *
+ * <p>Channel grid is defined as: each possible channel is set at
+ * lowerBound + channelNumber * spacing, up to upperBound.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable AmFmBandRange {
+ /**
+ * The frequency (in kHz) of the first channel within the range.
+ *
+ * Lower bound must be a tunable frequency.
+ */
+ int lowerBound;
+
+ /**
+ * The frequency (in kHz) of the last channel within the range.
+ */
+ int upperBound;
+
+ /**
+ * Channel grid resolution (in kHz), telling how far the channels are apart.
+ */
+ int spacing;
+
+ /**
+ * Channel spacing (in kHz) used to speed up seeking to the next station
+ * via the {@link IBroadcastRadio#seek} operation.
+ *
+ * It must be a multiple of channel grid resolution.
+ *
+ * Tuner may first quickly check every n-th channel and if it detects echo
+ * from a station, it fine-tunes to find the exact frequency.
+ *
+ * It's ignored for capabilities check (with full=true when calling
+ * getAmFmRegionConfig).
+ */
+ int seekSpacing;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl
new file mode 100644
index 0000000..a3086c6
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.AmFmBandRange;
+
+/**
+ * Regional configuration for AM/FM.
+ *
+ * <p>For hardware capabilities check (with full=true when calling
+ * {@link IBroadcastRadio#getAmFmRegionConfig}), HAL implementation fills
+ * entire supported range of frequencies and features.
+ *
+ * When checking current configuration, at most one bit in each bitset
+ * can be set.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable AmFmRegionConfig {
+ /**
+ * Noth D50 and D75 are FM de-emphasis filter supported or configured.
+ *
+ * Both might be set for hardware capabilities check (with full={@code true}
+ * when calling getAmFmRegionConfig), but exactly one for specific region
+ * settings.
+ */
+ const int DEEMPHASIS_D50 = 1 << 0;
+
+ const int DEEMPHASIS_D75 = 1 << 1;
+
+ /**
+ * Both RDS and RBDS are supported or configured RDS variants.
+ *
+ * Both might be set for hardware capabilities check (with full={@code true}
+ * when calling getAmFmRegionConfig), but only one (or none) for specific
+ * region settings.
+ *
+ * RDS is Standard variant, used everywhere except North America.
+ */
+ const int RDS = 1 << 0;
+
+ /**
+ * Variant used in North America (see RDS).
+ */
+ const int RBDS = 1 << 1;
+
+ /**
+ * All supported or configured AM/FM bands.
+ *
+ * AM/FM bands are identified by frequency value
+ * (see {@link IdentifierType#AMFM_FREQUENCY_KHZ}).
+ *
+ * With typical configuration, it's expected to have two frequency ranges
+ * for capabilities check (AM and FM) and four ranges for specific region
+ * configuration (AM LW, AM MW, AM SW, FM).
+ */
+ AmFmBandRange[] ranges;
+
+ /**
+ * De-emphasis filter supported/configured.
+ *
+ * It is a bitset of de-emphasis values (DEEMPHASIS_D50 and DEEMPHASIS_D75).
+ */
+ int fmDeemphasis;
+
+ /**
+ * RDS/RBDS variant supported/configured.
+ *
+ * It is a bitset of RDS values (RDS and RBDS).
+ */
+ int fmRds;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl
new file mode 100644
index 0000000..a972d4d
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.AnnouncementType;
+import android.hardware.broadcastradio.ProgramSelector;
+import android.hardware.broadcastradio.VendorKeyValue;
+
+/**
+ * Station broadcasting active announcement.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable Announcement {
+ /**
+ * Program selector to tune to the announcement.
+ */
+ ProgramSelector selector;
+
+ /**
+ * Announcement type.
+ */
+ AnnouncementType type = AnnouncementType.INVALID;
+
+ /**
+ * Vendor-specific information.
+ *
+ * It may be used for extra features, not supported by the platform,
+ * for example: com.me.hdradio.urgency=100; com.me.hdradio.certainity=50.
+ */
+ VendorKeyValue[] vendorInfo;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl
new file mode 100644
index 0000000..8df8025
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+/**
+ * Type of an announcement.
+ *
+ * <p>It maps to different announcement types for each radio technology.
+ */
+@VintfStability
+@Backing(type="byte")
+@JavaDerive(equals=true, toString=true)
+enum AnnouncementType {
+ /**
+ * Undefined announcement type
+ */
+ INVALID = 0,
+
+ /**
+ * DAB alarm, RDS emergency program type (PTY 31).
+ */
+ EMERGENCY = 1,
+
+ /**
+ * DAB warning.
+ */
+ WARNING,
+
+ /**
+ * DAB road traffic, RDS TA, HD Radio transportation.
+ */
+ TRAFFIC,
+
+ /**
+ * Weather.
+ */
+ WEATHER,
+
+ /**
+ * News.
+ */
+ NEWS,
+
+ /**
+ * DAB event, special event.
+ */
+ EVENT,
+
+ /**
+ * DAB sport report, RDS sports.
+ */
+ SPORT,
+
+ /**
+ * All others.
+ */
+ MISC,
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl
new file mode 100644
index 0000000..11da39c
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+/**
+ * Configuration flags to be used with isConfigFlagSet and setConfigFlag methods
+ * of IBroadcastRadio.
+ */
+@VintfStability
+@Backing(type="int")
+@JavaDerive(equals=true, toString=true)
+enum ConfigFlag {
+ /**
+ * Forces mono audio stream reception.
+ *
+ * Analog broadcasts can recover poor reception conditions by jointing
+ * stereo channels into one. Mainly for, but not limited to AM/FM.
+ */
+ FORCE_MONO = 1,
+
+ /**
+ * Forces the analog playback for the supporting radio technology.
+ *
+ * User may disable digital playback for FM HD Radio or hybrid FM/DAB with
+ * this option. This is purely user choice, ie. does not reflect digital-
+ * analog handover state managed from the HAL implementation side.
+ *
+ * Some radio technologies may not support this, ie. DAB.
+ */
+ FORCE_ANALOG,
+
+ /**
+ * Forces the digital playback for the supporting radio technology.
+ *
+ * User may disable digital-analog handover that happens with poor
+ * reception conditions. With digital forced, the radio will remain silent
+ * instead of switching to analog channel if it's available. This is purely
+ * user choice, it does not reflect the actual state of handover.
+ */
+ FORCE_DIGITAL,
+
+ /**
+ * RDS Alternative Frequencies.
+ *
+ * If set and the currently tuned RDS station broadcasts on multiple
+ * channels, radio tuner automatically switches to the best available
+ * alternative.
+ */
+ RDS_AF,
+
+ /**
+ * RDS region-specific program lock-down.
+ *
+ * Allows user to lock to the current region as they move into the
+ * other region.
+ */
+ RDS_REG,
+
+ /**
+ * Enables DAB-DAB hard- and implicit-linking (the same content).
+ */
+ DAB_DAB_LINKING,
+
+ /**
+ * Enables DAB-FM hard- and implicit-linking (the same content).
+ */
+ DAB_FM_LINKING,
+
+ /**
+ * Enables DAB-DAB soft-linking (related content).
+ */
+ DAB_DAB_SOFT_LINKING,
+
+ /**
+ * Enables DAB-FM soft-linking (related content).
+ */
+ DAB_FM_SOFT_LINKING,
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl
new file mode 100644
index 0000000..13c20b0
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+/**
+ * An entry in regional configuration for DAB.
+ *
+ * <p>This defines a frequency table row for ensembles.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable DabTableEntry {
+ /**
+ * Channel name, i.e. 5A, 7B.
+ *
+ * It must match the following regular expression:
+ * /^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$/ (2-7 uppercase alphanumeric characters
+ * without spaces allowed at the beginning nor end).
+ */
+ String label;
+
+ /**
+ * Frequency, in kHz.
+ */
+ int frequencyKhz;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl
new file mode 100644
index 0000000..f6021c1
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.Announcement;
+
+/**
+ * Callback interface for announcement listener.
+ *
+ * For typical configuration, the listener is a broadcast radio service.
+ */
+@VintfStability
+interface IAnnouncementListener {
+ /**
+ * Called whenever announcement list has changed.
+ *
+ * @param announcements The complete list of currently active announcements.
+ */
+ oneway void onListUpdated(in Announcement[] announcements);
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl
new file mode 100644
index 0000000..0f88fc0
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl
@@ -0,0 +1,353 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.AmFmRegionConfig;
+import android.hardware.broadcastradio.AnnouncementType;
+import android.hardware.broadcastradio.ConfigFlag;
+import android.hardware.broadcastradio.DabTableEntry;
+import android.hardware.broadcastradio.IAnnouncementListener;
+import android.hardware.broadcastradio.ICloseHandle;
+import android.hardware.broadcastradio.ITunerCallback;
+import android.hardware.broadcastradio.ProgramFilter;
+import android.hardware.broadcastradio.ProgramSelector;
+import android.hardware.broadcastradio.Properties;
+import android.hardware.broadcastradio.VendorKeyValue;
+
+/**
+ * Represents a hardware broadcast radio module. A single module may contain
+ * multiple hardware tuners (i.e. with an additional background tuner), but the
+ * layers above the HAL see them as a single logical unit.
+ */
+@VintfStability
+interface IBroadcastRadio {
+ /**
+ * Invalid identifier for {@link IBroadcastRadio#getImage}.
+ */
+ const int INVALID_IMAGE = 0;
+
+ /**
+ * If the antenna is disconnected from the beginning, the
+ * {@link ITunerCallback#onAntennaStateChange} callback must be
+ * called within this time.
+ */
+ const int ANTENNA_STATE_CHANGE_TIMEOUT_MS = 100;
+
+ /**
+ * All chunks of a signal program list update must be transmitted
+ * within this time.
+ */
+ const int LIST_COMPLETE_TIMEOUT_MS = 300000;
+
+ /**
+ * All tune, seek and step operations must be completed within
+ * this time.
+ */
+ const int TUNER_TIMEOUT_MS = 30000;
+
+ /**
+ * Returns module properties: a description of a module and its
+ * capabilities. This method must not fail.
+ *
+ * @return Module description.
+ */
+ Properties getProperties();
+
+ /**
+ * Fetches current or possible AM/FM region configuration.
+ *
+ * If the tuner doesn't support AM/FM, a service-specific error
+ * {@link Result#NOT_SUPPORTED} will be returned.
+ *
+ * @param full If {@code true}, returns full hardware capabilities.
+ * If {@code false}, returns current regional configuration.
+ * @return config Hardware capabilities (full={@code true}) or current configuration
+ * (full={@code false}).
+ */
+ AmFmRegionConfig getAmFmRegionConfig(in boolean full);
+
+ /**
+ * Fetches current DAB region configuration.
+ *
+ * If tuner doesn't support DAB, a service-specific error
+ * {@link Result#NOT_SUPPORTED} wiil be returned.
+ *
+ * @return config Current configuration.
+ */
+ DabTableEntry[] getDabRegionConfig();
+
+ /**
+ * Sets callback interface.
+ *
+ * It is expected that there will only ever be a single callback set.
+ * If called when a callback is already set, the existing one should be
+ * replaced with the new callback.
+ *
+ * If the callback to be set is null, a service-specific error
+ * {@link Result#INVALID_ARGUMENTS} will be returned; if the callback
+ * is not set successfully, a service-specific error
+ * {@link Result#NOT_SUPPORTED} should be returned.
+ *
+ * @param callback The callback interface used for BroadcastRadio HAL.
+ */
+ void setTunerCallback(in ITunerCallback callback);
+
+ /**
+ * Unsets callback interface.
+ *
+ * The existing callback is set to null.
+ */
+ void unsetTunerCallback();
+
+ /**
+ * Tunes to a specified program.
+ *
+ * Automatically cancels pending tune(), seek() or step().
+ * The method should first check whether tune can be processed by the status
+ * of tuner and inputs, schedule tune task, and then return status
+ * immediately. If a non-null callback is not set, a service-specific
+ * error {@link Result#INVALID_STATE} will be returned; if the program
+ * selector doesn't contain any supported identifier, a service-specific error
+ * {@link Result#NOT_SUPPORTED} will be returned; if the program selector
+ * contains identifiers in invalid format (i.e. out of range), a
+ * service-specific error {@link Result#INVALID_ARGUMENTS} will be returned;
+ * otherwise, OK will be returned as status. Tune task should be processed
+ * asynchronously after the method returns status. If the method returns OK,
+ * {@link ITunerCallback#tuneFailed} or
+ * {@link ITunerCallback#currentProgramInfoChanged} callback must be called
+ * after the tune task completes.
+ *
+ * @param program Program to tune to.
+ */
+ void tune(in ProgramSelector program);
+
+ /**
+ * Seeks the next valid program on the "air".
+ *
+ * Advance to the next detected program and stay there.
+ *
+ * Automatically cancels pending tune(), seek() or step().
+ * The method should first check whether seek can be processed by the status
+ * of tuner and inputs, schedule seek task, and then return status
+ * immediately. If a non-null callback is not set, a service-specific
+ * error {@link Result#INVALID_STATE} will be returned; otherwise, OK will
+ * be returned as status. Seek task should be processed asynchronously
+ * after the method returns status. If the method returns OK,
+ * {@link ITunerCallback#tuneFailed} or
+ * {@link ITunerCallback#currentProgramInfoChanged} callback must be called
+ * after the seek task completes.
+ *
+ * The skipSubChannel parameter is used to skip digital radio subchannels:
+ * - HD Radio SPS;
+ * - DAB secondary service.
+ *
+ * As an implementation detail, the HAL has the option to perform an actual
+ * seek or select the next program from the list retrieved in the
+ * background.
+ *
+ * @param directionUp {@code true} to change towards higher numeric values
+ * (frequency, channel number), {@code false} towards
+ * lower.
+ * @param skipSubChannel Don't tune to subchannels.
+ */
+ void seek(in boolean directionUp, in boolean skipSubChannel);
+
+ /**
+ * Steps to the adjacent channel, which may not be occupied by any program.
+ *
+ * Automatically cancels pending tune(), seek() or step().
+ * The method should first check whether step can be processed by the status
+ * of tuner and inputs, schedule step task, and then return status
+ * immediately. If a non-null callback is not set, service-specific
+ * error {@link Result#INVALID_STATE} will be returned; if tuning to an
+ * unoccupied channel is not supported (i.e. for satellite radio), a
+ * service-specific error {@link Result#NOT_SUPPORTED} will be returned;
+ * otherwise, OK should be returned as status. Step task should be
+ * processed asynchronously after the method returns status. If the
+ * method returns OK, {@link ITunerCallback#tuneFailed} or
+ * {@link currentProgramInfoChanged} callback must be called after the
+ * step task completes.
+ *
+ * @param directionUp {@code true} to change towards higher numeric values
+ * (frequency, channel number), {@code false} towards lower.
+ */
+ void step(in boolean directionUp);
+
+ /**
+ * Cancels pending tune(), seek() or step().
+ *
+ * If there is no such operation running, the call can be ignored.
+ * If cancel is called after the HAL completes an operation (tune, seek, and step)
+ * and before the callback completions, the cancel can be ignored and the callback
+ * should complete.
+ */
+ void cancel();
+
+ /**
+ * Applies a filter to the program list and starts sending program list
+ * update over {@link ITunerCallback#onProgramListUpdated} callback.
+ *
+ * There may be only one updates stream active at the moment. Calling this
+ * method again must result in cancelling the pending update request.
+ *
+ * This call clears the program list on the client side, the HAL must send
+ * the whole list again.
+ *
+ * If the program list scanning hardware (i.e. background tuner) is
+ * unavailable at the moment, the call must succeed and start updates
+ * when it becomes available.
+ *
+ * If the program list scanning is not supported by the hardware, a
+ * service-specific error {@link Result#NOT_SUPPORTED} will be returned.
+ *
+ * @param filter Filter to apply on the fetched program list.
+ */
+ void startProgramListUpdates(in ProgramFilter filter);
+
+ /**
+ * Stops sending program list updates.
+ *
+ * If stopProgramListUpdates is called after the HAL completes a program list update
+ * and before the onCurrentProgramInfoChanged callback completions,
+ * stopProgramListUpdates can be ignored and the callback should complete.
+ */
+ void stopProgramListUpdates();
+
+ /**
+ * Fetches the current setting of a given config flag.
+ *
+ * The success/failure result must be consistent with setConfigFlag.
+ *
+ * If the flag is not applicable, a service-specific error
+ * {@link Result#INVALID_STATE} will be returned. If the flag is not
+ * supported at all, a service-specific error {@link Result#NOT_SUPPORTED}
+ * will be returned.
+ *
+ * @return the current value of the flag, if succeed.
+ */
+ boolean isConfigFlagSet(in ConfigFlag flag);
+
+ /**
+ * Sets the config flag.
+ *
+ * The success/failure result must be consistent with isConfigFlagSet.
+ *
+ * If the flag is not applicable, a service-specific error
+ * {@link Result#INVALID_STATE} will be returned. If the flag is not
+ * supported at all, a service-specific error {@link Result#NOT_SUPPORTED}
+ * will be returned.
+ *
+ * @param flag Flag to set.
+ * @param value The new value of a given flag.
+ */
+ void setConfigFlag(in ConfigFlag flag, in boolean value);
+
+ /**
+ * Generic method for setting vendor-specific parameter values.
+ * The framework does not interpret the parameters, they are passed
+ * in an opaque manner between a vendor application and HAL.
+ *
+ * Framework does not make any assumptions on the keys or values, other than
+ * ones stated in VendorKeyValue documentation (a requirement of key
+ * prefixes).
+ *
+ * For each pair in the result array, the key must be one of the keys
+ * contained in the input (possibly with wildcards expanded), and the value
+ * must be a vendor-specific result status (i.e. the string "OK" or an error
+ * code). The implementation may choose to return an empty array, or only
+ * return a status for a subset of the provided inputs, at its discretion.
+ *
+ * Application and HAL must not use keys with unknown prefix. In particular,
+ * it must not place a key-value pair in results array for unknown key from
+ * parameters array - instead, an unknown key should simply be ignored.
+ * In other words, results array may contain a subset of parameter keys
+ * (however, the framework doesn't enforce a strict subset - the only
+ * formal requirement is vendor domain prefix for keys).
+ *
+ * @param parameters Vendor-specific key-value pairs.
+ * @return Operation completion status for parameters being set.
+ */
+ VendorKeyValue[] setParameters(in VendorKeyValue[] parameters);
+
+ /**
+ * Generic method for retrieving vendor-specific parameter values.
+ * The framework does not interpret the parameters, they are passed
+ * in an opaque manner between a vendor application and HAL.
+ *
+ * Framework does not cache set/get requests, so it's allowed for
+ * getParameter to return a different value than previous setParameter call.
+ *
+ * The syntax and semantics of keys are up to the vendor (as long as prefix
+ * rules are obeyed). For instance, vendors may include some form of
+ * wildcard support. In such case, result array may be of different size
+ * than requested keys array. However, wildcards are not recognized by
+ * framework and they are passed as-is to the HAL implementation.
+ *
+ * Unknown keys must be ignored and not placed into results array.
+ *
+ * @param keys Parameter keys to fetch.
+ * @return Vendor-specific key-value pairs.
+ */
+ VendorKeyValue[] getParameters(in String[] keys);
+
+ /**
+ * Fetches image from radio module cache.
+ *
+ * This is out-of-band transport mechanism for images carried with metadata.
+ * The metadata array only passes the identifier, so the client may cache
+ * images or even not fetch them.
+ *
+ * The identifier may be any arbitrary number (i.e. sha256 prefix) selected
+ * by the vendor. It must be stable so the application may cache it.
+ *
+ * The data must be a valid PNG, JPEG, GIF or BMP file, and must be less
+ * than 1MB, due to hard limit on binder transaction buffer.
+ *
+ * Image data with an invalid format must be handled gracefully in the same
+ * way as a missing image.
+ *
+ * The image identifier may become invalid after some time from passing it
+ * with metadata struct (due to resource cleanup at the HAL implementation).
+ * However, it must remain valid for a currently tuned program at least
+ * until onCurrentProgramInfoChanged is called.
+ *
+ * @param id Identifier of an image (value of {@link IBroadcastRadio#INVALID_IMAGE}
+ * is reserved and must be treated as invalid image).
+ * @return A binary blob with image data
+ * or a zero-length array if identifier doesn't exist.
+ */
+ byte[] getImage(in int id);
+
+ /**
+ * Registers announcement listener.
+ *
+ * If there is at least one observer registered, HAL implementation must
+ * notify about announcements.
+ *
+ * If the observer dies, the HAL implementation must unregister observer
+ * automatically.
+ *
+ * If the tuner doesn't support announcements, a service-specific error
+ * {@link Result#NOT_SUPPORTED} will be returned.
+ *
+ * @param listener The listener interface.
+ * @param enabled The list of announcement types to watch for.
+ * @return a handle to unregister observer.
+ */
+ ICloseHandle registerAnnouncementListener(
+ in IAnnouncementListener listener, in AnnouncementType[] enabled);
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl
new file mode 100644
index 0000000..4a3240b
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+/**
+ * Represents a generic close handle to remove a callback that doesn't need
+ * active interface.
+ */
+@VintfStability
+interface ICloseHandle {
+ /**
+ * Closes the handle.
+ *
+ * The call must not fail and must only be issued once.
+ *
+ * After the close call is executed, no other calls to this interface
+ * are allowed. If the call is issued second time, a service-specific
+ * error {@link Result#INVALID_STATE} will be returned.
+ */
+ void close();
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl
new file mode 100644
index 0000000..1f0221c
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.ConfigFlag;
+import android.hardware.broadcastradio.ProgramInfo;
+import android.hardware.broadcastradio.ProgramListChunk;
+import android.hardware.broadcastradio.ProgramSelector;
+import android.hardware.broadcastradio.Result;
+import android.hardware.broadcastradio.VendorKeyValue;
+
+@VintfStability
+oneway interface ITunerCallback {
+ /**
+ * Method called by the HAL when a tuning operation fails asynchronously
+ * following {@link IBroadcastRadio#tune}, {@link IBroadcastRadio#seek}
+ * or {@link IBroadcastRadio#step}.
+ *
+ * This callback is only called when the tune(), seek() or step() command
+ * succeeds without returning any error at first.
+ *
+ * @param result {@link Result#TIMEOUT} in case that tune(), seek() or
+ * step() is not completed within
+ * @link IBroadcastRadio#TUNER_TIMEOUT_MS}
+ * @param selector A ProgramSelector structure passed from tune() call;
+ * empty for step() and seek().
+ */
+ void onTuneFailed(in Result result, in ProgramSelector selector);
+
+ /**
+ * Method called by the HAL when current program information (including
+ * metadata) is updated. It must be called when {@link IBroadcastRadio#tune}
+ * {@link IBroadcastRadio#seek} or {@link IBroadcastRadio#step} command
+ * succeeds.
+ *
+ * This is also called when the radio tuned to the static (not a valid
+ * station), see {@link ProgramInfo#FLAG_TUNABLE} flag.
+ *
+ * @param info Current program information.
+ */
+ void onCurrentProgramInfoChanged(in ProgramInfo info);
+
+ /**
+ * A delta update of the program list, called whenever there's a change in
+ * the list.
+ *
+ * If there are frequent changes, HAL implementation must throttle the rate
+ * of the updates.
+ *
+ * There is a hard limit on binder transaction buffer, and the list must
+ * not exceed it. For large lists, HAL implementation must split them to
+ * multiple chunks, no larger than 500kiB each, and call this program list
+ * update callback method separately.
+ *
+ * @param chunk A chunk of the program list update.
+ */
+ void onProgramListUpdated(in ProgramListChunk chunk);
+
+ /**
+ * Method called by the HAL when the antenna gets connected or disconnected.
+ *
+ * For broadcast radio service, client must assume the antenna is connected.
+ * If it's not, then antennaStateChange must be called within
+ * {@link IBroadcastRadio#ANTENNA_STATE_CHANGE_TIMEOUT_MS} to indicate that.
+ *
+ * @param connected {@code true} if the antenna is now connected, {@code false}
+ * otherwise.
+ */
+ void onAntennaStateChange(in boolean connected);
+
+ /**
+ * Generic callback for passing updates to config flags.
+ *
+ * It's up to the HAL implementation if and how to implement this callback,
+ * as long as it obeys the prefix rule. However, setConfigFlag must not
+ * trigger this callback, while an internal event can change config flag
+ * asynchronously at the HAL layer.
+ *
+ * @param flag Flag that has changed.
+ * @param value The new value of the given flag.
+ */
+ void onConfigFlagUpdated(in ConfigFlag flag, in boolean value);
+
+ /**
+ * Generic callback for passing updates to vendor-specific parameter values.
+ * The framework does not interpret the parameters, they are passed
+ * in an opaque manner between a vendor application and HAL.
+ *
+ * It's up to the HAL implementation if and how to implement this callback,
+ * as long as it obeys the prefix rule. In particular, only selected keys
+ * may be notified this way. However, setParameters must not trigger
+ * this callback, while an internal event can change parameters
+ * asynchronously at the HAL layer.
+ *
+ * @param parameters Vendor-specific key-value pairs,
+ * opaque to Android framework.
+ */
+ void onParametersUpdated(in VendorKeyValue[] parameters);
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl
new file mode 100644
index 0000000..0484d02
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+/**
+ * Type of program identifier component.
+ *
+ * Each identifier type corresponds to exactly one radio technology,
+ * i.e. DAB_ENSEMBLE is specifically for DAB.
+ *
+ * VENDOR identifier types must be opaque to the framework.
+ *
+ * The value format for each (but VENDOR_*) identifier is strictly defined
+ * to maintain interoperability between devices made by different vendors.
+ *
+ * All other values are reserved for future use.
+ * Values not matching any enumerated constant must be ignored.
+ */
+@VintfStability
+@Backing(type="int")
+@JavaDerive(equals=true, toString=true)
+enum IdentifierType {
+ /**
+ * Primary/secondary identifier for vendor-specific radio technology.
+ * The value format is determined by a vendor.
+ *
+ * The vendor identifiers have limited serialization capabilities - see
+ * ProgramSelector description.
+ */
+ VENDOR_START = 1000,
+
+ /**
+ * See VENDOR_START
+ */
+ VENDOR_END = 1999,
+
+ /**
+ * Undefined identifier type.
+ */
+ INVALID = 0,
+
+ /**
+ * Primary identifier for analogue (without RDS) AM/FM stations:
+ * frequency in kHz.
+ *
+ * This identifier also contains band information:
+ * - <500kHz: AM LW;
+ * - 500kHz - 1705kHz: AM MW;
+ * - 1.71MHz - 30MHz: AM SW;
+ * - >60MHz: FM.
+ */
+ AMFM_FREQUENCY_KHZ,
+
+ /**
+ * 16bit primary identifier for FM RDS station.
+ */
+ RDS_PI,
+
+ /**
+ * 64bit compound primary identifier for HD Radio.
+ *
+ * Consists of (from the LSB):
+ * - 32bit: Station ID number;
+ * - 4bit: HD Radio subchannel;
+ * - 18bit: AMFM_FREQUENCY_KHZ.
+ *
+ * While station ID number should be unique globally, it sometimes get
+ * abused by broadcasters (i.e. not being set at all). To ensure local
+ * uniqueness, AMFM_FREQUENCY_KHZ was added here. Global uniqueness is
+ * a best-effort - see HD_STATION_NAME.
+ *
+ * HD Radio subchannel is a value in range 0-7.
+ * This index is 0-based (where 0 is MPS and 1..7 are SPS),
+ * as opposed to HD Radio standard (where it's 1-based).
+ *
+ * The remaining bits should be set to zeros when writing on the chip side
+ * and ignored when read.
+ */
+
+ HD_STATION_ID_EXT,
+
+ /**
+ * 64bit additional identifier for HD Radio.
+ *
+ * Due to Station ID abuse, some HD_STATION_ID_EXT identifiers may be not
+ * globally unique. To provide a best-effort solution, a short version of
+ * station name may be carried as additional identifier and may be used
+ * by the tuner hardware to double-check tuning.
+ *
+ * The name is limited to the first 8 A-Z0-9 characters (lowercase letters
+ * must be converted to uppercase). Encoded in little-endian ASCII:
+ * the first character of the name is the LSB.
+ *
+ * For example: "Abc" is encoded as 0x434241.
+ */
+ HD_STATION_NAME,
+
+ /**
+ * 28bit compound primary identifier for Digital Audio Broadcasting.
+ *
+ * Consists of (from the LSB):
+ * - 16bit: SId;
+ * - 8bit: ECC code;
+ * - 4bit: SCIdS.
+ *
+ * SCIdS (Service Component Identifier within the Service) value
+ * of 0 represents the main service, while 1 and above represents
+ * secondary services.
+ *
+ * The remaining bits should be set to zeros when writing on the chip side
+ * and ignored when read.
+ */
+ DAB_SID_EXT,
+
+ /**
+ * 16bit
+ */
+ DAB_ENSEMBLE,
+
+ /**
+ * 12bit
+ */
+ DAB_SCID,
+
+ /**
+ * kHz (see AMFM_FREQUENCY_KHZ)
+ */
+ DAB_FREQUENCY_KHZ,
+
+ /**
+ * 24bit primary identifier for Digital Radio Mondiale.
+ */
+ DRMO_SERVICE_ID,
+
+ /**
+ * kHz (see AMFM_FREQUENCY_KHZ)
+ */
+ DRMO_FREQUENCY_KHZ,
+
+ /**
+ * 32bit primary identifier for SiriusXM Satellite Radio.
+ */
+ SXM_SERVICE_ID = DRMO_FREQUENCY_KHZ + 2,
+
+ /**
+ * 0-999 range
+ */
+ SXM_CHANNEL,
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl
new file mode 100644
index 0000000..3298cac
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+/**
+ * An element of metadata array.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+union Metadata {
+ /**
+ * RDS PS (string)
+ */
+ String rdsPs;
+
+ /**
+ * RDS PTY (uint8_t)
+ */
+ int rdsPty;
+
+ /**
+ * RBDS PTY (uint8_t)
+ */
+ int rbdsPty;
+
+ /**
+ * RDS RT (string)
+ */
+ String rdsRt;
+
+ /**
+ * Song title (string)
+ */
+ String songTitle;
+
+ /**
+ * Artist name (string)
+ */
+ String songArtist;
+
+ /**
+ * Album name (string)
+ */
+ String songAlbum;
+
+ /**
+ * Station icon (uint32_t, see {@link IBroadcastRadio#getImage})
+ */
+ int stationIcon;
+
+ /**
+ * Album art (uint32_t, see {@link IBroadcastRadio#getImage})
+ */
+ int albumArt;
+
+ /**
+ * Station name.
+ *
+ * This is a generic field to cover any radio technology.
+ *
+ * If the PROGRAM_NAME has the same content as DAB_*_NAME or RDS_PS,
+ * it may not be present, to preserve space - framework must repopulate
+ * it on the client side.
+ */
+ String programName;
+
+ /**
+ * DAB ensemble name (string)
+ */
+ String dabEnsembleName;
+
+ /**
+ * DAB ensemble name abbreviated (string).
+ *
+ * The string must be up to 8 characters long.
+ *
+ * If the short variant is present, the long (DAB_ENSEMBLE_NAME) one must be
+ * present as well.
+ */
+ String dabEnsembleNameShort;
+
+ /**
+ * DAB service name (string)
+ */
+ String dabServiceName;
+
+ /**
+ * DAB service name abbreviated (see DAB_ENSEMBLE_NAME_SHORT) (string)
+ */
+ String dabServiceNameShort;
+
+ /**
+ * DAB component name (string)
+ */
+ String dabComponentName;
+
+ /**
+ * DAB component name abbreviated (see DAB_ENSEMBLE_NAME_SHORT) (string)
+ */
+ String dabComponentNameShort;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl
new file mode 100644
index 0000000..3dd10eb
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.IdentifierType;
+import android.hardware.broadcastradio.ProgramIdentifier;
+
+/**
+ * Large-grain filter to the program list.
+ *
+ * This is meant to reduce binder transaction bandwidth, not for fine-grained
+ * filtering user might expect.
+ *
+ * The filter is designed as conjunctive normal form: the entry that passes the
+ * filter must satisfy all the clauses (members of this struct). Vector clauses
+ * are disjunctions of literals. In other words, there is AND between each
+ * high-level group and OR inside it.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable ProgramFilter {
+ /**
+ * List of identifier types that are filtered by the filter.
+ *
+ * If the program list entry contains at least one identifier of the type
+ * listed, it satisfies this condition.
+ *
+ * Empty list means no filtering on identifier type.
+ */
+ IdentifierType[] identifierTypes;
+
+ /**
+ * List of identifiers that are filtered by the filter.
+ *
+ * If the program list entry contains at least one listed identifier,
+ * it satisfies this condition.
+ *
+ * Empty list means no filtering on identifier.
+ */
+ ProgramIdentifier[] identifiers;
+
+ /**
+ * Includes non-tunable entries that define tree structure on the
+ * program list (i.e. DAB ensembles).
+ */
+ boolean includeCategories;
+
+ /**
+ * Disables updates on entry modifications.
+ *
+ * If {@code true}, 'modified' vector of {@link ProgramListChunk} must contain
+ * list additions only. Once the program is added to the list, it's not
+ * updated anymore.
+ */
+ boolean excludeModifications;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl
new file mode 100644
index 0000000..2057d97
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.IdentifierType;
+
+/**
+ * A single program identifier component, i.e. frequency or channel ID.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable ProgramIdentifier {
+ /**
+ * Maps to IdentifierType enum.
+ */
+ IdentifierType type = IdentifierType.INVALID;
+
+ /**
+ * The uint64_t value field holds the value in format described in comments
+ * for IdentifierType enum.
+ */
+ long value;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl
new file mode 100644
index 0000000..3e2c9cc
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.Metadata;
+import android.hardware.broadcastradio.ProgramIdentifier;
+import android.hardware.broadcastradio.ProgramSelector;
+import android.hardware.broadcastradio.VendorKeyValue;
+
+/**
+ * Program (channel, station) information.
+ *
+ * Carries both user-visible information (like station name) and technical
+ * details (tuning selector).
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable ProgramInfo {
+ /**
+ * Set when the program is currently playing live stream.
+ * This may result in a slightly altered reception parameters,
+ * usually targeted at reduced latency.
+ */
+ const int FLAG_LIVE = 1 << 0;
+
+ /**
+ * Radio stream is not playing, ie. due to bad reception conditions or
+ * buffering. In this state volume knob MAY be disabled to prevent user
+ * increasing volume too much.
+ */
+ const int FLAG_MUTED = 1 << 1;
+
+ /**
+ * Station broadcasts traffic information regularly,
+ * but not necessarily right now.
+ */
+ const int FLAG_TRAFFIC_PROGRAM = 1 << 2;
+
+ /**
+ * Station is broadcasting traffic information at the very moment.
+ */
+ const int FLAG_TRAFFIC_ANNOUNCEMENT = 1 << 3;
+
+ /**
+ * Station can be tuned to (not playing static).
+ *
+ * It's the same condition that would stop a seek operation
+ * (i.e. {@link IBroadcastRadio#seek}).
+ *
+ * By definition, this flag must be set for all items on the program list.
+ */
+ const int FLAG_TUNABLE = 1 << 4;
+
+ /**
+ * Audio stream is MONO if this bit is not set.
+ */
+ const int FLAG_STEREO = 1 << 5;
+
+ /**
+ * An identifier used to point at the program (primarily to tune to it).
+ *
+ * This field is required - its type field must not be set to
+ * {@link IdentifierType#INVALID}.
+ */
+ ProgramSelector selector;
+
+ /**
+ * Identifier currently used for program selection.
+ *
+ * It allows to determine which technology is currently used for reception.
+ *
+ * Some program selectors contain tuning information for different radio
+ * technologies (i.e. FM RDS and DAB). For example, user may tune using
+ * a ProgramSelector with RDS_PI primary identifier, but the tuner hardware
+ * may choose to use DAB technology to make actual tuning. This identifier
+ * must reflect that.
+ *
+ * This field is required for currently tuned program only.
+ * For all other items on the program list, its type field must be
+ * initialized to {@link IdentifierType#INVALID}.
+ *
+ * Only primary identifiers for a given radio technology are valid:
+ * - AMFM_FREQUENCY_KHZ for analog AM/FM;
+ * - RDS_PI for FM RDS;
+ * - HD_STATION_ID_EXT;
+ * - DAB_SID_EXT;
+ * - DRMO_SERVICE_ID;
+ * - SXM_SERVICE_ID;
+ * - VENDOR_*;
+ * - more might come in next minor versions of this HAL.
+ */
+ ProgramIdentifier logicallyTunedTo;
+
+ /**
+ * Identifier currently used by hardware to physically tune to a channel.
+ *
+ * Some radio technologies broadcast the same program on multiple channels,
+ * i.e. with RDS AF the same program may be broadcasted on multiple
+ * alternative frequencies; the same DAB program may be broadcast on
+ * multiple ensembles. This identifier points to the channel to which the
+ * radio hardware is physically tuned to.
+ *
+ * This field is required for currently tuned program only.
+ * For all other items on the program list, its type field must be
+ * initialized to {@link IdentifierType#INVALID}.
+ *
+ * Only physical identifiers are valid:
+ * - AMFM_FREQUENCY_KHZ;
+ * - DAB_ENSEMBLE;
+ * - DRMO_FREQUENCY_KHZ;
+ * - SXM_CHANNEL;
+ * - VENDOR_*;
+ * - more might come in next minor versions of this HAL.
+ */
+ ProgramIdentifier physicallyTunedTo;
+
+ /**
+ * Primary identifiers of related contents.
+ *
+ * Some radio technologies provide pointers to other programs that carry
+ * related content (i.e. DAB soft-links). This field is a list of pointers
+ * to other programs on the program list.
+ *
+ * This is not a list of programs that carry the same content (i.e.
+ * DAB hard-links, RDS AF). Switching to programs from this list usually
+ * require user action.
+ *
+ * Please note, that these identifiers do not have to exist on the program
+ * list - i.e. DAB tuner may provide information on FM RDS alternatives
+ * despite not supporting FM RDS. If the system has multiple tuners, another
+ * one may have it on its list.
+ *
+ * This field is optional.
+ */
+ @nullable ProgramIdentifier[] relatedContent;
+
+ /**
+ * Program flags.
+ */
+ int infoFlags;
+
+ /**
+ * Signal quality measured in 0% to 100% range to be shown in the UI.
+ */
+ int signalQuality;
+
+ /**
+ * Program metadata (station name, PTY, song title).
+ */
+ Metadata[] metadata;
+
+ /**
+ * Vendor-specific information.
+ *
+ * It may be used for extra features, not supported by the platform,
+ * for example: paid-service=true; bitrate=320kbps.
+ */
+ VendorKeyValue[] vendorInfo;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl
new file mode 100644
index 0000000..a62d461
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.ProgramIdentifier;
+import android.hardware.broadcastradio.ProgramInfo;
+
+/**
+ * An update packet of the program list.
+ *
+ * The order of entries in the arrays is unspecified.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable ProgramListChunk {
+ /**
+ * Treats all previously added entries as removed.
+ *
+ * This is meant to save binder transaction bandwidth on 'removed' array
+ * and provide a clear empty state.
+ *
+ * If set, 'removed' array must be null.
+ *
+ * The client may wait with taking action on this until it received the
+ * chunk with complete flag set (to avoid part of stations temporarily
+ * disappearing from the list).
+ */
+ boolean purge;
+
+ /**
+ * If false, it means there are still programs not transmitted,
+ * due for transmission in following updates.
+ *
+ * Used by UIs that wait for complete list instead of displaying
+ * programs while scanning.
+ *
+ * After the whole channel range was scanned and all discovered programs
+ * were transmitted, the last chunk must have set this flag to {@code true}.
+ * This must happen within {@link IBroadcastRadio#LIST_COMPLETE_TIMEOUT_MS}
+ * from the startProgramListUpdates call. If it doesn't, client may assume
+ * the tuner came into a bad state and display error message.
+ */
+ boolean complete;
+
+ /**
+ * Added or modified program list entries.
+ *
+ * Two entries with the same primaryId (ProgramSelector member)
+ * are considered the same.
+ */
+ ProgramInfo[] modified;
+
+ /**
+ * Removed program list entries.
+ *
+ * Contains primaryId (ProgramSelector member) of a program to remove.
+ */
+ @nullable ProgramIdentifier[] removed;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl
new file mode 100644
index 0000000..8bd3fd4
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.ProgramIdentifier;
+
+/**
+ * A set of identifiers necessary to tune to a given station.
+ *
+ * This can hold a combination of various identifiers, like:
+ * - AM/FM frequency,
+ * - HD Radio subchannel,
+ * - DAB service ID.
+ *
+ * The type of radio technology is determined by the primary identifier - if the
+ * primary identifier is for DAB, the program is DAB. However, a program of a
+ * specific radio technology may have additional secondary identifiers for other
+ * technologies, i.e. a satellite program may have FM fallback frequency,
+ * if a station broadcasts both via satellite and FM.
+ *
+ * The identifiers from VENDOR_START..VENDOR_END range have limited
+ * serialization capabilities: they are serialized locally, but ignored by the
+ * cloud services. If a program has primary id from vendor range, it's not
+ * synchronized with other devices at all.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable ProgramSelector {
+ /**
+ * Primary program identifier.
+ *
+ * This identifier uniquely identifies a station and can be used for
+ * equality check.
+ *
+ * It can hold only a subset of identifier types, one per each
+ * radio technology:
+ * - analogue AM/FM: AMFM_FREQUENCY_KHZ;
+ * - FM RDS: RDS_PI;
+ * - HD Radio: HD_STATION_ID_EXT;
+ * - DAB: DAB_SID_EXT;
+ * - Digital Radio Mondiale: DRMO_SERVICE_ID;
+ * - SiriusXM: SXM_SERVICE_ID;
+ * - vendor-specific: VENDOR_START..VENDOR_END.
+ */
+ ProgramIdentifier primaryId;
+
+ /**
+ * Secondary program identifiers.
+ *
+ * These identifiers are supplementary and can speed up tuning process,
+ * but the primary ID must be sufficient (i.e. RDS PI is enough to select
+ * a station from the list after a full band scan).
+ *
+ * Two selectors with different secondary IDs, but the same primary ID are
+ * considered equal. In particular, secondary IDs array may get updated for
+ * an entry on the program list (ie. when a better frequency for a given
+ * station is found).
+ */
+ ProgramIdentifier[] secondaryIds;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl
new file mode 100644
index 0000000..36cbaff
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+import android.hardware.broadcastradio.IdentifierType;
+import android.hardware.broadcastradio.VendorKeyValue;
+
+/**
+ * Properties of a given broadcast radio module.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable Properties {
+ /**
+ * A company name who made the radio module. Must be a valid, registered
+ * name of the company itself.
+ *
+ * It must be opaque to the Android framework.
+ */
+ String maker;
+
+ /**
+ * A product name. Must be unique within the company.
+ *
+ * It must be opaque to the Android framework.
+ */
+ String product;
+
+ /**
+ * Version of the hardware module.
+ *
+ * It must be opaque to the Android framework.
+ */
+ String version;
+
+ /**
+ * Hardware serial number (for subscription services).
+ *
+ * It must be opaque to the Android framework.
+ */
+ String serial;
+
+ /**
+ * A list of supported {@link IdentifierType} values.
+ *
+ * If an identifier is supported by radio module, it means it can use it for
+ * tuning to ProgramSelector with either primary or secondary Identifier of
+ * a given type.
+ *
+ * Support for VENDOR identifier type does not guarantee compatibility, as
+ * other module properties (implementor, product, version) must be checked.
+ */
+ IdentifierType[] supportedIdentifierTypes;
+
+ /**
+ * Vendor-specific information.
+ *
+ * It may be used for extra features, not supported by the platform,
+ * for example: com.me.preset-slots=6; com.me.ultra-hd-capable={@code false}.
+ */
+ VendorKeyValue[] vendorInfo;
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl
new file mode 100644
index 0000000..9985ccb
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+/**
+ * Result for methods of BroadcastRadio AIDL HAL interfaces.
+ */
+@VintfStability
+@Backing(type="int")
+enum Result {
+ /**
+ * Methods run without error.
+ */
+ OK,
+
+ /**
+ * Internal error in HAL.
+ */
+ INTERNAL_ERROR,
+
+ /**
+ * Error used when the input argument for the method is invalid.
+ */
+ INVALID_ARGUMENTS,
+
+ /**
+ * Error used when the service is of invalid state (i.e. callback
+ * is not registered for IBroadcastRadio).
+ */
+ INVALID_STATE,
+
+ /**
+ * Error used when an operation is not supported.
+ */
+ NOT_SUPPORTED,
+
+ /**
+ * Error used when a tune, seek, step or operation is not completed
+ * within {@link IBroadcastRadio#LIST_COMPLETE_TIMEOUT_MS}.
+ */
+ TIMEOUT,
+
+ /**
+ * Error that does not follow into the error categories above.
+ */
+ UNKNOWN_ERROR,
+}
diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl
new file mode 100644
index 0000000..c923e92
--- /dev/null
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2022 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.broadcastradio;
+
+/**
+ * A key-value pair for vendor-specific information to be passed as-is through
+ * Android framework to the front-end application.
+ */
+@VintfStability
+@JavaDerive(equals=true, toString=true)
+parcelable VendorKeyValue {
+ /**
+ * Key must start with unique vendor Java-style namespace,
+ * eg. 'com.somecompany.parameter1'.
+ */
+ String key;
+
+ /**
+ * Value must be passed through the framework without any changes.
+ * Format of this string can vary across vendors.
+ */
+ String value;
+}
diff --git a/broadcastradio/aidl/default/Android.bp b/broadcastradio/aidl/default/Android.bp
new file mode 100644
index 0000000..720aa8a
--- /dev/null
+++ b/broadcastradio/aidl/default/Android.bp
@@ -0,0 +1,54 @@
+//
+// Copyright (C) 2022 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 {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_binary {
+ name: "android.hardware.broadcastradio-service.default",
+ relative_install_path: "hw",
+ init_rc: ["broadcastradio-default.rc"],
+ vintf_fragments: ["broadcastradio-default.xml"],
+ vendor: true,
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+ srcs: [
+ "BroadcastRadio.cpp",
+ "main.cpp",
+ "VirtualProgram.cpp",
+ "VirtualRadio.cpp",
+ ],
+ static_libs: [
+ "android.hardware.broadcastradio@common-utils-aidl-lib",
+ "android.hardware.broadcastradio@common-utils-lib",
+ ],
+ shared_libs: [
+ "android.hardware.broadcastradio-V1-ndk",
+ "libbase",
+ "libbinder_ndk",
+ "liblog",
+ "libcutils",
+ ],
+}
diff --git a/broadcastradio/aidl/default/BroadcastRadio.cpp b/broadcastradio/aidl/default/BroadcastRadio.cpp
new file mode 100644
index 0000000..0209a0e
--- /dev/null
+++ b/broadcastradio/aidl/default/BroadcastRadio.cpp
@@ -0,0 +1,788 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "BroadcastRadio.h"
+#include <broadcastradio-utils-aidl/Utils.h>
+#include "resources.h"
+
+#include <aidl/android/hardware/broadcastradio/IdentifierType.h>
+#include <aidl/android/hardware/broadcastradio/Result.h>
+
+#include <android-base/logging.h>
+#include <android-base/strings.h>
+
+#include <private/android_filesystem_config.h>
+
+namespace aidl::android::hardware::broadcastradio {
+
+using ::aidl::android::hardware::broadcastradio::utils::resultToInt;
+using ::aidl::android::hardware::broadcastradio::utils::tunesTo;
+using ::android::base::EqualsIgnoreCase;
+using ::ndk::ScopedAStatus;
+using ::std::literals::chrono_literals::operator""ms;
+using ::std::literals::chrono_literals::operator""s;
+using ::std::lock_guard;
+using ::std::mutex;
+using ::std::string;
+using ::std::vector;
+
+namespace {
+
+inline constexpr std::chrono::milliseconds kSeekDelayTimeMs = 200ms;
+inline constexpr std::chrono::milliseconds kStepDelayTimeMs = 100ms;
+inline constexpr std::chrono::milliseconds kTuneDelayTimeMs = 150ms;
+inline constexpr std::chrono::seconds kListDelayTimeS = 1s;
+
+// clang-format off
+const AmFmRegionConfig kDefaultAmFmConfig = {
+ {
+ {87500, 108000, 100, 100}, // FM
+ {153, 282, 3, 9}, // AM LW
+ {531, 1620, 9, 9}, // AM MW
+ {1600, 30000, 1, 5}, // AM SW
+ },
+ AmFmRegionConfig::DEEMPHASIS_D50,
+ AmFmRegionConfig::RDS};
+// clang-format on
+
+Properties initProperties(const VirtualRadio& virtualRadio) {
+ Properties prop = {};
+
+ prop.maker = "Android";
+ prop.product = virtualRadio.getName();
+ prop.supportedIdentifierTypes = vector<IdentifierType>({
+ IdentifierType::AMFM_FREQUENCY_KHZ,
+ IdentifierType::RDS_PI,
+ IdentifierType::HD_STATION_ID_EXT,
+ IdentifierType::DAB_SID_EXT,
+ });
+ prop.vendorInfo = vector<VendorKeyValue>({
+ {"com.android.sample", "sample"},
+ });
+
+ return prop;
+}
+
+// Makes ProgramInfo that does not point to any particular program
+ProgramInfo makeSampleProgramInfo(const ProgramSelector& selector) {
+ ProgramInfo info = {};
+ info.selector = selector;
+ info.logicallyTunedTo =
+ utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ,
+ utils::getId(selector, IdentifierType::AMFM_FREQUENCY_KHZ));
+ info.physicallyTunedTo = info.logicallyTunedTo;
+ return info;
+}
+
+static bool checkDumpCallerHasWritePermissions(int fd) {
+ uid_t uid = AIBinder_getCallingUid();
+ if (uid == AID_ROOT || uid == AID_SHELL || uid == AID_SYSTEM) {
+ return true;
+ }
+ dprintf(fd, "BroadcastRadio HAL dump must be root, shell or system\n");
+ return false;
+}
+
+} // namespace
+
+BroadcastRadio::BroadcastRadio(const VirtualRadio& virtualRadio)
+ : mVirtualRadio(virtualRadio),
+ mAmFmConfig(kDefaultAmFmConfig),
+ mProperties(initProperties(virtualRadio)) {
+ const auto& ranges = kDefaultAmFmConfig.ranges;
+ if (ranges.size() > 0) {
+ ProgramSelector sel = utils::makeSelectorAmfm(ranges[0].lowerBound);
+ VirtualProgram virtualProgram = {};
+ if (mVirtualRadio.getProgram(sel, &virtualProgram)) {
+ mCurrentProgram = virtualProgram.selector;
+ } else {
+ mCurrentProgram = sel;
+ }
+ }
+}
+
+BroadcastRadio::~BroadcastRadio() {
+ mThread.reset();
+}
+
+ScopedAStatus BroadcastRadio::getAmFmRegionConfig(bool full, AmFmRegionConfig* returnConfigs) {
+ if (full) {
+ *returnConfigs = {};
+ returnConfigs->ranges = vector<AmFmBandRange>({
+ {65000, 108000, 10, 0}, // FM
+ {150, 30000, 1, 0}, // AM
+ });
+ returnConfigs->fmDeemphasis =
+ AmFmRegionConfig::DEEMPHASIS_D50 | AmFmRegionConfig::DEEMPHASIS_D75;
+ returnConfigs->fmRds = AmFmRegionConfig::RDS | AmFmRegionConfig::RBDS;
+ return ScopedAStatus::ok();
+ }
+ lock_guard<mutex> lk(mMutex);
+ *returnConfigs = mAmFmConfig;
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::getDabRegionConfig(vector<DabTableEntry>* returnConfigs) {
+ *returnConfigs = {
+ {"5A", 174928}, {"7D", 194064}, {"8A", 195936}, {"8B", 197648}, {"9A", 202928},
+ {"9B", 204640}, {"9C", 206352}, {"10B", 211648}, {"10C", 213360}, {"10D", 215072},
+ {"11A", 216928}, {"11B", 218640}, {"11C", 220352}, {"11D", 222064}, {"12A", 223936},
+ {"12B", 225648}, {"12C", 227360}, {"12D", 229072},
+ };
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::getImage(int32_t id, vector<uint8_t>* returnImage) {
+ LOG(DEBUG) << __func__ << ": fetching image " << std::hex << id;
+
+ if (id == resources::kDemoPngId) {
+ *returnImage = vector<uint8_t>(resources::kDemoPng, std::end(resources::kDemoPng));
+ return ScopedAStatus::ok();
+ }
+
+ LOG(WARNING) << __func__ << ": image of id " << std::hex << id << " doesn't exist";
+ *returnImage = {};
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::getProperties(Properties* returnProperties) {
+ lock_guard<mutex> lk(mMutex);
+ *returnProperties = mProperties;
+ return ScopedAStatus::ok();
+}
+
+ProgramInfo BroadcastRadio::tuneInternalLocked(const ProgramSelector& sel) {
+ LOG(DEBUG) << __func__ << ": tune (internal) to " << sel.toString();
+
+ VirtualProgram virtualProgram = {};
+ ProgramInfo programInfo;
+ if (mVirtualRadio.getProgram(sel, &virtualProgram)) {
+ mCurrentProgram = virtualProgram.selector;
+ programInfo = virtualProgram;
+ } else {
+ mCurrentProgram = sel;
+ programInfo = makeSampleProgramInfo(sel);
+ }
+ mIsTuneCompleted = true;
+
+ return programInfo;
+}
+
+ScopedAStatus BroadcastRadio::setTunerCallback(const std::shared_ptr<ITunerCallback>& callback) {
+ LOG(DEBUG) << __func__ << ": setTunerCallback";
+
+ if (callback == nullptr) {
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::INVALID_ARGUMENTS), "cannot set tuner callback to null");
+ }
+
+ lock_guard<mutex> lk(mMutex);
+ mCallback = callback;
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::unsetTunerCallback() {
+ LOG(DEBUG) << __func__ << ": unsetTunerCallback";
+
+ lock_guard<mutex> lk(mMutex);
+ mCallback = nullptr;
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::tune(const ProgramSelector& program) {
+ LOG(DEBUG) << __func__ << ": tune to " << program.toString() << "...";
+
+ lock_guard<mutex> lk(mMutex);
+ if (mCallback == nullptr) {
+ LOG(ERROR) << __func__ << ": callback is not registered.";
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::INVALID_STATE), "callback is not registered");
+ }
+
+ if (!utils::isSupported(mProperties, program)) {
+ LOG(WARNING) << __func__ << ": selector not supported: " << program.toString();
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::NOT_SUPPORTED), "selector is not supported");
+ }
+
+ if (!utils::isValid(program)) {
+ LOG(ERROR) << __func__ << ": selector is not valid: " << program.toString();
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::INVALID_ARGUMENTS), "selector is not valid");
+ }
+
+ cancelLocked();
+
+ mIsTuneCompleted = false;
+ std::shared_ptr<ITunerCallback> callback = mCallback;
+ auto task = [this, program, callback]() {
+ ProgramInfo programInfo = {};
+ {
+ lock_guard<mutex> lk(mMutex);
+ programInfo = tuneInternalLocked(program);
+ }
+ callback->onCurrentProgramInfoChanged(programInfo);
+ };
+ mThread->schedule(task, kTuneDelayTimeMs);
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::seek(bool directionUp, bool skipSubChannel) {
+ LOG(DEBUG) << __func__ << ": seek " << (directionUp ? "up" : "down") << " with skipSubChannel? "
+ << (skipSubChannel ? "yes" : "no") << "...";
+
+ lock_guard<mutex> lk(mMutex);
+ if (mCallback == nullptr) {
+ LOG(ERROR) << __func__ << ": callback is not registered.";
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::INVALID_STATE), "callback is not registered");
+ }
+
+ cancelLocked();
+
+ const auto& list = mVirtualRadio.getProgramList();
+ std::shared_ptr<ITunerCallback> callback = mCallback;
+ if (list.empty()) {
+ mIsTuneCompleted = false;
+ auto task = [callback]() {
+ LOG(DEBUG) << "seek: program list is empty, seek couldn't stop";
+
+ callback->onTuneFailed(Result::TIMEOUT, {});
+ };
+ mThread->schedule(task, kSeekDelayTimeMs);
+
+ return ScopedAStatus::ok();
+ }
+
+ // The list is not sorted here since it has already stored in VirtualRadio.
+ // If the list is not sorted in advance, it should be sorted here.
+ const auto& current = mCurrentProgram;
+ auto found = std::lower_bound(list.begin(), list.end(), VirtualProgram({current}));
+ if (directionUp) {
+ if (found < list.end() - 1) {
+ if (tunesTo(current, found->selector)) found++;
+ } else {
+ found = list.begin();
+ }
+ } else {
+ if (found > list.begin() && found != list.end()) {
+ found--;
+ } else {
+ found = list.end() - 1;
+ }
+ }
+ const ProgramSelector tuneTo = found->selector;
+
+ mIsTuneCompleted = false;
+ auto task = [this, tuneTo, callback]() {
+ ProgramInfo programInfo = {};
+ {
+ lock_guard<mutex> lk(mMutex);
+ programInfo = tuneInternalLocked(tuneTo);
+ }
+ callback->onCurrentProgramInfoChanged(programInfo);
+ };
+ mThread->schedule(task, kSeekDelayTimeMs);
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::step(bool directionUp) {
+ LOG(DEBUG) << __func__ << ": step " << (directionUp ? "up" : "down") << "...";
+
+ lock_guard<mutex> lk(mMutex);
+ if (mCallback == nullptr) {
+ LOG(ERROR) << __func__ << ": callback is not registered.";
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::INVALID_STATE), "callback is not registered");
+ }
+
+ cancelLocked();
+
+ if (!utils::hasId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ)) {
+ LOG(WARNING) << __func__ << ": can't step in anything else than AM/FM";
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::NOT_SUPPORTED), "cannot step in anything else than AM/FM");
+ }
+
+ int64_t stepTo = utils::getId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ);
+ std::optional<AmFmBandRange> range = getAmFmRangeLocked();
+ if (!range) {
+ LOG(ERROR) << __func__ << ": can't find current band or tune operation is in process";
+ ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::INTERNAL_ERROR),
+ "can't find current band or tune operation is in process");
+ }
+
+ if (directionUp) {
+ stepTo += range->spacing;
+ } else {
+ stepTo -= range->spacing;
+ }
+ if (stepTo > range->upperBound) {
+ stepTo = range->lowerBound;
+ }
+ if (stepTo < range->lowerBound) {
+ stepTo = range->upperBound;
+ }
+
+ mIsTuneCompleted = false;
+ std::shared_ptr<ITunerCallback> callback = mCallback;
+ auto task = [this, stepTo, callback]() {
+ ProgramInfo programInfo;
+ {
+ lock_guard<mutex> lk(mMutex);
+ programInfo = tuneInternalLocked(utils::makeSelectorAmfm(stepTo));
+ }
+ callback->onCurrentProgramInfoChanged(programInfo);
+ };
+ mThread->schedule(task, kStepDelayTimeMs);
+
+ return ScopedAStatus::ok();
+}
+
+void BroadcastRadio::cancelLocked() {
+ LOG(DEBUG) << __func__ << ": cancelling current operations...";
+
+ mThread->cancelAll();
+ if (mCurrentProgram.primaryId.type != IdentifierType::INVALID) {
+ mIsTuneCompleted = true;
+ }
+}
+
+ScopedAStatus BroadcastRadio::cancel() {
+ LOG(DEBUG) << __func__ << ": cancel pending tune, seek and step...";
+
+ lock_guard<mutex> lk(mMutex);
+ cancelLocked();
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::startProgramListUpdates(const ProgramFilter& filter) {
+ LOG(DEBUG) << __func__ << ": requested program list updates, filter = " << filter.toString()
+ << "...";
+
+ auto filterCb = [&filter](const VirtualProgram& program) {
+ return utils::satisfies(filter, program.selector);
+ };
+
+ lock_guard<mutex> lk(mMutex);
+
+ const auto& list = mVirtualRadio.getProgramList();
+ vector<VirtualProgram> filteredList;
+ std::copy_if(list.begin(), list.end(), std::back_inserter(filteredList), filterCb);
+
+ auto task = [this, filteredList]() {
+ std::shared_ptr<ITunerCallback> callback;
+ {
+ lock_guard<mutex> lk(mMutex);
+ if (mCallback == nullptr) {
+ LOG(WARNING) << "Callback is null when updating program List";
+ return;
+ }
+ callback = mCallback;
+ }
+
+ ProgramListChunk chunk = {};
+ chunk.purge = true;
+ chunk.complete = true;
+ chunk.modified = vector<ProgramInfo>(filteredList.begin(), filteredList.end());
+
+ callback->onProgramListUpdated(chunk);
+ };
+ mThread->schedule(task, kListDelayTimeS);
+
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::stopProgramListUpdates() {
+ LOG(DEBUG) << __func__ << ": requested program list updates to stop...";
+ // TODO(b/243681584) Implement stop program list updates method
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::isConfigFlagSet(ConfigFlag flag, [[maybe_unused]] bool* returnIsSet) {
+ LOG(DEBUG) << __func__ << ": flag = " << toString(flag);
+
+ LOG(INFO) << __func__ << ": getting ConfigFlag is not supported";
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::NOT_SUPPORTED), "getting ConfigFlag is not supported");
+}
+
+ScopedAStatus BroadcastRadio::setConfigFlag(ConfigFlag flag, bool value) {
+ LOG(DEBUG) << __func__ << ": flag = " << toString(flag) << ", value = " << value;
+
+ LOG(INFO) << __func__ << ": setting ConfigFlag is not supported";
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::NOT_SUPPORTED), "setting ConfigFlag is not supported");
+}
+
+ScopedAStatus BroadcastRadio::setParameters(
+ [[maybe_unused]] const vector<VendorKeyValue>& parameters,
+ vector<VendorKeyValue>* returnParameters) {
+ // TODO(b/243682330) Support vendor parameter functionality
+ *returnParameters = {};
+ return ScopedAStatus::ok();
+}
+
+ScopedAStatus BroadcastRadio::getParameters([[maybe_unused]] const vector<string>& keys,
+ vector<VendorKeyValue>* returnParameters) {
+ // TODO(b/243682330) Support vendor parameter functionality
+ *returnParameters = {};
+ return ScopedAStatus::ok();
+}
+
+std::optional<AmFmBandRange> BroadcastRadio::getAmFmRangeLocked() const {
+ if (!mIsTuneCompleted) {
+ LOG(WARNING) << __func__ << ": tune operation is in process";
+ return {};
+ }
+ if (!utils::hasId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ)) {
+ LOG(WARNING) << __func__ << ": current program does not has AMFM_FREQUENCY_KHZ identifier";
+ return {};
+ }
+
+ int64_t freq = utils::getId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ);
+ for (const auto& range : mAmFmConfig.ranges) {
+ if (range.lowerBound <= freq && range.upperBound >= freq) {
+ return range;
+ }
+ }
+
+ return {};
+}
+
+ScopedAStatus BroadcastRadio::registerAnnouncementListener(
+ [[maybe_unused]] const std::shared_ptr<IAnnouncementListener>& listener,
+ const vector<AnnouncementType>& enabled, std::shared_ptr<ICloseHandle>* returnCloseHandle) {
+ LOG(DEBUG) << __func__ << ": registering announcement listener for "
+ << utils::vectorToString(enabled);
+
+ // TODO(b/243683842) Support announcement listener
+ *returnCloseHandle = nullptr;
+ LOG(INFO) << __func__ << ": registering announcementListener is not supported";
+ return ScopedAStatus::fromServiceSpecificErrorWithMessage(
+ resultToInt(Result::NOT_SUPPORTED),
+ "registering announcementListener is not supported");
+}
+
+binder_status_t BroadcastRadio::dump(int fd, const char** args, uint32_t numArgs) {
+ if (numArgs == 0) {
+ return dumpsys(fd);
+ }
+
+ string option = string(args[0]);
+ if (EqualsIgnoreCase(option, "--help")) {
+ return cmdHelp(fd);
+ } else if (EqualsIgnoreCase(option, "--tune")) {
+ return cmdTune(fd, args, numArgs);
+ } else if (EqualsIgnoreCase(option, "--seek")) {
+ return cmdSeek(fd, args, numArgs);
+ } else if (EqualsIgnoreCase(option, "--step")) {
+ return cmdStep(fd, args, numArgs);
+ } else if (EqualsIgnoreCase(option, "--cancel")) {
+ return cmdCancel(fd, numArgs);
+ } else if (EqualsIgnoreCase(option, "--startProgramListUpdates")) {
+ return cmdStartProgramListUpdates(fd, args, numArgs);
+ } else if (EqualsIgnoreCase(option, "--stopProgramListUpdates")) {
+ return cmdStopProgramListUpdates(fd, numArgs);
+ }
+ dprintf(fd, "Invalid option: %s\n", option.c_str());
+ return STATUS_BAD_VALUE;
+}
+
+binder_status_t BroadcastRadio::dumpsys(int fd) {
+ if (!checkDumpCallerHasWritePermissions(fd)) {
+ return STATUS_PERMISSION_DENIED;
+ }
+ lock_guard<mutex> lk(mMutex);
+ dprintf(fd, "AmFmRegionConfig: %s\n", mAmFmConfig.toString().c_str());
+ dprintf(fd, "Properties: %s \n", mProperties.toString().c_str());
+ if (mIsTuneCompleted) {
+ dprintf(fd, "Tune completed\n");
+ } else {
+ dprintf(fd, "Tune not completed\n");
+ }
+ if (mCallback == nullptr) {
+ dprintf(fd, "No ITunerCallback registered\n");
+ } else {
+ dprintf(fd, "ITunerCallback registered\n");
+ }
+ dprintf(fd, "CurrentProgram: %s \n", mCurrentProgram.toString().c_str());
+ return STATUS_OK;
+}
+
+binder_status_t BroadcastRadio::cmdHelp(int fd) const {
+ dprintf(fd, "Usage: \n\n");
+ dprintf(fd, "[no args]: dumps focus listener / gain callback registered status\n");
+ dprintf(fd, "--help: shows this help\n");
+ dprintf(fd,
+ "--tune amfm <FREQUENCY>: tunes amfm radio to frequency (in Hz) specified: "
+ "frequency (int) \n"
+ "--tune dab <SID> <ENSEMBLE>: tunes dab radio to sid and ensemble specified: "
+ "sidExt (int), ensemble (int) \n");
+ dprintf(fd,
+ "--seek [up|down] <SKIP_SUB_CHANNEL>: seek with direction (up or down) and "
+ "option whether skipping sub channel: "
+ "skipSubChannel (string, should be either \"true\" or \"false\")\n");
+ dprintf(fd, "--step [up|down]: step in direction (up or down) specified\n");
+ dprintf(fd, "--cancel: cancel current pending tune, step, and seek\n");
+ dprintf(fd,
+ "--startProgramListUpdates <IDENTIFIER_TYPES> <IDENTIFIERS> <INCLUDE_CATEGORIES> "
+ "<EXCLUDE_MODIFICATIONS>: start update program list with the filter specified: "
+ "identifier types (string, in format <TYPE>,<TYPE>,...,<TYPE> or \"null\" (if empty), "
+ "where TYPE is int), "
+ "program identifiers (string, in format "
+ "<TYPE>:<VALUE>,<TYPE>:<VALUE>,...,<TYPE>:<VALUE> or \"null\" (if empty), "
+ "where TYPE is int and VALUE is long), "
+ "includeCategories (string, should be either \"true\" or \"false\"), "
+ "excludeModifications (string, should be either \"true\" or \"false\")\n");
+ dprintf(fd, "--stopProgramListUpdates: stop current pending program list updates\n");
+ dprintf(fd,
+ "Note on <TYPE> for --startProgramList command: it is int for identifier type. "
+ "Please see broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl "
+ "for its definition.\n");
+ dprintf(fd,
+ "Note on <VALUE> for --startProgramList command: it is long type for identifier value. "
+ "Please see broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl "
+ "for its value.\n");
+
+ return STATUS_OK;
+}
+
+binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numArgs) {
+ if (!checkDumpCallerHasWritePermissions(fd)) {
+ return STATUS_PERMISSION_DENIED;
+ }
+ if (numArgs != 3 && numArgs != 4) {
+ dprintf(fd,
+ "Invalid number of arguments: please provide --tune amfm <FREQUENCY> "
+ "or --tune dab <SID> <ENSEMBLE>\n");
+ return STATUS_BAD_VALUE;
+ }
+ bool isDab = false;
+ if (EqualsIgnoreCase(string(args[1]), "dab")) {
+ isDab = true;
+ } else if (!EqualsIgnoreCase(string(args[1]), "amfm")) {
+ dprintf(fd, "Unknown radio type provided with tune: %s\n", args[1]);
+ return STATUS_BAD_VALUE;
+ }
+ ProgramSelector sel = {};
+ if (isDab) {
+ if (numArgs != 4) {
+ dprintf(fd,
+ "Invalid number of arguments: please provide --tune dab <SID> <ENSEMBLE>\n");
+ return STATUS_BAD_VALUE;
+ }
+ int sid;
+ if (!utils::parseArgInt(string(args[2]), &sid)) {
+ dprintf(fd, "Non-integer sid provided with tune: %s\n", string(args[2]).c_str());
+ return STATUS_BAD_VALUE;
+ }
+ int ensemble;
+ if (!utils::parseArgInt(string(args[3]), &ensemble)) {
+ dprintf(fd, "Non-integer ensemble provided with tune: %s\n", string(args[3]).c_str());
+ return STATUS_BAD_VALUE;
+ }
+ sel = utils::makeSelectorDab(sid, ensemble);
+ } else {
+ if (numArgs != 3) {
+ dprintf(fd, "Invalid number of arguments: please provide --tune amfm <FREQUENCY>\n");
+ return STATUS_BAD_VALUE;
+ }
+ int freq;
+ if (!utils::parseArgInt(string(args[2]), &freq)) {
+ dprintf(fd, "Non-integer frequency provided with tune: %s\n", string(args[2]).c_str());
+ return STATUS_BAD_VALUE;
+ }
+ sel = utils::makeSelectorAmfm(freq);
+ }
+
+ auto tuneResult = tune(sel);
+ if (!tuneResult.isOk()) {
+ dprintf(fd, "Unable to tune %s radio to %s\n", args[1], sel.toString().c_str());
+ return STATUS_BAD_VALUE;
+ }
+ dprintf(fd, "Tune %s radio to %s \n", args[1], sel.toString().c_str());
+ return STATUS_OK;
+}
+
+binder_status_t BroadcastRadio::cmdSeek(int fd, const char** args, uint32_t numArgs) {
+ if (!checkDumpCallerHasWritePermissions(fd)) {
+ return STATUS_PERMISSION_DENIED;
+ }
+ if (numArgs != 3) {
+ dprintf(fd,
+ "Invalid number of arguments: please provide --seek <DIRECTION> "
+ "<SKIP_SUB_CHANNEL>\n");
+ return STATUS_BAD_VALUE;
+ }
+ string seekDirectionIn = string(args[1]);
+ bool seekDirectionUp;
+ if (!utils::parseArgDirection(seekDirectionIn, &seekDirectionUp)) {
+ dprintf(fd, "Invalid direction (\"up\" or \"down\") provided with seek: %s\n",
+ seekDirectionIn.c_str());
+ return STATUS_BAD_VALUE;
+ }
+ string skipSubChannelIn = string(args[2]);
+ bool skipSubChannel;
+ if (!utils::parseArgBool(skipSubChannelIn, &skipSubChannel)) {
+ dprintf(fd, "Invalid skipSubChannel (\"true\" or \"false\") provided with seek: %s\n",
+ skipSubChannelIn.c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ auto seekResult = seek(seekDirectionUp, skipSubChannel);
+ if (!seekResult.isOk()) {
+ dprintf(fd, "Unable to seek in %s direction\n", seekDirectionIn.c_str());
+ return STATUS_BAD_VALUE;
+ }
+ dprintf(fd, "Seek in %s direction\n", seekDirectionIn.c_str());
+ return STATUS_OK;
+}
+
+binder_status_t BroadcastRadio::cmdStep(int fd, const char** args, uint32_t numArgs) {
+ if (!checkDumpCallerHasWritePermissions(fd)) {
+ return STATUS_PERMISSION_DENIED;
+ }
+ if (numArgs != 2) {
+ dprintf(fd, "Invalid number of arguments: please provide --step <DIRECTION>\n");
+ return STATUS_BAD_VALUE;
+ }
+ string stepDirectionIn = string(args[1]);
+ bool stepDirectionUp;
+ if (!utils::parseArgDirection(stepDirectionIn, &stepDirectionUp)) {
+ dprintf(fd, "Invalid direction (\"up\" or \"down\") provided with step: %s\n",
+ stepDirectionIn.c_str());
+ return STATUS_BAD_VALUE;
+ }
+
+ auto stepResult = step(stepDirectionUp);
+ if (!stepResult.isOk()) {
+ dprintf(fd, "Unable to step in %s direction\n", stepDirectionIn.c_str());
+ return STATUS_BAD_VALUE;
+ }
+ dprintf(fd, "Step in %s direction\n", stepDirectionIn.c_str());
+ return STATUS_OK;
+}
+
+binder_status_t BroadcastRadio::cmdCancel(int fd, uint32_t numArgs) {
+ if (!checkDumpCallerHasWritePermissions(fd)) {
+ return STATUS_PERMISSION_DENIED;
+ }
+ if (numArgs != 1) {
+ dprintf(fd,
+ "Invalid number of arguments: please provide --cancel "
+ "only and no more arguments\n");
+ return STATUS_BAD_VALUE;
+ }
+
+ auto cancelResult = cancel();
+ if (!cancelResult.isOk()) {
+ dprintf(fd, "Unable to cancel pending tune, seek, and step\n");
+ return STATUS_BAD_VALUE;
+ }
+ dprintf(fd, "Canceled pending tune, seek, and step\n");
+ return STATUS_OK;
+}
+
+binder_status_t BroadcastRadio::cmdStartProgramListUpdates(int fd, const char** args,
+ uint32_t numArgs) {
+ if (!checkDumpCallerHasWritePermissions(fd)) {
+ return STATUS_PERMISSION_DENIED;
+ }
+ if (numArgs != 5) {
+ dprintf(fd,
+ "Invalid number of arguments: please provide --startProgramListUpdates "
+ "<IDENTIFIER_TYPES> <IDENTIFIERS> <INCLUDE_CATEGORIES> "
+ "<EXCLUDE_MODIFICATIONS>\n");
+ return STATUS_BAD_VALUE;
+ }
+ string filterTypesStr = string(args[1]);
+ std::vector<IdentifierType> filterTypeList;
+ if (!EqualsIgnoreCase(filterTypesStr, "null") &&
+ !utils::parseArgIdentifierTypeArray(filterTypesStr, &filterTypeList)) {
+ dprintf(fd,
+ "Invalid identifier types provided with startProgramListUpdates: %s, "
+ "should be: <TYPE>,<TYPE>,...,<TYPE>\n",
+ filterTypesStr.c_str());
+ return STATUS_BAD_VALUE;
+ }
+ string filtersStr = string(args[2]);
+ std::vector<ProgramIdentifier> filterList;
+ if (!EqualsIgnoreCase(filtersStr, "null") &&
+ !utils::parseProgramIdentifierList(filtersStr, &filterList)) {
+ dprintf(fd,
+ "Invalid program identifiers provided with startProgramListUpdates: %s, "
+ "should be: <TYPE>:<VALUE>,<TYPE>:<VALUE>,...,<TYPE>:<VALUE>\n",
+ filtersStr.c_str());
+ return STATUS_BAD_VALUE;
+ }
+ string includeCategoriesStr = string(args[3]);
+ bool includeCategories;
+ if (!utils::parseArgBool(includeCategoriesStr, &includeCategories)) {
+ dprintf(fd,
+ "Invalid includeCategories (\"true\" or \"false\") "
+ "provided with startProgramListUpdates : %s\n",
+ includeCategoriesStr.c_str());
+ return STATUS_BAD_VALUE;
+ }
+ string excludeModificationsStr = string(args[4]);
+ bool excludeModifications;
+ if (!utils::parseArgBool(excludeModificationsStr, &excludeModifications)) {
+ dprintf(fd,
+ "Invalid excludeModifications(\"true\" or \"false\") "
+ "provided with startProgramListUpdates : %s\n",
+ excludeModificationsStr.c_str());
+ return STATUS_BAD_VALUE;
+ }
+ ProgramFilter filter = {filterTypeList, filterList, includeCategories, excludeModifications};
+
+ auto updateResult = startProgramListUpdates(filter);
+ if (!updateResult.isOk()) {
+ dprintf(fd, "Unable to start program list update for filter %s \n",
+ filter.toString().c_str());
+ return STATUS_BAD_VALUE;
+ }
+ dprintf(fd, "Start program list update for filter %s\n", filter.toString().c_str());
+ return STATUS_OK;
+}
+
+binder_status_t BroadcastRadio::cmdStopProgramListUpdates(int fd, uint32_t numArgs) {
+ if (!checkDumpCallerHasWritePermissions(fd)) {
+ return STATUS_PERMISSION_DENIED;
+ }
+ if (numArgs != 1) {
+ dprintf(fd,
+ "Invalid number of arguments: please provide --stopProgramListUpdates "
+ "only and no more arguments\n");
+ return STATUS_BAD_VALUE;
+ }
+
+ auto stopResult = stopProgramListUpdates();
+ if (!stopResult.isOk()) {
+ dprintf(fd, "Unable to stop pending program list update\n");
+ return STATUS_BAD_VALUE;
+ }
+ dprintf(fd, "Stop pending program list update\n");
+ return STATUS_OK;
+}
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/broadcastradio/aidl/default/BroadcastRadio.h b/broadcastradio/aidl/default/BroadcastRadio.h
new file mode 100644
index 0000000..1c85ddc
--- /dev/null
+++ b/broadcastradio/aidl/default/BroadcastRadio.h
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include "VirtualRadio.h"
+
+#include <aidl/android/hardware/broadcastradio/AmFmBandRange.h>
+#include <aidl/android/hardware/broadcastradio/AmFmRegionConfig.h>
+#include <aidl/android/hardware/broadcastradio/AnnouncementType.h>
+#include <aidl/android/hardware/broadcastradio/BnBroadcastRadio.h>
+#include <aidl/android/hardware/broadcastradio/DabTableEntry.h>
+#include <aidl/android/hardware/broadcastradio/IAnnouncementListener.h>
+#include <aidl/android/hardware/broadcastradio/ICloseHandle.h>
+#include <aidl/android/hardware/broadcastradio/ITunerCallback.h>
+#include <aidl/android/hardware/broadcastradio/Properties.h>
+#include <broadcastradio-utils/WorkerThread.h>
+
+#include <android-base/thread_annotations.h>
+
+#include <optional>
+
+namespace aidl::android::hardware::broadcastradio {
+
+class BroadcastRadio final : public BnBroadcastRadio {
+ public:
+ explicit BroadcastRadio(const VirtualRadio& virtualRadio);
+ ~BroadcastRadio();
+ ndk::ScopedAStatus getAmFmRegionConfig(bool full, AmFmRegionConfig* returnConfigs) override;
+ ndk::ScopedAStatus getDabRegionConfig(std::vector<DabTableEntry>* returnConfigs) override;
+ ndk::ScopedAStatus getImage(int32_t id, std::vector<uint8_t>* returnImage) override;
+ ndk::ScopedAStatus getProperties(Properties* returnProperties) override;
+
+ ndk::ScopedAStatus setTunerCallback(const std::shared_ptr<ITunerCallback>& callback) override;
+ ndk::ScopedAStatus unsetTunerCallback() override;
+ ndk::ScopedAStatus tune(const ProgramSelector& program) override;
+ ndk::ScopedAStatus seek(bool directionUp, bool skipSubChannel) override;
+ ndk::ScopedAStatus step(bool directionUp) override;
+ ndk::ScopedAStatus cancel() override;
+ ndk::ScopedAStatus startProgramListUpdates(const ProgramFilter& filter) override;
+ ndk::ScopedAStatus stopProgramListUpdates() override;
+ ndk::ScopedAStatus isConfigFlagSet(ConfigFlag flag, bool* returnIsSet) override;
+ ndk::ScopedAStatus setConfigFlag(ConfigFlag flag, bool in_value) override;
+ ndk::ScopedAStatus setParameters(const std::vector<VendorKeyValue>& parameters,
+ std::vector<VendorKeyValue>* returnParameters) override;
+ ndk::ScopedAStatus getParameters(const std::vector<std::string>& keys,
+ std::vector<VendorKeyValue>* returnParameters) override;
+ ndk::ScopedAStatus registerAnnouncementListener(
+ const std::shared_ptr<IAnnouncementListener>& listener,
+ const std::vector<AnnouncementType>& enabled,
+ std::shared_ptr<ICloseHandle>* returnCloseHandle) override;
+ binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
+
+ private:
+ const VirtualRadio& mVirtualRadio;
+ std::mutex mMutex;
+ AmFmRegionConfig mAmFmConfig GUARDED_BY(mMutex);
+ std::unique_ptr<::android::WorkerThread> mThread GUARDED_BY(mMutex) =
+ std::unique_ptr<::android::WorkerThread>(new ::android::WorkerThread());
+ bool mIsTuneCompleted GUARDED_BY(mMutex) = true;
+ Properties mProperties GUARDED_BY(mMutex);
+ ProgramSelector mCurrentProgram GUARDED_BY(mMutex) = {};
+ std::shared_ptr<ITunerCallback> mCallback GUARDED_BY(mMutex);
+
+ std::optional<AmFmBandRange> getAmFmRangeLocked() const;
+ void cancelLocked();
+ ProgramInfo tuneInternalLocked(const ProgramSelector& sel);
+
+ binder_status_t cmdHelp(int fd) const;
+ binder_status_t cmdTune(int fd, const char** args, uint32_t numArgs);
+ binder_status_t cmdSeek(int fd, const char** args, uint32_t numArgs);
+ binder_status_t cmdStep(int fd, const char** args, uint32_t numArgs);
+ binder_status_t cmdCancel(int fd, uint32_t numArgs);
+ binder_status_t cmdStartProgramListUpdates(int fd, const char** args, uint32_t numArgs);
+ binder_status_t cmdStopProgramListUpdates(int fd, uint32_t numArgs);
+
+ binder_status_t dumpsys(int fd);
+};
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/broadcastradio/aidl/default/VirtualProgram.cpp b/broadcastradio/aidl/default/VirtualProgram.cpp
new file mode 100644
index 0000000..0df0a82
--- /dev/null
+++ b/broadcastradio/aidl/default/VirtualProgram.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "VirtualProgram.h"
+
+#include <broadcastradio-utils-aidl/Utils.h>
+#include "resources.h"
+
+#include <android-base/logging.h>
+
+namespace aidl::android::hardware::broadcastradio {
+
+using ::std::vector;
+
+VirtualProgram::operator ProgramInfo() const {
+ ProgramInfo info = {};
+
+ info.selector = selector;
+
+ IdentifierType programType = selector.primaryId.type;
+ bool isDigital = (programType != IdentifierType::AMFM_FREQUENCY_KHZ &&
+ programType != IdentifierType::RDS_PI);
+
+ auto selectId = [&info](const IdentifierType& type) {
+ return utils::makeIdentifier(type, utils::getId(info.selector, type));
+ };
+
+ switch (programType) {
+ case IdentifierType::AMFM_FREQUENCY_KHZ:
+ info.logicallyTunedTo = info.physicallyTunedTo =
+ selectId(IdentifierType::AMFM_FREQUENCY_KHZ);
+ break;
+ case IdentifierType::RDS_PI:
+ info.logicallyTunedTo = selectId(IdentifierType::RDS_PI);
+ info.physicallyTunedTo = selectId(IdentifierType::AMFM_FREQUENCY_KHZ);
+ break;
+ case IdentifierType::HD_STATION_ID_EXT:
+ info.logicallyTunedTo = selectId(IdentifierType::HD_STATION_ID_EXT);
+ info.physicallyTunedTo = selectId(IdentifierType::AMFM_FREQUENCY_KHZ);
+ break;
+ case IdentifierType::DAB_SID_EXT:
+ info.logicallyTunedTo = selectId(IdentifierType::DAB_SID_EXT);
+ info.physicallyTunedTo = selectId(IdentifierType::DAB_ENSEMBLE);
+ break;
+ case IdentifierType::DRMO_SERVICE_ID:
+ info.logicallyTunedTo = selectId(IdentifierType::DRMO_SERVICE_ID);
+ info.physicallyTunedTo = selectId(IdentifierType::DRMO_FREQUENCY_KHZ);
+ break;
+ case IdentifierType::SXM_SERVICE_ID:
+ info.logicallyTunedTo = selectId(IdentifierType::SXM_SERVICE_ID);
+ info.physicallyTunedTo = selectId(IdentifierType::SXM_CHANNEL);
+ break;
+ default:
+ LOG(FATAL) << "unsupported program type: " << toString(programType);
+ return {};
+ }
+
+ info.infoFlags |= (ProgramInfo::FLAG_TUNABLE | ProgramInfo::FLAG_STEREO);
+ info.signalQuality = isDigital ? kSignalQualityDigital : kSignalQualityNonDigital;
+
+ info.metadata = vector<Metadata>({
+ Metadata::make<Metadata::rdsPs>(programName),
+ Metadata::make<Metadata::songTitle>(songTitle),
+ Metadata::make<Metadata::songArtist>(songArtist),
+ Metadata::make<Metadata::stationIcon>(resources::kDemoPngId),
+ Metadata::make<Metadata::albumArt>(resources::kDemoPngId),
+ });
+
+ info.vendorInfo = vector<VendorKeyValue>({
+ {"com.android.sample", "sample"},
+ {"com.android.sample.VirtualProgram", "VirtualProgram"},
+ });
+
+ return info;
+}
+
+bool operator<(const VirtualProgram& lhs, const VirtualProgram& rhs) {
+ auto& l = lhs.selector;
+ auto& r = rhs.selector;
+
+ // Two programs with the same primaryId are considered the same.
+ if (l.primaryId.type != r.primaryId.type) return l.primaryId.type < r.primaryId.type;
+
+ return l.primaryId.value < r.primaryId.value;
+}
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/broadcastradio/aidl/default/VirtualProgram.h b/broadcastradio/aidl/default/VirtualProgram.h
new file mode 100644
index 0000000..0c20721
--- /dev/null
+++ b/broadcastradio/aidl/default/VirtualProgram.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/broadcastradio/IdentifierType.h>
+#include <aidl/android/hardware/broadcastradio/ProgramInfo.h>
+#include <aidl/android/hardware/broadcastradio/ProgramSelector.h>
+
+namespace aidl::android::hardware::broadcastradio {
+
+constexpr int kSignalQualityDigital = 100;
+constexpr int kSignalQualityNonDigital = 80;
+/**
+ * A radio program mock.
+ *
+ * This represents broadcast waves flying over the air,
+ * not an entry for a captured station in the radio tuner memory.
+ */
+struct VirtualProgram {
+ ProgramSelector selector;
+
+ std::string programName = "";
+ std::string songArtist = "";
+ std::string songTitle = "";
+
+ operator ProgramInfo() const;
+
+ /**
+ * Defines order in which virtual programs appear on the "air" with
+ * ITunerSession::scan().
+ *
+ * It's for default implementation purposes, may not be complete or correct.
+ */
+ friend bool operator<(const VirtualProgram& lhs, const VirtualProgram& rhs);
+};
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/broadcastradio/aidl/default/VirtualRadio.cpp b/broadcastradio/aidl/default/VirtualRadio.cpp
new file mode 100644
index 0000000..851543b
--- /dev/null
+++ b/broadcastradio/aidl/default/VirtualRadio.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "VirtualRadio.h"
+#include <broadcastradio-utils-aidl/Utils.h>
+
+namespace aidl::android::hardware::broadcastradio {
+
+using ::aidl::android::hardware::broadcastradio::utils::makeSelectorAmfm;
+using ::aidl::android::hardware::broadcastradio::utils::makeSelectorDab;
+using ::std::string;
+using ::std::vector;
+
+VirtualRadio::VirtualRadio(const string& name, const vector<VirtualProgram>& initialList)
+ : mName(name), mPrograms(initialList) {
+ sort(mPrograms.begin(), mPrograms.end());
+}
+
+string VirtualRadio::getName() const {
+ return mName;
+}
+
+const vector<VirtualProgram>& VirtualRadio::getProgramList() const {
+ return mPrograms;
+}
+
+bool VirtualRadio::getProgram(const ProgramSelector& selector, VirtualProgram* programOut) const {
+ for (const auto& program : mPrograms) {
+ if (utils::tunesTo(selector, program.selector)) {
+ *programOut = program;
+ return true;
+ }
+ }
+ return false;
+}
+
+// get singleton of AMFM Virtual Radio
+const VirtualRadio& VirtualRadio::getAmFmRadio() {
+ // clang-format off
+ static VirtualRadio amFmRadioMock(
+ "AM/FM radio mock",
+ {
+ {makeSelectorAmfm(94900), "Wild 94.9", "Drake ft. Rihanna", "Too Good"},
+ {makeSelectorAmfm(96500), "KOIT", "Celine Dion", "All By Myself"},
+ {makeSelectorAmfm(97300), "Alice@97.3", "Drops of Jupiter", "Train"},
+ {makeSelectorAmfm(99700), "99.7 Now!", "The Chainsmokers", "Closer"},
+ {makeSelectorAmfm(101300), "101-3 KISS-FM", "Justin Timberlake", "Rock Your Body"},
+ {makeSelectorAmfm(103700), "iHeart80s @ 103.7", "Michael Jackson", "Billie Jean"},
+ {makeSelectorAmfm(106100), "106 KMEL", "Drake", "Marvins Room"},
+ {makeSelectorAmfm(700), "700 AM", "Artist700", "Title700"},
+ {makeSelectorAmfm(1700), "1700 AM", "Artist1700", "Title1700"},
+ });
+ // clang-format on
+ return amFmRadioMock;
+}
+
+// get singleton of DAB Virtual Radio
+const VirtualRadio& VirtualRadio::getDabRadio() {
+ // clang-format off
+ static VirtualRadio dabRadioMock(
+ "DAB radio mock",
+ {
+ {makeSelectorDab(0xA00001u, 0x0001u), "BBC Radio 1", "Khalid", "Talk"},
+ {makeSelectorDab(0xB00001u, 0x1001u), "Classic FM", "Jean Sibelius", "Andante Festivo"},
+ {makeSelectorDab(0xB00002u, 0x1001u), "Absolute Radio", "Coldplay", "Clocks"},
+ });
+ // clang-format on
+ return dabRadioMock;
+}
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/broadcastradio/aidl/default/VirtualRadio.h b/broadcastradio/aidl/default/VirtualRadio.h
new file mode 100644
index 0000000..ae039c4
--- /dev/null
+++ b/broadcastradio/aidl/default/VirtualRadio.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include "VirtualProgram.h"
+
+#include <vector>
+
+namespace aidl::android::hardware::broadcastradio {
+
+/**
+ * A radio frequency space mock.
+ *
+ * This represents all broadcast waves in the air for a given radio technology,
+ * not a captured station list in the radio tuner memory.
+ *
+ * It's meant to abstract out radio content from default tuner implementation.
+ */
+class VirtualRadio final {
+ public:
+ VirtualRadio(const std::string& name, const std::vector<VirtualProgram>& initialList);
+ std::string getName() const;
+ const std::vector<VirtualProgram>& getProgramList() const;
+ bool getProgram(const ProgramSelector& selector, VirtualProgram* program) const;
+
+ static const VirtualRadio& getAmFmRadio();
+ static const VirtualRadio& getDabRadio();
+
+ private:
+ const std::string mName;
+ std::vector<VirtualProgram> mPrograms;
+};
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/broadcastradio/aidl/default/broadcastradio-default.rc b/broadcastradio/aidl/default/broadcastradio-default.rc
new file mode 100644
index 0000000..49389e6
--- /dev/null
+++ b/broadcastradio/aidl/default/broadcastradio-default.rc
@@ -0,0 +1,6 @@
+service vendor.broadcastradio-default /vendor/bin/hw/android.hardware.broadcastradio-service.default
+ interface aidl android.hardware.broadcastradio.IBroadcastRadio/amfm
+ interface aidl android.hardware.broadcastradio.IBroadcastRadio/dab
+ class hal
+ user audioserver
+ group audio
diff --git a/broadcastradio/aidl/default/broadcastradio-default.xml b/broadcastradio/aidl/default/broadcastradio-default.xml
new file mode 100644
index 0000000..1555822
--- /dev/null
+++ b/broadcastradio/aidl/default/broadcastradio-default.xml
@@ -0,0 +1,7 @@
+<manifest version="1.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.broadcastradio</name>
+ <fqname>IBroadcastRadio/amfm</fqname>
+ <fqname>IBroadcastRadio/dab</fqname>
+ </hal>
+</manifest>
diff --git a/broadcastradio/aidl/default/main.cpp b/broadcastradio/aidl/default/main.cpp
new file mode 100644
index 0000000..6bf20d5
--- /dev/null
+++ b/broadcastradio/aidl/default/main.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "BroadcastRadio.h"
+#include "VirtualRadio.h"
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+using ::aidl::android::hardware::broadcastradio::BroadcastRadio;
+using ::aidl::android::hardware::broadcastradio::VirtualRadio;
+
+int main() {
+ android::base::SetDefaultTag("BcRadioAidlDef");
+ ABinderProcess_setThreadPoolMaxThreadCount(4);
+ ABinderProcess_startThreadPool();
+
+ const VirtualRadio& amFmRadioMock = VirtualRadio::getAmFmRadio();
+ std::shared_ptr<BroadcastRadio> broadcastRadio =
+ ::ndk::SharedRefBase::make<BroadcastRadio>(amFmRadioMock);
+ const std::string instanceAmFm = std::string() + BroadcastRadio::descriptor + "/amfm";
+ binder_status_t statusAmFm =
+ AServiceManager_addService(broadcastRadio->asBinder().get(), instanceAmFm.c_str());
+ CHECK_EQ(statusAmFm, STATUS_OK)
+ << "Failed to register Broadcast Radio AM/FM HAL implementation";
+
+ const VirtualRadio& dabRadioMock = VirtualRadio::getDabRadio();
+ std::shared_ptr<BroadcastRadio> dabRadio =
+ ::ndk::SharedRefBase::make<BroadcastRadio>(dabRadioMock);
+ const std::string instanceDab = std::string() + BroadcastRadio::descriptor + "/dab";
+ binder_status_t statusDab =
+ AServiceManager_addService(dabRadio->asBinder().get(), instanceDab.c_str());
+ CHECK_EQ(statusDab, STATUS_OK) << "Failed to register Broadcast Radio DAB HAL implementation";
+
+ ABinderProcess_joinThreadPool();
+ return EXIT_FAILURE; // should not reach
+}
diff --git a/broadcastradio/aidl/default/resources.h b/broadcastradio/aidl/default/resources.h
new file mode 100644
index 0000000..beffc76
--- /dev/null
+++ b/broadcastradio/aidl/default/resources.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/broadcastradio/ProgramSelector.h>
+
+namespace aidl::android::hardware::broadcastradio::resources {
+
+constexpr int32_t kDemoPngId = 123456;
+constexpr uint8_t kDemoPng[] = {
+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44,
+ 0x52, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x08, 0x02, 0x00, 0x00, 0x00, 0x25,
+ 0x0b, 0xe6, 0x89, 0x00, 0x00, 0x00, 0x5d, 0x49, 0x44, 0x41, 0x54, 0x68, 0xde, 0xed, 0xd9,
+ 0xc1, 0x09, 0x00, 0x30, 0x08, 0x04, 0xc1, 0x33, 0xfd, 0xf7, 0x6c, 0x6a, 0xc8, 0x23, 0x04,
+ 0xc9, 0x6c, 0x01, 0xc2, 0x20, 0xbe, 0x4c, 0x86, 0x57, 0x49, 0xba, 0xfb, 0xd6, 0xf4, 0xba,
+ 0x3e, 0x7f, 0x4d, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x8f, 0x00, 0xbd, 0xce, 0x7f,
+ 0xc0, 0x11, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xb8, 0x0d, 0x32, 0xd4, 0x0c, 0x77, 0xbd,
+ 0xfb, 0xc1, 0xce, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82};
+
+} // namespace aidl::android::hardware::broadcastradio::resources
diff --git a/broadcastradio/aidl/vts/Android.bp b/broadcastradio/aidl/vts/Android.bp
new file mode 100644
index 0000000..b60387e
--- /dev/null
+++ b/broadcastradio/aidl/vts/Android.bp
@@ -0,0 +1,47 @@
+// Copyright (C) 2022 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 {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_test {
+ name: "VtsHalBroadcastradioAidlTargetTest",
+ defaults: [
+ "VtsHalTargetTestDefaults",
+ "use_libaidlvintf_gtest_helper_static",
+ ],
+ tidy_timeout_srcs: ["src/*.cpp"],
+ srcs: ["src/*.cpp"],
+ shared_libs: [
+ "libbinder_ndk",
+ "libbase",
+ "libxml2",
+ ],
+ static_libs: [
+ "android.hardware.broadcastradio-V1-ndk",
+ "android.hardware.broadcastradio@common-utils-aidl-lib",
+ "android.hardware.broadcastradio@vts-utils-lib",
+ "libgmock",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+}
diff --git a/broadcastradio/aidl/vts/OWNERS b/broadcastradio/aidl/vts/OWNERS
new file mode 100644
index 0000000..302fdd7
--- /dev/null
+++ b/broadcastradio/aidl/vts/OWNERS
@@ -0,0 +1,4 @@
+xuweilin@google.com
+oscarazu@google.com
+ericjeong@google.com
+keunyoung@google.com
diff --git a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp
new file mode 100644
index 0000000..5a56846
--- /dev/null
+++ b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp
@@ -0,0 +1,1103 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#define EGMOCK_VERBOSE 1
+
+#include <aidl/android/hardware/broadcastradio/BnAnnouncementListener.h>
+#include <aidl/android/hardware/broadcastradio/BnTunerCallback.h>
+#include <aidl/android/hardware/broadcastradio/ConfigFlag.h>
+#include <aidl/android/hardware/broadcastradio/IBroadcastRadio.h>
+#include <aidl/android/hardware/broadcastradio/ProgramListChunk.h>
+#include <aidl/android/hardware/broadcastradio/ProgramSelector.h>
+#include <aidl/android/hardware/broadcastradio/VendorKeyValue.h>
+#include <android-base/logging.h>
+#include <android-base/strings.h>
+#include <android-base/thread_annotations.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <broadcastradio-utils-aidl/Utils.h>
+#include <broadcastradio-vts-utils/mock-timeout.h>
+#include <cutils/bitops.h>
+#include <gmock/gmock.h>
+
+#include <chrono>
+#include <optional>
+#include <regex>
+
+namespace aidl::android::hardware::broadcastradio::vts {
+
+namespace {
+
+using ::aidl::android::hardware::broadcastradio::utils::makeIdentifier;
+using ::aidl::android::hardware::broadcastradio::utils::makeSelectorAmfm;
+using ::aidl::android::hardware::broadcastradio::utils::resultToInt;
+using ::ndk::ScopedAStatus;
+using ::ndk::SharedRefBase;
+using ::std::string;
+using ::std::vector;
+using ::testing::_;
+using ::testing::AnyNumber;
+using ::testing::ByMove;
+using ::testing::DoAll;
+using ::testing::Invoke;
+using ::testing::SaveArg;
+
+namespace bcutils = ::aidl::android::hardware::broadcastradio::utils;
+
+inline constexpr std::chrono::seconds kTuneTimeoutSec =
+ std::chrono::seconds(IBroadcastRadio::TUNER_TIMEOUT_MS * 1000);
+inline constexpr std::chrono::seconds kProgramListScanTimeoutSec =
+ std::chrono::seconds(IBroadcastRadio::LIST_COMPLETE_TIMEOUT_MS * 1000);
+
+const ConfigFlag kConfigFlagValues[] = {
+ ConfigFlag::FORCE_MONO,
+ ConfigFlag::FORCE_ANALOG,
+ ConfigFlag::FORCE_DIGITAL,
+ ConfigFlag::RDS_AF,
+ ConfigFlag::RDS_REG,
+ ConfigFlag::DAB_DAB_LINKING,
+ ConfigFlag::DAB_FM_LINKING,
+ ConfigFlag::DAB_DAB_SOFT_LINKING,
+ ConfigFlag::DAB_FM_SOFT_LINKING,
+};
+
+void printSkipped(const string& msg) {
+ const auto testInfo = testing::UnitTest::GetInstance()->current_test_info();
+ LOG(INFO) << "[ SKIPPED ] " << testInfo->test_case_name() << "." << testInfo->name()
+ << " with message: " << msg;
+}
+
+bool isValidAmFmFreq(int64_t freq) {
+ ProgramIdentifier id = bcutils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, freq);
+ return bcutils::isValid(id);
+}
+
+void validateRange(const AmFmBandRange& range) {
+ EXPECT_TRUE(isValidAmFmFreq(range.lowerBound));
+ EXPECT_TRUE(isValidAmFmFreq(range.upperBound));
+ EXPECT_LT(range.lowerBound, range.upperBound);
+ EXPECT_GT(range.spacing, 0u);
+ EXPECT_EQ((range.upperBound - range.lowerBound) % range.spacing, 0u);
+}
+
+bool supportsFM(const AmFmRegionConfig& config) {
+ for (const auto& range : config.ranges) {
+ if (bcutils::getBand(range.lowerBound) == bcutils::FrequencyBand::FM) {
+ return true;
+ }
+ }
+ return false;
+}
+
+} // namespace
+
+class TunerCallbackMock : public BnTunerCallback {
+ public:
+ TunerCallbackMock();
+
+ MOCK_METHOD2(onTuneFailed, ScopedAStatus(Result, const ProgramSelector&));
+ MOCK_TIMEOUT_METHOD1(onCurrentProgramInfoChangedMock, ScopedAStatus(const ProgramInfo&));
+ ScopedAStatus onCurrentProgramInfoChanged(const ProgramInfo& info) override;
+ ScopedAStatus onProgramListUpdated(const ProgramListChunk& chunk) override;
+ MOCK_METHOD1(onAntennaStateChange, ScopedAStatus(bool connected));
+ MOCK_METHOD1(onParametersUpdated, ScopedAStatus(const vector<VendorKeyValue>& parameters));
+ MOCK_METHOD2(onConfigFlagUpdated, ScopedAStatus(ConfigFlag in_flag, bool in_value));
+ MOCK_TIMEOUT_METHOD0(onProgramListReady, void());
+
+ std::mutex mLock;
+ bcutils::ProgramInfoSet mProgramList GUARDED_BY(mLock);
+};
+
+struct AnnouncementListenerMock : public BnAnnouncementListener {
+ MOCK_METHOD1(onListUpdated, ScopedAStatus(const vector<Announcement>&));
+};
+
+class BroadcastRadioHalTest : public testing::TestWithParam<string> {
+ protected:
+ void SetUp() override;
+ void TearDown() override;
+
+ bool getAmFmRegionConfig(bool full, AmFmRegionConfig* config);
+ std::optional<bcutils::ProgramInfoSet> getProgramList();
+ std::optional<bcutils::ProgramInfoSet> getProgramList(const ProgramFilter& filter);
+
+ std::shared_ptr<IBroadcastRadio> mModule;
+ Properties mProperties;
+ std::shared_ptr<TunerCallbackMock> mCallback = SharedRefBase::make<TunerCallbackMock>();
+};
+
+MATCHER_P(InfoHasId, id, string(negation ? "does not contain" : "contains") + " " + id.toString()) {
+ vector<int> ids = bcutils::getAllIds(arg.selector, id.type);
+ return ids.end() != find(ids.begin(), ids.end(), id.value);
+}
+
+TunerCallbackMock::TunerCallbackMock() {
+ EXPECT_TIMEOUT_CALL(*this, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());
+
+ // we expect the antenna is connected through the whole test
+ EXPECT_CALL(*this, onAntennaStateChange(false)).Times(0);
+}
+
+ScopedAStatus TunerCallbackMock::onCurrentProgramInfoChanged(const ProgramInfo& info) {
+ for (const auto& id : info.selector) {
+ EXPECT_NE(id.type, IdentifierType::INVALID);
+ }
+
+ IdentifierType logically = info.logicallyTunedTo.type;
+ // This field is required for currently tuned program and should be INVALID
+ // for entries from the program list.
+ EXPECT_TRUE(logically == IdentifierType::AMFM_FREQUENCY_KHZ ||
+ logically == IdentifierType::RDS_PI ||
+ logically == IdentifierType::HD_STATION_ID_EXT ||
+ logically == IdentifierType::DAB_SID_EXT ||
+ logically == IdentifierType::DRMO_SERVICE_ID ||
+ logically == IdentifierType::SXM_SERVICE_ID ||
+ (logically >= IdentifierType::VENDOR_START &&
+ logically <= IdentifierType::VENDOR_END) ||
+ logically > IdentifierType::SXM_CHANNEL);
+
+ IdentifierType physically = info.physicallyTunedTo.type;
+ // ditto (see "logically" above)
+ EXPECT_TRUE(physically == IdentifierType::AMFM_FREQUENCY_KHZ ||
+ physically == IdentifierType::DAB_ENSEMBLE ||
+ physically == IdentifierType::DRMO_FREQUENCY_KHZ ||
+ physically == IdentifierType::SXM_CHANNEL ||
+ (physically >= IdentifierType::VENDOR_START &&
+ physically <= IdentifierType::VENDOR_END) ||
+ physically > IdentifierType::SXM_CHANNEL);
+
+ if (logically == IdentifierType::AMFM_FREQUENCY_KHZ) {
+ std::optional<string> ps = bcutils::getMetadataString(info, Metadata::rdsPs);
+ if (ps.has_value()) {
+ EXPECT_NE(::android::base::Trim(*ps), "")
+ << "Don't use empty RDS_PS as an indicator of missing RSD PS data.";
+ }
+ }
+
+ return onCurrentProgramInfoChangedMock(info);
+}
+
+ScopedAStatus TunerCallbackMock::onProgramListUpdated(const ProgramListChunk& chunk) {
+ std::lock_guard<std::mutex> lk(mLock);
+
+ updateProgramList(chunk, &mProgramList);
+
+ if (chunk.complete) {
+ onProgramListReady();
+ }
+
+ return ndk::ScopedAStatus::ok();
+}
+
+void BroadcastRadioHalTest::SetUp() {
+ EXPECT_EQ(mModule.get(), nullptr) << "Module is already open";
+
+ // lookup AIDL service (radio module)
+ AIBinder* binder = AServiceManager_waitForService(GetParam().c_str());
+ ASSERT_NE(binder, nullptr);
+ mModule = IBroadcastRadio::fromBinder(ndk::SpAIBinder(binder));
+ ASSERT_NE(mModule, nullptr) << "Couldn't find broadcast radio HAL implementation";
+
+ // get module properties
+ auto propResult = mModule->getProperties(&mProperties);
+
+ ASSERT_TRUE(propResult.isOk());
+ EXPECT_FALSE(mProperties.maker.empty());
+ EXPECT_FALSE(mProperties.product.empty());
+ EXPECT_GT(mProperties.supportedIdentifierTypes.size(), 0u);
+
+ // set callback
+ EXPECT_TRUE(mModule->setTunerCallback(mCallback).isOk());
+}
+
+void BroadcastRadioHalTest::TearDown() {
+ if (mModule) {
+ ASSERT_TRUE(mModule->unsetTunerCallback().isOk());
+ }
+}
+
+bool BroadcastRadioHalTest::getAmFmRegionConfig(bool full, AmFmRegionConfig* config) {
+ auto halResult = mModule->getAmFmRegionConfig(full, config);
+
+ if (halResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) {
+ return false;
+ }
+
+ EXPECT_TRUE(halResult.isOk());
+ return halResult.isOk();
+}
+
+std::optional<bcutils::ProgramInfoSet> BroadcastRadioHalTest::getProgramList() {
+ ProgramFilter emptyFilter = {};
+ return getProgramList(emptyFilter);
+}
+
+std::optional<bcutils::ProgramInfoSet> BroadcastRadioHalTest::getProgramList(
+ const ProgramFilter& filter) {
+ EXPECT_TIMEOUT_CALL(*mCallback, onProgramListReady).Times(AnyNumber());
+
+ auto startResult = mModule->startProgramListUpdates(filter);
+
+ if (startResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) {
+ printSkipped("Program list not supported");
+ return std::nullopt;
+ }
+ EXPECT_TRUE(startResult.isOk());
+ if (!startResult.isOk()) {
+ return std::nullopt;
+ }
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onProgramListReady, kProgramListScanTimeoutSec);
+
+ auto stopResult = mModule->stopProgramListUpdates();
+
+ EXPECT_TRUE(stopResult.isOk());
+
+ return mCallback->mProgramList;
+}
+
+/**
+ * Test setting tuner callback to null.
+ *
+ * Verifies that:
+ * - Setting to a null tuner callback results with INVALID_ARGUMENTS.
+ */
+TEST_P(BroadcastRadioHalTest, TunerCallbackFailsWithNull) {
+ LOG(DEBUG) << "TunerCallbackFailsWithNull Test";
+
+ auto halResult = mModule->setTunerCallback(nullptr);
+
+ EXPECT_EQ(halResult.getServiceSpecificError(), resultToInt(Result::INVALID_ARGUMENTS));
+}
+
+/**
+ * Test fetching AM/FM regional configuration.
+ *
+ * Verifies that:
+ * - AM/FM regional configuration is either set at startup or not supported at all by the hardware;
+ * - FM Deemphasis and RDS are correctly configured for FM-capable radio;
+ */
+TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfig) {
+ LOG(DEBUG) << "GetAmFmRegionConfig Test";
+
+ AmFmRegionConfig config;
+
+ bool supported = getAmFmRegionConfig(/* full= */ false, &config);
+
+ if (!supported) {
+ printSkipped("AM/FM not supported");
+ return;
+ }
+
+ EXPECT_LE(popcountll(static_cast<unsigned long long>(config.fmDeemphasis)), 1);
+ EXPECT_LE(popcountll(static_cast<unsigned long long>(config.fmRds)), 1);
+
+ if (supportsFM(config)) {
+ EXPECT_EQ(popcountll(static_cast<unsigned long long>(config.fmDeemphasis)), 1);
+ }
+}
+
+/**
+ * Test fetching ranges of AM/FM regional configuration.
+ *
+ * Verifies that:
+ * - AM/FM regional configuration is either set at startup or not supported at all by the hardware;
+ * - there is at least one AM/FM band configured;
+ * - all channel grids (frequency ranges and spacings) are valid;
+ * - seek spacing is a multiple of the manual spacing value.
+ */
+TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigRanges) {
+ LOG(DEBUG) << "GetAmFmRegionConfigRanges Test";
+
+ AmFmRegionConfig config;
+
+ bool supported = getAmFmRegionConfig(/* full= */ false, &config);
+
+ if (!supported) {
+ printSkipped("AM/FM not supported");
+ return;
+ }
+
+ EXPECT_GT(config.ranges.size(), 0u);
+ for (const auto& range : config.ranges) {
+ validateRange(range);
+ EXPECT_EQ(range.seekSpacing % range.spacing, 0u);
+ EXPECT_GE(range.seekSpacing, range.spacing);
+ }
+}
+
+/**
+ * Test fetching FM regional capabilities.
+ *
+ * Verifies that:
+ * - AM/FM regional capabilities are either available or not supported at all by the hardware;
+ * - there is at least one de-emphasis filter mode supported for FM-capable radio;
+ */
+TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilitiesForFM) {
+ LOG(DEBUG) << "GetAmFmRegionConfigCapabilitiesForFM Test";
+
+ AmFmRegionConfig config;
+
+ bool supported = getAmFmRegionConfig(/* full= */ true, &config);
+
+ if (supported && supportsFM(config)) {
+ EXPECT_GE(popcountll(static_cast<unsigned long long>(config.fmDeemphasis)), 1);
+ } else {
+ printSkipped("FM not supported");
+ }
+}
+
+/**
+ * Test fetching the ranges of AM/FM regional capabilities.
+ *
+ * Verifies that:
+ * - AM/FM regional capabilities are either available or not supported at all by the hardware;
+ * - there is at least one AM/FM range supported;
+ * - all channel grids (frequency ranges and spacings) are valid;
+ * - seek spacing is not set.
+ */
+TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilitiesRanges) {
+ LOG(DEBUG) << "GetAmFmRegionConfigCapabilitiesRanges Test";
+
+ AmFmRegionConfig config;
+
+ bool supported = getAmFmRegionConfig(/* full= */ true, &config);
+
+ if (!supported) {
+ printSkipped("AM/FM not supported");
+ return;
+ }
+
+ EXPECT_GT(config.ranges.size(), 0u);
+
+ for (const auto& range : config.ranges) {
+ validateRange(range);
+ EXPECT_EQ(range.seekSpacing, 0u);
+ }
+}
+
+/**
+ * Test fetching DAB regional configuration.
+ *
+ * Verifies that:
+ * - DAB regional configuration is either set at startup or not supported at all by the hardware;
+ * - all channel labels match correct format;
+ * - all channel frequencies are in correct range.
+ */
+TEST_P(BroadcastRadioHalTest, GetDabRegionConfig) {
+ LOG(DEBUG) << "GetDabRegionConfig Test";
+ vector<DabTableEntry> config;
+
+ auto halResult = mModule->getDabRegionConfig(&config);
+
+ if (halResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) {
+ printSkipped("DAB not supported");
+ return;
+ }
+ ASSERT_TRUE(halResult.isOk());
+
+ std::regex re("^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$");
+
+ for (const auto& entry : config) {
+ EXPECT_TRUE(std::regex_match(string(entry.label), re));
+
+ ProgramIdentifier id =
+ bcutils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, entry.frequencyKhz);
+ EXPECT_TRUE(bcutils::isValid(id));
+ }
+}
+
+/**
+ * Test tuning without tuner callback set.
+ *
+ * Verifies that:
+ * - No tuner callback set results in INVALID_STATE, regardless of whether the selector is
+ * supported.
+ */
+TEST_P(BroadcastRadioHalTest, TuneFailsWithoutTunerCallback) {
+ LOG(DEBUG) << "TuneFailsWithoutTunerCallback Test";
+
+ mModule->unsetTunerCallback();
+ int64_t freq = 90900; // 90.9 FM
+ ProgramSelector sel = makeSelectorAmfm(freq);
+
+ auto result = mModule->tune(sel);
+
+ EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE));
+}
+
+/**
+ * Test tuning with selectors that can be not supported.
+ *
+ * Verifies that:
+ * - if the selector is not supported, an invalid value results with NOT_SUPPORTED, regardless of
+ * whether it is valid;
+ * - if it is supported, the test is ignored;
+ */
+TEST_P(BroadcastRadioHalTest, TuneFailsWithNotSupported) {
+ LOG(DEBUG) << "TuneFailsWithInvalid Test";
+
+ vector<ProgramIdentifier> supportTestId = {
+ makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 0), // invalid
+ makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 94900), // valid
+ makeIdentifier(IdentifierType::RDS_PI, 0x10000), // invalid
+ makeIdentifier(IdentifierType::RDS_PI, 0x1001), // valid
+ makeIdentifier(IdentifierType::HD_STATION_ID_EXT, 0x100000000), // invalid
+ makeIdentifier(IdentifierType::HD_STATION_ID_EXT, 0x10000001), // valid
+ makeIdentifier(IdentifierType::DAB_SID_EXT, 0), // invalid
+ makeIdentifier(IdentifierType::DAB_SID_EXT, 0xA00001), // valid
+ makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x100000000), // invalid
+ makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x10000001), // valid
+ makeIdentifier(IdentifierType::SXM_SERVICE_ID, 0x100000000), // invalid
+ makeIdentifier(IdentifierType::SXM_SERVICE_ID, 0x10000001), // valid
+ };
+
+ auto notSupportedError = resultToInt(Result::NOT_SUPPORTED);
+ for (const auto& id : supportTestId) {
+ ProgramSelector sel{id, {}};
+
+ auto result = mModule->tune(sel);
+
+ if (!bcutils::isSupported(mProperties, sel)) {
+ EXPECT_EQ(result.getServiceSpecificError(), notSupportedError);
+ }
+ }
+}
+
+/**
+ * Test tuning with invalid selectors.
+ *
+ * Verifies that:
+ * - if the selector is not supported, it's ignored;
+ * - if it is supported, an invalid value results with INVALID_ARGUMENTS;
+ */
+TEST_P(BroadcastRadioHalTest, TuneFailsWithInvalid) {
+ LOG(DEBUG) << "TuneFailsWithInvalid Test";
+
+ vector<ProgramIdentifier> invalidId = {
+ makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 0),
+ makeIdentifier(IdentifierType::RDS_PI, 0x10000),
+ makeIdentifier(IdentifierType::HD_STATION_ID_EXT, 0x100000000),
+ makeIdentifier(IdentifierType::DAB_SID_EXT, 0),
+ makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x100000000),
+ makeIdentifier(IdentifierType::SXM_SERVICE_ID, 0x100000000),
+ };
+
+ auto invalidArgumentsError = resultToInt(Result::INVALID_ARGUMENTS);
+ for (const auto& id : invalidId) {
+ ProgramSelector sel{id, {}};
+
+ auto result = mModule->tune(sel);
+
+ if (bcutils::isSupported(mProperties, sel)) {
+ EXPECT_EQ(result.getServiceSpecificError(), invalidArgumentsError);
+ }
+ }
+}
+
+/**
+ * Test tuning with empty program selector.
+ *
+ * Verifies that:
+ * - tune fails with NOT_SUPPORTED when program selector is not initialized.
+ */
+TEST_P(BroadcastRadioHalTest, TuneFailsWithEmpty) {
+ LOG(DEBUG) << "TuneFailsWithEmpty Test";
+
+ // Program type is 1-based, so 0 will always be invalid.
+ ProgramSelector sel = {};
+
+ auto result = mModule->tune(sel);
+
+ ASSERT_EQ(result.getServiceSpecificError(), resultToInt(Result::NOT_SUPPORTED));
+}
+
+/**
+ * Test tuning with FM selector.
+ *
+ * Verifies that:
+ * - if AM/FM selector is not supported, the method returns NOT_SUPPORTED;
+ * - if it is supported, the method succeeds;
+ * - after a successful tune call, onCurrentProgramInfoChanged callback is
+ * invoked carrying a proper selector;
+ * - program changes exactly to what was requested.
+ */
+TEST_P(BroadcastRadioHalTest, FmTune) {
+ LOG(DEBUG) << "FmTune Test";
+
+ int64_t freq = 90900; // 90.9 FM
+ ProgramSelector sel = makeSelectorAmfm(freq);
+ // try tuning
+ ProgramInfo infoCb = {};
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock,
+ InfoHasId(makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, freq)))
+ .Times(AnyNumber())
+ .WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(ndk::ScopedAStatus::ok()))))
+ .WillRepeatedly(testing::InvokeWithoutArgs([] { return ndk::ScopedAStatus::ok(); }));
+
+ auto result = mModule->tune(sel);
+
+ // expect a failure if it's not supported
+ if (!bcutils::isSupported(mProperties, sel)) {
+ EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::NOT_SUPPORTED));
+ return;
+ }
+
+ // expect a callback if it succeeds
+ EXPECT_TRUE(result.isOk());
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
+
+ LOG(DEBUG) << "Current program info: " << infoCb.toString();
+
+ // it should tune exactly to what was requested
+ vector<int> freqs = bcutils::getAllIds(infoCb.selector, IdentifierType::AMFM_FREQUENCY_KHZ);
+ EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq))
+ << "FM freq " << freq << " kHz is not sent back by callback.";
+}
+
+/**
+ * Test tuning with DAB selector.
+ *
+ * Verifies that:
+ * - if DAB selector is not supported, the method returns NOT_SUPPORTED;
+ * - if it is supported, the method succeeds;
+ * - after a successful tune call, onCurrentProgramInfoChanged callback is
+ * invoked carrying a proper selector;
+ * - program changes exactly to what was requested.
+ */
+TEST_P(BroadcastRadioHalTest, DabTune) {
+ LOG(DEBUG) << "DabTune Test";
+ vector<DabTableEntry> config;
+
+ auto halResult = mModule->getDabRegionConfig(&config);
+
+ if (halResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) {
+ printSkipped("DAB not supported");
+ return;
+ }
+ ASSERT_TRUE(halResult.isOk());
+ ASSERT_NE(config.size(), 0U);
+
+ // TODO(245787803): use a DAB frequency that can actually be tuned to.
+ ProgramSelector sel = {};
+ int64_t freq = config[config.size() / 2].frequencyKhz;
+ sel.primaryId = makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, freq);
+
+ // try tuning
+ ProgramInfo infoCb = {};
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock,
+ InfoHasId(makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, freq)))
+ .Times(AnyNumber())
+ .WillOnce(
+ DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(ndk::ScopedAStatus::ok()))));
+
+ auto result = mModule->tune(sel);
+
+ // expect a failure if it's not supported
+ if (!bcutils::isSupported(mProperties, sel)) {
+ EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::NOT_SUPPORTED));
+ return;
+ }
+
+ // expect a callback if it succeeds
+ EXPECT_TRUE(result.isOk());
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
+ LOG(DEBUG) << "Current program info: " << infoCb.toString();
+
+ // it should tune exactly to what was requested
+ vector<int> freqs = bcutils::getAllIds(infoCb.selector, IdentifierType::DAB_FREQUENCY_KHZ);
+ EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq))
+ << "DAB freq " << freq << " kHz is not sent back by callback.";
+ ;
+}
+
+/**
+ * Test seeking to next/prev station via IBroadcastRadio::seek().
+ *
+ * Verifies that:
+ * - the method succeeds;
+ * - the program info is changed within kTuneTimeoutSec;
+ * - works both directions and with or without skipping sub-channel.
+ */
+TEST_P(BroadcastRadioHalTest, Seek) {
+ LOG(DEBUG) << "Seek Test";
+
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());
+
+ auto result = mModule->seek(/* in_directionUp= */ true, /* in_skipSubChannel= */ true);
+
+ if (result.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) {
+ printSkipped("Seek not supported");
+ return;
+ }
+
+ EXPECT_TRUE(result.isOk());
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
+
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());
+
+ result = mModule->seek(/* in_directionUp= */ false, /* in_skipSubChannel= */ false);
+
+ EXPECT_TRUE(result.isOk());
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
+}
+
+/**
+ * Test seeking without tuner callback set.
+ *
+ * Verifies that:
+ * - No tuner callback set results in INVALID_STATE.
+ */
+TEST_P(BroadcastRadioHalTest, SeekFailsWithoutTunerCallback) {
+ LOG(DEBUG) << "SeekFailsWithoutTunerCallback Test";
+
+ mModule->unsetTunerCallback();
+
+ auto result = mModule->seek(/* in_directionUp= */ true, /* in_skipSubChannel= */ true);
+
+ EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE));
+
+ result = mModule->seek(/* in_directionUp= */ false, /* in_skipSubChannel= */ false);
+
+ EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE));
+}
+
+/**
+ * Test step operation.
+ *
+ * Verifies that:
+ * - the method succeeds or returns NOT_SUPPORTED;
+ * - the program info is changed within kTuneTimeoutSec if the method succeeded;
+ * - works both directions.
+ */
+TEST_P(BroadcastRadioHalTest, Step) {
+ LOG(DEBUG) << "Step Test";
+
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());
+
+ auto result = mModule->step(/* in_directionUp= */ true);
+
+ if (result.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) {
+ printSkipped("Step not supported");
+ return;
+ }
+ EXPECT_TRUE(result.isOk());
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
+
+ EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber());
+
+ result = mModule->step(/* in_directionUp= */ false);
+
+ EXPECT_TRUE(result.isOk());
+ EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec);
+}
+
+/**
+ * Test step operation without tuner callback set.
+ *
+ * Verifies that:
+ * - No tuner callback set results in INVALID_STATE.
+ */
+TEST_P(BroadcastRadioHalTest, StepFailsWithoutTunerCallback) {
+ LOG(DEBUG) << "StepFailsWithoutTunerCallback Test";
+
+ mModule->unsetTunerCallback();
+
+ auto result = mModule->step(/* in_directionUp= */ true);
+
+ EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE));
+
+ result = mModule->step(/* in_directionUp= */ false);
+
+ EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE));
+}
+
+/**
+ * Test tune cancellation.
+ *
+ * Verifies that:
+ * - the method does not crash after being invoked multiple times.
+ *
+ * Since cancel() might be called after the HAL completes an operation (tune, seek, and step)
+ * and before the callback completions, the operation might not be actually canceled and the
+ * effect of cancel() is not deterministic to be tested here.
+ */
+TEST_P(BroadcastRadioHalTest, Cancel) {
+ LOG(DEBUG) << "Cancel Test";
+
+ auto notSupportedError = resultToInt(Result::NOT_SUPPORTED);
+ for (int i = 0; i < 10; i++) {
+ auto result = mModule->seek(/* in_directionUp= */ true, /* in_skipSubChannel= */ true);
+
+ if (result.getServiceSpecificError() == notSupportedError) {
+ printSkipped("Cancel is skipped because of seek not supported");
+ return;
+ }
+ EXPECT_TRUE(result.isOk());
+
+ auto cancelResult = mModule->cancel();
+
+ ASSERT_TRUE(cancelResult.isOk());
+ }
+}
+
+/**
+ * Test IBroadcastRadio::get|setParameters() methods called with no parameters.
+ *
+ * Verifies that:
+ * - callback is called for empty parameters set.
+ */
+TEST_P(BroadcastRadioHalTest, NoParameters) {
+ LOG(DEBUG) << "NoParameters Test";
+
+ vector<VendorKeyValue> parametersResults = {};
+
+ auto halResult = mModule->setParameters({}, ¶metersResults);
+
+ ASSERT_TRUE(halResult.isOk());
+ ASSERT_EQ(parametersResults.size(), 0u);
+
+ parametersResults.clear();
+
+ halResult = mModule->getParameters({}, ¶metersResults);
+
+ ASSERT_TRUE(halResult.isOk());
+ ASSERT_EQ(parametersResults.size(), 0u);
+}
+
+/**
+ * Test IBroadcastRadio::get|setParameters() methods called with unknown parameters.
+ *
+ * Verifies that:
+ * - unknown parameters are ignored;
+ * - callback is called also for empty results set.
+ */
+TEST_P(BroadcastRadioHalTest, UnknownParameters) {
+ LOG(DEBUG) << "UnknownParameters Test";
+
+ vector<VendorKeyValue> parametersResults = {};
+
+ auto halResult =
+ mModule->setParameters({{"com.android.unknown", "sample"}}, ¶metersResults);
+
+ ASSERT_TRUE(halResult.isOk());
+ ASSERT_EQ(parametersResults.size(), 0u);
+
+ parametersResults.clear();
+
+ halResult = mModule->getParameters({"com.android.unknown*", "sample"}, ¶metersResults);
+
+ ASSERT_TRUE(halResult.isOk());
+ ASSERT_EQ(parametersResults.size(), 0u);
+}
+
+/**
+ * Test geting image of invalid ID.
+ *
+ * Verifies that:
+ * - getImage call handles argument 0 gracefully.
+ */
+TEST_P(BroadcastRadioHalTest, GetNoImage) {
+ LOG(DEBUG) << "GetNoImage Test";
+ vector<uint8_t> rawImage;
+
+ auto result = mModule->getImage(IBroadcastRadio::INVALID_IMAGE, &rawImage);
+
+ ASSERT_TRUE(result.isOk());
+ ASSERT_EQ(rawImage.size(), 0u);
+}
+
+/**
+ * Test getting config flags.
+ *
+ * Verifies that:
+ * - isConfigFlagSet either succeeds or ends with NOT_SUPPORTED or INVALID_STATE;
+ * - call success or failure is consistent with setConfigFlag.
+ */
+TEST_P(BroadcastRadioHalTest, FetchConfigFlags) {
+ LOG(DEBUG) << "FetchConfigFlags Test";
+
+ for (const auto& flag : kConfigFlagValues) {
+ bool gotValue = false;
+
+ auto halResult = mModule->isConfigFlagSet(flag, &gotValue);
+
+ if (halResult.getServiceSpecificError() != resultToInt(Result::NOT_SUPPORTED) &&
+ halResult.getServiceSpecificError() != resultToInt(Result::INVALID_STATE)) {
+ ASSERT_TRUE(halResult.isOk());
+ }
+
+ // set must fail or succeed the same way as get
+ auto setResult = mModule->setConfigFlag(flag, /* value= */ false);
+
+ EXPECT_TRUE((halResult.isOk() && setResult.isOk()) ||
+ (halResult.getServiceSpecificError()) == setResult.getServiceSpecificError());
+
+ setResult = mModule->setConfigFlag(flag, /* value= */ true);
+
+ EXPECT_TRUE((halResult.isOk() && setResult.isOk()) ||
+ (halResult.getServiceSpecificError()) == setResult.getServiceSpecificError());
+ }
+}
+
+/**
+ * Test setting config flags.
+ *
+ * Verifies that:
+ * - setConfigFlag either succeeds or ends with NOT_SUPPORTED or INVALID_STATE;
+ * - isConfigFlagSet reflects the state requested immediately after the set call.
+ */
+TEST_P(BroadcastRadioHalTest, SetConfigFlags) {
+ LOG(DEBUG) << "SetConfigFlags Test";
+
+ auto get = [&](ConfigFlag flag) -> bool {
+ bool* gotValue = nullptr;
+
+ auto halResult = mModule->isConfigFlagSet(flag, gotValue);
+
+ EXPECT_FALSE(gotValue == nullptr);
+ EXPECT_TRUE(halResult.isOk());
+ return *gotValue;
+ };
+
+ auto notSupportedError = resultToInt(Result::NOT_SUPPORTED);
+ auto invalidStateError = resultToInt(Result::INVALID_STATE);
+ for (const auto& flag : kConfigFlagValues) {
+ auto result = mModule->setConfigFlag(flag, /* value= */ false);
+
+ if (result.getServiceSpecificError() == notSupportedError ||
+ result.getServiceSpecificError() == invalidStateError) {
+ // setting to true must result in the same error as false
+ auto secondResult = mModule->setConfigFlag(flag, /* value= */ true);
+
+ EXPECT_TRUE((result.isOk() && secondResult.isOk()) ||
+ result.getServiceSpecificError() == secondResult.getServiceSpecificError());
+ continue;
+ } else {
+ ASSERT_TRUE(result.isOk());
+ }
+
+ // verify false is set
+ bool value = get(flag);
+ EXPECT_FALSE(value);
+
+ // try setting true this time
+ result = mModule->setConfigFlag(flag, /* value= */ true);
+
+ ASSERT_TRUE(result.isOk());
+ value = get(flag);
+ EXPECT_TRUE(value);
+
+ // false again
+ result = mModule->setConfigFlag(flag, /* value= */ false);
+
+ ASSERT_TRUE(result.isOk());
+ value = get(flag);
+ EXPECT_FALSE(value);
+ }
+}
+
+/**
+ * Test getting program list using empty program filter.
+ *
+ * Verifies that:
+ * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
+ * - the complete list is fetched within kProgramListScanTimeoutSec;
+ * - stopProgramListUpdates does not crash.
+ */
+TEST_P(BroadcastRadioHalTest, GetProgramListFromEmptyFilter) {
+ LOG(DEBUG) << "GetProgramListFromEmptyFilter Test";
+
+ getProgramList();
+}
+
+/**
+ * Test getting program list using AMFM frequency program filter.
+ *
+ * Verifies that:
+ * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
+ * - the complete list is fetched within kProgramListScanTimeoutSec;
+ * - stopProgramListUpdates does not crash;
+ * - result for startProgramListUpdates using a filter with AMFM_FREQUENCY_KHZ value of the first
+ * AMFM program matches the expected result.
+ */
+TEST_P(BroadcastRadioHalTest, GetProgramListFromAmFmFilter) {
+ LOG(DEBUG) << "GetProgramListFromAmFmFilter Test";
+
+ std::optional<bcutils::ProgramInfoSet> completeList = getProgramList();
+ if (!completeList) {
+ printSkipped("No program list available");
+ return;
+ }
+
+ ProgramFilter amfmFilter = {};
+ int expectedResultSize = 0;
+ uint64_t expectedFreq = 0;
+ for (const auto& program : *completeList) {
+ vector<int> amfmIds =
+ bcutils::getAllIds(program.selector, IdentifierType::AMFM_FREQUENCY_KHZ);
+ EXPECT_LE(amfmIds.size(), 1u);
+ if (amfmIds.size() == 0) {
+ continue;
+ }
+
+ if (expectedResultSize == 0) {
+ expectedFreq = amfmIds[0];
+ amfmFilter.identifiers = {
+ makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, expectedFreq)};
+ expectedResultSize = 1;
+ } else if (amfmIds[0] == expectedFreq) {
+ expectedResultSize++;
+ }
+ }
+
+ if (expectedResultSize == 0) {
+ printSkipped("No Am/FM programs available");
+ return;
+ }
+ std::optional<bcutils::ProgramInfoSet> amfmList = getProgramList(amfmFilter);
+ ASSERT_EQ(amfmList->size(), expectedResultSize) << "amfm filter result size is wrong";
+}
+
+/**
+ * Test getting program list using DAB ensemble program filter.
+ *
+ * Verifies that:
+ * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED;
+ * - the complete list is fetched within kProgramListScanTimeoutSec;
+ * - stopProgramListUpdates does not crash;
+ * - result for startProgramListUpdates using a filter with DAB_ENSEMBLE value of the first DAB
+ * program matches the expected result.
+ */
+TEST_P(BroadcastRadioHalTest, GetProgramListFromDabFilter) {
+ LOG(DEBUG) << "GetProgramListFromDabFilter Test";
+
+ std::optional<bcutils::ProgramInfoSet> completeList = getProgramList();
+ if (!completeList) {
+ printSkipped("No program list available");
+ return;
+ }
+
+ ProgramFilter dabFilter = {};
+ int expectedResultSize = 0;
+ uint64_t expectedEnsemble = 0;
+ for (const auto& program : *completeList) {
+ auto dabEnsembles = bcutils::getAllIds(program.selector, IdentifierType::DAB_ENSEMBLE);
+ EXPECT_LE(dabEnsembles.size(), 1u);
+ if (dabEnsembles.size() == 0) {
+ continue;
+ }
+
+ if (expectedResultSize == 0) {
+ expectedEnsemble = dabEnsembles[0];
+ dabFilter.identifiers = {
+ makeIdentifier(IdentifierType::DAB_ENSEMBLE, expectedEnsemble)};
+ expectedResultSize = 1;
+ } else if (dabEnsembles[0] == expectedEnsemble) {
+ expectedResultSize++;
+ }
+ }
+
+ if (expectedResultSize == 0) {
+ printSkipped("No DAB programs available");
+ return;
+ }
+ std::optional<bcutils::ProgramInfoSet> dabList = getProgramList(dabFilter);
+ ASSERT_EQ(dabList->size(), expectedResultSize) << "dab filter result size is wrong";
+}
+
+/**
+ * Test HD_STATION_NAME correctness.
+ *
+ * Verifies that if a program on the list contains HD_STATION_NAME identifier:
+ * - the program provides station name in its metadata;
+ * - the identifier matches the name;
+ * - there is only one identifier of that type.
+ */
+TEST_P(BroadcastRadioHalTest, HdRadioStationNameId) {
+ LOG(DEBUG) << "HdRadioStationNameId Test";
+
+ std::optional<bcutils::ProgramInfoSet> list = getProgramList();
+ if (!list) {
+ printSkipped("No program list");
+ return;
+ }
+
+ for (const auto& program : *list) {
+ vector<int> nameIds = bcutils::getAllIds(program.selector, IdentifierType::HD_STATION_NAME);
+ EXPECT_LE(nameIds.size(), 1u);
+ if (nameIds.size() == 0) {
+ continue;
+ }
+
+ std::optional<string> name = bcutils::getMetadataString(program, Metadata::programName);
+ if (!name) {
+ name = bcutils::getMetadataString(program, Metadata::rdsPs);
+ }
+ ASSERT_TRUE(name.has_value());
+
+ ProgramIdentifier expectedId = bcutils::makeHdRadioStationName(*name);
+ EXPECT_EQ(nameIds[0], expectedId.value);
+ }
+}
+
+/**
+ * Test announcement listener registration.
+ *
+ * Verifies that:
+ * - registerAnnouncementListener either succeeds or returns NOT_SUPPORTED;
+ * - if it succeeds, it returns a valid close handle (which is a nullptr otherwise);
+ * - closing handle does not crash.
+ */
+TEST_P(BroadcastRadioHalTest, AnnouncementListenerRegistration) {
+ LOG(DEBUG) << "AnnouncementListenerRegistration Test";
+ std::shared_ptr<AnnouncementListenerMock> listener =
+ SharedRefBase::make<AnnouncementListenerMock>();
+ std::shared_ptr<ICloseHandle> closeHandle = nullptr;
+
+ auto halResult = mModule->registerAnnouncementListener(listener, {AnnouncementType::EMERGENCY},
+ &closeHandle);
+
+ if (halResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) {
+ ASSERT_EQ(closeHandle.get(), nullptr);
+ printSkipped("Announcements not supported");
+ return;
+ }
+
+ ASSERT_TRUE(halResult.isOk());
+ ASSERT_NE(closeHandle.get(), nullptr);
+
+ closeHandle->close();
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BroadcastRadioHalTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, BroadcastRadioHalTest,
+ testing::ValuesIn(::android::getAidlHalInstanceNames(IBroadcastRadio::descriptor)),
+ ::android::PrintInstanceNameToString);
+
+} // namespace aidl::android::hardware::broadcastradio::vts
+
+int main(int argc, char** argv) {
+ android::base::SetDefaultTag("BcRadio.vts");
+ android::base::SetMinimumLogSeverity(android::base::VERBOSE);
+ ::testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_setThreadPoolMaxThreadCount(4);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/broadcastradio/common/utils/WorkerThread.cpp b/broadcastradio/common/utils/WorkerThread.cpp
index 31f4d3f..dd87f53 100644
--- a/broadcastradio/common/utils/WorkerThread.cpp
+++ b/broadcastradio/common/utils/WorkerThread.cpp
@@ -31,7 +31,11 @@
return lhs.when > rhs.when;
}
-WorkerThread::WorkerThread() : mIsTerminating(false), mThread(&WorkerThread::threadLoop, this) {}
+WorkerThread::WorkerThread() : mIsTerminating(false) {
+ // putting mThread in constructor instead of initializer list
+ // to ensure all class members are init before mThread starts
+ mThread = std::thread(&WorkerThread::threadLoop, this);
+}
WorkerThread::~WorkerThread() {
{
diff --git a/broadcastradio/common/utilsaidl/Android.bp b/broadcastradio/common/utilsaidl/Android.bp
new file mode 100644
index 0000000..fa6de19
--- /dev/null
+++ b/broadcastradio/common/utilsaidl/Android.bp
@@ -0,0 +1,50 @@
+//
+// Copyright (C) 2022 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 {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_library_static {
+ name: "android.hardware.broadcastradio@common-utils-aidl-lib",
+ vendor_available: true,
+ relative_install_path: "hw",
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ "-Wno-error=implicit-fallthrough",
+ ],
+ cppflags: [
+ "-std=c++1z",
+ ],
+ srcs: [
+ "Utils.cpp",
+ ],
+ export_include_dirs: ["include"],
+ shared_libs: [
+ "android.hardware.broadcastradio-V1-ndk",
+ "libbase",
+ ],
+ static_libs: [
+ "libmath",
+ ],
+}
diff --git a/broadcastradio/common/utilsaidl/Utils.cpp b/broadcastradio/common/utilsaidl/Utils.cpp
new file mode 100644
index 0000000..52c7b40
--- /dev/null
+++ b/broadcastradio/common/utilsaidl/Utils.cpp
@@ -0,0 +1,545 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#define LOG_TAG "BcRadioAidlDef.utils"
+
+#include "broadcastradio-utils-aidl/Utils.h"
+
+#include <android-base/logging.h>
+#include <android-base/parseint.h>
+#include <android-base/strings.h>
+
+#include <math/HashCombine.h>
+
+namespace aidl::android::hardware::broadcastradio {
+
+namespace utils {
+
+namespace {
+
+using ::android::base::EqualsIgnoreCase;
+using ::std::string;
+using ::std::vector;
+
+const int64_t kValueForNotFoundIdentifier = 0;
+
+bool bothHaveId(const ProgramSelector& a, const ProgramSelector& b, const IdentifierType& type) {
+ return hasId(a, type) && hasId(b, type);
+}
+
+bool haveEqualIds(const ProgramSelector& a, const ProgramSelector& b, const IdentifierType& type) {
+ if (!bothHaveId(a, b, type)) {
+ return false;
+ }
+ /* We should check all Ids of a given type (ie. other AF),
+ * but it doesn't matter for default implementation.
+ */
+ return getId(a, type) == getId(b, type);
+}
+
+int getHdSubchannel(const ProgramSelector& sel) {
+ int64_t hdSidExt = getId(sel, IdentifierType::HD_STATION_ID_EXT, /* defaultValue */ 0);
+ hdSidExt >>= 32; // Station ID number
+ return hdSidExt & 0xF; // HD Radio subchannel
+}
+
+bool maybeGetId(const ProgramSelector& sel, const IdentifierType& type, int64_t* val) {
+ // iterate through primaryId and secondaryIds
+ for (auto it = begin(sel); it != end(sel); it++) {
+ if (it->type == type) {
+ if (val != nullptr) {
+ *val = it->value;
+ }
+ return true;
+ }
+ }
+
+ return false;
+}
+
+} // namespace
+
+IdentifierIterator::IdentifierIterator(const ProgramSelector& sel) : IdentifierIterator(sel, 0) {}
+
+IdentifierIterator::IdentifierIterator(const ProgramSelector& sel, size_t pos)
+ : mSel(sel), mPos(pos) {}
+
+const IdentifierIterator IdentifierIterator::operator++(int) {
+ IdentifierIterator i = *this;
+ mPos++;
+ return i;
+}
+
+IdentifierIterator& IdentifierIterator::operator++() {
+ ++mPos;
+ return *this;
+}
+
+IdentifierIterator::refType IdentifierIterator::operator*() const {
+ if (mPos == 0) {
+ return getSelector().primaryId;
+ }
+
+ // mPos is 1-based for secondary identifiers
+ DCHECK(mPos <= getSelector().secondaryIds.size());
+ return getSelector().secondaryIds[mPos - 1];
+}
+
+bool IdentifierIterator::operator==(const IdentifierIterator& rhs) const {
+ // Check, if both iterators points at the same selector.
+ if (reinterpret_cast<intptr_t>(&getSelector()) !=
+ reinterpret_cast<intptr_t>(&rhs.getSelector())) {
+ return false;
+ }
+
+ return mPos == rhs.mPos;
+}
+
+int32_t resultToInt(Result result) {
+ return static_cast<int32_t>(result);
+}
+
+FrequencyBand getBand(int64_t freq) {
+ // keep in sync with
+ // frameworks/base/services/core/java/com/android/server/broadcastradio/aidl/Utils.java
+ if (freq < 30) return FrequencyBand::UNKNOWN;
+ if (freq < 500) return FrequencyBand::AM_LW;
+ if (freq < 1705) return FrequencyBand::AM_MW;
+ if (freq < 30000) return FrequencyBand::AM_SW;
+ if (freq < 60000) return FrequencyBand::UNKNOWN;
+ if (freq < 110000) return FrequencyBand::FM;
+ return FrequencyBand::UNKNOWN;
+}
+
+bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) {
+ IdentifierType type = b.primaryId.type;
+
+ switch (type) {
+ case IdentifierType::HD_STATION_ID_EXT:
+ case IdentifierType::RDS_PI:
+ case IdentifierType::AMFM_FREQUENCY_KHZ:
+ if (haveEqualIds(a, b, IdentifierType::HD_STATION_ID_EXT)) return true;
+ if (haveEqualIds(a, b, IdentifierType::RDS_PI)) return true;
+ return getHdSubchannel(b) == 0 &&
+ haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ);
+ case IdentifierType::DAB_SID_EXT:
+ return haveEqualIds(a, b, IdentifierType::DAB_SID_EXT);
+ case IdentifierType::DRMO_SERVICE_ID:
+ return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID);
+ case IdentifierType::SXM_SERVICE_ID:
+ return haveEqualIds(a, b, IdentifierType::SXM_SERVICE_ID);
+ default: // includes all vendor types
+ LOG(WARNING) << "unsupported program type: " << toString(type);
+ return false;
+ }
+}
+
+bool hasId(const ProgramSelector& sel, const IdentifierType& type) {
+ return maybeGetId(sel, type, /* val */ nullptr);
+}
+
+int64_t getId(const ProgramSelector& sel, const IdentifierType& type) {
+ int64_t val;
+
+ if (maybeGetId(sel, type, &val)) {
+ return val;
+ }
+
+ LOG(WARNING) << "identifier not found: " << toString(type);
+ return kValueForNotFoundIdentifier;
+}
+
+int64_t getId(const ProgramSelector& sel, const IdentifierType& type, int64_t defaultValue) {
+ if (!hasId(sel, type)) {
+ return defaultValue;
+ }
+ return getId(sel, type);
+}
+
+vector<int> getAllIds(const ProgramSelector& sel, const IdentifierType& type) {
+ vector<int> ret;
+
+ // iterate through primaryId and secondaryIds
+ for (auto it = begin(sel); it != end(sel); it++) {
+ if (it->type == type) {
+ ret.push_back(it->value);
+ }
+ }
+
+ return ret;
+}
+
+bool isSupported(const Properties& prop, const ProgramSelector& sel) {
+ for (auto it = prop.supportedIdentifierTypes.begin(); it != prop.supportedIdentifierTypes.end();
+ it++) {
+ if (hasId(sel, *it)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool isValid(const ProgramIdentifier& id) {
+ int64_t val = id.value;
+ bool valid = true;
+
+ auto expect = [&valid](bool condition, const string& message) {
+ if (!condition) {
+ valid = false;
+ LOG(ERROR) << "identifier not valid, expected " << message;
+ }
+ };
+
+ switch (id.type) {
+ case IdentifierType::INVALID:
+ expect(false, "IdentifierType::INVALID");
+ break;
+ case IdentifierType::DAB_FREQUENCY_KHZ:
+ expect(val > 100000u, "f > 100MHz");
+ [[fallthrough]];
+ case IdentifierType::AMFM_FREQUENCY_KHZ:
+ case IdentifierType::DRMO_FREQUENCY_KHZ:
+ expect(val > 100u, "f > 100kHz");
+ expect(val < 10000000u, "f < 10GHz");
+ break;
+ case IdentifierType::RDS_PI:
+ expect(val != 0u, "RDS PI != 0");
+ expect(val <= 0xFFFFu, "16bit id");
+ break;
+ case IdentifierType::HD_STATION_ID_EXT: {
+ int64_t stationId = val & 0xFFFFFFFF; // 32bit
+ val >>= 32;
+ int64_t subchannel = val & 0xF; // 4bit
+ val >>= 4;
+ int64_t freq = val & 0x3FFFF; // 18bit
+ expect(stationId != 0u, "HD station id != 0");
+ expect(subchannel < 8u, "HD subch < 8");
+ expect(freq > 100u, "f > 100kHz");
+ expect(freq < 10000000u, "f < 10GHz");
+ break;
+ }
+ case IdentifierType::HD_STATION_NAME: {
+ while (val > 0) {
+ char ch = static_cast<char>(val & 0xFF);
+ val >>= 8;
+ expect((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z'),
+ "HD_STATION_NAME does not match [A-Z0-9]+");
+ }
+ break;
+ }
+ case IdentifierType::DAB_SID_EXT: {
+ int64_t sid = val & 0xFFFF; // 16bit
+ val >>= 16;
+ int64_t ecc = val & 0xFF; // 8bit
+ expect(sid != 0u, "DAB SId != 0");
+ expect(ecc >= 0xA0u && ecc <= 0xF6u, "Invalid ECC, see ETSI TS 101 756 V2.1.1");
+ break;
+ }
+ case IdentifierType::DAB_ENSEMBLE:
+ expect(val != 0u, "DAB ensemble != 0");
+ expect(val <= 0xFFFFu, "16bit id");
+ break;
+ case IdentifierType::DAB_SCID:
+ expect(val > 0xFu, "12bit SCId (not 4bit SCIdS)");
+ expect(val <= 0xFFFu, "12bit id");
+ break;
+ case IdentifierType::DRMO_SERVICE_ID:
+ expect(val != 0u, "DRM SId != 0");
+ expect(val <= 0xFFFFFFu, "24bit id");
+ break;
+ case IdentifierType::SXM_SERVICE_ID:
+ expect(val != 0u, "SXM SId != 0");
+ expect(val <= 0xFFFFFFFFu, "32bit id");
+ break;
+ case IdentifierType::SXM_CHANNEL:
+ expect(val < 1000u, "SXM channel < 1000");
+ break;
+ case IdentifierType::VENDOR_START:
+ case IdentifierType::VENDOR_END:
+ // skip
+ break;
+ }
+
+ return valid;
+}
+
+bool isValid(const ProgramSelector& sel) {
+ // iterate through primaryId and secondaryIds
+ for (auto it = begin(sel); it != end(sel); it++) {
+ if (!isValid(*it)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value) {
+ return {type, value};
+}
+
+ProgramSelector makeSelectorAmfm(int32_t frequency) {
+ ProgramSelector sel = {};
+ sel.primaryId = makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, frequency);
+ return sel;
+}
+
+ProgramSelector makeSelectorDab(int32_t sidExt, int32_t ensemble) {
+ ProgramSelector sel = {};
+ // TODO(243686545): Have a helper function to create the sidExt instead of
+ // passing the whole identifier here. Something like makeDabSidExt.
+ sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt);
+ vector<ProgramIdentifier> secondaryIds = {
+ makeIdentifier(IdentifierType::DAB_ENSEMBLE, ensemble),
+ // TODO(243686545): Include frequency here when the helper method to
+ // translate between ensemble and frequency is implemented.
+ };
+ sel.secondaryIds = std::move(secondaryIds);
+ return sel;
+}
+
+bool satisfies(const ProgramFilter& filter, const ProgramSelector& sel) {
+ if (filter.identifierTypes.size() > 0) {
+ auto typeEquals = [](const ProgramIdentifier& id, IdentifierType type) {
+ return id.type == type;
+ };
+ auto it = std::find_first_of(begin(sel), end(sel), filter.identifierTypes.begin(),
+ filter.identifierTypes.end(), typeEquals);
+ if (it == end(sel)) {
+ return false;
+ }
+ }
+
+ if (filter.identifiers.size() > 0) {
+ auto it = std::find_first_of(begin(sel), end(sel), filter.identifiers.begin(),
+ filter.identifiers.end());
+ if (it == end(sel)) {
+ return false;
+ }
+ }
+
+ if (!filter.includeCategories && sel.primaryId.type == IdentifierType::DAB_ENSEMBLE) {
+ return false;
+ }
+
+ return true;
+}
+
+size_t ProgramInfoHasher::operator()(const ProgramInfo& info) const {
+ const ProgramIdentifier& id = info.selector.primaryId;
+
+ // This is not the best hash implementation, but good enough for default HAL
+ // implementation and tests.
+ size_t h = 0;
+ ::android::hashCombineSingle(h, id.type);
+ ::android::hashCombineSingle(h, id.value);
+ return h;
+}
+
+bool ProgramInfoKeyEqual::operator()(const ProgramInfo& info1, const ProgramInfo& info2) const {
+ const ProgramIdentifier& id1 = info1.selector.primaryId;
+ const ProgramIdentifier& id2 = info2.selector.primaryId;
+ return id1.type == id2.type && id1.value == id2.value;
+}
+
+void updateProgramList(const ProgramListChunk& chunk, ProgramInfoSet* list) {
+ if (chunk.purge) {
+ list->clear();
+ }
+
+ list->insert(chunk.modified.begin(), chunk.modified.end());
+
+ if (!chunk.removed.has_value()) {
+ return;
+ }
+
+ for (auto& id : chunk.removed.value()) {
+ if (id.has_value()) {
+ ProgramInfo info = {};
+ info.selector.primaryId = id.value();
+ list->erase(info);
+ }
+ }
+}
+
+std::optional<std::string> getMetadataString(const ProgramInfo& info, const Metadata::Tag& tag) {
+ auto isRdsPs = [tag](const Metadata& item) { return item.getTag() == tag; };
+
+ auto it = std::find_if(info.metadata.begin(), info.metadata.end(), isRdsPs);
+ if (it == info.metadata.end()) {
+ return std::nullopt;
+ }
+
+ std::string metadataString;
+ switch (it->getTag()) {
+ case Metadata::rdsPs:
+ metadataString = it->get<Metadata::rdsPs>();
+ break;
+ case Metadata::rdsPty:
+ metadataString = std::to_string(it->get<Metadata::rdsPty>());
+ break;
+ case Metadata::rbdsPty:
+ metadataString = std::to_string(it->get<Metadata::rbdsPty>());
+ break;
+ case Metadata::rdsRt:
+ metadataString = it->get<Metadata::rdsRt>();
+ break;
+ case Metadata::songTitle:
+ metadataString = it->get<Metadata::songTitle>();
+ break;
+ case Metadata::songArtist:
+ metadataString = it->get<Metadata::songArtist>();
+ break;
+ case Metadata::songAlbum:
+ metadataString = it->get<Metadata::songAlbum>();
+ break;
+ case Metadata::stationIcon:
+ metadataString = std::to_string(it->get<Metadata::stationIcon>());
+ break;
+ case Metadata::albumArt:
+ metadataString = std::to_string(it->get<Metadata::albumArt>());
+ break;
+ case Metadata::programName:
+ metadataString = it->get<Metadata::programName>();
+ break;
+ case Metadata::dabEnsembleName:
+ metadataString = it->get<Metadata::dabEnsembleName>();
+ break;
+ case Metadata::dabEnsembleNameShort:
+ metadataString = it->get<Metadata::dabEnsembleNameShort>();
+ break;
+ case Metadata::dabServiceName:
+ metadataString = it->get<Metadata::dabServiceName>();
+ break;
+ case Metadata::dabServiceNameShort:
+ metadataString = it->get<Metadata::dabServiceNameShort>();
+ break;
+ case Metadata::dabComponentName:
+ metadataString = it->get<Metadata::dabComponentName>();
+ break;
+ case Metadata::dabComponentNameShort:
+ metadataString = it->get<Metadata::dabComponentNameShort>();
+ break;
+ default:
+ LOG(ERROR) << "Metadata " << it->toString() << " is not converted.";
+ return std::nullopt;
+ }
+ return metadataString;
+}
+
+ProgramIdentifier makeHdRadioStationName(const string& name) {
+ constexpr size_t maxlen = 8;
+
+ string shortName;
+ shortName.reserve(maxlen);
+
+ const auto& loc = std::locale::classic();
+ for (const char& ch : name) {
+ if (!std::isalnum(ch, loc)) {
+ continue;
+ }
+ shortName.push_back(std::toupper(ch, loc));
+ if (shortName.length() >= maxlen) {
+ break;
+ }
+ }
+
+ // Short name is converted to HD_STATION_NAME by encoding each char into its ASCII value in
+ // in little-endian order. For example, "Abc" is converted to 0x434241.
+ int64_t val = 0;
+ for (auto rit = shortName.rbegin(); rit != shortName.rend(); ++rit) {
+ val <<= 8;
+ val |= static_cast<char>(*rit);
+ }
+
+ return makeIdentifier(IdentifierType::HD_STATION_NAME, val);
+}
+
+IdentifierType getType(int typeAsInt) {
+ return static_cast<IdentifierType>(typeAsInt);
+}
+
+bool parseArgInt(const string& s, int* out) {
+ return ::android::base::ParseInt(s, out);
+}
+
+bool parseArgLong(const std::string& s, long* out) {
+ return ::android::base::ParseInt(s, out);
+}
+
+bool parseArgBool(const string& s, bool* out) {
+ if (EqualsIgnoreCase(s, "true")) {
+ *out = true;
+ } else if (EqualsIgnoreCase(s, "false")) {
+ *out = false;
+ } else {
+ return false;
+ }
+ return true;
+}
+
+bool parseArgDirection(const string& s, bool* out) {
+ if (EqualsIgnoreCase(s, "up")) {
+ *out = true;
+ } else if (EqualsIgnoreCase(s, "down")) {
+ *out = false;
+ } else {
+ return false;
+ }
+ return true;
+}
+
+bool parseArgIdentifierTypeArray(const string& s, vector<IdentifierType>* out) {
+ for (const string& val : ::android::base::Split(s, ",")) {
+ int outInt;
+ if (!parseArgInt(val, &outInt)) {
+ return false;
+ }
+ out->push_back(getType(outInt));
+ }
+ return true;
+}
+
+bool parseProgramIdentifierList(const std::string& s, vector<ProgramIdentifier>* out) {
+ for (const string& idStr : ::android::base::Split(s, ",")) {
+ const vector<string> idStrPair = ::android::base::Split(idStr, ":");
+ if (idStrPair.size() != 2) {
+ return false;
+ }
+ int idType;
+ if (!parseArgInt(idStrPair[0], &idType)) {
+ return false;
+ }
+ long idVal;
+ if (!parseArgLong(idStrPair[1], &idVal)) {
+ return false;
+ }
+ ProgramIdentifier id = {getType(idType), idVal};
+ out->push_back(id);
+ }
+ return true;
+}
+
+} // namespace utils
+
+utils::IdentifierIterator begin(const ProgramSelector& sel) {
+ return utils::IdentifierIterator(sel);
+}
+
+utils::IdentifierIterator end(const ProgramSelector& sel) {
+ return utils::IdentifierIterator(sel) + 1 /* primary id */ + sel.secondaryIds.size();
+}
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h
new file mode 100644
index 0000000..8ea6319
--- /dev/null
+++ b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/broadcastradio/IdentifierType.h>
+#include <aidl/android/hardware/broadcastradio/Metadata.h>
+#include <aidl/android/hardware/broadcastradio/ProgramFilter.h>
+#include <aidl/android/hardware/broadcastradio/ProgramIdentifier.h>
+#include <aidl/android/hardware/broadcastradio/ProgramInfo.h>
+#include <aidl/android/hardware/broadcastradio/ProgramListChunk.h>
+#include <aidl/android/hardware/broadcastradio/ProgramSelector.h>
+#include <aidl/android/hardware/broadcastradio/Properties.h>
+#include <aidl/android/hardware/broadcastradio/Result.h>
+
+#include <numeric>
+#include <optional>
+#include <thread>
+#include <unordered_set>
+
+namespace aidl::android::hardware::broadcastradio {
+
+namespace utils {
+
+enum class FrequencyBand {
+ UNKNOWN,
+ FM,
+ AM_LW,
+ AM_MW,
+ AM_SW,
+};
+
+class IdentifierIterator final
+ : public std::iterator<std::random_access_iterator_tag, ProgramIdentifier, ssize_t,
+ const ProgramIdentifier*, const ProgramIdentifier&> {
+ using ptrType = typename std::iterator_traits<IdentifierIterator>::pointer;
+ using refType = typename std::iterator_traits<IdentifierIterator>::reference;
+ using diffType = typename std::iterator_traits<IdentifierIterator>::difference_type;
+
+ public:
+ explicit IdentifierIterator(const ProgramSelector& sel);
+
+ const IdentifierIterator operator++(int);
+ IdentifierIterator& operator++();
+ refType operator*() const;
+ inline ptrType operator->() const { return &operator*(); }
+ IdentifierIterator operator+(diffType v) const { return IdentifierIterator(mSel, mPos + v); }
+ bool operator==(const IdentifierIterator& rhs) const;
+ inline bool operator!=(const IdentifierIterator& rhs) const { return !operator==(rhs); };
+
+ private:
+ explicit IdentifierIterator(const ProgramSelector& sel, size_t pos);
+
+ std::reference_wrapper<const ProgramSelector> mSel;
+
+ const ProgramSelector& getSelector() const { return mSel.get(); }
+
+ /** 0 is the primary identifier, 1-n are secondary identifiers. */
+ size_t mPos = 0;
+};
+
+/**
+ * Convert Result to int
+ */
+int32_t resultToInt(Result result);
+
+/**
+ * Guesses band from the frequency value.
+ *
+ * The band bounds are not exact to cover multiple regions.
+ * The function is biased towards success, i.e. it never returns
+ * FrequencyBand::UNKNOWN for correct frequency, but a result for
+ * incorrect one is undefined (it doesn't have to return UNKNOWN).
+ */
+FrequencyBand getBand(int64_t frequency);
+
+/**
+ * Checks, if {@code pointer} tunes to {@channel}.
+ *
+ * For example, having a channel {AMFM_FREQUENCY_KHZ = 103.3}:
+ * - selector {AMFM_FREQUENCY_KHZ = 103.3, HD_SUBCHANNEL = 0} can tune to this channel;
+ * - selector {AMFM_FREQUENCY_KHZ = 103.3, HD_SUBCHANNEL = 1} can't.
+ *
+ * @param pointer selector we're trying to match against channel.
+ * @param channel existing channel.
+ */
+bool tunesTo(const ProgramSelector& pointer, const ProgramSelector& channel);
+
+/**
+ * Checks whether a given program selector has the given ID (either primary or secondary).
+ */
+bool hasId(const ProgramSelector& sel, const IdentifierType& type);
+
+/**
+ * Returns ID (either primary or secondary) for a given program selector.
+ *
+ * If the selector does not contain given type, returns kValueForNotFoundIdentifier
+ * and emits a warning.
+ */
+int64_t getId(const ProgramSelector& sel, const IdentifierType& type);
+
+/**
+ * Returns ID (either primary or secondary) for a given program selector.
+ *
+ * If the selector does not contain given type, returns default value.
+ */
+int64_t getId(const ProgramSelector& sel, const IdentifierType& type, int64_t defaultValue);
+
+/**
+ * Returns all IDs of a given type.
+ */
+std::vector<int> getAllIds(const ProgramSelector& sel, const IdentifierType& type);
+
+/**
+ * Checks, if a given selector is supported by the radio module.
+ *
+ * @param prop Module description.
+ * @param sel The selector to check.
+ * @return True, if the selector is supported, false otherwise.
+ */
+bool isSupported(const Properties& prop, const ProgramSelector& sel);
+
+bool isValid(const ProgramIdentifier& id);
+bool isValid(const ProgramSelector& sel);
+
+ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value);
+ProgramSelector makeSelectorAmfm(int32_t frequency);
+ProgramSelector makeSelectorDab(int32_t sidExt, int32_t ensemble);
+
+bool satisfies(const ProgramFilter& filter, const ProgramSelector& sel);
+
+struct ProgramInfoHasher {
+ size_t operator()(const ProgramInfo& info) const;
+};
+
+struct ProgramInfoKeyEqual {
+ bool operator()(const ProgramInfo& info1, const ProgramInfo& info2) const;
+};
+
+typedef std::unordered_set<ProgramInfo, ProgramInfoHasher, ProgramInfoKeyEqual> ProgramInfoSet;
+
+void updateProgramList(const ProgramListChunk& chunk, ProgramInfoSet* list);
+
+std::optional<std::string> getMetadataString(const ProgramInfo& info, const Metadata::Tag& tag);
+
+ProgramIdentifier makeHdRadioStationName(const std::string& name);
+
+template <typename aidl_type>
+inline std::string vectorToString(const std::vector<aidl_type>& in_values) {
+ return std::accumulate(std::begin(in_values), std::end(in_values), std::string{},
+ [](const std::string& ls, const aidl_type& rs) {
+ return ls + (ls.empty() ? "" : ",") + toString(rs);
+ });
+}
+
+IdentifierType getType(int typeAsInt);
+
+bool parseArgInt(const std::string& s, int* out);
+
+bool parseArgLong(const std::string& s, long* out);
+
+bool parseArgBool(const std::string& s, bool* out);
+
+bool parseArgDirection(const std::string& s, bool* out);
+
+bool parseArgIdentifierTypeArray(const std::string& s, std::vector<IdentifierType>* out);
+
+bool parseProgramIdentifierList(const std::string& s, std::vector<ProgramIdentifier>* out);
+
+} // namespace utils
+
+utils::IdentifierIterator begin(const ProgramSelector& sel);
+utils::IdentifierIterator end(const ProgramSelector& sel);
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp
index 365a5ff..c184677 100644
--- a/camera/device/aidl/Android.bp
+++ b/camera/device/aidl/Android.bp
@@ -15,9 +15,9 @@
imports: [
"android.hardware.common-V2",
"android.hardware.common.fmq-V1",
- "android.hardware.camera.common",
- "android.hardware.camera.metadata",
- "android.hardware.graphics.common",
+ "android.hardware.camera.common-V1",
+ "android.hardware.camera.metadata-V2",
+ "android.hardware.graphics.common-V4",
],
backend: {
cpp: {
@@ -36,7 +36,7 @@
"android.hardware.common.fmq-V1",
"android.hardware.camera.common-V1",
"android.hardware.camera.metadata-V1",
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
],
},
],
diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl
index d2f295a..5057663 100644
--- a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl
+++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl
@@ -48,4 +48,5 @@
android.hardware.camera.metadata.SensorPixelMode[] sensorPixelModesUsed;
android.hardware.camera.metadata.RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile;
android.hardware.camera.metadata.ScalerAvailableStreamUseCases useCase;
+ int colorSpace;
}
diff --git a/camera/device/aidl/android/hardware/camera/device/Stream.aidl b/camera/device/aidl/android/hardware/camera/device/Stream.aidl
index e35e4ff..457b1bc 100644
--- a/camera/device/aidl/android/hardware/camera/device/Stream.aidl
+++ b/camera/device/aidl/android/hardware/camera/device/Stream.aidl
@@ -98,14 +98,18 @@
*
* For most formats, dataSpace defines the color space of the image data.
* In addition, for some formats, dataSpace indicates whether image- or
- * depth-based data is requested. See
- * android.hardware.graphics.common@1.0::types for details of formats and
- * valid dataSpace values for each format.
+ * depth-based data is requested. For others, it merely describes an encoding
+ * scheme. See android.hardware.graphics.common@1.0::types for details of formats
+ * and valid dataSpace values for each format.
*
* The HAL must use this dataSpace to configure the stream to the correct
* colorspace, or to select between color and depth outputs if
* supported. The dataspace values are set using the V0 dataspace
* definitions.
+ *
+ * The color space implied by dataSpace should be overridden by colorSpace if
+ * the device supports the REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES
+ * capability.
*/
android.hardware.graphics.common.Dataspace dataSpace;
@@ -222,4 +226,19 @@
* DEFAULT.
*/
android.hardware.camera.metadata.ScalerAvailableStreamUseCases useCase;
+
+ /**
+ * The color space of the stream.
+ *
+ * A client may not specify a color space. In this case, the value will be
+ * ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED, and the color space
+ * implied by dataSpace should be used instead.
+ *
+ * When specified, this field is the ultimate authority over the color space of the stream,
+ * regardless of dataSpace. The purpose of this field is to support specifying wide gamut
+ * color spaces for dataSpace values such as JFIF and HEIF.
+ *
+ * Possible values are the ordinals of the ColorSpace.Named enum in the public-facing API.
+ */
+ int colorSpace;
}
diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl
index 9bb55d2..af414b4 100644
--- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl
+++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl
@@ -92,6 +92,8 @@
ANDROID_CONTROL_ZOOM_RATIO_RANGE = 65582,
ANDROID_CONTROL_ZOOM_RATIO = 65583,
ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION = 65584,
+ ANDROID_CONTROL_SETTINGS_OVERRIDE = 65588,
+ ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES = 65589,
ANDROID_DEMOSAIC_MODE = 131072,
ANDROID_EDGE_MODE = 196608,
ANDROID_EDGE_STRENGTH = 196609,
@@ -171,6 +173,7 @@
ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION = 786450,
ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP = 786451,
ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE = 786452,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP = 786453,
ANDROID_SCALER_CROP_REGION = 851968,
ANDROID_SCALER_AVAILABLE_FORMATS = 851969,
ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS = 851970,
diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl
new file mode 100644
index 0000000..ed5d46f
--- /dev/null
+++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 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.
+ *//*
+ * Autogenerated from camera metadata definitions in
+ * /system/media/camera/docs/metadata_definitions.xml
+ * *** DO NOT EDIT BY HAND ***
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.camera.metadata;
+@Backing(type="int") @VintfStability
+enum ControlSettingsOverride {
+ ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF = 0,
+ ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM = 1,
+ ANDROID_CONTROL_SETTINGS_OVERRIDE_VENDOR_START = 16384,
+}
diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl
index 8dc2aa2..37b1dec 100644
--- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl
+++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl
@@ -58,4 +58,5 @@
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING = 17,
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT = 18,
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE = 19,
+ ANDROID_REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES = 20,
}
diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl
new file mode 100644
index 0000000..0d59ab0
--- /dev/null
+++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2022 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.
+ *//*
+ * Autogenerated from camera metadata definitions in
+ * /system/media/camera/docs/metadata_definitions.xml
+ * *** DO NOT EDIT BY HAND ***
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.camera.metadata;
+@Backing(type="long") @VintfStability
+enum RequestAvailableColorSpaceProfilesMap {
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED = -1,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB = 0,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_SRGB = 1,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_EXTENDED_SRGB = 2,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_EXTENDED_SRGB = 3,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT709 = 4,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020 = 5,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DCI_P3 = 6,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 = 7,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_NTSC_1953 = 8,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SMPTE_C = 9,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ADOBE_RGB = 10,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_PRO_PHOTO_RGB = 11,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACES = 12,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACESCG = 13,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_XYZ = 14,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_LAB = 15,
+}
diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl
index 48b1ee4..cc98ff0 100644
--- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl
+++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl
@@ -450,6 +450,20 @@
*/
ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION,
/**
+ * android.control.settingsOverride [dynamic, enum, public]
+ *
+ * <p>The desired CaptureRequest settings override with which certain keys are
+ * applied earlier so that they can take effect sooner.</p>
+ */
+ ANDROID_CONTROL_SETTINGS_OVERRIDE = 65588,
+ /**
+ * android.control.availableSettingsOverrides [static, int32[], public]
+ *
+ * <p>List of available settings overrides supported by the camera device that can
+ * be used to speed up certain controls.</p>
+ */
+ ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES,
+ /**
* android.demosaic.mode [controls, enum, system]
*
* <p>Controls the quality of the demosaicing
@@ -1030,6 +1044,12 @@
*/
ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE,
/**
+ * android.request.availableColorSpaceProfilesMap [static, enum[], ndk_public]
+ *
+ * <p>A list of all possible color space profiles supported by a camera device.</p>
+ */
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP,
+ /**
* android.scaler.cropRegion [dynamic, int32[], public]
*
* <p>The desired region of the sensor to read out for this capture.</p>
diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlSettingsOverride.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlSettingsOverride.aidl
new file mode 100644
index 0000000..d97f7c8
--- /dev/null
+++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlSettingsOverride.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+/*
+ * Autogenerated from camera metadata definitions in
+ * /system/media/camera/docs/metadata_definitions.xml
+ * *** DO NOT EDIT BY HAND ***
+ */
+
+package android.hardware.camera.metadata;
+
+/**
+ * android.control.settingsOverride enumeration values
+ * @see ANDROID_CONTROL_SETTINGS_OVERRIDE
+ */
+@VintfStability
+@Backing(type="int")
+enum ControlSettingsOverride {
+ ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF,
+ ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM,
+ ANDROID_CONTROL_SETTINGS_OVERRIDE_VENDOR_START = 0x4000,
+}
diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl
index f5c77eb..ebe0b4c 100644
--- a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl
+++ b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl
@@ -49,4 +49,5 @@
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING,
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT,
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE,
+ ANDROID_REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES,
}
diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl
new file mode 100644
index 0000000..1423305
--- /dev/null
+++ b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+/*
+ * Autogenerated from camera metadata definitions in
+ * /system/media/camera/docs/metadata_definitions.xml
+ * *** DO NOT EDIT BY HAND ***
+ */
+
+package android.hardware.camera.metadata;
+
+/**
+ * android.request.availableColorSpaceProfilesMap enumeration values
+ * @see ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP
+ */
+@VintfStability
+@Backing(type="long")
+enum RequestAvailableColorSpaceProfilesMap {
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED = -1L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB = 0L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_SRGB = 1L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_EXTENDED_SRGB = 2L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_EXTENDED_SRGB = 3L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT709 = 4L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020 = 5L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DCI_P3 = 6L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 = 7L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_NTSC_1953 = 8L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SMPTE_C = 9L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ADOBE_RGB = 10L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_PRO_PHOTO_RGB = 11L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACES = 12L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACESCG = 13L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_XYZ = 14L,
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_LAB = 15L,
+}
diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp
index 87a94b2..bb30e43 100644
--- a/camera/provider/aidl/Android.bp
+++ b/camera/provider/aidl/Android.bp
@@ -14,8 +14,8 @@
"android/hardware/camera/provider/*.aidl",
],
imports: [
- "android.hardware.camera.device",
- "android.hardware.camera.common",
+ "android.hardware.camera.device-V2",
+ "android.hardware.camera.common-V1",
],
stability: "vintf",
backend: {
diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl
index c15bdee..c6a3b9a 100644
--- a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl
+++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl
@@ -41,6 +41,7 @@
void notifyDeviceStateChange(long deviceState);
android.hardware.camera.provider.ConcurrentCameraIdCombination[] getConcurrentCameraIds();
boolean isConcurrentStreamCombinationSupported(in android.hardware.camera.provider.CameraIdAndStreamCombination[] configs);
+ void placeholder();
const long DEVICE_STATE_NORMAL = 0;
const long DEVICE_STATE_BACK_COVERED = 1;
const long DEVICE_STATE_FRONT_COVERED = 2;
diff --git a/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl
index c4eba8d..5442058 100644
--- a/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl
+++ b/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl
@@ -304,4 +304,12 @@
*
*/
boolean isConcurrentStreamCombinationSupported(in CameraIdAndStreamCombination[] configs);
+
+ /*
+ * Due to a bug in vintf regarding aidl changes that are contained to fields,
+ * we need a placeholder method that will be removed after this patch.
+ *
+ * TODO(b/237048744): Remove this once fixed.
+ */
+ void placeholder();
}
diff --git a/camera/provider/aidl/vts/Android.bp b/camera/provider/aidl/vts/Android.bp
index 727ef03..8429b21 100644
--- a/camera/provider/aidl/vts/Android.bp
+++ b/camera/provider/aidl/vts/Android.bp
@@ -27,6 +27,7 @@
name: "VtsAidlHalCameraProvider_TargetTest",
defaults: [
"VtsHalTargetTestDefaults",
+ "android.hardware.graphics.common-ndk_static",
"use_libaidlvintf_gtest_helper_static",
],
srcs: [
@@ -58,10 +59,9 @@
static_libs: [
"android.hardware.camera.common@1.0-helper",
"android.hardware.camera.common-V1-ndk",
- "android.hardware.camera.device-V1-ndk",
- "android.hardware.camera.metadata-V1-ndk",
- "android.hardware.camera.provider-V1-ndk",
- "android.hardware.graphics.common-V3-ndk",
+ "android.hardware.camera.device-V2-ndk",
+ "android.hardware.camera.metadata-V2-ndk",
+ "android.hardware.camera.provider-V2-ndk",
"android.hidl.allocator@1.0",
"libgrallocusage",
"libhidlmemory",
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index 70ab7a0..017f6ef 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -36,6 +36,7 @@
using ::aidl::android::hardware::camera::common::TorchModeStatus;
using ::aidl::android::hardware::camera::common::VendorTagSection;
using ::aidl::android::hardware::camera::device::ICameraDevice;
+using ::aidl::android::hardware::camera::metadata::RequestAvailableColorSpaceProfilesMap;
using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap;
using ::aidl::android::hardware::camera::metadata::SensorPixelMode;
using ::aidl::android::hardware::camera::provider::CameraIdAndStreamCombination;
@@ -2021,6 +2022,49 @@
}
}
+TEST_P(CameraAidlTest, process8BitColorSpaceRequests) {
+ static int profiles[] = {
+ ColorSpaceNamed::BT709,
+ ColorSpaceNamed::DCI_P3,
+ ColorSpaceNamed::DISPLAY_P3,
+ ColorSpaceNamed::EXTENDED_SRGB,
+ ColorSpaceNamed::LINEAR_EXTENDED_SRGB,
+ ColorSpaceNamed::NTSC_1953,
+ ColorSpaceNamed::SMPTE_C,
+ ColorSpaceNamed::SRGB
+ };
+
+ for (int32_t i = 0; i < sizeof(profiles) / sizeof(profiles[0]); i++) {
+ processColorSpaceRequest(static_cast<RequestAvailableColorSpaceProfilesMap>(profiles[i]),
+ static_cast<RequestAvailableDynamicRangeProfilesMap>(
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD));
+ }
+}
+
+TEST_P(CameraAidlTest, process10BitColorSpaceRequests) {
+ static const camera_metadata_enum_android_request_available_dynamic_range_profiles_map
+ dynamicRangeProfiles[] = {
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM,
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO
+ };
+
+ // Process all dynamic range profiles with BT2020
+ for (int32_t i = 0; i < sizeof(dynamicRangeProfiles) / sizeof(dynamicRangeProfiles[0]); i++) {
+ processColorSpaceRequest(
+ static_cast<RequestAvailableColorSpaceProfilesMap>(ColorSpaceNamed::BT2020),
+ static_cast<RequestAvailableDynamicRangeProfilesMap>(dynamicRangeProfiles[i]));
+ }
+}
+
// Generate and verify a burst containing alternating sensor sensitivity values
TEST_P(CameraAidlTest, processCaptureRequestBurstISO) {
std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider);
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index 2c2f1b2..ca316e5 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -22,6 +22,7 @@
#include <HandleImporter.h>
#include <aidl/android/hardware/camera/device/ICameraDevice.h>
#include <aidl/android/hardware/camera/metadata/CameraMetadataTag.h>
+#include <aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.h>
#include <aidl/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.h>
#include <aidl/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.h>
#include <aidl/android/hardware/camera/metadata/SensorPixelMode.h>
@@ -43,6 +44,7 @@
using ::aidl::android::hardware::camera::device::CameraMetadata;
using ::aidl::android::hardware::camera::device::ICameraDevice;
using ::aidl::android::hardware::camera::metadata::CameraMetadataTag;
+using ::aidl::android::hardware::camera::metadata::RequestAvailableColorSpaceProfilesMap;
using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap;
using ::aidl::android::hardware::camera::metadata::SensorInfoColorFilterArrangement;
using ::aidl::android::hardware::camera::metadata::SensorPixelMode;
@@ -329,6 +331,63 @@
ASSERT_EQ(hasStreamUseCaseCap, supportMandatoryUseCases);
}
+void CameraAidlTest::verifySettingsOverrideCharacteristics(const camera_metadata_t* metadata) {
+ camera_metadata_ro_entry entry;
+ int retcode = find_camera_metadata_ro_entry(metadata,
+ ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES, &entry);
+ bool supportSettingsOverride = false;
+ if ((0 == retcode) && (entry.count > 0)) {
+ supportSettingsOverride = true;
+ bool hasOff = false;
+ for (size_t i = 0; i < entry.count; i++) {
+ if (entry.data.u8[i] == ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF) {
+ hasOff = true;
+ }
+ }
+ ASSERT_TRUE(hasOff);
+ }
+
+ // Check availableRequestKeys
+ retcode = find_camera_metadata_ro_entry(metadata,
+ ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, &entry);
+ bool hasSettingsOverrideRequestKey = false;
+ if ((0 == retcode) && (entry.count > 0)) {
+ hasSettingsOverrideRequestKey =
+ std::find(entry.data.i32, entry.data.i32 + entry.count,
+ ANDROID_CONTROL_SETTINGS_OVERRIDE) != entry.data.i32 + entry.count;
+ } else {
+ ADD_FAILURE() << "Get camera availableRequestKeys failed!";
+ }
+
+ // Check availableResultKeys
+ retcode = find_camera_metadata_ro_entry(metadata,
+ ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, &entry);
+ bool hasSettingsOverrideResultKey = false;
+ if ((0 == retcode) && (entry.count > 0)) {
+ hasSettingsOverrideResultKey =
+ std::find(entry.data.i32, entry.data.i32 + entry.count,
+ ANDROID_CONTROL_SETTINGS_OVERRIDE) != entry.data.i32 + entry.count;
+ } else {
+ ADD_FAILURE() << "Get camera availableResultKeys failed!";
+ }
+
+ // Check availableCharacteristicKeys
+ retcode = find_camera_metadata_ro_entry(metadata,
+ ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, &entry);
+ bool hasSettingsOverrideCharacteristicsKey= false;
+ if ((0 == retcode) && (entry.count > 0)) {
+ hasSettingsOverrideCharacteristicsKey = std::find(entry.data.i32,
+ entry.data.i32 + entry.count, ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES)
+ != entry.data.i32 + entry.count;
+ } else {
+ ADD_FAILURE() << "Get camera availableCharacteristicsKeys failed!";
+ }
+
+ ASSERT_EQ(supportSettingsOverride, hasSettingsOverrideRequestKey);
+ ASSERT_EQ(supportSettingsOverride, hasSettingsOverrideResultKey);
+ ASSERT_EQ(supportSettingsOverride, hasSettingsOverrideCharacteristicsKey);
+}
+
Status CameraAidlTest::isMonochromeCamera(const camera_metadata_t* staticMeta) {
Status ret = Status::OPERATION_NOT_SUPPORTED;
if (nullptr == staticMeta) {
@@ -604,6 +663,7 @@
verifyExtendedSceneModeCharacteristics(metadata);
verifyZoomCharacteristics(metadata);
verifyStreamUseCaseCharacteristics(metadata);
+ verifySettingsOverrideCharacteristics(metadata);
}
void CameraAidlTest::verifyExtendedSceneModeCharacteristics(const camera_metadata_t* metadata) {
@@ -1515,6 +1575,15 @@
ASSERT_EQ(zoomRatioEntry.count, 1);
ASSERT_EQ(zoomRatioEntry.data.f[0], 1.0f);
}
+
+ // Check settings override
+ camera_metadata_ro_entry settingsOverrideEntry;
+ int foundSettingsOverride = find_camera_metadata_ro_entry(metadata,
+ ANDROID_CONTROL_SETTINGS_OVERRIDE,&settingsOverrideEntry);
+ if (foundSettingsOverride == 0) {
+ ASSERT_EQ(settingsOverrideEntry.count, 1);
+ ASSERT_EQ(settingsOverrideEntry.data.u8[0], ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF);
+ }
}
void CameraAidlTest::openEmptyDeviceSession(const std::string& name,
@@ -2788,6 +2857,168 @@
}
}
+bool CameraAidlTest::reportsColorSpaces(const camera_metadata_t* staticMeta) {
+ camera_metadata_ro_entry capabilityEntry;
+ int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES,
+ &capabilityEntry);
+ if (rc == 0) {
+ for (uint32_t i = 0; i < capabilityEntry.count; i++) {
+ if (capabilityEntry.data.u8[i] ==
+ ANDROID_REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+void CameraAidlTest::getColorSpaceProfiles(
+ const camera_metadata_t* staticMeta,
+ std::vector<RequestAvailableColorSpaceProfilesMap>* profiles) {
+ ASSERT_NE(nullptr, staticMeta);
+ ASSERT_NE(nullptr, profiles);
+ camera_metadata_ro_entry entry;
+ int rc = find_camera_metadata_ro_entry(
+ staticMeta, ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP, &entry);
+ ASSERT_EQ(rc, 0);
+ ASSERT_TRUE(entry.count > 0);
+ ASSERT_EQ(entry.count % 3, 0);
+
+ for (uint32_t i = 0; i < entry.count; i += 3) {
+ ASSERT_NE(entry.data.i64[i],
+ ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED);
+ if (std::find(profiles->begin(), profiles->end(),
+ static_cast<RequestAvailableColorSpaceProfilesMap>(entry.data.i64[i]))
+ == profiles->end()) {
+ profiles->emplace_back(
+ static_cast<RequestAvailableColorSpaceProfilesMap>(entry.data.i64[i]));
+ }
+ }
+}
+
+bool CameraAidlTest::isColorSpaceCompatibleWithDynamicRangeAndPixelFormat(
+ const camera_metadata_t* staticMeta,
+ RequestAvailableColorSpaceProfilesMap colorSpace,
+ RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile,
+ aidl::android::hardware::graphics::common::PixelFormat pixelFormat) {
+ camera_metadata_ro_entry entry;
+ int rc = find_camera_metadata_ro_entry(
+ staticMeta, ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP, &entry);
+
+ if (rc == 0) {
+ for (uint32_t i = 0; i < entry.count; i += 3) {
+ RequestAvailableColorSpaceProfilesMap entryColorSpace =
+ static_cast<RequestAvailableColorSpaceProfilesMap>(entry.data.i64[i]);
+ int64_t dynamicRangeProfileI64 = static_cast<int64_t>(dynamicRangeProfile);
+ int32_t entryImageFormat = static_cast<int32_t>(entry.data.i64[i + 1]);
+ int32_t expectedImageFormat = halFormatToPublicFormat(pixelFormat);
+ if (entryColorSpace == colorSpace
+ && (entry.data.i64[i + 2] & dynamicRangeProfileI64) != 0
+ && entryImageFormat == expectedImageFormat) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+const char* CameraAidlTest::getColorSpaceProfileString(
+ RequestAvailableColorSpaceProfilesMap colorSpace) {
+ auto colorSpaceCast = static_cast<int>(colorSpace);
+ switch (colorSpaceCast) {
+ case ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED:
+ return "UNSPECIFIED";
+ case ColorSpaceNamed::SRGB:
+ return "SRGB";
+ case ColorSpaceNamed::LINEAR_SRGB:
+ return "LINEAR_SRGB";
+ case ColorSpaceNamed::EXTENDED_SRGB:
+ return "EXTENDED_SRGB";
+ case ColorSpaceNamed::LINEAR_EXTENDED_SRGB:
+ return "LINEAR_EXTENDED_SRGB";
+ case ColorSpaceNamed::BT709:
+ return "BT709";
+ case ColorSpaceNamed::BT2020:
+ return "BT2020";
+ case ColorSpaceNamed::DCI_P3:
+ return "DCI_P3";
+ case ColorSpaceNamed::DISPLAY_P3:
+ return "DISPLAY_P3";
+ case ColorSpaceNamed::NTSC_1953:
+ return "NTSC_1953";
+ case ColorSpaceNamed::SMPTE_C:
+ return "SMPTE_C";
+ case ColorSpaceNamed::ADOBE_RGB:
+ return "ADOBE_RGB";
+ case ColorSpaceNamed::PRO_PHOTO_RGB:
+ return "PRO_PHOTO_RGB";
+ case ColorSpaceNamed::ACES:
+ return "ACES";
+ case ColorSpaceNamed::ACESCG:
+ return "ACESCG";
+ case ColorSpaceNamed::CIE_XYZ:
+ return "CIE_XYZ";
+ case ColorSpaceNamed::CIE_LAB:
+ return "CIE_LAB";
+ default:
+ return "INVALID";
+ }
+
+ return "INVALID";
+}
+
+const char* CameraAidlTest::getDynamicRangeProfileString(
+ RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile) {
+ auto dynamicRangeProfileCast =
+ static_cast<camera_metadata_enum_android_request_available_dynamic_range_profiles_map>
+ (dynamicRangeProfile);
+ switch (dynamicRangeProfileCast) {
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD:
+ return "STANDARD";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10:
+ return "HLG10";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10:
+ return "HDR10";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS:
+ return "HDR10_PLUS";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF:
+ return "DOLBY_VISION_10B_HDR_REF";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO:
+ return "DOLBY_VISION_10B_HDR_REF_P0";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM:
+ return "DOLBY_VISION_10B_HDR_OEM";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO:
+ return "DOLBY_VISION_10B_HDR_OEM_P0";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF:
+ return "DOLBY_VISION_8B_HDR_REF";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO:
+ return "DOLBY_VISION_8B_HDR_REF_P0";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM:
+ return "DOLBY_VISION_8B_HDR_OEM";
+ case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO:
+ return "DOLBY_VISION_8B_HDR_OEM_P0";
+ default:
+ return "INVALID";
+ }
+
+ return "INVALID";
+}
+
+int32_t CameraAidlTest::halFormatToPublicFormat(
+ aidl::android::hardware::graphics::common::PixelFormat pixelFormat) {
+ // This is an incomplete mapping of pixel format to image format and assumes dataspaces
+ // (see getDataspace)
+ switch (pixelFormat) {
+ case PixelFormat::BLOB:
+ return 0x100; // ImageFormat.JPEG
+ case PixelFormat::Y16:
+ return 0x44363159; // ImageFormat.DEPTH16
+ default:
+ return static_cast<int32_t>(pixelFormat);
+ }
+}
+
void CameraAidlTest::configurePreviewStream(
const std::string& name, const std::shared_ptr<ICameraProvider>& provider,
const AvailableStream* previewThreshold, std::shared_ptr<ICameraDeviceSession>* session,
@@ -2933,4 +3164,224 @@
for (auto& it : mInflightMap) {
it.second->resultQueue = resultQueue;
}
-}
\ No newline at end of file
+}
+
+void CameraAidlTest::processColorSpaceRequest(
+ RequestAvailableColorSpaceProfilesMap colorSpace,
+ RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile) {
+ std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+ int64_t bufferId = 1;
+ CameraMetadata settings;
+
+ for (const auto& name : cameraDeviceNames) {
+ std::string version, deviceId;
+ ASSERT_TRUE(matchDeviceName(name, mProviderType, &version, &deviceId));
+ CameraMetadata meta;
+ std::shared_ptr<ICameraDevice> device;
+ openEmptyDeviceSession(name, mProvider, &mSession, &meta, &device);
+ camera_metadata_t* staticMeta = reinterpret_cast<camera_metadata_t*>(meta.metadata.data());
+
+ // Device does not report color spaces, skip.
+ if (!reportsColorSpaces(staticMeta)) {
+ ndk::ScopedAStatus ret = mSession->close();
+ mSession = nullptr;
+ ASSERT_TRUE(ret.isOk());
+ ALOGV("Camera %s does not report color spaces", name.c_str());
+ continue;
+ }
+ std::vector<RequestAvailableColorSpaceProfilesMap> profileList;
+ getColorSpaceProfiles(staticMeta, &profileList);
+ ASSERT_FALSE(profileList.empty());
+
+ // Device does not support color space / dynamic range profile, skip
+ if (std::find(profileList.begin(), profileList.end(), colorSpace)
+ == profileList.end() || !isColorSpaceCompatibleWithDynamicRangeAndPixelFormat(
+ staticMeta, colorSpace, dynamicRangeProfile,
+ PixelFormat::IMPLEMENTATION_DEFINED)) {
+ ndk::ScopedAStatus ret = mSession->close();
+ mSession = nullptr;
+ ASSERT_TRUE(ret.isOk());
+ ALOGV("Camera %s does not support color space %s with dynamic range profile %s and "
+ "pixel format %d", name.c_str(), getColorSpaceProfileString(colorSpace),
+ getDynamicRangeProfileString(dynamicRangeProfile),
+ PixelFormat::IMPLEMENTATION_DEFINED);
+ continue;
+ }
+
+ ALOGV("Camera %s supports color space %s with dynamic range profile %s and pixel format %d",
+ name.c_str(), getColorSpaceProfileString(colorSpace),
+ getDynamicRangeProfileString(dynamicRangeProfile),
+ PixelFormat::IMPLEMENTATION_DEFINED);
+
+ // If an HDR dynamic range profile is reported in the color space profile list,
+ // the device must also have the dynamic range profiles map capability and contain
+ // the dynamic range profile in the map.
+ if (dynamicRangeProfile != static_cast<RequestAvailableDynamicRangeProfilesMap>(
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD)) {
+ ASSERT_TRUE(is10BitDynamicRangeCapable(staticMeta));
+
+ std::vector<RequestAvailableDynamicRangeProfilesMap> dynamicRangeProfiles;
+ get10BitDynamicRangeProfiles(staticMeta, &dynamicRangeProfiles);
+ ASSERT_FALSE(dynamicRangeProfiles.empty());
+ ASSERT_FALSE(std::find(dynamicRangeProfiles.begin(), dynamicRangeProfiles.end(),
+ dynamicRangeProfile) == dynamicRangeProfiles.end());
+ }
+
+ CameraMetadata req;
+ android::hardware::camera::common::V1_0::helper::CameraMetadata defaultSettings;
+ ndk::ScopedAStatus ret =
+ mSession->constructDefaultRequestSettings(RequestTemplate::PREVIEW, &req);
+ ASSERT_TRUE(ret.isOk());
+
+ const camera_metadata_t* metadata =
+ reinterpret_cast<const camera_metadata_t*>(req.metadata.data());
+ size_t expectedSize = req.metadata.size();
+ int result = validate_camera_metadata_structure(metadata, &expectedSize);
+ ASSERT_TRUE((result == 0) || (result == CAMERA_METADATA_VALIDATION_SHIFTED));
+
+ size_t entryCount = get_camera_metadata_entry_count(metadata);
+ ASSERT_GT(entryCount, 0u);
+ defaultSettings = metadata;
+
+ const camera_metadata_t* settingsBuffer = defaultSettings.getAndLock();
+ uint8_t* rawSettingsBuffer = (uint8_t*)settingsBuffer;
+ settings.metadata = std::vector(
+ rawSettingsBuffer, rawSettingsBuffer + get_camera_metadata_size(settingsBuffer));
+ overrideRotateAndCrop(&settings);
+
+ ret = mSession->close();
+ mSession = nullptr;
+ ASSERT_TRUE(ret.isOk());
+
+ std::vector<HalStream> halStreams;
+ bool supportsPartialResults = false;
+ bool useHalBufManager = false;
+ int32_t partialResultCount = 0;
+ Stream previewStream;
+ std::shared_ptr<DeviceCb> cb;
+
+ previewStream.usage =
+ static_cast<aidl::android::hardware::graphics::common::BufferUsage>(
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER);
+ previewStream.dataSpace = getDataspace(PixelFormat::IMPLEMENTATION_DEFINED);
+ previewStream.colorSpace = static_cast<int32_t>(colorSpace);
+ configureStreams(name, mProvider, PixelFormat::IMPLEMENTATION_DEFINED, &mSession,
+ &previewStream, &halStreams, &supportsPartialResults,
+ &partialResultCount, &useHalBufManager, &cb, 0,
+ /*maxResolution*/ false, dynamicRangeProfile);
+ ASSERT_NE(mSession, nullptr);
+
+ ::aidl::android::hardware::common::fmq::MQDescriptor<
+ int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite>
+ descriptor;
+ auto resultQueueRet = mSession->getCaptureResultMetadataQueue(&descriptor);
+ ASSERT_TRUE(resultQueueRet.isOk());
+
+ std::shared_ptr<ResultMetadataQueue> resultQueue =
+ std::make_shared<ResultMetadataQueue>(descriptor);
+ if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) {
+ ALOGE("%s: HAL returns empty result metadata fmq, not use it", __func__);
+ resultQueue = nullptr;
+ // Don't use the queue onwards.
+ }
+
+ mInflightMap.clear();
+ // Stream as long as needed to fill the Hal inflight queue
+ std::vector<CaptureRequest> requests(halStreams[0].maxBuffers);
+
+ for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
+ std::shared_ptr<InFlightRequest> inflightReq = std::make_shared<InFlightRequest>(
+ static_cast<ssize_t>(halStreams.size()), false, supportsPartialResults,
+ partialResultCount, std::unordered_set<std::string>(), resultQueue);
+
+ CaptureRequest& request = requests[frameNumber];
+ std::vector<StreamBuffer>& outputBuffers = request.outputBuffers;
+ outputBuffers.resize(halStreams.size());
+
+ size_t k = 0;
+ inflightReq->mOutstandingBufferIds.resize(halStreams.size());
+ std::vector<buffer_handle_t> graphicBuffers;
+ graphicBuffers.reserve(halStreams.size());
+
+ for (const auto& halStream : halStreams) {
+ buffer_handle_t buffer_handle;
+ if (useHalBufManager) {
+ outputBuffers[k] = {halStream.id, 0,
+ NativeHandle(), BufferStatus::OK,
+ NativeHandle(), NativeHandle()};
+ } else {
+ auto usage = android_convertGralloc1To0Usage(
+ static_cast<uint64_t>(halStream.producerUsage),
+ static_cast<uint64_t>(halStream.consumerUsage));
+ allocateGraphicBuffer(previewStream.width, previewStream.height, usage,
+ halStream.overrideFormat, &buffer_handle);
+
+ inflightReq->mOutstandingBufferIds[halStream.id][bufferId] = buffer_handle;
+ graphicBuffers.push_back(buffer_handle);
+ outputBuffers[k] = {halStream.id, bufferId,
+ android::makeToAidl(buffer_handle), BufferStatus::OK, NativeHandle(),
+ NativeHandle()};
+ bufferId++;
+ }
+ k++;
+ }
+
+ request.inputBuffer = {
+ -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()};
+ request.frameNumber = frameNumber;
+ request.fmqSettingsSize = 0;
+ request.settings = settings;
+ request.inputWidth = 0;
+ request.inputHeight = 0;
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ mInflightMap[frameNumber] = inflightReq;
+ }
+
+ }
+
+ int32_t numRequestProcessed = 0;
+ std::vector<BufferCache> cachesToRemove;
+ ndk::ScopedAStatus returnStatus =
+ mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(numRequestProcessed, requests.size());
+
+ returnStatus = mSession->repeatingRequestEnd(requests.size() - 1,
+ std::vector<int32_t> {halStreams[0].id});
+ ASSERT_TRUE(returnStatus.isOk());
+
+ for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
+ const auto& inflightReq = mInflightMap[frameNumber];
+ std::unique_lock<std::mutex> l(mLock);
+ while (!inflightReq->errorCodeValid &&
+ ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kStreamBufferTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout));
+ }
+
+ ASSERT_FALSE(inflightReq->errorCodeValid);
+ ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u);
+
+ if (dynamicRangeProfile != static_cast<RequestAvailableDynamicRangeProfilesMap>(
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD)) {
+ verify10BitMetadata(mHandleImporter, *inflightReq, dynamicRangeProfile);
+ }
+ }
+
+ if (useHalBufManager) {
+ std::vector<int32_t> streamIds(halStreams.size());
+ for (size_t i = 0; i < streamIds.size(); i++) {
+ streamIds[i] = halStreams[i].id;
+ }
+ mSession->signalStreamFlush(streamIds, /*streamConfigCounter*/ 0);
+ cb->waitForBuffersReturned();
+ }
+
+ ret = mSession->close();
+ mSession = nullptr;
+ ASSERT_TRUE(ret.isOk());
+ }
+}
diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h
index d828cee..ff3617f 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.h
+++ b/camera/provider/aidl/vts/camera_aidl_test.h
@@ -44,6 +44,8 @@
#include <aidl/android/hardware/camera/provider/ICameraProvider.h>
+#include <aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.h>
+
#include <aidl/android/hardware/graphics/common/PixelFormat.h>
#include <gtest/gtest.h>
@@ -123,6 +125,26 @@
YUV_REPROCESS,
};
+ // Copied from ColorSpace.java (see Named)
+ enum ColorSpaceNamed {
+ SRGB,
+ LINEAR_SRGB,
+ EXTENDED_SRGB,
+ LINEAR_EXTENDED_SRGB,
+ BT709,
+ BT2020,
+ DCI_P3,
+ DISPLAY_P3,
+ NTSC_1953,
+ SMPTE_C,
+ ADOBE_RGB,
+ PRO_PHOTO_RGB,
+ ACES,
+ ACESCG,
+ CIE_XYZ,
+ CIE_LAB
+ };
+
struct AvailableZSLInputOutput {
int32_t inputFormat;
int32_t outputFormat;
@@ -230,6 +252,8 @@
static void verifyStreamUseCaseCharacteristics(const camera_metadata_t* metadata);
+ static void verifySettingsOverrideCharacteristics(const camera_metadata_t* metadata);
+
static void verifyStreamCombination(const std::shared_ptr<ICameraDevice>& device,
const StreamConfiguration& config, bool expectedStatus,
bool expectStreamCombQuery);
@@ -348,11 +372,40 @@
std::vector<aidl::android::hardware::camera::metadata::
RequestAvailableDynamicRangeProfilesMap>* profiles);
+ static bool reportsColorSpaces(const camera_metadata_t* staticMeta);
+
+ static void getColorSpaceProfiles(
+ const camera_metadata_t* staticMeta,
+ std::vector<aidl::android::hardware::camera::metadata::
+ RequestAvailableColorSpaceProfilesMap>* profiles);
+
+ static bool isColorSpaceCompatibleWithDynamicRangeAndPixelFormat(
+ const camera_metadata_t* staticMeta,
+ aidl::android::hardware::camera::metadata::
+ RequestAvailableColorSpaceProfilesMap colorSpace,
+ aidl::android::hardware::camera::metadata::
+ RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile,
+ aidl::android::hardware::graphics::common::PixelFormat pixelFormat);
+
+ static const char* getColorSpaceProfileString(aidl::android::hardware::camera::metadata::
+ RequestAvailableColorSpaceProfilesMap colorSpace);
+
+ static const char* getDynamicRangeProfileString(aidl::android::hardware::camera::metadata::
+ RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile);
+
+ static int32_t halFormatToPublicFormat(
+ aidl::android::hardware::graphics::common::PixelFormat pixelFormat);
+
// Used by switchToOffline where a new result queue is created for offline reqs
void updateInflightResultQueue(const std::shared_ptr<ResultMetadataQueue>& resultQueue);
static Size getMinSize(Size a, Size b);
+ void processColorSpaceRequest(aidl::android::hardware::camera::metadata::
+ RequestAvailableColorSpaceProfilesMap colorSpace,
+ aidl::android::hardware::camera::metadata::
+ RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile);
+
protected:
// In-flight queue for tracking completion of capture requests.
struct InFlightRequest {
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index bbf05cc..e4fd65e 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -112,21 +112,13 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl" optional="true">
<name>android.hardware.automotive.remoteaccess</name>
<interface>
<name>IRemoteAccess</name>
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.automotive.vehicle</name>
- <version>2.0</version>
- <interface>
- <name>IVehicle</name>
- <regex-instance>.*</regex-instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.biometrics.face</name>
<version>2</version>
@@ -141,6 +133,7 @@
<interface>
<name>IFingerprint</name>
<instance>default</instance>
+ <instance>virtual</instance>
</interface>
</hal>
<hal format="hidl" optional="true">
@@ -173,33 +166,16 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="aidl" optional="true">
<name>android.hardware.broadcastradio</name>
- <version>1.0-1</version>
- <interface>
- <name>IBroadcastRadioFactory</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.broadcastradio</name>
- <version>2.0</version>
<interface>
<name>IBroadcastRadio</name>
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.camera.provider</name>
- <version>2.4-7</version>
- <interface>
- <name>ICameraProvider</name>
- <regex-instance>[^/]+/[0-9]+</regex-instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.camera.provider</name>
- <version>1</version>
+ <version>1-2</version>
<interface>
<name>ICameraProvider</name>
<regex-instance>[^/]+/[0-9]+</regex-instance>
@@ -243,18 +219,6 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.drm</name>
- <version>1.3-4</version>
- <interface>
- <name>ICryptoFactory</name>
- <regex-instance>.*</regex-instance>
- </interface>
- <interface>
- <name>IDrmFactory</name>
- <regex-instance>.*</regex-instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.dumpstate</name>
<interface>
@@ -280,7 +244,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.gnss</name>
- <version>2</version>
+ <version>3</version>
<interface>
<name>IGnss</name>
<instance>default</instance>
@@ -302,21 +266,6 @@
<instance>default</instance>
</interface>
</hal>
- <!-- Either the AIDL or the HIDL allocator HAL must exist on the device.
- If the HIDL composer HAL exists, it must be at least version 2.0.
- See DeviceManifestTest.GrallocHal -->
- <hal format="hidl" optional="true">
- <name>android.hardware.graphics.allocator</name>
- <!-- New, non-Go devices should use 4.0 or the AIDL hal.
- See DeviceManifestTest.GrallocVersionCompatibility. -->
- <version>2.0</version>
- <version>3.0</version>
- <version>4.0</version>
- <interface>
- <name>IAllocator</name>
- <instance>default</instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.graphics.allocator</name>
<version>1</version>
@@ -325,17 +274,6 @@
<instance>default</instance>
</interface>
</hal>
- <!-- Either the AIDL or the HIDL composer HAL must exist on the device.
- If the HIDL composer HAL exists, it must be at least version 2.1.
- See DeviceManifestTest.ComposerHal -->
- <hal format="hidl" optional="true">
- <name>android.hardware.graphics.composer</name>
- <version>2.1-4</version>
- <interface>
- <name>IComposer</name>
- <instance>default</instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.graphics.composer3</name>
<version>1</version>
@@ -494,7 +432,7 @@
</hal>
<hal format="aidl" optional="false">
<name>android.hardware.power</name>
- <version>2-3</version>
+ <version>2-4</version>
<interface>
<name>IPower</name>
<instance>default</instance>
@@ -547,7 +485,7 @@
</hal>
<hal format="aidl" optional="true">
<name>android.hardware.radio.network</name>
- <version>1</version>
+ <version>2</version>
<interface>
<name>IRadioNetwork</name>
<instance>slot1</instance>
@@ -575,6 +513,16 @@
<instance>slot3</instance>
</interface>
</hal>
+ <hal format="aidl" optional="true">
+ <name>android.hardware.radio.ims</name>
+ <version>1</version>
+ <interface>
+ <name>IRadioIms</name>
+ <instance>slot1</instance>
+ <instance>slot2</instance>
+ <instance>slot3</instance>
+ </interface>
+ </hal>
<hal format="hidl" optional="true">
<name>android.hardware.radio</name>
<version>1.2</version>
@@ -583,6 +531,14 @@
<instance>slot1</instance>
</interface>
</hal>
+ <hal format="aidl" optional="true">
+ <name>android.hardware.radio.ims.media</name>
+ <version>1</version>
+ <interface>
+ <name>IImsMedia</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
<hal format="hidl" optional="true">
<name>android.hardware.renderscript</name>
<version>1.0</version>
@@ -632,23 +588,6 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.sensors</name>
- <version>1.0</version>
- <version>2.0-1</version>
- <interface>
- <name>ISensors</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.soundtrigger</name>
- <version>2.3</version>
- <interface>
- <name>ISoundTriggerHw</name>
- <instance>default</instance>
- </interface>
- </hal>
<hal format="aidl" optional="true">
<name>android.hardware.soundtrigger3</name>
<version>1</version>
@@ -695,27 +634,19 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
- <name>android.hardware.tv.input</name>
- <version>1.0</version>
- <interface>
- <name>ITvInput</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl" optional="true">
+ <hal format="aidl" optional="true">
<name>android.hardware.tv.tuner</name>
- <version>1.0-1</version>
+ <version>1</version>
<interface>
<name>ITuner</name>
<instance>default</instance>
</interface>
</hal>
<hal format="aidl" optional="true">
- <name>android.hardware.tv.tuner</name>
+ <name>android.hardware.tv.input</name>
<version>1</version>
<interface>
- <name>ITuner</name>
+ <name>ITvInput</name>
<instance>default</instance>
</interface>
</hal>
diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp
index cb77c7b..cf1e138 100644
--- a/compatibility_matrices/exclude/fcm_exclude.cpp
+++ b/compatibility_matrices/exclude/fcm_exclude.cpp
@@ -61,6 +61,7 @@
"android.hardware.graphics.common",
"android.hardware.input.common",
"android.hardware.keymaster",
+ "android.hardware.media.bufferpool2",
"android.hardware.radio",
"android.hardware.uwb.fira_android",
diff --git a/gnss/1.1/default/Android.bp b/gnss/1.1/default/Android.bp
index a73182e..300e8de 100644
--- a/gnss/1.1/default/Android.bp
+++ b/gnss/1.1/default/Android.bp
@@ -27,7 +27,7 @@
"android.hardware.gnss@2.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@1.0",
- "android.hardware.gnss-V2-ndk",
+ "android.hardware.gnss-V3-ndk",
],
static_libs: [
"android.hardware.gnss@common-default-lib",
diff --git a/gnss/1.1/vts/functional/Android.bp b/gnss/1.1/vts/functional/Android.bp
index f8fad94..2414cbc 100644
--- a/gnss/1.1/vts/functional/Android.bp
+++ b/gnss/1.1/vts/functional/Android.bp
@@ -36,7 +36,7 @@
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
"android.hardware.gnss@common-vts-lib",
- "android.hardware.gnss-V2-cpp",
+ "android.hardware.gnss-V3-cpp",
],
shared_libs: [
"android.hardware.gnss.measurement_corrections@1.0",
diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp
index 769e8ae..83bc2cc 100644
--- a/gnss/2.0/default/Android.bp
+++ b/gnss/2.0/default/Android.bp
@@ -50,7 +50,7 @@
"android.hardware.gnss@2.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@1.0",
- "android.hardware.gnss-V2-ndk",
+ "android.hardware.gnss-V3-ndk",
],
static_libs: [
"android.hardware.gnss@common-default-lib",
diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp
index 2042dd9..e8db886 100644
--- a/gnss/2.0/vts/functional/Android.bp
+++ b/gnss/2.0/vts/functional/Android.bp
@@ -39,7 +39,7 @@
"android.hardware.gnss@2.0",
"android.hardware.gnss@2.1",
"android.hardware.gnss@common-vts-lib",
- "android.hardware.gnss-V2-cpp",
+ "android.hardware.gnss-V3-cpp",
],
test_suites: [
"general-tests",
diff --git a/gnss/2.1/default/Android.bp b/gnss/2.1/default/Android.bp
index 2979f5c..4a4ce54 100644
--- a/gnss/2.1/default/Android.bp
+++ b/gnss/2.1/default/Android.bp
@@ -44,7 +44,7 @@
"android.hardware.gnss@1.0",
"android.hardware.gnss@1.1",
"android.hardware.gnss@2.0",
- "android.hardware.gnss-V2-ndk",
+ "android.hardware.gnss-V3-ndk",
],
static_libs: [
"android.hardware.gnss@common-default-lib",
diff --git a/gnss/2.1/vts/functional/Android.bp b/gnss/2.1/vts/functional/Android.bp
index d7b6eeb..76f9d07 100644
--- a/gnss/2.1/vts/functional/Android.bp
+++ b/gnss/2.1/vts/functional/Android.bp
@@ -40,7 +40,7 @@
"android.hardware.gnss@2.0",
"android.hardware.gnss@2.1",
"android.hardware.gnss@common-vts-lib",
- "android.hardware.gnss-V2-cpp",
+ "android.hardware.gnss-V3-cpp",
],
shared_libs: [
"libvintf",
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl
index 8930752..c782b6f 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl
@@ -39,6 +39,7 @@
void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation);
void setSetId(in android.hardware.gnss.IAGnssRil.SetIdType type, in @utf8InCpp String setid);
void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes);
+ void injectNiSuplMessageData(in byte[] msgData, in int slotIndex);
const int NETWORK_CAPABILITY_NOT_METERED = 1;
const int NETWORK_CAPABILITY_NOT_ROAMING = 2;
@Backing(type="int") @VintfStability
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl
index 48c88f5..fd07a6e 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl
@@ -45,6 +45,7 @@
void gnssSetSystemInfoCb(in android.hardware.gnss.IGnssCallback.GnssSystemInfo info);
void gnssRequestTimeCb();
void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency);
+ void gnssSetSignalTypeCapabilitiesCb(in android.hardware.gnss.GnssSignalType[] gnssSignalTypes);
const int CAPABILITY_SCHEDULING = 1;
const int CAPABILITY_MSB = 2;
const int CAPABILITY_MSA = 4;
diff --git a/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl
index 44847f0..5f2e261 100644
--- a/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl
+++ b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl
@@ -164,4 +164,14 @@
*
*/
void updateNetworkState(in NetworkAttributes attributes);
+
+ /**
+ * Injects an SMS/WAP initiated SUPL message.
+ *
+ * @param msgData ASN.1 encoded SUPL INIT message. This is defined in
+ * UserPlane Location Protocol (Version 2.0.4).
+ * @param slotIndex Specifies the slot index (See
+ * android.telephony.SubscriptionManager#getSlotIndex()) of the SUPL connection.
+ */
+ void injectNiSuplMessageData(in byte[] msgData, in int slotIndex);
}
diff --git a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
index 8633bea..2b2592b 100644
--- a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl
@@ -18,6 +18,7 @@
import android.hardware.gnss.GnssConstellationType;
import android.hardware.gnss.GnssLocation;
+import android.hardware.gnss.GnssSignalType;
import android.hardware.gnss.IGnssConfiguration;
import android.hardware.gnss.IGnssPsds;
@@ -308,4 +309,18 @@
* during-call to E911, or up to 5 minutes after end-of-call or text to E911).
*/
void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency);
+
+ /**
+ * Callback to inform the framework of the list of GnssSignalTypes the GNSS HAL implementation
+ * supports.
+ *
+ * These capabilities are static at runtime, i.e., they represent the signal types the
+ * GNSS implementation supports without considering the temporary disabled signal types such as
+ * the blocklisted satellites/constellations or the constellations disabled by regional
+ * restrictions.
+ *
+ * @param gnssSignalTypes a list of GnssSignalTypes specifying the constellations, carrier
+ * frequencies, and the code types the GNSS HAL implementation supports.
+ */
+ void gnssSetSignalTypeCapabilitiesCb(in GnssSignalType[] gnssSignalTypes);
}
diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
index 8733754..4316407 100644
--- a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl
@@ -78,6 +78,9 @@
* output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec
* can be tolerated.)
*
+ * If setCallback() is invoked without a previous close(), the HAL must use the new callback
+ * and parameters to provide updates.
+ *
* @param callback Handle to GnssMeasurement callback interface.
* @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode
* no clock discontinuities are expected and, when supported, carrier phase should be
@@ -104,6 +107,9 @@
/**
* Initializes the interface and registers the callback routines with the HAL.
*
+ * If setCallbackWithOptions() is invoked without a previous close(), the HAL must use the new
+ * callback and options to provide updates.
+ *
* @param options See Options definition.
*/
void setCallbackWithOptions(in IGnssMeasurementCallback callback, in Options options);
diff --git a/gnss/aidl/default/AGnssRil.cpp b/gnss/aidl/default/AGnssRil.cpp
index 2aa1abc..81b4f2a 100644
--- a/gnss/aidl/default/AGnssRil.cpp
+++ b/gnss/aidl/default/AGnssRil.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "AGnssRilAidl"
#include "AGnssRil.h"
+#include <aidl/android/hardware/gnss/BnGnss.h>
#include <inttypes.h>
#include <log/log.h>
@@ -55,4 +56,15 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus AGnssRil::injectNiSuplMessageData(const std::vector<uint8_t>& msgData,
+ int slotIndex) {
+ ALOGD("AGnssRil::injectNiSuplMessageData: msgData:%d bytes slotIndex:%d",
+ static_cast<int>(msgData.size()), slotIndex);
+ if (msgData.size() > 0) {
+ return ndk::ScopedAStatus::ok();
+ } else {
+ return ndk::ScopedAStatus::fromServiceSpecificError(IGnss::ERROR_INVALID_ARGUMENT);
+ }
+}
+
} // namespace aidl::android::hardware::gnss
diff --git a/gnss/aidl/default/AGnssRil.h b/gnss/aidl/default/AGnssRil.h
index e205b69..76583ac 100644
--- a/gnss/aidl/default/AGnssRil.h
+++ b/gnss/aidl/default/AGnssRil.h
@@ -26,6 +26,8 @@
ndk::ScopedAStatus setRefLocation(const AGnssRefLocation& agnssReflocation) override;
ndk::ScopedAStatus setSetId(SetIdType type, const std::string& setid) override;
ndk::ScopedAStatus updateNetworkState(const NetworkAttributes& attributes) override;
+ ndk::ScopedAStatus injectNiSuplMessageData(const std::vector<uint8_t>& msgData,
+ int slotIndex) override;
private:
// Synchronization lock for sCallback
diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp
index c8ae6b2..ca5a41f 100644
--- a/gnss/aidl/default/Android.bp
+++ b/gnss/aidl/default/Android.bp
@@ -50,7 +50,7 @@
"android.hardware.gnss.measurement_corrections@1.1",
"android.hardware.gnss.measurement_corrections@1.0",
"android.hardware.gnss.visibility_control@1.0",
- "android.hardware.gnss-V2-ndk",
+ "android.hardware.gnss-V3-ndk",
],
srcs: [
"AGnssRil.cpp",
diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp
index cf2c90d..8a4d186 100644
--- a/gnss/aidl/default/Gnss.cpp
+++ b/gnss/aidl/default/Gnss.cpp
@@ -74,7 +74,21 @@
if (!status.isOk()) {
ALOGE("%s: Unable to invoke callback.gnssSetSystemInfoCb", __func__);
}
-
+ GnssSignalType signalType1 = {
+ .constellation = GnssConstellationType::GPS,
+ .carrierFrequencyHz = 1.59975e+09,
+ .codeType = GnssSignalType::CODE_TYPE_C,
+ };
+ GnssSignalType signalType2 = {
+ .constellation = GnssConstellationType::GLONASS,
+ .carrierFrequencyHz = 1.59975e+09,
+ .codeType = GnssSignalType::CODE_TYPE_C,
+ };
+ status = sGnssCallback->gnssSetSignalTypeCapabilitiesCb(
+ std::vector<GnssSignalType>({signalType1, signalType2}));
+ if (!status.isOk()) {
+ ALOGE("%s: Unable to invoke callback.gnssSetSignalTypeCapabilitiesCb", __func__);
+ }
return ScopedAStatus::ok();
}
diff --git a/gnss/aidl/default/gnss-default.xml b/gnss/aidl/default/gnss-default.xml
index 7449310..73b841e 100644
--- a/gnss/aidl/default/gnss-default.xml
+++ b/gnss/aidl/default/gnss-default.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.gnss</name>
- <version>2</version>
+ <version>3</version>
<interface>
<name>IGnss</name>
<instance>default</instance>
diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp
index f02a41e..2a09a56 100644
--- a/gnss/aidl/vts/Android.bp
+++ b/gnss/aidl/vts/Android.bp
@@ -51,7 +51,7 @@
"libbinder",
],
static_libs: [
- "android.hardware.gnss-V2-cpp",
+ "android.hardware.gnss-V3-cpp",
"android.hardware.gnss@common-vts-lib",
],
test_suites: [
diff --git a/gnss/aidl/vts/AndroidTest.xml b/gnss/aidl/vts/AndroidTest.xml
new file mode 100644
index 0000000..d203402
--- /dev/null
+++ b/gnss/aidl/vts/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 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.
+-->
+<configuration description="Runs VtsHalGnssTargetTest.">
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
+ </target_preparer>
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="VtsHalGnssTargetTest->/data/local/tmp/VtsHalGnssTargetTest" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="VtsHalGnssTargetTest" />
+ <option name="native-test-timeout" value="2m" />
+ </test>
+</configuration>
diff --git a/gnss/aidl/vts/GnssCallbackAidl.cpp b/gnss/aidl/vts/GnssCallbackAidl.cpp
index 2f6128b..d3be414 100644
--- a/gnss/aidl/vts/GnssCallbackAidl.cpp
+++ b/gnss/aidl/vts/GnssCallbackAidl.cpp
@@ -23,6 +23,7 @@
using android::hardware::gnss::GnssLocation;
using GnssSvInfo = android::hardware::gnss::IGnssCallback::GnssSvInfo;
using GnssSystemInfo = android::hardware::gnss::IGnssCallback::GnssSystemInfo;
+using GnssSignalType = android::hardware::gnss::GnssSignalType;
Status GnssCallbackAidl::gnssSetCapabilitiesCb(const int capabilities) {
ALOGI("Capabilities received %#08x", capabilities);
@@ -30,6 +31,20 @@
return Status::ok();
}
+Status GnssCallbackAidl::gnssSetSignalTypeCapabilitiesCb(
+ const std::vector<GnssSignalType>& signalTypes) {
+ ALOGI("SignalTypeCapabilities received");
+ std::ostringstream ss;
+ for (auto& signalType : signalTypes) {
+ ss << "[constellation=" << (int)signalType.constellation
+ << ", carrierFrequencyHz=" << signalType.carrierFrequencyHz
+ << ", codeType=" << signalType.codeType << "], ";
+ }
+ ALOGI("%s", ss.str().c_str());
+ signal_type_capabilities_cbq_.store(signalTypes);
+ return Status::ok();
+}
+
Status GnssCallbackAidl::gnssStatusCb(const GnssStatusValue /* status */) {
ALOGI("gnssStatusCb");
return Status::ok();
diff --git a/gnss/aidl/vts/GnssCallbackAidl.h b/gnss/aidl/vts/GnssCallbackAidl.h
index a9495ba..06526d3 100644
--- a/gnss/aidl/vts/GnssCallbackAidl.h
+++ b/gnss/aidl/vts/GnssCallbackAidl.h
@@ -25,6 +25,7 @@
public:
GnssCallbackAidl()
: capabilities_cbq_("capabilities"),
+ signal_type_capabilities_cbq_("signal_type_capabilities"),
info_cbq_("system_info"),
location_cbq_("location"),
sv_info_list_cbq_("sv_info"),
@@ -32,6 +33,8 @@
~GnssCallbackAidl(){};
android::binder::Status gnssSetCapabilitiesCb(const int capabilities) override;
+ android::binder::Status gnssSetSignalTypeCapabilitiesCb(
+ const std::vector<android::hardware::gnss::GnssSignalType>& signalTypes) override;
android::binder::Status gnssStatusCb(const GnssStatusValue status) override;
android::binder::Status gnssSvStatusCb(const std::vector<GnssSvInfo>& svInfoList) override;
android::binder::Status gnssLocationCb(
@@ -45,11 +48,15 @@
const bool isUserEmergency) override;
int last_capabilities_;
+ std::vector<android::hardware::gnss::GnssSignalType> last_signal_type_capabilities;
android::hardware::gnss::IGnssCallback::GnssSystemInfo last_info_;
android::hardware::gnss::GnssLocation last_location_;
android::hardware::gnss::common::GnssCallbackEventQueue<int> capabilities_cbq_;
android::hardware::gnss::common::GnssCallbackEventQueue<
+ std::vector<android::hardware::gnss::GnssSignalType>>
+ signal_type_capabilities_cbq_;
+ android::hardware::gnss::common::GnssCallbackEventQueue<
android::hardware::gnss::IGnssCallback::GnssSystemInfo>
info_cbq_;
android::hardware::gnss::common::GnssCallbackEventQueue<android::hardware::gnss::GnssLocation>
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
index 3907f57..91cd917 100644
--- a/gnss/aidl/vts/gnss_hal_test.cpp
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -105,6 +105,15 @@
EXPECT_TRUE(aidl_gnss_cb_->info_cbq_.retrieve(aidl_gnss_cb_->last_info_, TIMEOUT_SEC));
EXPECT_EQ(aidl_gnss_cb_->info_cbq_.calledCount(), 1);
}
+
+ /*
+ * SignalTypeCapabilities callback should trigger.
+ */
+ if (aidl_gnss_hal_->getInterfaceVersion() >= 3) {
+ EXPECT_TRUE(aidl_gnss_cb_->signal_type_capabilities_cbq_.retrieve(
+ aidl_gnss_cb_->last_signal_type_capabilities, TIMEOUT_SEC));
+ EXPECT_EQ(aidl_gnss_cb_->signal_type_capabilities_cbq_.calledCount(), 1);
+ }
}
void GnssHalTest::TearDown() {
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 3696233..7c0a4df 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -1077,6 +1077,7 @@
* 2. Sets AGnssRilCallback.
* 3. Update network state to connected and then disconnected.
* 4. Sets reference location.
+ * 5. Injects empty NI message data and verifies that it returns an error.
*/
TEST_P(GnssHalTest, TestAGnssRilExtension) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
@@ -1120,6 +1121,9 @@
status = iAGnssRil->setRefLocation(agnssReflocation);
ASSERT_TRUE(status.isOk());
+
+ status = iAGnssRil->injectNiSuplMessageData(std::vector<uint8_t>(), 0);
+ ASSERT_FALSE(status.isOk());
}
/*
@@ -1494,3 +1498,33 @@
assertMeanAndStdev(locationIntervalMs, deltas);
}
}
+
+TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) {
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 2) {
+ return;
+ }
+
+ sp<IGnssMeasurementInterface> iGnssMeasurement;
+ auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_TRUE(iGnssMeasurement != nullptr);
+
+ ALOGD("TestGnssMeasurementSetCallback");
+ auto callback = sp<GnssMeasurementCallbackAidl>::make();
+ std::vector<int> deltas;
+
+ // setCallback at 20s interval and wait for 1 measurement
+ startMeasurementWithInterval(20000, iGnssMeasurement, callback);
+ collectMeasurementIntervals(callback, /* numEvents= */ 1, /* timeoutSeconds= */ 10, deltas);
+
+ // setCallback at 1s interval and wait for 5 measurements
+ callback->gnss_data_cbq_.reset();
+ startMeasurementWithInterval(1000, iGnssMeasurement, callback);
+ collectMeasurementIntervals(callback, /* numEvents= */ 5, /* timeoutSeconds= */ 10, deltas);
+
+ // verify the measurements were received at 1Hz
+ assertMeanAndStdev(1000, deltas);
+
+ status = iGnssMeasurement->close();
+ ASSERT_TRUE(status.isOk());
+}
diff --git a/gnss/common/utils/default/Android.bp b/gnss/common/utils/default/Android.bp
index b896f04..4cf17a6 100644
--- a/gnss/common/utils/default/Android.bp
+++ b/gnss/common/utils/default/Android.bp
@@ -57,6 +57,6 @@
"android.hardware.gnss@2.1",
"android.hardware.gnss.measurement_corrections@1.1",
"android.hardware.gnss.measurement_corrections@1.0",
- "android.hardware.gnss-V2-ndk",
+ "android.hardware.gnss-V3-ndk",
],
}
diff --git a/gnss/common/utils/vts/Android.bp b/gnss/common/utils/vts/Android.bp
index f92e609..b5325b2 100644
--- a/gnss/common/utils/vts/Android.bp
+++ b/gnss/common/utils/vts/Android.bp
@@ -44,7 +44,7 @@
"android.hardware.gnss@2.1",
"android.hardware.gnss.measurement_corrections@1.0",
"android.hardware.gnss.measurement_corrections@1.1",
- "android.hardware.gnss-V2-cpp",
+ "android.hardware.gnss-V3-cpp",
],
static_libs: [
"libgtest",
diff --git a/graphics/Android.bp b/graphics/Android.bp
index b48844d..1e9089f 100644
--- a/graphics/Android.bp
+++ b/graphics/Android.bp
@@ -33,27 +33,27 @@
cc_defaults {
name: "android.hardware.graphics.common-ndk_static",
static_libs: [
- "android.hardware.graphics.common-V3-ndk",
+ "android.hardware.graphics.common-V4-ndk",
],
}
cc_defaults {
name: "android.hardware.graphics.common-ndk_shared",
shared_libs: [
- "android.hardware.graphics.common-V3-ndk",
+ "android.hardware.graphics.common-V4-ndk",
],
}
cc_defaults {
name: "android.hardware.graphics.composer3-ndk_static",
static_libs: [
- "android.hardware.graphics.composer3-V1-ndk",
+ "android.hardware.graphics.composer3-V2-ndk",
],
}
cc_defaults {
name: "android.hardware.graphics.composer3-ndk_shared",
shared_libs: [
- "android.hardware.graphics.composer3-V1-ndk",
+ "android.hardware.graphics.composer3-V2-ndk",
],
}
diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp
index 40a575d..cb96663 100644
--- a/graphics/common/aidl/Android.bp
+++ b/graphics/common/aidl/Android.bp
@@ -15,7 +15,7 @@
enabled: true,
support_system_process: true,
},
- vndk_use_version: "3",
+ vndk_use_version: "4",
srcs: [
"android/hardware/graphics/common/*.aidl",
],
diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl
index 7bae45e..128ef49 100644
--- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl
+++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl
@@ -39,4 +39,5 @@
HDR10 = 2,
HLG = 3,
HDR10_PLUS = 4,
+ DOLBY_VISION_4K30 = 5,
}
diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
index f543780..407b54f 100644
--- a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
+++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl
@@ -39,4 +39,8 @@
* Device supports HDR10+
*/
HDR10_PLUS = 4,
+ /**
+ * If present, indicates that device supports Dolby Vision only up to 4k30hz graphics mode
+ */
+ DOLBY_VISION_4K30 = 5,
}
diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp
index e383ce2..478e2b7 100644
--- a/graphics/composer/2.2/utils/vts/Android.bp
+++ b/graphics/composer/2.2/utils/vts/Android.bp
@@ -41,7 +41,6 @@
static_libs: [
"android.hardware.graphics.composer@2.1-vts",
"android.hardware.graphics.composer@2.2",
- "android.hardware.graphics.composer3-V1-ndk",
"android.hardware.graphics.mapper@2.1-vts",
"libarect",
"libgtest",
diff --git a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp
index 4a33fb5..1700b2a 100644
--- a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp
+++ b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp
@@ -71,14 +71,12 @@
});
auto texture = std::make_shared<renderengine::impl::ExternalTexture>(
mGraphicBuffer, *mRenderEngine, renderengine::impl::ExternalTexture::Usage::WRITEABLE);
- auto [status, readyFence] = mRenderEngine
- ->drawLayers(mDisplaySettings, compositionLayers, texture,
- true, std::move(bufferFence))
- .get();
- int fd = readyFence.release();
- if (fd != -1) {
- ASSERT_EQ(0, sync_wait(fd, -1));
- ASSERT_EQ(0, close(fd));
+ auto result = mRenderEngine
+ ->drawLayers(mDisplaySettings, compositionLayers, texture, true,
+ std::move(bufferFence))
+ .get();
+ if (result.ok()) {
+ result.value()->waitForever(LOG_TAG);
}
}
diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp
index cdc7a93..c693d35 100644
--- a/graphics/composer/2.2/vts/functional/Android.bp
+++ b/graphics/composer/2.2/vts/functional/Android.bp
@@ -69,7 +69,6 @@
"android.hardware.graphics.composer@2.1-vts",
"android.hardware.graphics.composer@2.2",
"android.hardware.graphics.composer@2.2-vts",
- "android.hardware.graphics.composer3-V1-ndk",
"android.hardware.graphics.mapper@2.0-vts",
"android.hardware.graphics.mapper@2.1-vts",
"android.hardware.graphics.mapper@3.0-vts",
diff --git a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp
index fa294ff..35225d9 100644
--- a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp
+++ b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp
@@ -737,6 +737,39 @@
}
}
+/*
+ * Test that no two display configs are exactly the same.
+ */
+TEST_P(GraphicsComposerHidlTest, GetDisplayConfigNoRepetitions) {
+ for (const auto& display : mDisplays) {
+ std::vector<Config> configs = mComposerClient->getDisplayConfigs(display.get());
+ for (int i = 0; i < configs.size(); i++) {
+ for (int j = i + 1; j < configs.size(); j++) {
+ const int32_t width1 = mComposerClient->getDisplayAttribute_2_4(
+ display.get(), configs[i], IComposerClient::Attribute::WIDTH);
+ const int32_t height1 = mComposerClient->getDisplayAttribute_2_4(
+ display.get(), configs[i], IComposerClient::Attribute::HEIGHT);
+ const int32_t vsyncPeriod1 = mComposerClient->getDisplayAttribute_2_4(
+ display.get(), configs[i], IComposerClient::Attribute::VSYNC_PERIOD);
+ const int32_t group1 = mComposerClient->getDisplayAttribute_2_4(
+ display.get(), configs[i], IComposerClient::Attribute::CONFIG_GROUP);
+
+ const int32_t width2 = mComposerClient->getDisplayAttribute_2_4(
+ display.get(), configs[j], IComposerClient::Attribute::WIDTH);
+ const int32_t height2 = mComposerClient->getDisplayAttribute_2_4(
+ display.get(), configs[j], IComposerClient::Attribute::HEIGHT);
+ const int32_t vsyncPeriod2 = mComposerClient->getDisplayAttribute_2_4(
+ display.get(), configs[j], IComposerClient::Attribute::VSYNC_PERIOD);
+ const int32_t group2 = mComposerClient->getDisplayAttribute_2_4(
+ display.get(), configs[j], IComposerClient::Attribute::CONFIG_GROUP);
+
+ ASSERT_FALSE(width1 == width2 && height1 == height2 &&
+ vsyncPeriod1 == vsyncPeriod2 && group1 == group2);
+ }
+ }
+ }
+}
+
} // namespace
} // namespace vts
} // namespace V2_4
diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp
index 9b88d98..0ba320d 100644
--- a/graphics/composer/aidl/Android.bp
+++ b/graphics/composer/aidl/Android.bp
@@ -36,7 +36,7 @@
],
stability: "vintf",
imports: [
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
"android.hardware.common-V2",
],
backend: {
@@ -57,7 +57,7 @@
{
version: "1",
imports: [
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
"android.hardware.common-V2",
],
},
@@ -67,9 +67,9 @@
cc_library_headers {
name: "android.hardware.graphics.composer3-command-buffer",
+ defaults: ["android.hardware.graphics.composer3-ndk_shared"],
vendor_available: true,
shared_libs: [
- "android.hardware.graphics.composer3-V1-ndk",
"android.hardware.common-V2-ndk",
"libbase",
"libfmq",
@@ -87,12 +87,12 @@
cc_test {
name: "android.hardware.graphics.composer3-hidl2aidl-asserts",
+ defaults: ["android.hardware.graphics.composer3-ndk_shared"],
vendor_available: true,
srcs: ["android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp"],
shared_libs: [
"libbinder_ndk",
"libhidlbase",
- "android.hardware.graphics.composer3-V1-ndk",
"android.hardware.graphics.composer@2.1",
"android.hardware.graphics.composer@2.4",
],
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl
index 6eba887..0e2d72b 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl
@@ -42,4 +42,5 @@
AUTO_LOW_LATENCY_MODE = 5,
SUSPEND = 6,
DISPLAY_IDLE_TIMER = 7,
+ MULTI_THREADED_PRESENT = 8,
}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
index b49f239..a7e6535 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -75,6 +75,7 @@
void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer, in @nullable ParcelFileDescriptor releaseFence);
void setVsyncEnabled(long display, boolean enabled);
void setIdleTimerEnabled(long display, int timeoutMs);
+ android.hardware.graphics.composer3.OverlayProperties getOverlaySupport();
const int EX_BAD_CONFIG = 1;
const int EX_BAD_DISPLAY = 2;
const int EX_BAD_LAYER = 3;
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl
new file mode 100644
index 0000000..4d8fcac
--- /dev/null
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl
@@ -0,0 +1,38 @@
+/**
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.graphics.composer3;
+@VintfStability
+parcelable OverlayProperties {
+ android.hardware.graphics.composer3.SupportedBufferCombinations[] combinations;
+}
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl
new file mode 100644
index 0000000..1828be1
--- /dev/null
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl
@@ -0,0 +1,39 @@
+/**
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.graphics.composer3;
+@VintfStability
+parcelable SupportedBufferCombinations {
+ android.hardware.graphics.common.PixelFormat[] pixelFormats;
+ android.hardware.graphics.common.Dataspace[] dataspaces;
+}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl
index ddd45b7..9e8c768 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl
@@ -23,7 +23,6 @@
parcelable ChangedCompositionTypes {
/**
* The display which this commands refers to.
- * @see IComposer.createDisplay
*/
long display;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl
index ba6fe97..ea54a89 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl
@@ -23,7 +23,6 @@
parcelable ClientTargetPropertyWithBrightness {
/**
* The display which this commands refers to.
- * @see IComposer.createDisplay
*/
long display;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl
index f4b2984..7154d74 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl
@@ -80,4 +80,20 @@
* IComposerCallback.onVsyncIdle.
*/
DISPLAY_IDLE_TIMER = 7,
+ /**
+ * Indicates that both the composer HAL implementation and the given display
+ * support calling executeCommands concurrently from separate threads.
+ * executeCommands for a particular display will never run concurrently to
+ * any other executeCommands for the same display. In addition, the
+ * CommandResultPayload must only reference displays included in the
+ * DisplayCommands passed to executeCommands. Displays referenced from
+ * separate threads must have minimal interference with one another. If a
+ * HWC-managed display has this capability, SurfaceFlinger can run
+ * executeCommands for this display concurrently with other displays with the
+ * same capability.
+ * @see IComposerClient.executeCommands
+ * @see DisplayCommand.presentDisplay
+ * @see DisplayCommand.validateDisplay
+ */
+ MULTI_THREADED_PRESENT = 8,
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
index b6df147..4f69aee 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl
@@ -26,7 +26,6 @@
parcelable DisplayCommand {
/**
* The display which this commands refers to.
- * @see IComposer.createDisplay
*/
long display;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl
index 27fe1e6..3a50b6e 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl
@@ -34,7 +34,6 @@
/**
* The display which this commands refers to.
- * @see IComposer.createDisplay
*/
long display;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
index a4ea64f..88bb3a4 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl
@@ -32,6 +32,7 @@
import android.hardware.graphics.composer3.FormatColorComponent;
import android.hardware.graphics.composer3.HdrCapabilities;
import android.hardware.graphics.composer3.IComposerCallback;
+import android.hardware.graphics.composer3.OverlayProperties;
import android.hardware.graphics.composer3.PerFrameMetadataKey;
import android.hardware.graphics.composer3.PowerMode;
import android.hardware.graphics.composer3.ReadbackBufferAttributes;
@@ -814,4 +815,14 @@
*
*/
void setIdleTimerEnabled(long display, int timeoutMs);
+
+ /**
+ * Hardware overlays is a technique to composite different buffers directly to the screen
+ * while bypassing GPU composition.
+ *
+ * This function returns what the device's overlays support.
+ *
+ * @return the overlay properties of the device.
+ */
+ OverlayProperties getOverlaySupport();
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl
new file mode 100644
index 0000000..d3bd7d3
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl
@@ -0,0 +1,29 @@
+/**
+ * Copyright (C) 2022 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.graphics.composer3;
+
+import android.hardware.graphics.composer3.SupportedBufferCombinations;
+
+@VintfStability
+parcelable OverlayProperties {
+ // Array of all valid pixelformat and dataspace combinations.
+ // If all supported formats work with all supported dataspaces,
+ // then this list may only have 1 entry.
+ // If some dataspaces, e.g. scRGB, only work with specific formats,
+ // then this list may contain more than 1 entry.
+ SupportedBufferCombinations[] combinations;
+}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl
index 244b4e5..b757656 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl
@@ -20,7 +20,6 @@
parcelable PresentFence {
/**
* The display which this commands refers to.
- * @see IComposer.createDisplay
*/
long display;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl
index 5ae8940..e15dbf2 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl
@@ -20,7 +20,6 @@
parcelable PresentOrValidate {
/**
* The display which this commands refers to.
- * @see IComposer.createDisplay
*/
long display;
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl
index 459a042..58649d5 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl
@@ -20,7 +20,6 @@
parcelable ReleaseFences {
/**
* The display which this commands refers to.
- * @see IComposer.createDisplay
*/
long display;
@VintfStability
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl
new file mode 100644
index 0000000..41f8817
--- /dev/null
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl
@@ -0,0 +1,25 @@
+/**
+ * Copyright (C) 2022 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.graphics.composer3;
+
+@VintfStability
+parcelable SupportedBufferCombinations {
+ // List of pixelformats and dataspaces that can be used together.
+ // All pixelformats and dataspaces stored inside are valid combinations.
+ android.hardware.graphics.common.PixelFormat[] pixelFormats;
+ android.hardware.graphics.common.Dataspace[] dataspaces;
+}
diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
index 1d81f7b..775ae9f 100644
--- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
+++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h
@@ -59,13 +59,13 @@
namespace aidl::android::hardware::graphics::composer3 {
-class ComposerClientWriter {
+class ComposerClientWriter final {
public:
static constexpr std::optional<ClockMonotonicTimestamp> kNoTimestamp = std::nullopt;
ComposerClientWriter() { reset(); }
- virtual ~ComposerClientWriter() { reset(); }
+ ~ComposerClientWriter() { reset(); }
void reset() {
mDisplayCommand.reset();
diff --git a/graphics/composer/aidl/vts/Android.bp b/graphics/composer/aidl/vts/Android.bp
index 1e70a0e..cbd2da5 100644
--- a/graphics/composer/aidl/vts/Android.bp
+++ b/graphics/composer/aidl/vts/Android.bp
@@ -30,6 +30,8 @@
"use_libaidlvintf_gtest_helper_static",
// Needed for librenderengine
"skia_deps",
+ "android.hardware.graphics.common-ndk_static",
+ "android.hardware.graphics.composer3-ndk_static",
],
srcs: [
"VtsHalGraphicsComposer3_TargetTest.cpp",
@@ -67,8 +69,6 @@
"android.hardware.graphics.composer3-command-buffer",
],
static_libs: [
- "android.hardware.graphics.composer3-V1-ndk",
- "android.hardware.graphics.common-V3-ndk",
"android.hardware.graphics.common@1.2",
"android.hardware.common-V2-ndk",
"android.hardware.common.fmq-V1-ndk",
diff --git a/graphics/composer/aidl/vts/RenderEngineVts.cpp b/graphics/composer/aidl/vts/RenderEngineVts.cpp
index 71b011c..66779c8 100644
--- a/graphics/composer/aidl/vts/RenderEngineVts.cpp
+++ b/graphics/composer/aidl/vts/RenderEngineVts.cpp
@@ -66,14 +66,12 @@
auto texture = std::make_shared<::android::renderengine::impl::ExternalTexture>(
mGraphicBuffer, *mRenderEngine,
::android::renderengine::impl::ExternalTexture::Usage::WRITEABLE);
- auto [status, readyFence] = mRenderEngine
- ->drawLayers(mDisplaySettings, compositionLayers, texture,
- true, std::move(bufferFence))
- .get();
- int fd = readyFence.release();
- if (fd != -1) {
- ASSERT_EQ(0, sync_wait(fd, -1));
- ASSERT_EQ(0, close(fd));
+ auto result = mRenderEngine
+ ->drawLayers(mDisplaySettings, compositionLayers, texture, true,
+ std::move(bufferFence))
+ .get();
+ if (result.ok()) {
+ result.value()->waitForever(LOG_TAG);
}
}
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp
index 5bc7296..34cc802 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.cpp
+++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp
@@ -338,6 +338,11 @@
outDisplayOrientation};
}
+std::pair<ScopedAStatus, composer3::OverlayProperties> VtsComposerClient::getOverlaySupport() {
+ OverlayProperties properties;
+ return {mComposerClient->getOverlaySupport(&properties), properties};
+}
+
ScopedAStatus VtsComposerClient::setIdleTimerEnabled(int64_t display, int32_t timeoutMs) {
return mComposerClient->setIdleTimerEnabled(display, timeoutMs);
}
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h
index 3625c8c..6358b85 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.h
+++ b/graphics/composer/aidl/vts/VtsComposerClient.h
@@ -172,6 +172,8 @@
std::pair<ScopedAStatus, std::vector<VtsDisplay>> getDisplays();
+ std::pair<ScopedAStatus, OverlayProperties> getOverlaySupport();
+
private:
ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config);
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 047109e..ed8a06c 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/graphics/common/BlendMode.h>
@@ -808,6 +809,18 @@
EXPECT_TRUE(status.isOk());
}
+// TODO(b/250036572): disable this due to no implementation and revup on cuttlefish
+TEST_P(GraphicsComposerAidlTest, DISABLED_GetOverlaySupport) {
+ const auto& [status, _] = mComposerClient->getOverlaySupport();
+ if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC &&
+ status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
+ GTEST_SUCCEED() << "getOverlaySupport is not supported";
+ return;
+ }
+
+ ASSERT_TRUE(status.isOk());
+}
+
TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) {
const auto& [status, _] = mComposerClient->getDisplayPhysicalOrientation(getInvalidDisplayId());
@@ -2122,6 +2135,55 @@
EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
}
+/*
+ * Test that no two display configs are exactly the same.
+ */
+TEST_P(GraphicsComposerAidlTest, GetDisplayConfigNoRepetitions) {
+ for (const auto& display : mDisplays) {
+ const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId());
+ for (std::vector<int>::size_type i = 0; i < configs.size(); i++) {
+ for (std::vector<int>::size_type j = i + 1; j < configs.size(); j++) {
+ const auto& [widthStatus1, width1] = mComposerClient->getDisplayAttribute(
+ display.getDisplayId(), configs[i], DisplayAttribute::WIDTH);
+ const auto& [heightStatus1, height1] = mComposerClient->getDisplayAttribute(
+ display.getDisplayId(), configs[i], DisplayAttribute::HEIGHT);
+ const auto& [vsyncPeriodStatus1, vsyncPeriod1] =
+ mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[i],
+ DisplayAttribute::VSYNC_PERIOD);
+ const auto& [groupStatus1, group1] = mComposerClient->getDisplayAttribute(
+ display.getDisplayId(), configs[i], DisplayAttribute::CONFIG_GROUP);
+
+ const auto& [widthStatus2, width2] = mComposerClient->getDisplayAttribute(
+ display.getDisplayId(), configs[j], DisplayAttribute::WIDTH);
+ const auto& [heightStatus2, height2] = mComposerClient->getDisplayAttribute(
+ display.getDisplayId(), configs[j], DisplayAttribute::HEIGHT);
+ const auto& [vsyncPeriodStatus2, vsyncPeriod2] =
+ mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[j],
+ DisplayAttribute::VSYNC_PERIOD);
+ const auto& [groupStatus2, group2] = mComposerClient->getDisplayAttribute(
+ display.getDisplayId(), configs[j], DisplayAttribute::CONFIG_GROUP);
+
+ ASSERT_FALSE(width1 == width2 && height1 == height2 &&
+ vsyncPeriod1 == vsyncPeriod2 && group1 == group2);
+ }
+ }
+ }
+}
+
+TEST_P(GraphicsComposerAidlCommandTest, MultiThreadedPresent) {
+ std::vector<VtsDisplay*> displays;
+ for (auto& display : mDisplays) {
+ if (hasDisplayCapability(display.getDisplayId(),
+ DisplayCapability::MULTI_THREADED_PRESENT)) {
+ displays.push_back(&display);
+ }
+ }
+ if (displays.size() <= 1u) {
+ return;
+ }
+ // TODO(b/251842321): Try to present on multiple threads.
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest);
INSTANTIATE_TEST_SUITE_P(
PerInstance, GraphicsComposerAidlCommandTest,
diff --git a/graphics/mapper/4.0/utils/vts/Android.bp b/graphics/mapper/4.0/utils/vts/Android.bp
index 269b972..51e871b 100644
--- a/graphics/mapper/4.0/utils/vts/Android.bp
+++ b/graphics/mapper/4.0/utils/vts/Android.bp
@@ -37,7 +37,6 @@
],
static_libs: [
"android.hardware.graphics.allocator@4.0",
- "android.hardware.graphics.common-V3-ndk",
"android.hardware.graphics.mapper@4.0",
"libaidlcommonsupport",
],
@@ -48,7 +47,7 @@
],
export_static_lib_headers: [
"android.hardware.graphics.allocator@4.0",
- "android.hardware.graphics.common-V3-ndk",
+ "android.hardware.graphics.common-V4-ndk",
"android.hardware.graphics.mapper@4.0",
],
export_include_dirs: ["include"],
diff --git a/graphics/mapper/4.0/vts/functional/Android.bp b/graphics/mapper/4.0/vts/functional/Android.bp
index 8f3e7eb..6208ae9 100644
--- a/graphics/mapper/4.0/vts/functional/Android.bp
+++ b/graphics/mapper/4.0/vts/functional/Android.bp
@@ -33,7 +33,6 @@
],
srcs: ["VtsHalGraphicsMapperV4_0TargetTest.cpp"],
static_libs: [
- "android.hardware.graphics.common-V3-ndk",
"android.hardware.graphics.mapper@4.0-vts",
"libaidlcommonsupport",
"libgralloctypes",
diff --git a/media/bufferpool/aidl/Android.bp b/media/bufferpool/aidl/Android.bp
new file mode 100644
index 0000000..3b2ea3c
--- /dev/null
+++ b/media/bufferpool/aidl/Android.bp
@@ -0,0 +1,35 @@
+// Copyright (C) 2022 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.
+
+aidl_interface {
+ name: "android.hardware.media.bufferpool2",
+ vendor_available: true,
+ srcs: ["android/hardware/media/bufferpool2/*.aidl"],
+ imports: [
+ "android.hardware.common-V2",
+ "android.hardware.common.fmq-V1",
+ ],
+ stability: "vintf",
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ enabled: false,
+ },
+ ndk: {
+ enabled: true,
+ },
+ },
+}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl
new file mode 100644
index 0000000..4ea0bba
--- /dev/null
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.bufferpool2;
+@VintfStability
+parcelable Buffer {
+ int id;
+ android.hardware.common.NativeHandle buffer;
+}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl
new file mode 100644
index 0000000..181286c
--- /dev/null
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.bufferpool2;
+@FixedSize @VintfStability
+parcelable BufferInvalidationMessage {
+ int messageId;
+ int fromBufferId;
+ int toBufferId;
+}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatus.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatus.aidl
new file mode 100644
index 0000000..13174ff
--- /dev/null
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatus.aidl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.bufferpool2;
+@Backing(type="int") @VintfStability
+enum BufferStatus {
+ NOT_USED = 0,
+ USED = 1,
+ TRANSFER_TO = 2,
+ TRANSFER_FROM = 3,
+ TRANSFER_TIMEOUT = 4,
+ TRANSFER_LOST = 5,
+ TRANSFER_FETCH = 6,
+ TRANSFER_OK = 7,
+ TRANSFER_ERROR = 8,
+ INVALIDATION_ACK = 9,
+}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatusMessage.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatusMessage.aidl
new file mode 100644
index 0000000..7e79a36
--- /dev/null
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatusMessage.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.bufferpool2;
+@FixedSize @VintfStability
+parcelable BufferStatusMessage {
+ long transactionId;
+ int bufferId;
+ android.hardware.media.bufferpool2.BufferStatus status;
+ long connectionId;
+ long targetConnectionId;
+ long timestampUs;
+}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IAccessor.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IAccessor.aidl
new file mode 100644
index 0000000..4053797
--- /dev/null
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IAccessor.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.bufferpool2;
+@VintfStability
+interface IAccessor {
+ android.hardware.media.bufferpool2.IAccessor.ConnectionInfo connect(in android.hardware.media.bufferpool2.IObserver observer);
+ @VintfStability
+ parcelable ConnectionInfo {
+ android.hardware.media.bufferpool2.IConnection connection;
+ long connectionId;
+ int msgId;
+ android.hardware.common.fmq.MQDescriptor<android.hardware.media.bufferpool2.BufferStatusMessage,android.hardware.common.fmq.SynchronizedReadWrite> toFmqDesc;
+ android.hardware.common.fmq.MQDescriptor<android.hardware.media.bufferpool2.BufferInvalidationMessage,android.hardware.common.fmq.UnsynchronizedWrite> fromFmqDesc;
+ }
+}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl
new file mode 100644
index 0000000..54896d4
--- /dev/null
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.bufferpool2;
+@VintfStability
+interface IClientManager {
+ long registerSender(in android.hardware.media.bufferpool2.IAccessor bufferPool);
+}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl
new file mode 100644
index 0000000..300fcba
--- /dev/null
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.bufferpool2;
+@VintfStability
+interface IConnection {
+ android.hardware.media.bufferpool2.IConnection.FetchResult[] fetch(in android.hardware.media.bufferpool2.IConnection.FetchInfo[] fetchInfos);
+ parcelable FetchInfo {
+ long transactionId;
+ int bufferId;
+ }
+ union FetchResult {
+ android.hardware.media.bufferpool2.Buffer buffer;
+ android.hardware.media.bufferpool2.ResultStatus failure;
+ }
+}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IObserver.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IObserver.aidl
new file mode 100644
index 0000000..2d8cffe
--- /dev/null
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IObserver.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.bufferpool2;
+@VintfStability
+interface IObserver {
+ oneway void onMessage(in long connectionId, in int msgId);
+}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl
new file mode 100644
index 0000000..7370998
--- /dev/null
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.bufferpool2;
+@VintfStability
+parcelable ResultStatus {
+ int resultStatus;
+ const int OK = 0;
+ const int NO_MEMORY = 1;
+ const int ALREADY_EXISTS = 2;
+ const int NOT_FOUND = 3;
+ const int CRITICAL_ERROR = 4;
+}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl
new file mode 100644
index 0000000..976f674
--- /dev/null
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 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.media.bufferpool2;
+
+import android.hardware.common.NativeHandle;
+
+/**
+ * Generic buffer for fast recycling for media/stagefright.
+ *
+ * During media pipeline buffer references are created, shared and
+ * destroyed frequently. The underlying buffers are allocated on demand
+ * by a buffer pool, and are recycled to the buffer pool when they are
+ * no longer referenced by the clients.
+ *
+ * E.g. ion or gralloc buffer
+ */
+@VintfStability
+parcelable Buffer {
+ int id;
+ NativeHandle buffer;
+}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl
new file mode 100644
index 0000000..ad03cd5
--- /dev/null
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.media.bufferpool2;
+
+/*
+ * Buffer pool sends a buffer invalidation message to clients in order to
+ * ensure fast reclamation of the buffers. Buffer pool implementation on
+ * clients must release the invalidated buffers right away after finishing
+ * the use of buffers upon receiving a buffer invalidation message.
+ * Users cannot delay or control timing of the handling/reception of
+ * invalidation messages. Buffer pool implementation must guarantee timely
+ * handling of invalidation messages.
+ */
+@VintfStability
+@FixedSize
+parcelable BufferInvalidationMessage {
+ int messageId;
+ /**
+ * Buffers from fromBufferId to toBufferId must be invalidated.
+ * fromBufferId is inclusive, but toBufferId is not inclusive.
+ * If fromBufferId > toBufferID, wrap happens. In that case
+ * the wrap is based on UINT32_MAX.
+ */
+ int fromBufferId;
+ int toBufferId;
+}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatus.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatus.aidl
new file mode 100644
index 0000000..b63aee2
--- /dev/null
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatus.aidl
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2022 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.media.bufferpool2;
+
+/**
+ * Buffer ownership status for the specified client.
+ * Buffer transfer status for the specified buffer transafer transaction.
+ * BufferStatus is posted along with BufferStatusMessage from a client to
+ * the buffer pool for synchronization after status change.
+ */
+@VintfStability
+@Backing(type="int")
+enum BufferStatus {
+ /**
+ * No longer used by the specified client.
+ */
+ NOT_USED = 0,
+ /**
+ * Buffer is acquired by the specified client.
+ */
+ USED = 1,
+ /**
+ * Buffer is sent by the specified client.
+ */
+ TRANSFER_TO = 2,
+ /**
+ * Buffer transfer is acked by the receiver client.
+ */
+ TRANSFER_FROM = 3,
+ /**
+ * Buffer transfer is timed out by receiver client.
+ */
+ TRANSFER_TIMEOUT = 4,
+ /**
+ * Buffer transfer is not acked by the receiver.
+ */
+ TRANSFER_LOST = 5,
+ /**
+ * Buffer fetch request from the client.
+ */
+ TRANSFER_FETCH = 6,
+ /**
+ * Buffer transaction succeeded.
+ */
+ TRANSFER_OK = 7,
+ /**
+ * Buffer transaction failure.
+ */
+ TRANSFER_ERROR = 8,
+ /**
+ * Buffer invalidation ack.
+ */
+ INVALIDATION_ACK = 9,
+}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatusMessage.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatusMessage.aidl
new file mode 100644
index 0000000..e3fd8f0
--- /dev/null
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatusMessage.aidl
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2022 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.media.bufferpool2;
+
+import android.hardware.media.bufferpool2.BufferStatus;
+
+/**
+ * Buffer ownership status change message. This message is
+ * sent via fmq to the buffer pool from client processes.
+ */
+@VintfStability
+@FixedSize
+parcelable BufferStatusMessage {
+ /**
+ * Transaction Id = (SenderId : sender local transaction Id)
+ * Transaction Id is created from sender and posted via fmq within
+ * TRANSFER_TO message.
+ */
+ long transactionId;
+ int bufferId;
+ BufferStatus status;
+ /**
+ * Used by the buffer pool, not by client.
+ */
+ long connectionId;
+ /**
+ * Valid only when TRANSFER_TO is posted.
+ */
+ long targetConnectionId;
+ /**
+ * Used by the buffer pool, not by client.
+ * Monotonic timestamp in Us since fixed point in time as decided
+ * by the sender of the message
+ */
+ long timestampUs;
+}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IAccessor.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IAccessor.aidl
new file mode 100644
index 0000000..0fa5961
--- /dev/null
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IAccessor.aidl
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2022 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.media.bufferpool2;
+
+import android.hardware.common.fmq.MQDescriptor;
+import android.hardware.common.fmq.SynchronizedReadWrite;
+import android.hardware.common.fmq.UnsynchronizedWrite;
+
+
+import android.hardware.media.bufferpool2.BufferInvalidationMessage;
+import android.hardware.media.bufferpool2.BufferStatusMessage;
+import android.hardware.media.bufferpool2.IConnection;
+import android.hardware.media.bufferpool2.IObserver;
+
+/**
+ * IAccessor creates IConnection which is used from IClientManager in order to
+ * use functionality of the specified buffer pool.
+ */
+@VintfStability
+interface IAccessor {
+ @VintfStability
+ /**
+ * Connection information between the bufferpool process and the receiver
+ * process. The information is used from the receiver process in order to
+ * receive buffers from the bufferpool process.
+ */
+ parcelable ConnectionInfo {
+ /**
+ * The interface to get shared buffers from the bufferpool.
+ */
+ IConnection connection;
+ /**
+ * The identifier for a (sender/receiver) pair during buffer transfer.
+ * This is system wide unique.
+ */
+ long connectionId;
+ /**
+ * Id of the most recent message from bufferpool. This is monotonic.
+ */
+ int msgId;
+ /**
+ * The FMQ descriptor for sending buffer status messages back to bufferpool
+ */
+ MQDescriptor<BufferStatusMessage, SynchronizedReadWrite> toFmqDesc;
+ /**
+ * The FMQ descriptor for receiving buffer invalidation messages from bufferpool
+ */
+ MQDescriptor<BufferInvalidationMessage, UnsynchronizedWrite> fromFmqDesc;
+ }
+
+ /**
+ * Registers a new client and creates IConnection to the buffer pool for
+ * the client. IConnection and FMQ are used by IClientManager in order to
+ * communicate with the buffer pool. Via FMQ IClientManager sends
+ * BufferStatusMessage(s) to the buffer pool.
+ *
+ * FMQ is used to send buffer ownership status changes to a buffer pool
+ * from a buffer pool client. A buffer pool synchronizes FMQ messages when
+ * there is an aidl request from the clients. Every client has its own
+ * connection and FMQ to communicate with the buffer pool. So sending an
+ * FMQ message on behalf of other clients is not possible.
+ *
+ * FMQ messages are sent when a buffer is acquired or released. Also, FMQ
+ * messages are sent when a buffer is transferred from a client to another
+ * client. FMQ has its own ID from a buffer pool. A client is specified
+ * with the ID.
+ *
+ * To transfer a buffer, a sender must send an FMQ message. The message
+ * must include a receiver's ID and a transaction ID. A receiver must send
+ * the transaction ID to fetch a buffer from a buffer pool. Since the
+ * sender already registered the receiver via an FMQ message, The buffer
+ * pool must verify the receiver with the transaction ID. In order to
+ * prevent faking a receiver, a connection to a buffer pool from client is
+ * made and kept private. Also part of transaction ID is a sender ID in
+ * order to prevent fake transactions from other clients. This must be
+ * verified with an FMQ message from a buffer pool.
+ *
+ * @param observer The buffer pool event observer from the client.
+ * Observer is provided to ensure FMQ messages are processed even when
+ * client processes are idle. Buffer invalidation caused by
+ * reconfiguration does not call observer. Buffer invalidation caused
+ * by termination of pipeline call observer in order to ensure
+ * invalidation is done after pipeline completion.
+ * @return ConnectionInfo The information regarding the established
+ * connection
+ * @@throws ServiceSpecificException with one of the following values:
+ * ResultStatus::NO_MEMORY - Memory allocation failure occurred.
+ * ResultStatus::ALREADY_EXISTS - A connection was already made.
+ * ResultStatus::CRITICAL_ERROR - Other errors.
+ */
+ ConnectionInfo connect(in IObserver observer);
+}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl
new file mode 100644
index 0000000..bf36e25
--- /dev/null
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.media.bufferpool2;
+
+import android.hardware.media.bufferpool2.IAccessor;
+
+/**
+ * IClientManager manages IConnection(s) inside a process. A locally
+ * created IConnection represents a communication node(receiver) with the
+ * specified buffer pool(IAccessor).
+ * IConnection(s) are not exposed to other processes(IClientManager).
+ * IClientManager instance must be unique within a process.
+ */
+@VintfStability
+interface IClientManager {
+ /**
+ * Sets up a buffer receiving communication node for the specified
+ * buffer pool. A manager must create a IConnection to the buffer
+ * pool if it does not already have a connection.
+ *
+ * @param bufferPool a buffer pool which is specified with the IAccessor.
+ * The specified buffer pool is the owner of received buffers.
+ * @return the Id of the communication node to the buffer pool.
+ * This id is used in FMQ to notify IAccessor that a buffer has been
+ * sent to that connection during transfers.
+ * @throws ServiceSpecificException with one of the following values:
+ * ResultStatus::NO_MEMORY - Memory allocation failure occurred.
+ * ResultStatus::ALREADY_EXISTS - A sender was registered already.
+ * ResultStatus::CRITICAL_ERROR - Other errors.
+ */
+ long registerSender(in IAccessor bufferPool);
+}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl
new file mode 100644
index 0000000..d869f47
--- /dev/null
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2022 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.media.bufferpool2;
+
+import android.hardware.media.bufferpool2.Buffer;
+import android.hardware.media.bufferpool2.ResultStatus;
+
+/**
+ * A connection to a buffer pool which handles requests from a buffer pool
+ * client. The connection must be made in order to receive buffers from
+ * other buffer pool clients.
+ */
+@VintfStability
+interface IConnection {
+
+ parcelable FetchInfo {
+ /**
+ * Unique transaction id for buffer transferring.
+ */
+ long transactionId;
+ /**
+ * Id of the buffer to be fetched.
+ */
+ int bufferId;
+ }
+
+ union FetchResult {
+ /**
+ * The fetched buffer on successful fetch.
+ */
+ Buffer buffer;
+ /**
+ * The reason of the request failure. Possible values are below.
+ *
+ * ResultStatus::NOT_FOUND - A buffer was not found due to invalidation.
+ * ResultStatus::CRITICAL_ERROR - Other errors.
+ */
+ ResultStatus failure;
+ }
+
+ /**
+ * Retrieves buffers using an array of FetchInfo.
+ * Each element of FetchInfo array contains a bufferId and a transactionId
+ * for each buffer to fetch. The method must be called from receiving side of buffers
+ * during transferring only when the specified buffer is neither cached nor used.
+ *
+ * The method could have partial failures, in the case other successfully fetched buffers
+ * will be in returned result along with the failures. The order of the returned result
+ * will be the same with the fetchInfos.
+ *
+ * @param fetchInfos information of buffers to fetch
+ * @return Requested buffers.
+ * If there are failures, reasons of failures are also included.
+ * @throws ServiceSpecificException with one of the following values:
+ * ResultStatus::NO_MEMORY - Memory allocation failure occurred.
+ * ResultStatus::CRITICAL_ERROR - Other errors.
+ */
+ FetchResult[] fetch(in FetchInfo[] fetchInfos);
+}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IObserver.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IObserver.aidl
new file mode 100644
index 0000000..07d1c3e
--- /dev/null
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IObserver.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 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.media.bufferpool2;
+
+/**
+ * IObserver listens on notifications from the buffer pool. On receiving
+ * notifications, FMQ messages from the specific buffer pool which are already
+ * in the FMQ are processed.
+ */
+@VintfStability
+interface IObserver {
+ /**
+ * The specific buffer pool sent a message to the client. Calling this
+ * method from the buffer pool enforces a buffer pool client process the
+ * message.
+ *
+ * @param connectionId the connection Id of the specific buffer pool client
+ * @param msgId Id of the most recent message
+ */
+ oneway void onMessage(in long connectionId, in int msgId);
+}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl
new file mode 100644
index 0000000..162f9a7
--- /dev/null
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 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.media.bufferpool2;
+
+@VintfStability
+parcelable ResultStatus {
+ const int OK = 0;
+ const int NO_MEMORY = 1;
+ const int ALREADY_EXISTS = 2;
+ const int NOT_FOUND = 3;
+ const int CRITICAL_ERROR = 4;
+
+ int resultStatus;
+}
diff --git a/neuralnetworks/aidl/Android.bp b/neuralnetworks/aidl/Android.bp
index db1188d..be86879 100644
--- a/neuralnetworks/aidl/Android.bp
+++ b/neuralnetworks/aidl/Android.bp
@@ -17,7 +17,7 @@
stability: "vintf",
imports: [
"android.hardware.common-V2",
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
],
backend: {
java: {
@@ -40,28 +40,28 @@
version: "1",
imports: [
"android.hardware.common-V2",
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
],
},
{
version: "2",
imports: [
"android.hardware.common-V2",
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
],
},
{
version: "3",
imports: [
"android.hardware.common-V2",
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
],
},
{
version: "4",
imports: [
"android.hardware.common-V2",
- "android.hardware.graphics.common-V3",
+ "android.hardware.graphics.common-V4",
],
},
diff --git a/neuralnetworks/aidl/utils/Android.bp b/neuralnetworks/aidl/utils/Android.bp
index 3258092..f0b458a 100644
--- a/neuralnetworks/aidl/utils/Android.bp
+++ b/neuralnetworks/aidl/utils/Android.bp
@@ -25,7 +25,10 @@
cc_defaults {
name: "neuralnetworks_utils_hal_aidl_defaults",
- defaults: ["neuralnetworks_utils_defaults"],
+ defaults: [
+ "android.hardware.graphics.common-ndk_static",
+ "neuralnetworks_utils_defaults",
+ ],
srcs: [
// AIDL utils that a driver may depend on.
"src/BufferTracker.cpp",
@@ -38,7 +41,6 @@
export_include_dirs: ["include"],
cflags: ["-Wthread-safety"],
static_libs: [
- "android.hardware.graphics.common-V3-ndk",
"libaidlcommonsupport",
"libarect",
"neuralnetworks_types",
@@ -90,9 +92,9 @@
// AIDL features can include this cc_defaults to avoid managing dependency versions explicitly.
cc_defaults {
name: "neuralnetworks_use_latest_utils_hal_aidl",
+ defaults: ["android.hardware.graphics.common-ndk_static"],
static_libs: [
"android.hardware.common-V2-ndk",
- "android.hardware.graphics.common-V3-ndk",
"android.hardware.neuralnetworks-V4-ndk",
"neuralnetworks_utils_hal_aidl",
],
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl
index 1d3ecb7..928668c 100644
--- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl
@@ -39,4 +39,5 @@
oneway void pause();
oneway void resume();
oneway void close();
+ oneway void sendHint(android.hardware.power.SessionHint hint);
}
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl
new file mode 100644
index 0000000..9c1f381
--- /dev/null
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.power;
+@Backing(type="int") @VintfStability
+enum SessionHint {
+ CPU_LOAD_UP = 0,
+ CPU_LOAD_DOWN = 1,
+ CPU_LOAD_RESET = 2,
+ CPU_LOAD_RESUME = 3,
+ POWER_EFFICIENCY = 4,
+}
diff --git a/power/aidl/android/hardware/power/IPowerHintSession.aidl b/power/aidl/android/hardware/power/IPowerHintSession.aidl
index c289448..4ca9c54 100644
--- a/power/aidl/android/hardware/power/IPowerHintSession.aidl
+++ b/power/aidl/android/hardware/power/IPowerHintSession.aidl
@@ -16,6 +16,7 @@
package android.hardware.power;
+import android.hardware.power.SessionHint;
import android.hardware.power.WorkDuration;
@VintfStability
@@ -56,4 +57,12 @@
* Close the session to release resources.
*/
void close();
+
+ /**
+ * Gives information to the PowerHintSession about upcoming or unexpected
+ * changes in load to supplement the normal updateTarget/reportActual cycle.
+ *
+ * @param hint The hint to provide to the PowerHintSession
+ */
+ void sendHint(SessionHint hint);
}
diff --git a/power/aidl/android/hardware/power/SessionHint.aidl b/power/aidl/android/hardware/power/SessionHint.aidl
new file mode 100644
index 0000000..a172e12
--- /dev/null
+++ b/power/aidl/android/hardware/power/SessionHint.aidl
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2022 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.power;
+
+@VintfStability
+@Backing(type="int")
+enum SessionHint {
+ /**
+ * This hint indicates an increase in CPU workload intensity. It means that
+ * this hint session needs extra CPU resources to meet the target duration.
+ * This hint must be sent before reporting the actual duration to the session.
+ */
+ CPU_LOAD_UP = 0,
+
+ /**
+ * This hint indicates a decrease in CPU workload intensity. It means that
+ * this hint session can reduce CPU resources and still meet the target duration.
+ */
+ CPU_LOAD_DOWN = 1,
+
+ /**
+ * This hint indicates an upcoming CPU workload that is completely changed and
+ * unknown. It means that the hint session should reset CPU resources to a known
+ * baseline to prepare for an arbitrary load, and must wake up if inactive.
+ */
+ CPU_LOAD_RESET = 2,
+
+ /**
+ * This hint indicates that the most recent CPU workload is resuming after a
+ * period of inactivity. It means that the hint session should allocate similar
+ * CPU resources to what was used previously, and must wake up if inactive.
+ */
+ CPU_LOAD_RESUME = 3,
+
+ /**
+ * This hint indicates that this power hint session should be applied with a
+ * power-efficient-first scheduling strategy. This means the work of this
+ * power hint session is noncritical despite its CPU intensity.
+ */
+ POWER_EFFICIENCY = 4,
+}
diff --git a/power/aidl/default/Android.bp b/power/aidl/default/Android.bp
index b321394..da91ee6 100644
--- a/power/aidl/default/Android.bp
+++ b/power/aidl/default/Android.bp
@@ -30,7 +30,7 @@
shared_libs: [
"libbase",
"libbinder_ndk",
- "android.hardware.power-V3-ndk",
+ "android.hardware.power-V4-ndk",
],
srcs: [
"main.cpp",
diff --git a/power/aidl/default/PowerHintSession.cpp b/power/aidl/default/PowerHintSession.cpp
index 17fd26a..aa95be4 100644
--- a/power/aidl/default/PowerHintSession.cpp
+++ b/power/aidl/default/PowerHintSession.cpp
@@ -47,4 +47,8 @@
return ScopedAStatus::ok();
}
+ScopedAStatus PowerHintSession::sendHint(SessionHint /* hint */) {
+ return ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::power::impl::example
diff --git a/power/aidl/default/PowerHintSession.h b/power/aidl/default/PowerHintSession.h
index b7bf54c..6a7627a 100644
--- a/power/aidl/default/PowerHintSession.h
+++ b/power/aidl/default/PowerHintSession.h
@@ -17,6 +17,7 @@
#pragma once
#include <aidl/android/hardware/power/BnPowerHintSession.h>
+#include <aidl/android/hardware/power/SessionHint.h>
#include <aidl/android/hardware/power/WorkDuration.h>
namespace aidl::android::hardware::power::impl::example {
@@ -30,6 +31,7 @@
ndk::ScopedAStatus pause() override;
ndk::ScopedAStatus resume() override;
ndk::ScopedAStatus close() override;
+ ndk::ScopedAStatus sendHint(SessionHint hint) override;
};
} // namespace aidl::android::hardware::power::impl::example
diff --git a/power/aidl/default/power-default.xml b/power/aidl/default/power-default.xml
index 927ba22..f5dd6b9 100644
--- a/power/aidl/default/power-default.xml
+++ b/power/aidl/default/power-default.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.power</name>
- <version>3</version>
+ <version>4</version>
<fqname>IPower/default</fqname>
</hal>
</manifest>
diff --git a/power/aidl/vts/Android.bp b/power/aidl/vts/Android.bp
index 4e8f517..56c98bd 100644
--- a/power/aidl/vts/Android.bp
+++ b/power/aidl/vts/Android.bp
@@ -32,7 +32,7 @@
"libbinder_ndk",
],
static_libs: [
- "android.hardware.power-V3-ndk",
+ "android.hardware.power-V4-ndk",
],
test_suites: [
"general-tests",
diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp
index b81dd8f..e51f756 100644
--- a/power/aidl/vts/VtsHalPowerTargetTest.cpp
+++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp
@@ -34,12 +34,16 @@
using android::hardware::power::IPower;
using android::hardware::power::IPowerHintSession;
using android::hardware::power::Mode;
+using android::hardware::power::SessionHint;
using android::hardware::power::WorkDuration;
const std::vector<Boost> kBoosts{ndk::enum_range<Boost>().begin(), ndk::enum_range<Boost>().end()};
const std::vector<Mode> kModes{ndk::enum_range<Mode>().begin(), ndk::enum_range<Mode>().end()};
+const std::vector<SessionHint> kSessionHints{ndk::enum_range<SessionHint>().begin(),
+ ndk::enum_range<SessionHint>().end()};
+
const std::vector<Boost> kInvalidBoosts = {
static_cast<Boost>(static_cast<int32_t>(kBoosts.front()) - 1),
static_cast<Boost>(static_cast<int32_t>(kBoosts.back()) + 1),
@@ -50,6 +54,11 @@
static_cast<Mode>(static_cast<int32_t>(kModes.back()) + 1),
};
+const std::vector<SessionHint> kInvalidSessionHints = {
+ static_cast<SessionHint>(static_cast<int32_t>(kSessionHints.front()) - 1),
+ static_cast<SessionHint>(static_cast<int32_t>(kSessionHints.back()) + 1),
+};
+
class DurationWrapper : public WorkDuration {
public:
DurationWrapper(int64_t dur, int64_t time) {
@@ -218,6 +227,21 @@
ASSERT_TRUE(session->reportActualWorkDuration(kDurations).isOk());
}
+TEST_P(PowerAidl, sendSessionHint) {
+ std::shared_ptr<IPowerHintSession> session;
+ auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &session);
+ if (!status.isOk()) {
+ EXPECT_TRUE(isUnknownOrUnsupported(status));
+ return;
+ }
+ for (const auto& sessionHint : kSessionHints) {
+ ASSERT_TRUE(session->sendHint(sessionHint).isOk());
+ }
+ for (const auto& sessionHint : kInvalidSessionHints) {
+ ASSERT_TRUE(session->sendHint(sessionHint).isOk());
+ }
+}
+
// FIXED_PERFORMANCE mode is required for all devices which ship on Android 11
// or later
TEST_P(PowerAidl, hasFixedPerformance) {
diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp
index 98eafc1..8911aea 100644
--- a/radio/aidl/Android.bp
+++ b/radio/aidl/Android.bp
@@ -15,7 +15,7 @@
stability: "vintf",
backend: {
cpp: {
- enabled: false,
+ enabled: true,
},
java: {
sdk_version: "module_current",
@@ -36,10 +36,10 @@
host_supported: true,
srcs: ["android/hardware/radio/config/*.aidl"],
stability: "vintf",
- imports: ["android.hardware.radio"],
+ imports: ["android.hardware.radio-V1"],
backend: {
cpp: {
- enabled: false,
+ enabled: true,
},
java: {
sdk_version: "module_current",
@@ -60,10 +60,10 @@
host_supported: true,
srcs: ["android/hardware/radio/data/*.aidl"],
stability: "vintf",
- imports: ["android.hardware.radio"],
+ imports: ["android.hardware.radio-V1"],
backend: {
cpp: {
- enabled: false,
+ enabled: true,
},
java: {
sdk_version: "module_current",
@@ -84,10 +84,10 @@
host_supported: true,
srcs: ["android/hardware/radio/messaging/*.aidl"],
stability: "vintf",
- imports: ["android.hardware.radio"],
+ imports: ["android.hardware.radio-V1"],
backend: {
cpp: {
- enabled: false,
+ enabled: true,
},
java: {
sdk_version: "module_current",
@@ -108,10 +108,10 @@
host_supported: true,
srcs: ["android/hardware/radio/modem/*.aidl"],
stability: "vintf",
- imports: ["android.hardware.radio"],
+ imports: ["android.hardware.radio-V1"],
backend: {
cpp: {
- enabled: false,
+ enabled: true,
},
java: {
sdk_version: "module_current",
@@ -132,10 +132,10 @@
host_supported: true,
srcs: ["android/hardware/radio/network/*.aidl"],
stability: "vintf",
- imports: ["android.hardware.radio"],
+ imports: ["android.hardware.radio-V1"],
backend: {
cpp: {
- enabled: false,
+ enabled: true,
},
java: {
sdk_version: "module_current",
@@ -157,12 +157,12 @@
srcs: ["android/hardware/radio/sim/*.aidl"],
stability: "vintf",
imports: [
- "android.hardware.radio",
+ "android.hardware.radio-V1",
"android.hardware.radio.config",
],
backend: {
cpp: {
- enabled: false,
+ enabled: true,
},
java: {
sdk_version: "module_current",
@@ -186,10 +186,10 @@
host_supported: true,
srcs: ["android/hardware/radio/voice/*.aidl"],
stability: "vintf",
- imports: ["android.hardware.radio"],
+ imports: ["android.hardware.radio-V1"],
backend: {
cpp: {
- enabled: false,
+ enabled: true,
},
java: {
sdk_version: "module_current",
@@ -203,3 +203,37 @@
],
}
+
+aidl_interface {
+ name: "android.hardware.radio.ims.media",
+ vendor_available: true,
+ srcs: ["android/hardware/radio/ims/media/*.aidl"],
+ stability: "vintf",
+ imports: ["android.hardware.radio-V1",
+ "android.hardware.radio.data-V1"],
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ sdk_version: "module_current",
+ },
+ },
+}
+
+aidl_interface {
+ name: "android.hardware.radio.ims",
+ vendor_available: true,
+ srcs: ["android/hardware/radio/ims/*.aidl"],
+ stability: "vintf",
+ imports: ["android.hardware.radio-V1"],
+ backend: {
+ cpp: {
+ enabled: false,
+ },
+ java: {
+ sdk_version: "module_current",
+ },
+ },
+}
+
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
new file mode 100644
index 0000000..5179169
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum AmrMode {
+ AMR_MODE_0 = 1 << 0,
+ AMR_MODE_1 = 1 << 1,
+ AMR_MODE_2 = 1 << 2,
+ AMR_MODE_3 = 1 << 3,
+ AMR_MODE_4 = 1 << 4,
+ AMR_MODE_5 = 1 << 5,
+ AMR_MODE_6 = 1 << 6,
+ AMR_MODE_7 = 1 << 7,
+ AMR_MODE_8 = 1 << 8,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl
new file mode 100644
index 0000000..36edb7f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable AmrParams {
+ android.hardware.radio.ims.media.AmrMode amrMode;
+ boolean octetAligned;
+ int maxRedundancyMillis;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
new file mode 100644
index 0000000..711ac19
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable AnbrBitrate {
+ int uplinkBps;
+ int downlinkBps;
+ const int INVALID_ANBR_BITRATE = -1;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl
new file mode 100644
index 0000000..fff6e1c
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable CallQuality {
+ int downlinkCallQualityLevel;
+ int uplinkCallQualityLevel;
+ int callDuration;
+ int numRtpPacketsTransmitted;
+ int numRtpPacketsReceived;
+ int numRtpPacketsTransmittedLost;
+ int numRtpPacketsNotReceived;
+ int averageRelativeJitter;
+ int maxRelativeJitter;
+ int averageRoundTripTime;
+ int codecType;
+ boolean rtpInactivityDetected;
+ boolean rxSilenceDetected;
+ boolean txSilenceDetected;
+ int numVoiceFrames;
+ int numNoDataFrames;
+ int numDroppedRtpPackets;
+ long minPlayoutDelayMillis;
+ long maxPlayoutDelayMillis;
+ int numRtpSidPacketsReceived;
+ int numRtpDuplicatePackets;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl
new file mode 100644
index 0000000..3da2dbd
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable CodecParams {
+ android.hardware.radio.ims.media.CodecType codecType;
+ byte rxPayloadTypeNumber;
+ byte txPayloadTypeNumber;
+ byte samplingRateKHz;
+ boolean dtxEnabled;
+ android.hardware.radio.ims.media.CodecSpecificParams codecSpecificParams;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl
new file mode 100644
index 0000000..08e3f0f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+union CodecSpecificParams {
+ android.hardware.radio.ims.media.AmrParams amr;
+ android.hardware.radio.ims.media.EvsParams evs;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
new file mode 100644
index 0000000..56d2800
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum CodecType {
+ AMR = 1,
+ AMR_WB = 2,
+ EVS = 4,
+ PCMA = 8,
+ PCMU = 16,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl
new file mode 100644
index 0000000..5523fd8
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable DtmfParams {
+ byte rxPayloadTypeNumber;
+ byte txPayloadTypeNumber;
+ byte samplingRateKHz;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
new file mode 100644
index 0000000..eb31175
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum EvsBandwidth {
+ NONE = 0,
+ NARROW_BAND = 1,
+ WIDE_BAND = 2,
+ SUPER_WIDE_BAND = 4,
+ FULL_BAND = 8,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
new file mode 100644
index 0000000..a067357
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum EvsMode {
+ EVS_MODE_0 = 1 << 0,
+ EVS_MODE_1 = 1 << 1,
+ EVS_MODE_2 = 1 << 2,
+ EVS_MODE_3 = 1 << 3,
+ EVS_MODE_4 = 1 << 4,
+ EVS_MODE_5 = 1 << 5,
+ EVS_MODE_6 = 1 << 6,
+ EVS_MODE_7 = 1 << 7,
+ EVS_MODE_8 = 1 << 8,
+ EVS_MODE_9 = 1 << 9,
+ EVS_MODE_10 = 1 << 10,
+ EVS_MODE_11 = 1 << 11,
+ EVS_MODE_12 = 1 << 12,
+ EVS_MODE_13 = 1 << 13,
+ EVS_MODE_14 = 1 << 14,
+ EVS_MODE_15 = 1 << 15,
+ EVS_MODE_16 = 1 << 16,
+ EVS_MODE_17 = 1 << 17,
+ EVS_MODE_18 = 1 << 18,
+ EVS_MODE_19 = 1 << 19,
+ EVS_MODE_20 = 1 << 20,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl
new file mode 100644
index 0000000..735eb08
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable EvsParams {
+ android.hardware.radio.ims.media.EvsBandwidth bandwidth;
+ android.hardware.radio.ims.media.EvsMode evsMode;
+ byte channelAwareMode;
+ boolean useHeaderFullOnly;
+ boolean useEvsModeSwitch;
+ byte codecModeRequest;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl
new file mode 100644
index 0000000..30793e5
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+interface IImsMedia {
+ oneway void setListener(in android.hardware.radio.ims.media.IImsMediaListener mediaListener);
+ oneway void openSession(int sessionId, in android.hardware.radio.ims.media.LocalEndPoint localEndPoint, in android.hardware.radio.ims.media.RtpConfig config);
+ oneway void closeSession(int sessionId);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl
new file mode 100644
index 0000000..40f7107
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+interface IImsMediaListener {
+ oneway void onOpenSessionSuccess(int sessionId, android.hardware.radio.ims.media.IImsMediaSession session);
+ oneway void onOpenSessionFailure(int sessionId, android.hardware.radio.ims.media.RtpError error);
+ oneway void onSessionClosed(int sessionId);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl
new file mode 100644
index 0000000..ea9f3a4
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+interface IImsMediaSession {
+ oneway void setListener(in android.hardware.radio.ims.media.IImsMediaSessionListener sessionListener);
+ oneway void modifySession(in android.hardware.radio.ims.media.RtpConfig config);
+ oneway void sendDtmf(char dtmfDigit, int duration);
+ oneway void startDtmf(char dtmfDigit);
+ oneway void stopDtmf();
+ oneway void sendHeaderExtension(in List<android.hardware.radio.ims.media.RtpHeaderExtension> extensions);
+ oneway void setMediaQualityThreshold(in android.hardware.radio.ims.media.MediaQualityThreshold threshold);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl
new file mode 100644
index 0000000..f03b29e
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+interface IImsMediaSessionListener {
+ oneway void onModifySessionResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error);
+ oneway void onFirstMediaPacketReceived(in android.hardware.radio.ims.media.RtpConfig config);
+ oneway void onHeaderExtensionReceived(in List<android.hardware.radio.ims.media.RtpHeaderExtension> extensions);
+ oneway void notifyMediaInactivity(android.hardware.radio.ims.media.MediaProtocolType packetType);
+ oneway void notifyPacketLoss(int packetLossPercentage);
+ oneway void notifyJitter(int jitter);
+ oneway void triggerAnbrQuery(in android.hardware.radio.ims.media.RtpConfig config);
+ oneway void onDtmfReceived(char dtmfDigit);
+ oneway void onCallQualityChanged(in android.hardware.radio.ims.media.CallQuality callQuality);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl
new file mode 100644
index 0000000..6ec5156
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable LocalEndPoint {
+ ParcelFileDescriptor rtpFd;
+ ParcelFileDescriptor rtcpFd;
+ int modemId;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
new file mode 100644
index 0000000..d90b2a4
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum MediaDirection {
+ NO_FLOW = 0,
+ SEND_ONLY = 1,
+ RECEIVE_ONLY = 2,
+ SEND_RECEIVE = 3,
+ INACTIVE = 4,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl
new file mode 100644
index 0000000..1a290d4
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum MediaProtocolType {
+ RTP = 0,
+ RTCP = 1,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl
new file mode 100644
index 0000000..a448bac
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable MediaQualityThreshold {
+ int rtpInactivityTimerMillis;
+ int rtcpInactivityTimerMillis;
+ int rtpPacketLossDurationMillis;
+ int rtpPacketLossRate;
+ int jitterDurationMillis;
+ int rtpJitterMillis;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl
new file mode 100644
index 0000000..6a76d85
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable RtcpConfig {
+ String canonicalName;
+ int transmitPort;
+ int transmitIntervalSec;
+ int rtcpXrBlocks;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
new file mode 100644
index 0000000..2eefe6f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum RtcpXrReportBlockType {
+ RTCPXR_NONE = 0,
+ RTCPXR_LOSS_RLE_REPORT_BLOCK = 1,
+ RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = 2,
+ RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = 4,
+ RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = 8,
+ RTCPXR_DLRR_REPORT_BLOCK = 16,
+ RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = 32,
+ RTCPXR_VOIP_METRICS_REPORT_BLOCK = 64,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl
new file mode 100644
index 0000000..35357d1
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable RtpAddress {
+ String ipAddress;
+ int portNumber;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
new file mode 100644
index 0000000..ad8b86c
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable RtpConfig {
+ android.hardware.radio.ims.media.MediaDirection direction;
+ android.hardware.radio.AccessNetwork accessNetwork;
+ android.hardware.radio.ims.media.RtpAddress remoteAddress;
+ android.hardware.radio.ims.media.RtpSessionParams sessionParams;
+ android.hardware.radio.ims.media.RtcpConfig rtcpConfig;
+ android.hardware.radio.ims.media.AnbrBitrate anbrBitrateParams;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl
new file mode 100644
index 0000000..41b0aeb
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@Backing(type="int") @VintfStability
+enum RtpError {
+ NONE = 0,
+ INVALID_PARAM = 1,
+ NOT_READY = 2,
+ NO_MEMORY = 3,
+ NO_RESOURCES = 4,
+ PORT_UNAVAILABLE = 5,
+ NOT_SUPPORTED = 6,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl
new file mode 100644
index 0000000..83b8a31
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable RtpHeaderExtension {
+ int localId;
+ byte[] data;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl
new file mode 100644
index 0000000..13a7487
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims.media;
+@VintfStability
+parcelable RtpSessionParams {
+ byte pTimeMillis;
+ int maxPtimeMillis;
+ byte dscp;
+ android.hardware.radio.ims.media.DtmfParams dtmfParams;
+ android.hardware.radio.ims.media.CodecParams codecParams;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl
new file mode 100644
index 0000000..030479f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@JavaDerive(toString=true) @VintfStability
+parcelable ConnectionFailureInfo {
+ android.hardware.radio.ims.ConnectionFailureInfo.ConnectionFailureReason failureReason;
+ int causeCode;
+ int waitTimeMillis;
+ @Backing(type="int") @VintfStability
+ enum ConnectionFailureReason {
+ REASON_ACCESS_DENIED = 1,
+ REASON_NAS_FAILURE = 2,
+ REASON_RACH_FAILURE = 3,
+ REASON_RLC_FAILURE = 4,
+ REASON_RRC_REJECT = 5,
+ REASON_RRC_TIMEOUT = 6,
+ REASON_NO_SERVICE = 7,
+ REASON_PDN_NOT_AVAILABLE = 8,
+ REASON_RF_BUSY = 9,
+ REASON_UNSPECIFIED = 65535,
+ }
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl
new file mode 100644
index 0000000..ebea903
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum EpsFallbackReason {
+ NO_NETWORK_TRIGGER = 1,
+ NO_NETWORK_RESPONSE = 2,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl
new file mode 100644
index 0000000..4df8709
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@VintfStability
+interface IRadioIms {
+ oneway void setSrvccCallInfo(int serial, in android.hardware.radio.ims.SrvccCall[] srvccCalls);
+ oneway void updateImsRegistrationInfo(int serial, in android.hardware.radio.ims.ImsRegistration imsRegistration);
+ oneway void startImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType, android.hardware.radio.ims.ImsCall.Direction trafficDirection);
+ oneway void stopImsTraffic(int serial, int token);
+ oneway void triggerEpsFallback(int serial, in android.hardware.radio.ims.EpsFallbackReason reason);
+ oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication);
+ oneway void sendAnbrQuery(int serial, android.hardware.radio.ims.ImsStreamType mediaType, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond);
+ oneway void updateImsCallStatus(int serial, in android.hardware.radio.ims.ImsCall[] imsCalls);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl
new file mode 100644
index 0000000..ef6b4cc
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@VintfStability
+interface IRadioImsIndication {
+ oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, int token, in android.hardware.radio.ims.ConnectionFailureInfo info);
+ oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsStreamType mediaType, in android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond);
+ oneway void triggerImsDeregistration(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsDeregistrationReason reason);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl
new file mode 100644
index 0000000..053ba46
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@VintfStability
+interface IRadioImsResponse {
+ oneway void setSrvccCallInfoResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void updateImsRegistrationInfoResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void startImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info, in @nullable android.hardware.radio.ims.ConnectionFailureInfo failureInfo);
+ oneway void stopImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void triggerEpsFallbackResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void updateImsCallStatusResponse(in android.hardware.radio.RadioResponseInfo info);
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl
new file mode 100644
index 0000000..e48653b
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@JavaDerive(toString=true) @VintfStability
+parcelable ImsCall {
+ int index;
+ android.hardware.radio.ims.ImsCall.CallType callType;
+ android.hardware.radio.AccessNetwork accessNetwork;
+ android.hardware.radio.ims.ImsCall.CallState callState;
+ android.hardware.radio.ims.ImsCall.Direction direction;
+ boolean isHeldByRemote;
+ @Backing(type="int")
+ enum CallType {
+ NORMAL = 0,
+ EMERGENCY = 1,
+ }
+ @Backing(type="int")
+ enum CallState {
+ ACTIVE = 0,
+ HOLDING = 1,
+ DIALING = 2,
+ ALERTING = 3,
+ INCOMING = 4,
+ WAITING = 5,
+ DISCONNECTING = 6,
+ DISCONNECTED = 7,
+ }
+ @Backing(type="int")
+ enum Direction {
+ INCOMING = 0,
+ OUTGOING = 1,
+ }
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl
new file mode 100644
index 0000000..b04e559
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum ImsDeregistrationReason {
+ REASON_SIM_REMOVED = 1,
+ REASON_SIM_REFRESH = 2,
+ REASON_ALLOWED_NETWORK_TYPES_CHANGED = 3,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl
new file mode 100644
index 0000000..1c4c12a
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@JavaDerive(toString=true) @VintfStability
+parcelable ImsRegistration {
+ android.hardware.radio.ims.ImsRegistrationState regState;
+ android.hardware.radio.AccessNetwork accessNetworkType;
+ android.hardware.radio.ims.SuggestedAction suggestedAction;
+ int capabilities;
+ const int IMS_MMTEL_CAPABILITY_NONE = 0;
+ const int IMS_MMTEL_CAPABILITY_VOICE = 1;
+ const int IMS_MMTEL_CAPABILITY_VIDEO = 2;
+ const int IMS_MMTEL_CAPABILITY_SMS = 4;
+ const int IMS_RCS_CAPABILITIES = 8;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl
new file mode 100644
index 0000000..664f561
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum ImsRegistrationState {
+ NOT_REGISTERED = 0,
+ REGISTERED = 1,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl
new file mode 100644
index 0000000..cf2e4f1
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum ImsStreamDirection {
+ UPLINK = 1,
+ DOWNLINK = 2,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl
new file mode 100644
index 0000000..10c477f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @VintfStability
+enum ImsStreamType {
+ AUDIO = 1,
+ VIDEO = 2,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl
new file mode 100644
index 0000000..f7654b4
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum ImsTrafficType {
+ EMERGENCY = 0,
+ EMERGENCY_SMS = 1,
+ VOICE = 2,
+ VIDEO = 3,
+ SMS = 4,
+ REGISTRATION = 5,
+ UT_XCAP = 6,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl
new file mode 100644
index 0000000..a8b7cfc
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@JavaDerive(toString=true) @VintfStability
+parcelable SrvccCall {
+ int index;
+ android.hardware.radio.ims.SrvccCall.CallType callType;
+ int callState;
+ android.hardware.radio.ims.SrvccCall.CallSubState callSubstate;
+ android.hardware.radio.ims.SrvccCall.ToneType ringbackToneType;
+ boolean isMpty;
+ boolean isMT;
+ String number;
+ int numPresentation;
+ String name;
+ int namePresentation;
+ @Backing(type="int") @VintfStability
+ enum CallType {
+ NORMAL = 0,
+ EMERGENCY = 1,
+ }
+ @Backing(type="int") @VintfStability
+ enum CallSubState {
+ NONE = 0,
+ PREALERTING = 1,
+ }
+ @Backing(type="int") @VintfStability
+ enum ToneType {
+ NONE = 0,
+ LOCAL = 1,
+ NETWORK = 2,
+ }
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl
new file mode 100644
index 0000000..da19774
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.ims;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum SuggestedAction {
+ NONE = 0,
+ TRIGGER_PLMN_BLOCK = 1,
+ TRIGGER_PLMN_BLOCK_WITH_TIMEOUT = 2,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl
new file mode 100644
index 0000000..071e6b5
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.network;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum EmergencyMode {
+ EMERGENCY_WWAN = 1,
+ EMERGENCY_WLAN = 2,
+ EMERGENCY_CALLBACK = 3,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl
new file mode 100644
index 0000000..2797aff
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.network;
+@JavaDerive(toString=true) @VintfStability
+parcelable EmergencyNetworkScanTrigger {
+ android.hardware.radio.AccessNetwork[] accessNetwork;
+ android.hardware.radio.network.EmergencyScanType scanType;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl
new file mode 100644
index 0000000..7d99a53
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.network;
+@JavaDerive(toString=true) @VintfStability
+parcelable EmergencyRegResult {
+ android.hardware.radio.AccessNetwork accessNetwork;
+ android.hardware.radio.network.RegState regState;
+ android.hardware.radio.network.Domain emcDomain;
+ boolean isVopsSupported;
+ boolean isEmcBearerSupported;
+ byte nwProvidedEmc;
+ byte nwProvidedEmf;
+ String mcc = "";
+ String mnc = "";
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl
new file mode 100644
index 0000000..5e86c76
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.network;
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum EmergencyScanType {
+ NO_PREFERENCE = 0,
+ LIMITED_SERVICE = 1,
+ FULL_SERVICE = 2,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl
index dfbf881..93df3a4 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl
@@ -36,4 +36,13 @@
parcelable EutranRegistrationInfo {
android.hardware.radio.network.LteVopsInfo lteVopsInfo;
android.hardware.radio.network.NrIndicators nrIndicators;
+ android.hardware.radio.network.EutranRegistrationInfo.AttachResultType lteAttachResultType;
+ int extraInfo;
+ const int EXTRA_CSFB_NOT_PREFERRED = 1;
+ const int EXTRA_SMS_ONLY = 2;
+ enum AttachResultType {
+ NONE = 0,
+ EPS_ONLY = 1,
+ COMBINED = 2,
+ }
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl
index 2b70e45..c115c86 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl
@@ -70,4 +70,8 @@
oneway void supplyNetworkDepersonalization(in int serial, in String netPin);
oneway void setUsageSetting(in int serial, in android.hardware.radio.network.UsageSetting usageSetting);
oneway void getUsageSetting(in int serial);
+ oneway void setEmergencyMode(int serial, in android.hardware.radio.network.EmergencyMode emcModeType);
+ oneway void triggerEmergencyNetworkScan(int serial, in android.hardware.radio.network.EmergencyNetworkScanTrigger request);
+ oneway void cancelEmergencyNetworkScan(int serial, boolean resetScan);
+ oneway void exitEmergencyMode(in int serial);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl
index bd03c51..0f017ea 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl
@@ -48,4 +48,5 @@
oneway void restrictedStateChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.PhoneRestrictedState state);
oneway void suppSvcNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SuppSvcNotification suppSvc);
oneway void voiceRadioTechChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.RadioTechnology rat);
+ oneway void emergencyNetworkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.EmergencyRegResult result);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl
index 5f6c736..24d587e 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl
@@ -69,4 +69,8 @@
oneway void supplyNetworkDepersonalizationResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries);
oneway void setUsageSettingResponse(in android.hardware.radio.RadioResponseInfo info);
oneway void getUsageSettingResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.UsageSetting usageSetting);
+ oneway void setEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.EmergencyRegResult regState);
+ oneway void triggerEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info);
+ oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info);
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl
index e6e7999..711c9ac 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl
@@ -44,4 +44,5 @@
NOT_REG_MT_SEARCHING_OP_EM = 12,
REG_DENIED_EM = 13,
UNKNOWN_EM = 14,
+ REG_EM = 20,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl
index 040932c..744eed7 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl
@@ -48,4 +48,5 @@
const int SIGNAL_MEASUREMENT_TYPE_SSRSRP = 6;
const int SIGNAL_MEASUREMENT_TYPE_SSRSRQ = 7;
const int SIGNAL_MEASUREMENT_TYPE_SSSINR = 8;
+ const int SIGNAL_MEASUREMENT_TYPE_ECNO = 9;
}
diff --git a/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl
new file mode 100644
index 0000000..70faa1e
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+parcelable ConnectionFailureInfo {
+
+ @VintfStability
+ @Backing(type="int")
+ enum ConnectionFailureReason {
+ /** Access class check failed */
+ REASON_ACCESS_DENIED = 1,
+ /** 3GPP Non-access stratum failure */
+ REASON_NAS_FAILURE = 2,
+ /** Random access failure */
+ REASON_RACH_FAILURE = 3,
+ /** Radio link failure */
+ REASON_RLC_FAILURE = 4,
+ /** Radio connection establishment rejected by network */
+ REASON_RRC_REJECT = 5,
+ /** Radio connection establishment timed out */
+ REASON_RRC_TIMEOUT = 6,
+ /** Device currently not in service */
+ REASON_NO_SERVICE = 7,
+ /** The PDN is no more active */
+ REASON_PDN_NOT_AVAILABLE = 8,
+ /** Radio resource is busy with another subscription */
+ REASON_RF_BUSY = 9,
+ REASON_UNSPECIFIED = 0xFFFF,
+ }
+
+ /**
+ * Values are REASON_* constants
+ */
+ ConnectionFailureReason failureReason;
+
+ /**
+ * Failure cause code from network or modem specific to the failure
+ */
+ int causeCode;
+
+ /**
+ * Retry wait time provided by network in milliseconds
+ */
+ int waitTimeMillis;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl b/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl
new file mode 100644
index 0000000..670638b
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum EpsFallbackReason {
+ /**
+ * If VoNR is not supported and EPS fallback is not triggered by network then UE initiated EPS
+ * fallback would be triggered by IMS stack with this reason. The modem shall locally release
+ * the 5G NR SA RRC connection and acquire the LTE network and perform a tracking area update
+ * procedure. After the EPS fallback procedure is completed, the call setup for voice will
+ * be established.
+ */
+ NO_NETWORK_TRIGGER = 1,
+
+ /**
+ * If the UE doesn't receive any response for SIP INVITE within a certain time in 5G NR SA,
+ * UE initiated EPS fallback will be triggered with this reason. The modem shall reset its data
+ * buffer of IMS PDUs to prevent the ghost call. After the EPS fallback procedure is completed,
+ * the VoLTE call will be established.
+ */
+ NO_NETWORK_RESPONSE = 2,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl
new file mode 100644
index 0000000..bd661a7
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+import android.hardware.radio.AccessNetwork;
+import android.hardware.radio.ims.EpsFallbackReason;
+import android.hardware.radio.ims.IRadioImsIndication;
+import android.hardware.radio.ims.IRadioImsResponse;
+import android.hardware.radio.ims.ImsCall;
+import android.hardware.radio.ims.ImsRegistration;
+import android.hardware.radio.ims.ImsStreamDirection;
+import android.hardware.radio.ims.ImsStreamType;
+import android.hardware.radio.ims.ImsTrafficType;
+import android.hardware.radio.ims.SrvccCall;
+
+/**
+ * This interface is used by IMS telephony layer to talk to cellular radio.
+ * All the functions have minimum one parameter:
+ * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the
+ * duration of a method call. If clients provide colliding serials (including passing the same
+ * serial to different methods), multiple responses (one for each method call) must still be served.
+ * setResponseFunctions must work with IRadioImsResponse and IRadioImsIndication.
+ */
+@VintfStability
+oneway interface IRadioIms {
+ /**
+ * Provides a list of SRVCC call information to radio.
+ *
+ * @param serial Serial number of request
+ * @param srvccCalls the list of calls
+ *
+ * Response function is IRadioImsResponse.setSrvccCallInfoResponse()
+ */
+ void setSrvccCallInfo(int serial, in SrvccCall[] srvccCalls);
+
+ /**
+ * Update the IMS registration information to the radio.
+ *
+ * This information shall be used by radio to implement following carrier requirements:
+ * 1) Graceful IMS PDN disconnection on cellular when NAS is about to perform detach
+ * eg. SIM removal or SIM refresh
+ * 2) Block PLMN or RAT based on the IMS registration failure reason
+ *
+ * @param serial Serial number of request
+ * @param imsRegistration IMS registration information
+ *
+ * Response function is IRadioImsResponse.updateImsRegistrationInfoResponse()
+ */
+ void updateImsRegistrationInfo(int serial, in ImsRegistration imsRegistration);
+
+ /**
+ * IMS stack notifies the NAS and RRC layers of the radio that the upcoming IMS traffic is
+ * for the service mentioned in the ImsTrafficType. If this API is not
+ * explicitly invoked and IMS module sends traffic on IMS PDN then the radio
+ * shall treat type as background data traffic type.
+ * This API shall be used by modem
+ * 1. To set the appropriate establishment cause in RRC connection request.
+ * 2. To prioritize RF resources in case of DSDS. The service priority is
+ * EMERGENCY > EMERGENCY SMS > VOICE > VIDEO > SMS > REGISTRATION > Ut/XCAP. The RF
+ * shall be prioritized to the subscription which handles higher priority service.
+ * When both subscriptions are handling the same type of service then RF shall be
+ * prioritized to the voice preferred sub.
+ * 3. To evaluate the overall access barring in the case of ACB, ACB-Skp/SCM and UAC.
+ * The response {@link IRadioImsResponse#startImsTrafficResponse()} with success shall
+ * be sent by modem upon access class is allowed and RF resource is allotted. Otherwise
+ * the same API shall be invoked with appropriate {@link ConnectionFailureInfo}. Further
+ * if RRC connection setup fails then {@link IRadioImsIndication#onConnectionSetupFailure()}
+ * shall be invoked by modem with appropriate {@link ConnectionFailureInfo}.
+ *
+ * @param serial Serial number of request
+ * @param token A nonce to identify the request
+ * @param imsTrafficType IMS traffic type like registration, voice, and video
+ * @param accessNetworkType The type of the radio access network used
+ * @param trafficDirection Indicates whether traffic is originated by mobile originated or
+ * mobile terminated use case eg. MO/MT call/SMS etc
+ *
+ * Response function is IRadioImsResponse.startImsTrafficResponse()
+ */
+ void startImsTraffic(int serial, int token,
+ ImsTrafficType imsTrafficType, AccessNetwork accessNetworkType,
+ ImsCall.Direction trafficDirection);
+
+ /**
+ * Indicates IMS traffic has been stopped.
+ * For all IMS traffic, notified with startImsTraffic, IMS service shall notify
+ * stopImsTraffic when it completes the traffic specified by the token.
+ *
+ * @param serial Serial number of request
+ * @param token The token assigned by startImsTraffic()
+ *
+ * Response function is IRadioImsResponse.stopImsTrafficResponse()
+ */
+ void stopImsTraffic(int serial, int token);
+
+ /**
+ * Triggers the UE initiated EPS fallback when a MO voice call failed to establish on 5G NR
+ * network and network didn't initiate a fallback.
+ *
+ * @param serial Serial number of request
+ * @param reason Specifies the reason that causes EPS fallback
+ *
+ * Response function is IRadioImsResponse.triggerEpsFallbackResponse()
+ */
+ void triggerEpsFallback(int serial, in EpsFallbackReason reason);
+
+ /**
+ * Set response functions for IMS radio requests and indications.
+ *
+ * @param radioImsResponse Object containing response functions
+ * @param radioImsIndication Object containing radio indications
+ */
+ void setResponseFunctions(in IRadioImsResponse radioImsResponse,
+ in IRadioImsIndication radioImsIndication);
+
+ /**
+ * Access Network Bitrate Recommendation Query (ANBRQ), see 3GPP TS 26.114.
+ * This API triggers radio to send ANBRQ message
+ * to the access network to query the desired bitrate.
+ *
+ * @param serial Serial number of request
+ * @param mediaType Media type is used to identify media stream such as audio or video
+ * @param direction Direction of this packet stream (e.g. uplink or downlink)
+ * @param bitsPerSecond The bit rate requested by the opponent UE
+ *
+ * Response function is IRadioImsResponse.sendAnbrQueryResponse()
+ */
+ void sendAnbrQuery(int serial, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond);
+
+ /**
+ * Provides a list of IMS call information to radio.
+ *
+ * @param serial Serial number of request
+ * @param imsCalls The list of IMS calls
+ *
+ * Response function is IRadioImsResponse.updateImsCallStatusResponse()
+ */
+ void updateImsCallStatus(int serial, in ImsCall[] imsCalls);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl
new file mode 100644
index 0000000..d123d07
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+import android.hardware.radio.RadioIndicationType;
+import android.hardware.radio.ims.ConnectionFailureInfo;
+import android.hardware.radio.ims.ImsDeregistrationReason;
+import android.hardware.radio.ims.ImsStreamDirection;
+import android.hardware.radio.ims.ImsStreamType;
+
+/**
+ * Interface declaring unsolicited radio indications for ims APIs.
+ */
+@VintfStability
+oneway interface IRadioImsIndication {
+ /**
+ * Fired by radio when any IMS traffic is not sent to network due to any failure
+ * on cellular networks. IMS service shall call stopImsTraffic when receiving
+ * this indication.
+ *
+ * @param type Type of radio indication
+ * @param token The token of startImsTraffic() associated with this indication
+ * @param info Connection failure information
+ */
+ void onConnectionSetupFailure(
+ in RadioIndicationType type, int token, in ConnectionFailureInfo info);
+
+ /**
+ * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114.
+ * Notifies the bit rate received from the network via ANBR message
+ *
+ * @param type Type of radio indication
+ * @param mediaType Media type is used to identify media stream such as audio or video
+ * @param direction Direction of this packet stream (e.g. uplink or downlink)
+ * @param bitsPerSecond The recommended bit rate for the UE
+ * for a specific logical channel and a specific direction by NW
+ */
+ void notifyAnbr(in RadioIndicationType type, in ImsStreamType mediaType,
+ in ImsStreamDirection direction, int bitsPerSecond);
+
+ /**
+ * Requests IMS stack to perform graceful IMS deregistration before radio performing
+ * network detach in the events of SIM remove, refresh or and so on. The radio waits for
+ * the IMS deregistration, which will be notified by telephony via
+ * {@link IRadioIms#updateImsRegistrationInfo()}, or a certain timeout interval to start
+ * the network detach procedure.
+ *
+ * @param type Type of radio indication
+ * @param reason the reason why the deregistration is triggered
+ */
+ void triggerImsDeregistration(in RadioIndicationType type, in ImsDeregistrationReason reason);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl
new file mode 100644
index 0000000..b5e7680
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+import android.hardware.radio.RadioResponseInfo;
+import android.hardware.radio.ims.ConnectionFailureInfo;
+
+/**
+ * Interface declaring response functions to solicited radio requests for ims APIs.
+ */
+@VintfStability
+oneway interface IRadioImsResponse {
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void setSrvccCallInfoResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void updateImsRegistrationInfoResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param failureInfo Information about failure in detail
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void startImsTrafficResponse(in RadioResponseInfo info,
+ in @nullable ConnectionFailureInfo failureInfo);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void stopImsTrafficResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void triggerEpsFallbackResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void sendAnbrQueryResponse(in RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INVALID_STATE
+ * RadioError:NO_MEMORY
+ * RadioError:SYSTEM_ERR
+ * RadioError:MODEM_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ */
+ void updateImsCallStatusResponse(in RadioResponseInfo info);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/android/hardware/radio/ims/ImsCall.aidl
new file mode 100644
index 0000000..b71682f
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsCall.aidl
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+import android.hardware.radio.AccessNetwork;
+
+@VintfStability
+@JavaDerive(toString=true)
+parcelable ImsCall {
+
+ @Backing(type="int")
+ enum CallType {
+ NORMAL,
+ EMERGENCY,
+ }
+
+ @Backing(type="int")
+ enum CallState {
+ ACTIVE,
+ HOLDING,
+ DIALING, /* Outgoing only */
+ ALERTING, /* Outgoing only */
+ INCOMING, /* Incoming only */
+ WAITING, /* Incoming only */
+ DISCONNECTING,
+ DISCONNECTED,
+ }
+
+ @Backing(type="int")
+ enum Direction {
+ INCOMING,
+ OUTGOING,
+ }
+
+ /** Call index */
+ int index;
+
+ /** The type of the call */
+ CallType callType;
+
+ /** The access network where the call is in progress */
+ AccessNetwork accessNetwork;
+
+ /** The state of the call */
+ CallState callState;
+
+ /** The direction of the call */
+ Direction direction;
+
+ /** True if the call is put on HOLD by the other party */
+ boolean isHeldByRemote;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl
new file mode 100644
index 0000000..eac8db4
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum ImsDeregistrationReason {
+ /**
+ * Radio shall send this reason to IMS stack to perform graceful de-registration
+ * due to SIM card is removed.
+ */
+ REASON_SIM_REMOVED = 1,
+ /**
+ * Radio shall send this reason to IMS stack to perform graceful de-registration
+ * due to SIM refresh that needs a NAS detach and re-attach.
+ */
+ REASON_SIM_REFRESH = 2,
+ /**
+ * Radio shall send this reason to IMS stack to perform graceful de-registration
+ * due to allowed network types bitmask changed that results in NAS detach.
+ */
+ REASON_ALLOWED_NETWORK_TYPES_CHANGED = 3,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl
new file mode 100644
index 0000000..662f9e9
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+import android.hardware.radio.AccessNetwork;
+import android.hardware.radio.ims.ImsRegistrationState;
+import android.hardware.radio.ims.SuggestedAction;
+
+@VintfStability
+@JavaDerive(toString=true)
+parcelable ImsRegistration {
+ /** Default value */
+ const int IMS_MMTEL_CAPABILITY_NONE = 0;
+ /** IMS voice */
+ const int IMS_MMTEL_CAPABILITY_VOICE = 1 << 0;
+ /** IMS video */
+ const int IMS_MMTEL_CAPABILITY_VIDEO = 1 << 1;
+ /** IMS SMS */
+ const int IMS_MMTEL_CAPABILITY_SMS = 1 << 2;
+ /** IMS RCS */
+ const int IMS_RCS_CAPABILITIES = 1 << 3;
+
+ /** Indicates the current IMS registration state. */
+ ImsRegistrationState regState;
+
+ /**
+ * Indicates the type of the radio access network where IMS is registered.
+ */
+ AccessNetwork accessNetworkType;
+
+ /** Indicates the expected action for the radio to do. */
+ SuggestedAction suggestedAction;
+
+ /**
+ * Values are bitwise ORs of IMS_MMTEL_CAPABILITY_* constants and IMS_RCS_CAPABILITIES.
+ * IMS capability such as VOICE, VIDEO, SMS and RCS.
+ */
+ int capabilities;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl
new file mode 100644
index 0000000..fd5c0fa
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum ImsRegistrationState {
+ /** IMS is not registered */
+ NOT_REGISTERED,
+
+ /** IMS is successfully registered */
+ REGISTERED,
+}
\ No newline at end of file
diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl
new file mode 100644
index 0000000..c0cea32
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum ImsStreamDirection {
+ /** DIRECTION_UPLINK - From UE to Network **/
+ UPLINK = 1,
+ /** DIRECTION_DOWNLINK - From Network to UE **/
+ DOWNLINK = 2,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl
new file mode 100644
index 0000000..c12a0c1
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+@VintfStability
+@Backing(type="int")
+enum ImsStreamType {
+ /** Media Stream Type - Audio **/
+ AUDIO = 1,
+ /** Media Stream Type - Video **/
+ VIDEO = 2,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl
new file mode 100644
index 0000000..5a824c0
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum ImsTrafficType {
+ /** Emergency call */
+ EMERGENCY,
+
+ /** Emergency SMS */
+ EMERGENCY_SMS,
+
+ /** Voice call */
+ VOICE,
+
+ /** Video call */
+ VIDEO,
+
+ /** SMS over IMS */
+ SMS,
+
+ /** IMS registration and subscription for reg event package (signaling) */
+ REGISTRATION,
+
+ /** Ut/XCAP (XML Configuration Access Protocol) */
+ UT_XCAP
+}
\ No newline at end of file
diff --git a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl
new file mode 100644
index 0000000..38e6cdb
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+parcelable SrvccCall {
+
+ @VintfStability
+ @Backing(type="int")
+ enum CallType {
+ NORMAL,
+ EMERGENCY,
+ }
+
+ @VintfStability
+ @Backing(type="int")
+ enum CallSubState {
+ NONE,
+ /** Pre-alerting state. Applicable for MT calls only */
+ PREALERTING,
+ }
+
+ @VintfStability
+ @Backing(type="int")
+ enum ToneType {
+ NONE,
+ LOCAL,
+ NETWORK,
+ }
+
+ /** Connection index */
+ int index;
+
+ /** The type of the call */
+ CallType callType;
+
+ /** Values are android.hardware.radio.voice.Call.STATE_* constants */
+ int callState;
+
+ /** The substate of the call */
+ CallSubState callSubstate;
+
+ /** The type of the ringback tone */
+ ToneType ringbackToneType;
+
+ /** true if is mpty call */
+ boolean isMpty;
+
+ /** true if call is mobile terminated */
+ boolean isMT;
+
+ /** Remote party nummber */
+ String number;
+
+ /** Values are android.hardware.radio.voice.Call.PRESENTATION_* constants */
+ int numPresentation;
+
+ /** Remote party name */
+ String name;
+
+ /** Values are android.hardware.radio.voice.Call.PRESENTATION_* constants */
+ int namePresentation;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl
new file mode 100644
index 0000000..2d12ed6
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2022 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.radio.ims;
+
+@VintfStability
+@JavaDerive(toString=true)
+@Backing(type="int")
+enum SuggestedAction {
+ /** Default value */
+ NONE,
+ /**
+ * Indicates that the IMS registration is failed with fatal error such as 403 or 404
+ * on all P-CSCF addresses. The radio shall block the current PLMN or disable
+ * the RAT as per the carrier requirements.
+ */
+ TRIGGER_PLMN_BLOCK,
+ /**
+ * Indicates that the IMS registration on current PLMN failed multiple times.
+ * The radio shall block the current PLMN or disable the RAT during EPS or 5GS mobility
+ * management timer value as per the carrier requirements.
+ */
+ TRIGGER_PLMN_BLOCK_WITH_TIMEOUT,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl
new file mode 100644
index 0000000..66d8ef0
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+/** AMR codec mode to represent the bit rate. See 3ggp Specs 26.976 & 26.071 */
+@VintfStability
+@Backing(type="int")
+enum AmrMode {
+ /** 4.75 kbps for AMR / 6.6 kbps for AMR-WB */
+ AMR_MODE_0 = 1 << 0,
+ /** 5.15 kbps for AMR / 8.855 kbps for AMR-WB */
+ AMR_MODE_1 = 1 << 1,
+ /** 5.9 kbps for AMR / 12.65 kbps for AMR-WB */
+ AMR_MODE_2 = 1 << 2,
+ /** 6.7 kbps for AMR / 14.25 kbps for AMR-WB */
+ AMR_MODE_3 = 1 << 3,
+ /** 7.4 kbps for AMR / 15.85 kbps for AMR-WB */
+ AMR_MODE_4 = 1 << 4,
+ /** 7.95 kbps for AMR / 18.25 kbps for AMR-WB */
+ AMR_MODE_5 = 1 << 5,
+ /** 10.2 kbps for AMR / 19.85 kbps for AMR-WB */
+ AMR_MODE_6 = 1 << 6,
+ /** 12.2 kbps for AMR / 23.05 kbps for AMR-WB */
+ AMR_MODE_7 = 1 << 7,
+ /** Silence frame for AMR / 23.85 kbps for AMR-WB */
+ AMR_MODE_8 = 1 << 8,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl b/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl
new file mode 100644
index 0000000..4ed3a24
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.ims.media.AmrMode;
+
+@VintfStability
+parcelable AmrParams {
+ /** mode-set: AMR codec mode to represent the bit rate */
+ AmrMode amrMode;
+ /**
+ * octet-align: If it's set to true then all fields in the AMR/AMR-WB header
+ * shall be aligned to octet boundaries by adding padding bits.
+ */
+ boolean octetAligned;
+ /**
+ * max-red: It’s the maximum duration in milliseconds that elapses between the
+ * primary (first) transmission of a frame and any redundant transmission that
+ * the sender will use. This parameter allows a receiver to have a bounded delay
+ * when redundancy is used. Allowed values are between 0 (no redundancy will be
+ * used) and 65535. If the parameter is omitted, no limitation on the use of
+ * redundancy is present. See RFC 4867
+ */
+ int maxRedundancyMillis;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
new file mode 100644
index 0000000..61239d0
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2022 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.radio.ims.media;
+
+@VintfStability
+parcelable AnbrBitrate {
+ /** default value to represent NOT_SET */
+ const int INVALID_ANBR_BITRATE = -1;
+
+ /** Received bitrate in seconds for Uplink from NW or peer UE for ANBR */
+ int uplinkBps;
+ /** Received bitrate in secondsfor Downlink from NW or peer UE for ANBR */
+ int downlinkBps;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl b/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl
new file mode 100644
index 0000000..a8f7b16
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2022 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.radio.ims.media;
+
+@VintfStability
+parcelable CallQuality {
+ /**
+ * downlink CallQualityLevel for a given ongoing call
+ * this value corresponds to the CALL_QUALITY_* constants in {@link CallQuality}
+ */
+ int downlinkCallQualityLevel;
+ /**
+ * uplink CallQualityLevel for a given ongoing call
+ * this value corresponds to the CALL_QUALITY_* constants in {@link CallQuality}
+ */
+ int uplinkCallQualityLevel;
+ /** the call duration in milliseconds */
+ int callDuration;
+ /** RTP packets sent to network */
+ int numRtpPacketsTransmitted;
+ /** RTP packets received from network */
+ int numRtpPacketsReceived;
+ /** RTP packets which were lost in network and never transmitted */
+ int numRtpPacketsTransmittedLost;
+ /** RTP packets which were lost in network and never received */
+ int numRtpPacketsNotReceived;
+ /** average relative jitter in milliseconds */
+ int averageRelativeJitter;
+ /** maximum relative jitter in milliseconds */
+ int maxRelativeJitter;
+ /** average round trip delay in milliseconds */
+ int averageRoundTripTime;
+ /**
+ * the codec type. This value corresponds to the AUDIO_QUALITY_* constants in
+ * {@link ImsStreamMediaProfile}
+ */
+ int codecType;
+ /** True if no incoming RTP is received for a continuous duration of 4 seconds */
+ boolean rtpInactivityDetected;
+ /**
+ * True if only silence RTP packets are received for 20 seconds
+ * immediately after call is connected
+ */
+ boolean rxSilenceDetected;
+ /**
+ * True if only silence RTP packets are sent for 20 seconds
+ * immediately after call is connected
+ */
+ boolean txSilenceDetected;
+ /** the number of Voice frames sent by jitter buffer to audio */
+ int numVoiceFrames;
+ /** the number of no-data frames sent by jitter buffer to audio */
+ int numNoDataFrames;
+ /** the number of RTP voice packets dropped by jitter buffer */
+ int numDroppedRtpPackets;
+ /** the minimum playout delay in the reporting interval in milliseconds */
+ long minPlayoutDelayMillis;
+ /** the maximum playout delay in the reporting interval in milliseconds */
+ long maxPlayoutDelayMillis;
+ /**
+ * the total number of RTP SID (Silence Insertion Descriptor) packets
+ * received by this device for an ongoing call
+ */
+ int numRtpSidPacketsReceived;
+ /**
+ * the total number of RTP duplicate packets received by this device
+ * for an ongoing call
+ */
+ int numRtpDuplicatePackets;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl
new file mode 100644
index 0000000..0aa5505
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.ims.media.CodecSpecificParams;
+import android.hardware.radio.ims.media.CodecType;
+
+@VintfStability
+parcelable CodecParams {
+ /** Negotiated codec type */
+ CodecType codecType;
+ /**
+ * Static or dynamic payload type number negotiated through the SDP for
+ * the incoming RTP packets. This value shall be matched with the PT value
+ * of the incoming RTP header. Values 0 to 127, see RFC 3551 section 6
+ */
+ byte rxPayloadTypeNumber;
+ /**
+ * Static or dynamic payload type number negotiated through the SDP for
+ * the outgoing RTP packets. This value shall be set to the PT value
+ * of the outgoing RTP header. Values 0 to 127, see RFC 3551 section 6
+ */
+ byte txPayloadTypeNumber;
+ /** Sampling rate in kHz*/
+ byte samplingRateKHz;
+ /** dtx: Whether discontinuous transmission is enabled or not */
+ boolean dtxEnabled;
+ /** Codec specific parameters */
+ CodecSpecificParams codecSpecificParams;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl
new file mode 100644
index 0000000..4410c81
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.ims.media.AmrParams;
+import android.hardware.radio.ims.media.EvsParams;
+
+@VintfStability
+union CodecSpecificParams {
+ AmrParams amr;
+ EvsParams evs;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl
new file mode 100644
index 0000000..31218e3
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+@VintfStability
+@Backing(type="int")
+enum CodecType {
+ /** Adaptive Multi-Rate */
+ AMR = 1 << 0,
+ /** Adaptive Multi-Rate Wide Band */
+ AMR_WB = 1 << 1,
+ /** Enhanced Voice Services */
+ EVS = 1 << 2,
+ /** G.711 A-law i.e. Pulse Code Modulation using A-law */
+ PCMA = 1 << 3,
+ /** G.711 μ-law i.e. Pulse Code Modulation using μ-law */
+ PCMU = 1 << 4,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl
new file mode 100644
index 0000000..a7dcb0d
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+@VintfStability
+parcelable DtmfParams {
+ /**
+ * Dynamic payload type number to be used for DTMF RTP packets received.
+ * The values is in the range from 96 to 127 chosen during the session
+ * establishment. The PT value of the RTP header of all DTMF packets shall be
+ * set with this value.
+ */
+ byte rxPayloadTypeNumber;
+
+ /**
+ * Dynamic payload type number to be used for DTMF RTP packets sent.
+ * The values is in the range from 96 to 127 chosen during the session
+ * establishment. The PT value of the RTP header of all DTMF packets shall be set
+ * with this value.
+ */
+ byte txPayloadTypeNumber;
+
+ /** Sampling rate in kHz */
+ byte samplingRateKHz;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl
new file mode 100644
index 0000000..8278514
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+/** EVS Speech codec bandwidths, See 3gpp spec 26.441 Table 1 */
+@VintfStability
+@Backing(type="int")
+enum EvsBandwidth {
+ NONE = 0,
+ NARROW_BAND = 1 << 0,
+ WIDE_BAND = 1 << 1,
+ SUPER_WIDE_BAND = 1 << 2,
+ FULL_BAND = 1 << 3,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl
new file mode 100644
index 0000000..95bd6c7
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+/** EVS codec mode to represent the bit rate. See 3ggp Spec 26.952 Table 5.1 */
+@VintfStability
+@Backing(type="int")
+enum EvsMode {
+ /** 6.6 kbps for EVS AMR-WB IO */
+ EVS_MODE_0 = 1 << 0,
+ /** 8.855 kbps for AMR-WB IO */
+ EVS_MODE_1 = 1 << 1,
+ /** 12.65 kbps for AMR-WB IO */
+ EVS_MODE_2 = 1 << 2,
+ /** 14.25 kbps for AMR-WB IO */
+ EVS_MODE_3 = 1 << 3,
+ /** 15.85 kbps for AMR-WB IO */
+ EVS_MODE_4 = 1 << 4,
+ /** 18.25 kbps for AMR-WB IO */
+ EVS_MODE_5 = 1 << 5,
+ /** 19.85 kbps for AMR-WB IO */
+ EVS_MODE_6 = 1 << 6,
+ /** 23.05 kbps for AMR-WB IO */
+ EVS_MODE_7 = 1 << 7,
+ /** 23.85 kbps for AMR-WB IO */
+ EVS_MODE_8 = 1 << 8,
+ /** 5.9 kbps for EVS primary */
+ EVS_MODE_9 = 1 << 9,
+ /** 7.2 kbps for EVS primary */
+ EVS_MODE_10 = 1 << 10,
+ /** 8.0 kbps for EVS primary */
+ EVS_MODE_11 = 1 << 11,
+ /** 9.6 kbps for EVS primary */
+ EVS_MODE_12 = 1 << 12,
+ /** 13.2 kbps for EVS primary */
+ EVS_MODE_13 = 1 << 13,
+ /** 16.4 kbps for EVS primary */
+ EVS_MODE_14 = 1 << 14,
+ /** 24.4 kbps for EVS primary */
+ EVS_MODE_15 = 1 << 15,
+ /** 32.0 kbps for EVS primary */
+ EVS_MODE_16 = 1 << 16,
+ /** 48.0 kbps for EVS primary */
+ EVS_MODE_17 = 1 << 17,
+ /** 64.0 kbps for EVS primary */
+ EVS_MODE_18 = 1 << 18,
+ /** 96.0 kbps for EVS primary */
+ EVS_MODE_19 = 1 << 19,
+ /** 128.0 kbps for EVS primary */
+ EVS_MODE_20 = 1 << 20,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl
new file mode 100644
index 0000000..d138c83
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.ims.media.EvsBandwidth;
+import android.hardware.radio.ims.media.EvsMode;
+
+@VintfStability
+parcelable EvsParams {
+ /** EVS codec bandwidth */
+ EvsBandwidth bandwidth;
+
+ /** mode-set: EVS codec mode to represent the bit rate */
+ EvsMode evsMode;
+ /**
+ * ch-aw-recv: Channel aware mode for the receive direction. Permissible values
+ * are -1, 0, 2, 3, 5, and 7. If -1, channel-aware mode is disabled in the
+ * session for the receive direction. If 0 or not present, partial redundancy
+ * (channel-aware mode) is not used at the start of the session for the receive
+ * direction. If positive (2, 3, 5, or 7), partial redundancy (channel-aware
+ * mode) is used at the start of the session for the receive direction using the
+ * value as the offset, See 3GPP TS 26.445 section 4.4.5
+ */
+ byte channelAwareMode;
+ /**
+ * hf-only: Header full only is used for the outgoing and incoming packets.
+ * If it's true then the session shall support header full format only else the
+ * session could support both header full format and compact format.
+ */
+ boolean useHeaderFullOnly;
+ /**
+ * evs-mode-switch: Used for switching between EVS Primary mode and EVS AMR-WB IO mode,
+ * If this value is true, the codec operates in AMR-WB IO mode
+ */
+ boolean useEvsModeSwitch;
+ /**
+ * cmr: Codec mode request is used to request the speech codec encoder of the
+ * other party to set the frame type index of speech mode via RTP header, See
+ * 3GPP TS 26.445 section A.3. Allowed values are -1, 0 and 1.
+ */
+ byte codecModeRequest;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl
new file mode 100644
index 0000000..ecf1370
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.ims.media.IImsMediaListener;
+import android.hardware.radio.ims.media.LocalEndPoint;
+import android.hardware.radio.ims.media.RtpConfig;
+import android.hardware.radio.ims.media.RtpError;
+
+/**
+ * This interface is used by IMS media framework to talk to RTP stack located in another processor.
+ */
+@VintfStability
+oneway interface IImsMedia {
+
+ /**
+ * Set the listener functions for receiving notifications from the RTP stack.
+ *
+ * @param mediaListener Object containing listener methods
+ */
+ void setListener(in IImsMediaListener mediaListener);
+
+ /**
+ * Opens a RTP session for the local end point with the associated initial remote configuration
+ * if there is a valid RtpConfig passed. It starts the media flow if the media direction in the
+ * RtpConfig is set to any value other than NO_MEDIA_FLOW. If the open session is successful
+ * then the implementation shall return a new IImsMediaSession binder connection for this
+ * session using IImsMediaListener#onOpenSessionSuccess() API. If the open session is failed
+ * then the implementation shall return the error using IImsMediaListener#onOpenSessionFailure()
+ *
+ * @param sessionId unique identifier of the session
+ * @param localEndPoint provides IP address, port and logical modem id for local RTP endpoint
+ * @param config provides remote end point info and codec details. This could be null initially
+ * and the application may update this later using modifySession() API.
+ */
+ void openSession(int sessionId, in LocalEndPoint localEndPoint, in RtpConfig config);
+
+ /**
+ * Close the RTP session including cleanup of all the resources associated with the session.
+ * This shall also close the session specific binder connection opened as part of openSession().
+ *
+ * @param sessionId identifier for the rtp session that needs to be closed
+ */
+ void closeSession(int sessionId);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl
new file mode 100644
index 0000000..228acb7
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.ims.media.IImsMediaSession;
+import android.hardware.radio.ims.media.RtpError;
+
+/**
+ * Interface declaring listener functions for unsolicited IMS media notifications.
+ */
+@VintfStability
+oneway interface IImsMediaListener {
+ /**
+ * Fired when a IImsMedia#openSession() API is successful.
+ *
+ * @param sessionId identifier of the session
+ * @param session new IImsMediaSession binder connection to be used for the session
+ * specific operations
+ */
+ void onOpenSessionSuccess(int sessionId, IImsMediaSession session);
+
+ /**
+ * Fired when IImsMedia#openSession() API failed to create a new session.
+ *
+ * @param sessionId identifier of the session
+ * @param error one of the following RTP error code
+ * RtpError :INVALID_PARAM
+ * RtpError :INTERNAL_ERR
+ * RtpError :NO_MEMORY
+ * RtpError :NO_RESOURCES
+ * RtpError :PORT_UNAVAILABLE
+ */
+ void onOpenSessionFailure(int sessionId, RtpError error);
+
+ /**
+ * Fired when IImsMedia#closeSession() API handled.
+ *
+ * @param sessionId identifier of the session
+ */
+ void onSessionClosed(int sessionId);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl
new file mode 100644
index 0000000..a8d2161
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.ims.media.IImsMediaSessionListener;
+import android.hardware.radio.ims.media.MediaProtocolType;
+import android.hardware.radio.ims.media.MediaQualityThreshold;
+import android.hardware.radio.ims.media.RtpConfig;
+import android.hardware.radio.ims.media.RtpError;
+import android.hardware.radio.ims.media.RtpHeaderExtension;
+
+/**
+ * Session specific interface used by IMS media framework to talk to the vendor RTP stack.
+ */
+@VintfStability
+oneway interface IImsMediaSession {
+ /**
+ * Set the listener functions to receive IMS media session specific notifications.
+ *
+ * @param sessionListener Object containing notification methods
+ */
+ void setListener(in IImsMediaSessionListener sessionListener);
+
+ /**
+ * Modifies the configuration of the RTP session. It can be used to pause/resume
+ * the media stream by changing the value of the MediaDirection.
+ *
+ * @param config provides remote end point info and codec details
+ */
+ void modifySession(in RtpConfig config);
+
+ /**
+ * Send DTMF digit until the duration expires.
+ *
+ * @param dtmfDigit single char having one of 12 values: 0-9, *, #
+ * @param duration of the key press in milliseconds.
+ */
+ void sendDtmf(char dtmfDigit, int duration);
+
+ /**
+ * Start sending DTMF digit until the stopDtmf() API is received.
+ * If the implementation is currently sending a DTMF tone for which
+ * stopDtmf() is not received yet, then that digit must be stopped first
+ *
+ * @param dtmfDigit single char having one of 12 values: 0-9, *, #
+ */
+ void startDtmf(char dtmfDigit);
+
+ /**
+ * Stop sending the last DTMF digit started by startDtmf().
+ * stopDtmf() without preceding startDtmf() must be ignored.
+ */
+ void stopDtmf();
+
+ /**
+ * Send RTP header extension to the other party in the next RTP packet.
+ *
+ * @param extensions data to be transmitted via RTP header extension
+ */
+ void sendHeaderExtension(in List<RtpHeaderExtension> extensions);
+
+ /**
+ * Sets the media quality threshold parameters of the session to get
+ * media quality notifications.
+ *
+ * @param threshold media quality thresholds for various quality parameters
+ */
+ void setMediaQualityThreshold(in MediaQualityThreshold threshold);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl
new file mode 100644
index 0000000..d40da64
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.ims.media.CallQuality;
+import android.hardware.radio.ims.media.MediaProtocolType;
+import android.hardware.radio.ims.media.RtpConfig;
+import android.hardware.radio.ims.media.RtpError;
+import android.hardware.radio.ims.media.RtpHeaderExtension;
+
+/**
+ * Interface declaring listener functions for unsolicited IMS media notifications per session.
+ */
+@VintfStability
+oneway interface IImsMediaSessionListener {
+ /**
+ * Notifies the result of IImsMediaSession#modifySession() API.
+ *
+ * @param config The RTP config passed in IImsMediaSession#modifySession() API
+ * @param error RtpError.NONE in case of success else one of the following
+ * RtpError :INVALID_PARAM
+ * RtpError :INTERNAL_ERR
+ * RtpError :NO_MEMORY
+ * RtpError :NO_RESOURCES
+ */
+ void onModifySessionResponse(in RtpConfig config, RtpError error);
+
+ /**
+ * Indicates when the first Rtp media packet is received by the UE during ring
+ * back, call hold or early media scenarios. This is sent only if the packet is
+ * received on the active remote configuration.
+ *
+ * In case of early media scenarios, the implementation shall play the RTP
+ * packets from the most recently added config.
+ *
+ * @param config The remote config where the media is received
+ */
+ void onFirstMediaPacketReceived(in RtpConfig config);
+
+ /**
+ * RTP header extension received from the other party
+ *
+ * @param extensions content of the received RTP header extension
+ */
+ void onHeaderExtensionReceived(in List<RtpHeaderExtension> extensions);
+
+ /**
+ * Notifies media inactivity observed as per thresholds set by
+ * setMediaQualityThreshold() API
+ *
+ * @param packetType either RTP or RTCP
+ */
+ void notifyMediaInactivity(MediaProtocolType packetType);
+
+ /**
+ * Notifies RTP packet loss observed as per thresholds set by
+ * setMediaQualityThreshold() API
+ *
+ * @param packetLossPercentage percentage of packet loss calculated over the duration
+ */
+ void notifyPacketLoss(int packetLossPercentage);
+
+ /**
+ * Notifies RTP jitter observed as per thresholds set by
+ * IImsMediaSession#setMediaQualityThreshold() API
+ *
+ * @param jitter jitter of the RTP packets in milliseconds calculated over the duration
+ */
+ void notifyJitter(int jitter);
+
+ /**
+ * The modem RTP stack fires this API to query whether the desired bitrate mentioned
+ * in the RtpConfig is currently available on the NW or not using ANBRQ message.
+ * See 3GPP TS 26.114.
+ *
+ * @param config containing desired bitrate and direction
+ */
+ void triggerAnbrQuery(in RtpConfig config);
+
+ /**
+ * Notifies the received DTMF digit from the other party
+ *
+ * @param dtmfDigit single char having one of 12 values: 0-9, *, #
+ */
+ void onDtmfReceived(char dtmfDigit);
+
+ /**
+ * Notifies when a change to call quality has occurred
+ *
+ * @param CallQuality The call quality statistics of ongoing call since last report
+ */
+ void onCallQualityChanged(in CallQuality callQuality);
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl
new file mode 100644
index 0000000..2bd48c6
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.os.ParcelFileDescriptor;
+
+@VintfStability
+parcelable LocalEndPoint {
+ /** Socket file descriptor for RTP traffic */
+ ParcelFileDescriptor rtpFd;
+ /** Socket file descriptor for RTCP traffic */
+ ParcelFileDescriptor rtcpFd;
+ /** The logical modem ID, returned by IRadioConfig.getPhoneCapability() */
+ int modemId;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
new file mode 100644
index 0000000..9f04d8e
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+@VintfStability
+@Backing(type="int")
+enum MediaDirection {
+ /**
+ * No RTP/RTCP flow in either direction. The implementation
+ * may release the audio resource. Eg. SRVCC.
+ */
+ NO_FLOW = 0,
+ /** Device sends outgoing RTP and drops incoming RTP */
+ SEND_ONLY = 1,
+ /** Device receives the downlink RTP and does not transmit any uplink RTP */
+ RECEIVE_ONLY = 2,
+ /** Device sends and receive RTP in both directions */
+ SEND_RECEIVE = 3,
+ /** No RTP flow however RTCP continues to flow. Eg. HOLD */
+ INACTIVE = 4,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl
new file mode 100644
index 0000000..325c6fa
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+@VintfStability
+@Backing(type="int")
+enum MediaProtocolType {
+ /** Real Time Protocol, see RFC 3550 */
+ RTP = 0,
+ /** Real Time Control Protocol, see RFC 3550 */
+ RTCP = 1,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl
new file mode 100644
index 0000000..946bd5c
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+@VintfStability
+parcelable MediaQualityThreshold {
+ /** Timer in milliseconds for monitoring RTP inactivity */
+ int rtpInactivityTimerMillis;
+ /** Timer in milliseconds for monitoring RTCP inactivity */
+ int rtcpInactivityTimerMillis;
+ /** Duration in milliseconds for monitoring the RTP packet loss rate */
+ int rtpPacketLossDurationMillis;
+ /**
+ * Packet loss rate in percentage of (total number of packets lost) /
+ * (total number of packets expected) during rtpPacketLossDurationMs
+ */
+ int rtpPacketLossRate;
+ /** Duration in milliseconds for monitoring the jitter for RTP traffic */
+ int jitterDurationMillis;
+ /** RTP jitter threshold in milliseconds */
+ int rtpJitterMillis;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl
new file mode 100644
index 0000000..98bbfc6
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+@VintfStability
+parcelable RtcpConfig {
+ /** Canonical name that will be sent to all session participants */
+ String canonicalName;
+ /** Port for sending outgoing RTCP packets */
+ int transmitPort;
+ /** Transmit interval in seconds. Value 0 indicates that RTCP reports should not be reported */
+ int transmitIntervalSec;
+ /** Bitmask of RTCP-XR blocks to enable as in RtcpXrReportBlockType */
+ int rtcpXrBlocks;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
new file mode 100644
index 0000000..7f6839a
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+/** RTP Control Protocol Extended Reports (RTCP XR) Blocks, See RFC 3611 section 4 */
+
+@VintfStability
+@Backing(type="int")
+enum RtcpXrReportBlockType {
+ /** Disable RTCP XR */
+ RTCPXR_NONE = 0,
+ /** Loss RLE Report Block */
+ RTCPXR_LOSS_RLE_REPORT_BLOCK = 1 << 0,
+ /** Duplicate RLE Report Block */
+ RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = 1 << 1,
+ /** Packet Receipt Times Report Block */
+ RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = 1 << 2,
+ /** Receiver Reference Time Report Block */
+ RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = 1 << 3,
+ /** DLRR Report Block */
+ RTCPXR_DLRR_REPORT_BLOCK = 1 << 4,
+ /** Statistics Summary Report Block */
+ RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = 1 << 5,
+ /** VoIP Metrics Report Block */
+ RTCPXR_VOIP_METRICS_REPORT_BLOCK = 1 << 6,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl
new file mode 100644
index 0000000..2db73a3
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+@VintfStability
+parcelable RtpAddress {
+ /** Point to point IP address */
+ String ipAddress;
+ /** UDP port number used for the RTP traffic */
+ int portNumber;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
new file mode 100644
index 0000000..d0d849e
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.AccessNetwork;
+import android.hardware.radio.ims.media.AnbrBitrate;
+import android.hardware.radio.ims.media.MediaDirection;
+import android.hardware.radio.ims.media.RtcpConfig;
+import android.hardware.radio.ims.media.RtpAddress;
+import android.hardware.radio.ims.media.RtpSessionParams;
+
+@VintfStability
+parcelable RtpConfig {
+ /** Media flow direction */
+ MediaDirection direction;
+ /** Radio Access Network */
+ AccessNetwork accessNetwork;
+ /** IP address and port number of the other party for RTP media */
+ RtpAddress remoteAddress;
+ /** Negotiated session parameters */
+ RtpSessionParams sessionParams;
+ /** RTCP configuration */
+ RtcpConfig rtcpConfig;
+ /**
+ * ANBR Bitrate parameters. This is set to valid only when its triggered,
+ * otherwise it shall be set to NULL.
+ *
+ * This would be used in the following two cases
+ * - IImsMediaSession#modifySession(RtpConfig) - When RAN wants to change the bit
+ * rate via ANBR MAC layer signaling, ImsStack would set the values and direction
+ * and pass it in the modifySession(). The underlying RTP stack shall adapt to
+ * the changed bitrate.
+ *
+ * - IImsMediaSessionListener#triggerAnbrQuery(RtpConfig) - When the vendor RTP
+ * stack receives a request for bitrate increase from the peer terminal via CMR,
+ * RTCP-APP or TMMBR, it triggers ANBRQ by setting the desired bitrate and the
+ * direction of the stream.
+ */
+ AnbrBitrate anbrBitrateParams;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl
new file mode 100644
index 0000000..11a3468
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+@VintfStability
+@Backing(type="int")
+enum RtpError {
+ /** Success */
+ NONE = 0,
+ /** Invalid parameters passed in the request */
+ INVALID_PARAM = 1,
+ /** The RTP stack is not ready to handle the request */
+ NOT_READY = 2,
+ /** Unable to handle the request due to memory allocation failure */
+ NO_MEMORY = 3,
+ /** Unable to handle the request due to no sufficient resources such as audio, codec */
+ NO_RESOURCES = 4,
+ /** The requested port number is not available */
+ PORT_UNAVAILABLE = 5,
+ /** The request is not supported by the implementation */
+ NOT_SUPPORTED = 6,
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl
new file mode 100644
index 0000000..76b13dc
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+/** RTP Header Extensions, see RFC 8285 */
+@VintfStability
+parcelable RtpHeaderExtension {
+ /** Local identifier */
+ int localId;
+ /** Extension data bytes */
+ byte[] data;
+}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl
new file mode 100644
index 0000000..f93c52c
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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.radio.ims.media;
+
+import android.hardware.radio.ims.media.CodecParams;
+import android.hardware.radio.ims.media.DtmfParams;
+
+@VintfStability
+parcelable RtpSessionParams {
+ /**
+ * ptime: Recommended length of time in milliseconds represented by the media
+ * in each packet, see RFC 4566
+ */
+ byte pTimeMillis;
+ /**
+ * maxptime: Maximum amount of media that can be encapsulated in each packet
+ * represented in milliseconds, see RFC 4566
+ */
+ int maxPtimeMillis;
+ /** dscp: Differentiated Services Field Code Point value, see RFC 2474 */
+ byte dscp;
+ /** DTMF payload and clock rate */
+ DtmfParams dtmfParams;
+ /** Negotiated codec parameters */
+ CodecParams codecParams;
+}
diff --git a/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl b/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl
index ee62d95..b256c9a 100644
--- a/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl
+++ b/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl
@@ -27,6 +27,7 @@
/**
* SMS in PDU format as an ASCII hex string less the SMSC address.
* TP-Layer-Length is be "strlen(pdu)/2
+ * TP - MessageRef field of pdu must not be modified by modem
*/
String pdu;
}
diff --git a/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl b/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl
new file mode 100644
index 0000000..25031a9
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.radio.network;
+
+@VintfStability
+@Backing(type="int")
+@JavaDerive(toString=true)
+enum EmergencyMode {
+ /**
+ * Mode Type Emergency WWAN, indicates that the current domain selected for the Emergency call
+ * is cellular.
+ */
+ EMERGENCY_WWAN = 1,
+
+ /**
+ * Mode Type Emergency WLAN, indicates that the current domain selected for the Emergency call
+ * is WLAN/WIFI.
+ */
+ EMERGENCY_WLAN = 2,
+
+ /**
+ * Mode Type Emergency Callback, indicates that the current mode set request is for Emergency
+ * callback.
+ */
+ EMERGENCY_CALLBACK = 3,
+}
diff --git a/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl b/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl
new file mode 100644
index 0000000..0a22e4c
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2022 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.radio.network;
+import android.hardware.radio.AccessNetwork;
+import android.hardware.radio.network.EmergencyScanType;
+
+@VintfStability
+@JavaDerive(toString=true)
+parcelable EmergencyNetworkScanTrigger{
+ /**
+ * Access network to be prioritized during emergency scan. The 1st entry has the highest
+ * priority.
+ */
+ AccessNetwork[] accessNetwork;
+
+ /**
+ * Scan type indicates the type of scans to be performed i.e. limited scan, full service scan or
+ * any scan.
+ */
+ EmergencyScanType scanType;
+}
diff --git a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl
new file mode 100644
index 0000000..2215149
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2022 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.radio.network;
+import android.hardware.radio.AccessNetwork;
+import android.hardware.radio.network.Domain;
+import android.hardware.radio.network.RegState;
+
+@VintfStability
+@JavaDerive(toString=true)
+parcelable EmergencyRegResult {
+ /**
+ * Indicates the cellular access network of the current emergency capable system.
+ */
+ AccessNetwork accessNetwork;
+
+ /**
+ * Registration state of the current emergency capable system.
+ */
+ RegState regState;
+
+ /**
+ * EMC domain indicates the current domain of the acquired system.
+ */
+ Domain emcDomain;
+
+ /**
+ * This indicates whether the network supports voice over PS network.
+ */
+ boolean isVopsSupported;
+
+ /**
+ * This indicates if camped network support VoLTE emergency bearers.
+ * This should only be set if the UE is in LTE mode.
+ */
+ boolean isEmcBearerSupported;
+
+ /**
+ * The value of the network provided EMC 5G Registration ACCEPT.
+ * This should be set only if the UE is in 5G mode.
+ */
+ byte nwProvidedEmc;
+
+ /**
+ * The value of the network provided EMF ( EPS Fallback) in 5G Registration ACCEPT.
+ * This should not be set if UE is not in 5G mode.
+ */
+ byte nwProvidedEmf;
+
+ /** 3-digit Mobile Country Code, 000..999, empty string if unknown. */
+ String mcc = "";
+
+ /** 2 or 3-digit Mobile Network Code, 00..999, empty string if unknown. */
+ String mnc = "";
+}
diff --git a/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl b/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl
new file mode 100644
index 0000000..72c5490
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2022 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.radio.network;
+
+@VintfStability
+@Backing(type="int")
+@JavaDerive(toString=true)
+enum EmergencyScanType {
+ /**
+ * Scan Type No Preference, indicates that the modem can scan for emergency
+ * service as per modem’s implementation.
+ */
+ NO_PREFERENCE = 0,
+
+ /**
+ * Scan Type limited, indicates that the modem will scan for
+ * emergency service in limited service mode.
+ */
+ LIMITED_SERVICE = 1,
+
+ /**
+ * Scan Type Full Service, indicates that the modem will scan for
+ * emergency service in Full service mode.
+ */
+ FULL_SERVICE = 2,
+}
diff --git a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl
index c9563ac..b986944 100644
--- a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl
+++ b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl
@@ -22,6 +22,21 @@
@VintfStability
@JavaDerive(toString=true)
parcelable EutranRegistrationInfo {
+ enum AttachResultType {
+ /** Default value. */
+ NONE,
+ /** LTE is attached with eps only. */
+ EPS_ONLY,
+ /** LTE combined EPS and IMSI attach. */
+ COMBINED,
+ }
+
+ /** LTE combined attach with CSFB not preferred */
+ const int EXTRA_CSFB_NOT_PREFERRED = 1 << 0;
+
+ /** LTE combined attach for SMS only */
+ const int EXTRA_SMS_ONLY = 1 << 1;
+
/**
* Network capabilities for voice over PS services. This info is valid only on LTE network and
* must be present when device is camped on LTE. VopsInfo must be empty when device is camped
@@ -33,4 +48,13 @@
* be empty.
*/
NrIndicators nrIndicators;
+
+ /**
+ * The type of network attachment. This info is valid only on LTE network and must be present
+ * when device has attached to the network.
+ */
+ AttachResultType lteAttachResultType;
+
+ /** Values are bitwise ORs of EXTRA_* constants */
+ int extraInfo;
}
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
index cce52ff..574798a 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl
@@ -18,6 +18,8 @@
import android.hardware.radio.AccessNetwork;
import android.hardware.radio.network.CdmaRoamingType;
+import android.hardware.radio.network.EmergencyMode;
+import android.hardware.radio.network.EmergencyNetworkScanTrigger;
import android.hardware.radio.network.IRadioNetworkIndication;
import android.hardware.radio.network.IRadioNetworkResponse;
import android.hardware.radio.network.IndicationFilter;
@@ -437,4 +439,47 @@
* @param serial Serial number of request.
*/
oneway void getUsageSetting(in int serial);
+
+ /**
+ * Set the Emergency Mode
+ *
+ * @param serial Serial number of the request.
+ * @param emcModeType Defines the radio emergency mode type/radio network required/
+ * type of service to be scanned.
+ *
+ * Response function is IRadioEmergencyResponse.setEmergencyModeResponse()
+ */
+ void setEmergencyMode(int serial, in EmergencyMode emcModeType);
+
+ /**
+ * Triggers an Emergency network scan.
+ *
+ * @param serial Serial number of the request.
+ * @param request Contains the preferred networks and type of service to be scanned.
+ * See {@link EmergencyNetworkScanTrigger}.
+ *
+ * Response function is IRadioEmergencyResponse.triggerEmergencyNetworkScanResponse()
+ */
+ void triggerEmergencyNetworkScan(int serial, in EmergencyNetworkScanTrigger request);
+
+ /**
+ * Cancels ongoing Emergency network scan
+ *
+ * @param serial Serial number of the request.
+ * @param resetScan Indicates how the next {@link #triggerEmergencyNetworkScan} should work.
+ * If {@code true}, then the modem shall start the new scan from the beginning,
+ * otherwise the modem shall resume from the last search.
+ *
+ * Response function is IRadioEmergencyResponse.cancelEmergencyNetworkScan()
+ */
+ void cancelEmergencyNetworkScan(int serial, boolean resetScan);
+
+ /**
+ * Exits ongoing Emergency Mode
+ *
+ * @param serial Serial number of the request.
+ *
+ * Response function is IRadioEmergencyResponse.exitEmergencyModeResponse()
+ */
+ void exitEmergencyMode(in int serial);
}
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl
index f471433..47d932d 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl
@@ -27,6 +27,7 @@
import android.hardware.radio.network.PhysicalChannelConfig;
import android.hardware.radio.network.SignalStrength;
import android.hardware.radio.network.SuppSvcNotification;
+import android.hardware.radio.network.EmergencyRegResult;
/**
* Interface declaring unsolicited radio indications for network APIs.
@@ -190,4 +191,12 @@
* @param rat Current new voice rat
*/
void voiceRadioTechChanged(in RadioIndicationType type, in RadioTechnology rat);
+
+ /**
+ * Emergency Scan Results.
+ *
+ * @param type Type of radio indication
+ * @param result the result of the Emergency Network Scan
+ */
+ void emergencyNetworkScanResult(in RadioIndicationType type, in EmergencyRegResult result);
}
diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
index dcf0004..fc4db2c 100644
--- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
+++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl
@@ -23,6 +23,7 @@
import android.hardware.radio.network.CdmaRoamingType;
import android.hardware.radio.network.CellIdentity;
import android.hardware.radio.network.CellInfo;
+import android.hardware.radio.network.EmergencyRegResult;
import android.hardware.radio.network.OperatorInfo;
import android.hardware.radio.network.RadioAccessSpecifier;
import android.hardware.radio.network.RadioBandMode;
@@ -572,4 +573,63 @@
* RadioError:SIM_ABSENT
*/
oneway void getUsageSettingResponse(in RadioResponseInfo info, in UsageSetting usageSetting);
+
+ /**
+ * Response of setEmergencyMode.
+ * This is an optional API.
+ *
+ * @param info Response info struct containing response type, serial no. and error.
+ * @param regState the current registration state of the modem.
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:MODEM_ERR
+ * RadioError:INVALID_ARGUMENTS
+ */
+ void setEmergencyModeResponse(in RadioResponseInfo info, in EmergencyRegResult regState);
+
+ /**
+ * Response of triggerEmergencyNetworkScan.
+ * This is an optional API.
+ *
+ * @param info Response info struct containing response type, serial no. and error.
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:MODEM_ERR
+ * RadioError:INVALID_ARGUMENTS
+ */
+ void triggerEmergencyNetworkScanResponse(in RadioResponseInfo info);
+
+ /**
+ * Response of exitEmergencyMode.
+ * This is an optional API.
+ *
+ * @param info Response info struct containing response type, serial no. and error.
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:MODEM_ERR
+ */
+ void exitEmergencyModeResponse(in RadioResponseInfo info);
+
+ /**
+ * Response of cancelEmergencyNetworkScan.
+ * This is an optional API.
+ *
+ * @param info Response info struct containing response type, serial no. and error.
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:MODEM_ERR
+ */
+ void cancelEmergencyNetworkScanResponse(in RadioResponseInfo info);
}
diff --git a/radio/aidl/android/hardware/radio/network/RegState.aidl b/radio/aidl/android/hardware/radio/network/RegState.aidl
index 3f13783..bdba4c4 100644
--- a/radio/aidl/android/hardware/radio/network/RegState.aidl
+++ b/radio/aidl/android/hardware/radio/network/RegState.aidl
@@ -65,4 +65,10 @@
* Same as UNKNOWN but indicates that emergency calls are enabled
*/
UNKNOWN_EM = 14,
+ /**
+ * Emergency attached in EPS or in 5GS.
+ * Reference: 3GPP TS 24.301 9.9.3.11 EPS attach type.
+ * Reference: 3GPP TS 24.501 9.11.3.6 5GS registration result.
+ */
+ REG_EM = 20,
}
diff --git a/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl
index 2f90180..0a8e9ce 100644
--- a/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl
+++ b/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl
@@ -82,7 +82,13 @@
* Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
*/
const int SIGNAL_MEASUREMENT_TYPE_SSSINR = 8;
-
+ /**
+ * EcNo value
+ * Range: -24 dBm to 1 dBm.
+ * Used RAN: UTRAN
+ * Reference: 3GPP TS 25.215 5.1.5
+ */
+ const int SIGNAL_MEASUREMENT_TYPE_ECNO = 9;
/**
* Signal Measurement Type
* Values are SIGNAL_MEASUREMENT_TYPE_
diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp
index 487d91b..f79e045 100644
--- a/radio/aidl/compat/libradiocompat/Android.bp
+++ b/radio/aidl/compat/libradiocompat/Android.bp
@@ -39,7 +39,7 @@
"android.hardware.radio.data-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
"android.hardware.radio.modem-V1-ndk",
- "android.hardware.radio.network-V1-ndk",
+ "android.hardware.radio.network-V2-ndk",
"android.hardware.radio.sim-V1-ndk",
"android.hardware.radio.voice-V1-ndk",
"android.hardware.radio@1.0",
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
index 9784665..5dd6f0a 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h
@@ -90,6 +90,16 @@
::aidl::android::hardware::radio::network::UsageSetting usageSetting) override;
::ndk::ScopedAStatus getUsageSetting(int32_t serial) override;
+ ::ndk::ScopedAStatus setEmergencyMode(
+ int32_t serial,
+ const ::aidl::android::hardware::radio::network::EmergencyMode emergencyMode) override;
+ ::ndk::ScopedAStatus triggerEmergencyNetworkScan(
+ int32_t serial,
+ const ::aidl::android::hardware::radio::network::EmergencyNetworkScanTrigger&
+ scanTrigger) override;
+ ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial, bool resetScan) override;
+ ::ndk::ScopedAStatus exitEmergencyMode(int32_t serial) override;
+
protected:
std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond();
diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
index d5e2a8d..6bb6b75 100644
--- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
+++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp
@@ -311,4 +311,33 @@
return ok();
}
+ScopedAStatus RadioNetwork::setEmergencyMode(int32_t serial, aidl::EmergencyMode) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " setEmergencyMode is unsupported by HIDL HALs";
+ respond()->setEmergencyModeResponse(notSupported(serial), {});
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::triggerEmergencyNetworkScan(int32_t serial,
+ const aidl::EmergencyNetworkScanTrigger&) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " triggerEmergencyNetworkScan is unsupported by HIDL HALs";
+ respond()->triggerEmergencyNetworkScanResponse(notSupported(serial));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::cancelEmergencyNetworkScan(int32_t serial, bool) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " cancelEmergencyNetworkScan is unsupported by HIDL HALs";
+ respond()->cancelEmergencyNetworkScanResponse(notSupported(serial));
+ return ok();
+}
+
+ScopedAStatus RadioNetwork::exitEmergencyMode(int32_t serial) {
+ LOG_CALL << serial;
+ LOG(ERROR) << " exitEmergencyMode is unsupported by HIDL HALs";
+ respond()->exitEmergencyModeResponse(notSupported(serial));
+ return ok();
+}
+
} // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp
index 52eb71f..4dbaef4 100644
--- a/radio/aidl/compat/service/Android.bp
+++ b/radio/aidl/compat/service/Android.bp
@@ -42,7 +42,7 @@
"android.hardware.radio.data-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
"android.hardware.radio.modem-V1-ndk",
- "android.hardware.radio.network-V1-ndk",
+ "android.hardware.radio.network-V2-ndk",
"android.hardware.radio.sim-V1-ndk",
"android.hardware.radio.voice-V1-ndk",
"android.hardware.radio@1.0",
diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp
index 021ee89..bb992c9 100644
--- a/radio/aidl/vts/Android.bp
+++ b/radio/aidl/vts/Android.bp
@@ -41,6 +41,9 @@
"radio_data_indication.cpp",
"radio_data_response.cpp",
"radio_data_test.cpp",
+ "radio_ims_indication.cpp",
+ "radio_ims_response.cpp",
+ "radio_ims_test.cpp",
"radio_messaging_indication.cpp",
"radio_messaging_response.cpp",
"radio_messaging_test.cpp",
@@ -66,9 +69,10 @@
"android.hardware.radio-V1-ndk",
"android.hardware.radio.config-V1-ndk",
"android.hardware.radio.data-V1-ndk",
+ "android.hardware.radio.ims-V1-ndk",
"android.hardware.radio.messaging-V1-ndk",
"android.hardware.radio.modem-V1-ndk",
- "android.hardware.radio.network-V1-ndk",
+ "android.hardware.radio.network-V2-ndk",
"android.hardware.radio.sim-V1-ndk",
"android.hardware.radio.voice-V1-ndk",
],
diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
index 1ebc6af..67a2672 100644
--- a/radio/aidl/vts/VtsHalRadioTargetTest.cpp
+++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp
@@ -18,6 +18,7 @@
#include "radio_config_utils.h"
#include "radio_data_utils.h"
+#include "radio_ims_utils.h"
#include "radio_messaging_utils.h"
#include "radio_modem_utils.h"
#include "radio_network_utils.h"
@@ -65,6 +66,12 @@
testing::ValuesIn(android::getAidlHalInstanceNames(IRadioVoice::descriptor)),
android::PrintInstanceNameToString);
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioImsTest);
+INSTANTIATE_TEST_SUITE_P(
+ PerInstance, RadioImsTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IRadioIms::descriptor)),
+ android::PrintInstanceNameToString);
+
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
ABinderProcess_setThreadPoolMaxThreadCount(1);
diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h
index 47976b9..4ed6b3f 100644
--- a/radio/aidl/vts/radio_aidl_hal_utils.h
+++ b/radio/aidl/vts/radio_aidl_hal_utils.h
@@ -67,6 +67,8 @@
static constexpr const char* FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
+static constexpr const char* FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims";
+
#define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3
#define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3
#define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2
diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp
new file mode 100644
index 0000000..988038b
--- /dev/null
+++ b/radio/aidl/vts/radio_ims_indication.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "radio_ims_utils.h"
+
+RadioImsIndication::RadioImsIndication(RadioServiceTest& parent) : parent_ims(parent) {}
+
+ndk::ScopedAStatus RadioImsIndication::onConnectionSetupFailure(RadioIndicationType /*type*/,
+ int32_t /*token*/, const ConnectionFailureInfo& /*info*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsIndication::notifyAnbr(RadioIndicationType /*type*/,
+ ImsStreamType /*mediaType*/, ImsStreamDirection /*direction*/, int /*bitsPerSecond*/) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsIndication::triggerImsDeregistration(RadioIndicationType /*type*/,
+ ImsDeregistrationReason /*reason*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp
new file mode 100644
index 0000000..c6d62dc
--- /dev/null
+++ b/radio/aidl/vts/radio_ims_response.cpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include "radio_ims_utils.h"
+
+RadioImsResponse::RadioImsResponse(RadioServiceTest& parent) : parent_ims(parent) {}
+
+ndk::ScopedAStatus RadioImsResponse::setSrvccCallInfoResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::updateImsRegistrationInfoResponse(
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::startImsTrafficResponse(const RadioResponseInfo& info,
+ const std::optional<ConnectionFailureInfo>& response) {
+ rspInfo = info;
+ startImsTrafficResp = response;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::stopImsTrafficResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::triggerEpsFallbackResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::sendAnbrQueryResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioImsResponse::updateImsCallStatusResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_ims.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp
new file mode 100644
index 0000000..5e3f057
--- /dev/null
+++ b/radio/aidl/vts/radio_ims_test.cpp
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#include <aidl/android/hardware/radio/config/IRadioConfig.h>
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+
+#include "radio_ims_utils.h"
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+
+void RadioImsTest::SetUp() {
+ std::string serviceName = GetParam();
+
+ if (!isServiceValidForDeviceConfiguration(serviceName)) {
+ ALOGI("Skipped the test due to device configuration.");
+ GTEST_SKIP();
+ }
+
+ radio_ims = IRadioIms::fromBinder(
+ ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str())));
+ ASSERT_NE(nullptr, radio_ims.get());
+
+ radioRsp_ims = ndk::SharedRefBase::make<RadioImsResponse>(*this);
+ ASSERT_NE(nullptr, radioRsp_ims.get());
+
+ count_ = 0;
+
+ radioInd_ims = ndk::SharedRefBase::make<RadioImsIndication>(*this);
+ ASSERT_NE(nullptr, radioInd_ims.get());
+
+ radio_ims->setResponseFunctions(radioRsp_ims, radioInd_ims);
+
+ // Assert IRadioConfig exists before testing
+ radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder(
+ AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default")));
+ ASSERT_NE(nullptr, radio_config.get());
+}
+
+/*
+ * Test IRadioIms.setSrvccCallInfo() for the response returned.
+ */
+TEST_P(RadioImsTest, setSrvccCallInfo) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping setSrvccCallInfo because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running setSrvccCallInfo because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ SrvccCall srvccCall;
+
+ ndk::ScopedAStatus res =
+ radio_ims->setSrvccCallInfo(serial, { srvccCall });
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("setSrvccCallInfo, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.updateImsRegistrationInfo() for the response returned.
+ */
+TEST_P(RadioImsTest, updateImsRegistrationInfo) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping updateImsRegistrationInfo because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running updateImsRegistrationInfo because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ImsRegistration regInfo;
+ regInfo.regState = ImsRegistrationState::NOT_REGISTERED;
+ regInfo.accessNetworkType = AccessNetwork::EUTRAN;
+ regInfo.suggestedAction = SuggestedAction::NONE;
+ regInfo.capabilities = ImsRegistration::IMS_MMTEL_CAPABILITY_NONE;
+
+ ndk::ScopedAStatus res =
+ radio_ims->updateImsRegistrationInfo(serial, regInfo);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("updateImsRegistrationInfo, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.startImsTraffic() for the response returned.
+ */
+TEST_P(RadioImsTest, startImsTraffic) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping startImsTraffic because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running startImsTraffic because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_ims->startImsTraffic(serial, 1,
+ ImsTrafficType::REGISTRATION, AccessNetwork::EUTRAN, ImsCall::Direction::OUTGOING);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("startImsTraffic, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.stopImsTraffic() for the response returned.
+ */
+TEST_P(RadioImsTest, stopImsTraffic) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping stopImsTraffic because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running stopImsTraffic because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res = radio_ims->stopImsTraffic(serial, 2);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("stopImsTraffic, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.triggerEpsFallback() for the response returned.
+ */
+TEST_P(RadioImsTest, triggerEpsFallback) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping triggerEpsFallback because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running triggerEpsFallback because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_ims->triggerEpsFallback(serial, EpsFallbackReason::NO_NETWORK_TRIGGER);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("triggerEpsFallback, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.sendAnbrQuery() for the response returned.
+ */
+TEST_P(RadioImsTest, sendAnbrQuery) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping sendAnbrQuery because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running sendAnbrQuery because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ndk::ScopedAStatus res =
+ radio_ims->sendAnbrQuery(serial, ImsStreamType::AUDIO, ImsStreamDirection::UPLINK, 13200);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("sendAnbrQuery, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+/*
+ * Test IRadioIms.updateImsCallStatus() for the response returned.
+ */
+TEST_P(RadioImsTest, updateImsCallStatus) {
+ if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) {
+ ALOGI("Skipping updateImsCallStatus because ims is not supported in device");
+ return;
+ } else {
+ ALOGI("Running updateImsCallStatus because ims is supported in device");
+ }
+
+ serial = GetRandomSerialNumber();
+
+ ImsCall imsCall;
+
+ ndk::ScopedAStatus res =
+ radio_ims->updateImsCallStatus(serial, { imsCall });
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial);
+
+ ALOGI("updateImsCallStatus, rspInfo.error = %s\n",
+ toString(radioRsp_ims->rspInfo.error).c_str());
+
+ verifyError(radioRsp_ims->rspInfo.error);
+}
+
+void RadioImsTest::verifyError(RadioError resp) {
+ switch (resp) {
+ case RadioError::NONE:
+ case RadioError::RADIO_NOT_AVAILABLE:
+ case RadioError::INVALID_STATE:
+ case RadioError::NO_MEMORY:
+ case RadioError::SYSTEM_ERR:
+ case RadioError::MODEM_ERR:
+ case RadioError::INTERNAL_ERR:
+ case RadioError::INVALID_ARGUMENTS:
+ case RadioError::REQUEST_NOT_SUPPORTED:
+ case RadioError::NO_RESOURCES:
+ SUCCEED();
+ break;
+ default:
+ FAIL();
+ break;
+ }
+}
diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h
new file mode 100644
index 0000000..2bf80dc
--- /dev/null
+++ b/radio/aidl/vts/radio_ims_utils.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2022 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/radio/ims/BnRadioImsIndication.h>
+#include <aidl/android/hardware/radio/ims/BnRadioImsResponse.h>
+#include <aidl/android/hardware/radio/ims/IRadioIms.h>
+
+#include "radio_aidl_hal_utils.h"
+
+using namespace aidl::android::hardware::radio::ims;
+
+class RadioImsTest;
+
+/* Callback class for radio ims response */
+class RadioImsResponse : public BnRadioImsResponse {
+ protected:
+ RadioServiceTest& parent_ims;
+
+ public:
+ RadioImsResponse(RadioServiceTest& parent_ims);
+ virtual ~RadioImsResponse() = default;
+
+ RadioResponseInfo rspInfo;
+ std::optional<ConnectionFailureInfo> startImsTrafficResp;
+
+ virtual ndk::ScopedAStatus setSrvccCallInfoResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus startImsTrafficResponse(
+ const RadioResponseInfo& info,
+ const std::optional<ConnectionFailureInfo>& response) override;
+
+ virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus triggerEpsFallbackResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus updateImsCallStatusResponse(const RadioResponseInfo& info) override;
+};
+
+/* Callback class for radio ims indication */
+class RadioImsIndication : public BnRadioImsIndication {
+ protected:
+ RadioServiceTest& parent_ims;
+
+ public:
+ RadioImsIndication(RadioServiceTest& parent_ims);
+ virtual ~RadioImsIndication() = default;
+
+ virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type,
+ int32_t token, const ConnectionFailureInfo& info) override;
+
+ virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, ImsStreamType mediaType,
+ ImsStreamDirection direction, int bitsPerSecond) override;
+
+ virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type,
+ ImsDeregistrationReason reason) override;
+};
+
+// The main test class for Radio AIDL Ims.
+class RadioImsTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
+ protected:
+ virtual void verifyError(RadioError resp);
+
+ public:
+ virtual void SetUp() override;
+
+ /* radio ims service handle */
+ std::shared_ptr<IRadioIms> radio_ims;
+ /* radio ims response handle */
+ std::shared_ptr<RadioImsResponse> radioRsp_ims;
+ /* radio ims indication handle */
+ std::shared_ptr<RadioImsIndication> radioInd_ims;
+};
diff --git a/radio/aidl/vts/radio_network_indication.cpp b/radio/aidl/vts/radio_network_indication.cpp
index 7acbff4..ae3bd4b 100644
--- a/radio/aidl/vts/radio_network_indication.cpp
+++ b/radio/aidl/vts/radio_network_indication.cpp
@@ -92,3 +92,8 @@
RadioTechnology /*rat*/) {
return ndk::ScopedAStatus::ok();
}
+
+ndk::ScopedAStatus RadioNetworkIndication::emergencyNetworkScanResult(
+ RadioIndicationType /*type*/, const EmergencyRegResult& /*result*/) {
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp
index 2292c54..5599c03 100644
--- a/radio/aidl/vts/radio_network_response.cpp
+++ b/radio/aidl/vts/radio_network_response.cpp
@@ -266,3 +266,30 @@
parent_network.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
+
+ndk::ScopedAStatus RadioNetworkResponse::setEmergencyModeResponse(
+ const RadioResponseInfo& info, const EmergencyRegResult& /*regState*/) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::triggerEmergencyNetworkScanResponse(
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::exitEmergencyModeResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioNetworkResponse::cancelEmergencyNetworkScanResponse(
+ const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent_network.notify(info.serial);
+ return ndk::ScopedAStatus::ok();
+}
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index c83571e..31f4aca 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -1499,11 +1499,12 @@
// Check for access technology specific info
AccessTechnologySpecificInfo info = radioRsp_network->dataRegResp.accessTechnologySpecificInfo;
RadioTechnology rat = radioRsp_network->dataRegResp.rat;
+
// TODO: add logic for cdmaInfo
if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) {
ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo);
} else if (rat == RadioTechnology::NR) {
- ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::ngranNrVopsInfo);
+ ASSERT_TRUE(info.getTag() == AccessTechnologySpecificInfo::ngranNrVopsInfo);
}
}
@@ -1833,3 +1834,83 @@
}
LOG(DEBUG) << "supplyNetworkDepersonalization finished";
}
+
+/*
+ * Test IRadioNetwork.setEmergencyMode() for the response returned.
+ */
+TEST_P(RadioNetworkTest, setEmergencyMode) {
+ LOG(DEBUG) << "setEmergencyMode";
+ serial = GetRandomSerialNumber();
+
+ radio_network->setEmergencyMode(serial, EmergencyMode::EMERGENCY_WWAN);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS}));
+ LOG(DEBUG) << "setEmergencyMode finished";
+}
+
+/*
+ * Test IRadioNetwork.triggerEmergencyNetworkScan() for the response returned.
+ */
+TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) {
+ LOG(DEBUG) << "triggerEmergencyNetworkScan";
+ serial = GetRandomSerialNumber();
+
+ EmergencyNetworkScanTrigger scanRequest;
+ scanRequest.accessNetwork = {AccessNetwork::EUTRAN};
+ scanRequest.scanType = EmergencyScanType::NO_PREFERENCE;
+
+ radio_network->triggerEmergencyNetworkScan(serial, scanRequest);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS}));
+ LOG(DEBUG) << "triggerEmergencyNetworkScan finished";
+}
+
+/*
+ * Test IRadioNetwork.cancelEmergencyNetworkScan() for the response returned.
+ */
+TEST_P(RadioNetworkTest, cancelEmergencyNetworkScan) {
+ LOG(DEBUG) << "cancelEmergencyNetworkScan";
+ serial = GetRandomSerialNumber();
+
+ radio_network->cancelEmergencyNetworkScan(serial, true);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR}));
+ LOG(DEBUG) << "cancelEmergencyNetworkScan finished";
+}
+
+/*
+ * Test IRadioNetwork.exitEmergencyMode() for the response returned.
+ */
+TEST_P(RadioNetworkTest, exitEmergencyMode) {
+ LOG(DEBUG) << "exitEmergencyMode";
+ serial = GetRandomSerialNumber();
+
+ radio_network->exitEmergencyMode(serial);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
+
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::MODEM_ERR}));
+ LOG(DEBUG) << "exitEmergencyMode finished";
+}
diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h
index 29f20e8..8480825 100644
--- a/radio/aidl/vts/radio_network_utils.h
+++ b/radio/aidl/vts/radio_network_utils.h
@@ -147,6 +147,17 @@
virtual ndk::ScopedAStatus supplyNetworkDepersonalizationResponse(
const RadioResponseInfo& info, int32_t remainingRetries) override;
+
+ virtual ndk::ScopedAStatus setEmergencyModeResponse(
+ const RadioResponseInfo& info, const EmergencyRegResult& regState) override;
+
+ virtual ndk::ScopedAStatus triggerEmergencyNetworkScanResponse(
+ const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus exitEmergencyModeResponse(const RadioResponseInfo& info) override;
+
+ virtual ndk::ScopedAStatus cancelEmergencyNetworkScanResponse(
+ const RadioResponseInfo& info) override;
};
/* Callback class for radio network indication */
@@ -201,6 +212,9 @@
virtual ndk::ScopedAStatus voiceRadioTechChanged(RadioIndicationType type,
RadioTechnology rat) override;
+
+ virtual ndk::ScopedAStatus emergencyNetworkScanResult(
+ RadioIndicationType type, const EmergencyRegResult& result) override;
};
// The main test class for Radio AIDL Network.
diff --git a/sensors/2.1/default/apex/apex_manifest.json b/sensors/2.1/default/apex/apex_manifest.json
deleted file mode 100644
index 47e45ee..0000000
--- a/sensors/2.1/default/apex/apex_manifest.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "com.android.hardware.sensors",
- "version": 1
-}
diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.rc b/sensors/2.1/default/apex/com.android.hardware.sensors.rc
deleted file mode 100644
index bd245b4..0000000
--- a/sensors/2.1/default/apex/com.android.hardware.sensors.rc
+++ /dev/null
@@ -1,7 +0,0 @@
-service vendor.sensors-hal-2-1-mock /apex/com.android.hardware.sensors/bin/hw/android.hardware.sensors@2.1-service.mock
- interface android.hardware.sensors@2.0::ISensors default
- interface android.hardware.sensors@2.1::ISensors default
- class hal
- user system
- group system
- rlimit rtprio 10 10
diff --git a/sensors/2.1/default/apex/file_contexts b/sensors/2.1/default/apex/file_contexts
deleted file mode 100644
index d0095c0..0000000
--- a/sensors/2.1/default/apex/file_contexts
+++ /dev/null
@@ -1,5 +0,0 @@
-(/.*)? u:object_r:vendor_file:s0
-# Permission XMLs
-/etc/permissions(/.*)? u:object_r:vendor_configs_file:s0
-# Service binary
-/bin/hw/android\.hardware\.sensors@2\.1-service\.mock u:object_r:hal_sensors_default_exec:s0
diff --git a/sensors/aidl/default/Android.bp b/sensors/aidl/default/Android.bp
index 49841a4..3c66744 100644
--- a/sensors/aidl/default/Android.bp
+++ b/sensors/aidl/default/Android.bp
@@ -23,6 +23,16 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
+filegroup {
+ name: "sensors-default.rc",
+ srcs: ["sensors-default.rc"],
+}
+
+filegroup {
+ name: "sensors-default.xml",
+ srcs: ["sensors-default.xml"],
+}
+
cc_library_static {
name: "libsensorsexampleimpl",
vendor: true,
@@ -47,8 +57,8 @@
cc_binary {
name: "android.hardware.sensors-service.example",
relative_install_path: "hw",
- init_rc: ["sensors-default.rc"],
- vintf_fragments: ["sensors-default.xml"],
+ init_rc: [":sensors-default.rc"],
+ vintf_fragments: [":sensors-default.xml"],
vendor: true,
shared_libs: [
"libbase",
diff --git a/sensors/2.1/default/apex/Android.bp b/sensors/aidl/default/apex/Android.bp
similarity index 78%
rename from sensors/2.1/default/apex/Android.bp
rename to sensors/aidl/default/apex/Android.bp
index 3345b92..ceb428b 100644
--- a/sensors/2.1/default/apex/Android.bp
+++ b/sensors/aidl/default/apex/Android.bp
@@ -13,9 +13,16 @@
certificate: "com.android.hardware.sensors",
}
+genrule {
+ name: "com.android.hardware.sensors.rc-gen",
+ srcs: [":sensors-default.rc"],
+ out: ["com.android.hardware.sensors.rc"],
+ cmd: "sed -E 's/\\/vendor/\\/apex\\/com.android.hardware.sensors/' $(in) > $(out)",
+}
+
prebuilt_etc {
name: "com.android.hardware.sensors.rc",
- src: "com.android.hardware.sensors.rc",
+ src: ":com.android.hardware.sensors.rc-gen",
installable: false,
}
@@ -31,7 +38,7 @@
updatable: false,
// Install the apex in /vendor/apex
soc_specific: true,
- binaries: ["android.hardware.sensors@2.1-service.mock"],
+ binaries: ["android.hardware.sensors-service.example"],
prebuilts: [
"com.android.hardware.sensors.rc",
"android.hardware.sensor.ambient_temperature.prebuilt.xml",
@@ -42,5 +49,5 @@
"android.hardware.sensor.proximity.prebuilt.xml",
"android.hardware.sensor.relative_humidity.prebuilt.xml",
],
- vintf_fragments: [":android.hardware.sensors@2.1.xml"],
+ vintf_fragments: [":sensors-default.xml"],
}
diff --git a/sensors/aidl/default/apex/apex_manifest.json b/sensors/aidl/default/apex/apex_manifest.json
new file mode 100644
index 0000000..659e739
--- /dev/null
+++ b/sensors/aidl/default/apex/apex_manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.hardware.sensors",
+ "version": 1
+}
diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.avbpubkey b/sensors/aidl/default/apex/com.android.hardware.sensors.avbpubkey
similarity index 100%
rename from sensors/2.1/default/apex/com.android.hardware.sensors.avbpubkey
rename to sensors/aidl/default/apex/com.android.hardware.sensors.avbpubkey
Binary files differ
diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.pem b/sensors/aidl/default/apex/com.android.hardware.sensors.pem
similarity index 100%
rename from sensors/2.1/default/apex/com.android.hardware.sensors.pem
rename to sensors/aidl/default/apex/com.android.hardware.sensors.pem
diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.pk8 b/sensors/aidl/default/apex/com.android.hardware.sensors.pk8
similarity index 100%
rename from sensors/2.1/default/apex/com.android.hardware.sensors.pk8
rename to sensors/aidl/default/apex/com.android.hardware.sensors.pk8
Binary files differ
diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.x509.pem b/sensors/aidl/default/apex/com.android.hardware.sensors.x509.pem
similarity index 100%
rename from sensors/2.1/default/apex/com.android.hardware.sensors.x509.pem
rename to sensors/aidl/default/apex/com.android.hardware.sensors.x509.pem
diff --git a/sensors/aidl/default/apex/file_contexts b/sensors/aidl/default/apex/file_contexts
new file mode 100644
index 0000000..27be16b
--- /dev/null
+++ b/sensors/aidl/default/apex/file_contexts
@@ -0,0 +1,5 @@
+(/.*)? u:object_r:vendor_file:s0
+# Permission XMLs
+/etc/permissions(/.*)? u:object_r:vendor_configs_file:s0
+# Service binary
+/bin/hw/android\.hardware\.sensors-service\.example u:object_r:hal_sensors_default_exec:s0
\ No newline at end of file
diff --git a/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc b/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc
index 3f91a0a..1edfbec 100644
--- a/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc
+++ b/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc
@@ -1,7 +1,7 @@
service vendor.sensors-hal-multihal /vendor/bin/hw/android.hardware.sensors-service.multihal
class hal
user system
- group system wakelock context_hub
+ group system wakelock context_hub input
task_profiles ServiceCapacityLow
capabilities BLOCK_SUSPEND
rlimit rtprio 10 10
\ No newline at end of file
diff --git a/tv/cec/aidl/TEST_MAPPING b/tv/cec/aidl/TEST_MAPPING
new file mode 100644
index 0000000..ef4bee1
--- /dev/null
+++ b/tv/cec/aidl/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+ "presubmit": [
+ {
+ "name": "VtsHalTvCecAidlTargetTest"
+ }
+ ]
+}
diff --git a/tv/cec/aidl/vts/functional/AndroidTest.xml b/tv/cec/aidl/vts/functional/AndroidTest.xml
new file mode 100644
index 0000000..8604147
--- /dev/null
+++ b/tv/cec/aidl/vts/functional/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2021 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.
+-->
+<configuration description="Runs VtsHalTvCecAidlTargetTest.">
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-native" />
+
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
+ </target_preparer>
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="VtsHalTvCecAidlTargetTest->/data/local/tmp/VtsHalTvCecAidlTargetTest" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="VtsHalTvCecAidlTargetTest" />
+ <option name="native-test-timeout" value="30m" />
+ </test>
+</configuration>
diff --git a/tv/hdmi/aidl/TEST_MAPPING b/tv/hdmi/aidl/TEST_MAPPING
new file mode 100644
index 0000000..6bd3b57
--- /dev/null
+++ b/tv/hdmi/aidl/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+ "presubmit": [
+ {
+ "name": "VtsHalTvHdmiAidlTargetTest"
+ }
+ ]
+}
diff --git a/tv/hdmi/aidl/vts/functional/AndroidTest.xml b/tv/hdmi/aidl/vts/functional/AndroidTest.xml
new file mode 100644
index 0000000..0640b2d
--- /dev/null
+++ b/tv/hdmi/aidl/vts/functional/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2021 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.
+-->
+<configuration description="Runs VtsHalTvHdmiAidlTargetTest.">
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-native" />
+
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
+ </target_preparer>
+
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="VtsHalTvHdmiAidlTargetTest->/data/local/tmp/VtsHalTvHdmiAidlTargetTest" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="VtsHalTvHdmiAidlTargetTest" />
+ <option name="native-test-timeout" value="30m" />
+ </test>
+</configuration>
diff --git a/tv/input/aidl/Android.bp b/tv/input/aidl/Android.bp
new file mode 100644
index 0000000..1987174
--- /dev/null
+++ b/tv/input/aidl/Android.bp
@@ -0,0 +1,27 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+aidl_interface {
+ name: "android.hardware.tv.input",
+ vendor_available: true,
+ srcs: ["android/hardware/tv/input/*.aidl"],
+ imports: [
+ "android.hardware.common-V2",
+ "android.media.audio.common.types-V1",
+ ],
+ stability: "vintf",
+ backend: {
+ java: {
+ sdk_version: "module_current",
+ },
+ cpp: {
+ enabled: false,
+ },
+ },
+}
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/CableConnectionStatus.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/CableConnectionStatus.aidl
new file mode 100644
index 0000000..a48bdb1
--- /dev/null
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/CableConnectionStatus.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.tv.input;
+@Backing(type="int") @VintfStability
+enum CableConnectionStatus {
+ UNKNOWN = 0,
+ CONNECTED = 1,
+ DISCONNECTED = 2,
+}
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl
new file mode 100644
index 0000000..f8d5e05
--- /dev/null
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.tv.input;
+@VintfStability
+interface ITvInput {
+ void closeStream(in int deviceId, in int streamId);
+ android.hardware.tv.input.TvStreamConfig[] getStreamConfigurations(in int deviceId);
+ android.hardware.common.NativeHandle openStream(in int deviceId, in int streamId);
+ void setCallback(in android.hardware.tv.input.ITvInputCallback callback);
+ const int STATUS_UNKNOWN = 1;
+ const int STATUS_NO_RESOURCE = 2;
+ const int STATUS_INVALID_ARGUMENTS = 3;
+ const int STATUS_INVALID_STATE = 4;
+}
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl
new file mode 100644
index 0000000..7f2aff6
--- /dev/null
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.tv.input;
+@VintfStability
+interface ITvInputCallback {
+ void notify(in android.hardware.tv.input.TvInputEvent event);
+}
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputDeviceInfo.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputDeviceInfo.aidl
new file mode 100644
index 0000000..d095146
--- /dev/null
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputDeviceInfo.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.tv.input;
+@VintfStability
+parcelable TvInputDeviceInfo {
+ int deviceId;
+ android.hardware.tv.input.TvInputType type;
+ int portId;
+ android.hardware.tv.input.CableConnectionStatus cableConnectionStatus;
+ android.media.audio.common.AudioDevice audioDevice;
+}
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEvent.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEvent.aidl
new file mode 100644
index 0000000..cfa8a34
--- /dev/null
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEvent.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.tv.input;
+@VintfStability
+parcelable TvInputEvent {
+ android.hardware.tv.input.TvInputEventType type;
+ android.hardware.tv.input.TvInputDeviceInfo deviceInfo;
+}
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEventType.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEventType.aidl
new file mode 100644
index 0000000..a9f518a
--- /dev/null
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEventType.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.tv.input;
+@Backing(type="int") @VintfStability
+enum TvInputEventType {
+ DEVICE_AVAILABLE = 1,
+ DEVICE_UNAVAILABLE = 2,
+ STREAM_CONFIGURATIONS_CHANGED = 3,
+}
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputType.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputType.aidl
new file mode 100644
index 0000000..7e44a7d
--- /dev/null
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputType.aidl
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.tv.input;
+@Backing(type="int") @VintfStability
+enum TvInputType {
+ OTHER = 1,
+ TUNER = 2,
+ COMPOSITE = 3,
+ SVIDEO = 4,
+ SCART = 5,
+ COMPONENT = 6,
+ VGA = 7,
+ DVI = 8,
+ HDMI = 9,
+ DISPLAY_PORT = 10,
+}
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvStreamConfig.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvStreamConfig.aidl
new file mode 100644
index 0000000..8378ff3
--- /dev/null
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvStreamConfig.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.tv.input;
+@VintfStability
+parcelable TvStreamConfig {
+ int streamId;
+ int maxVideoWidth;
+ int maxVideoHeight;
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/CableConnectionStatus.aidl b/tv/input/aidl/android/hardware/tv/input/CableConnectionStatus.aidl
new file mode 100644
index 0000000..64b79dd
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/CableConnectionStatus.aidl
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+/**
+ * Status of cable connection.
+ * This status is for devices having availability to detect the cable in a mechanical way,
+ * regardless of whether the connected external device is electrically on or not.
+ * If the device does not have such capability, you must use UNKNOWN.
+ */
+@VintfStability
+@Backing(type="int")
+enum CableConnectionStatus {
+ UNKNOWN = 0,
+ CONNECTED = 1,
+ DISCONNECTED = 2,
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl b/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl
new file mode 100644
index 0000000..31d6586
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+import android.hardware.common.NativeHandle;
+import android.hardware.tv.input.ITvInputCallback;
+import android.hardware.tv.input.TvStreamConfig;
+
+@VintfStability
+interface ITvInput {
+ /**
+ * ServiceSpecificException values for ITvInput requests
+ */
+ const int STATUS_UNKNOWN = 1;
+ const int STATUS_NO_RESOURCE = 2;
+ const int STATUS_INVALID_ARGUMENTS = 3;
+ const int STATUS_INVALID_STATE = 4;
+
+ /**
+ * Closes a specific stream in a device.
+ *
+ * @param deviceId Device ID for the stream to close.
+ * @param streamId Stream ID for the stream to close.
+ * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants
+ */
+ void closeStream(in int deviceId, in int streamId);
+
+ /**
+ * Gets stream configurations for a specific device.
+ *
+ * The configs object is valid only until the next
+ * STREAM_CONFIGURATIONS_CHANGED event.
+ *
+ * @param deviceId Device ID for the configurations.
+ * @return the array of available configurations.
+ * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants
+ */
+ TvStreamConfig[] getStreamConfigurations(in int deviceId);
+
+ /**
+ * Opens a specific stream in a device.
+ *
+ * @param deviceId Device ID for the stream to open.
+ * @param streamId Stream ID for the stream to open. Must be one of the
+ * stream IDs returned from getStreamConfigurations().
+ * @return the handle for sideband stream.
+ * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants
+ */
+ NativeHandle openStream(in int deviceId, in int streamId);
+
+ /**
+ * Sets a callback for events.
+ *
+ * Note that initially no device is available in the client side, so the
+ * implementation must notify all the currently available devices including
+ * static devices via callback once callback is set.
+ *
+ * @param callback Callback object to pass events.
+ * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants
+ */
+ void setCallback(in ITvInputCallback callback);
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl
new file mode 100644
index 0000000..fc7492d
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+import android.hardware.tv.input.TvInputEvent;
+
+@VintfStability
+interface ITvInputCallback {
+ /**
+ * Notifies the client that an event has occurred. For possible event types,
+ * check TvInputEventType.
+ *
+ * @param event Event passed to the client.
+ */
+ void notify(in TvInputEvent event);
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/TvInputDeviceInfo.aidl b/tv/input/aidl/android/hardware/tv/input/TvInputDeviceInfo.aidl
new file mode 100644
index 0000000..2782e90
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/TvInputDeviceInfo.aidl
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+import android.hardware.tv.input.CableConnectionStatus;
+import android.hardware.tv.input.TvInputType;
+import android.media.audio.common.AudioDevice;
+
+@VintfStability
+parcelable TvInputDeviceInfo {
+ int deviceId;
+ TvInputType type;
+
+ /* HDMI port ID number. e.g. 2 for HDMI 2. */
+ int portId;
+
+ /* Cable connection status. */
+ CableConnectionStatus cableConnectionStatus;
+
+ /* Audio device info. */
+ AudioDevice audioDevice;
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/TvInputEvent.aidl b/tv/input/aidl/android/hardware/tv/input/TvInputEvent.aidl
new file mode 100644
index 0000000..66ca7aa
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/TvInputEvent.aidl
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+import android.hardware.tv.input.TvInputDeviceInfo;
+import android.hardware.tv.input.TvInputEventType;
+
+@VintfStability
+parcelable TvInputEvent {
+ TvInputEventType type;
+
+ /**
+ * TvInputEventType::DEVICE_AVAILABLE: all fields are relevant.
+ * TvInputEventType::DEVICE_UNAVAILABLE: only deviceId is relevant.
+ * TvInputEventType::STREAM_CONFIGURATIONS_CHANGED: only deviceId is relevant.
+ */
+ TvInputDeviceInfo deviceInfo;
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/TvInputEventType.aidl b/tv/input/aidl/android/hardware/tv/input/TvInputEventType.aidl
new file mode 100644
index 0000000..fcbc3c2
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/TvInputEventType.aidl
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+@VintfStability
+@Backing(type="int")
+enum TvInputEventType {
+ /**
+ * Hardware notifies the framework that a device is available.
+ *
+ * Note that DEVICE_AVAILABLE and DEVICE_UNAVAILABLE events do not represent
+ * hotplug events (i.e. plugging cable into or out of the physical port).
+ * These events notify the framework whether the port is available or not.
+ * For a concrete example, when a user plugs in or pulls out the HDMI cable
+ * from a HDMI port, it does not generate DEVICE_AVAILABLE and/or
+ * DEVICE_UNAVAILABLE events. However, if a user inserts a pluggable USB
+ * tuner into the Android device, it must generate a DEVICE_AVAILABLE event
+ * and when the port is removed, it must generate a DEVICE_UNAVAILABLE
+ * event.
+ *
+ * For hotplug events, please see STREAM_CONFIGURATION_CHANGED for more
+ * details.
+ *
+ * HAL implementation must register devices by using this event when the
+ * device boots up. The framework must recognize device reported via this
+ * event only.
+ */
+ DEVICE_AVAILABLE = 1,
+
+ /**
+ * Hardware notifies the framework that a device is unavailable.
+ *
+ * HAL implementation must generate this event when a device registered
+ * by DEVICE_AVAILABLE is no longer available. For example,
+ * the event can indicate that a USB tuner is plugged out from the Android
+ * device.
+ *
+ * Note that this event is not for indicating cable plugged out of the port;
+ * for that purpose, the implementation must use
+ * STREAM_CONFIGURATION_CHANGED event. This event represents the port itself
+ * being no longer available.
+ */
+ DEVICE_UNAVAILABLE = 2,
+
+ /**
+ * Stream configurations are changed. Client must regard all open streams
+ * at the specific device are closed, and must call
+ * getStreamConfigurations() again, opening some of them if necessary.
+ *
+ * HAL implementation must generate this event when the available stream
+ * configurations change for any reason. A typical use case of this event
+ * is to notify the framework that the input signal has changed resolution,
+ * or that the cable is plugged out so that the number of available streams
+ * is 0.
+ *
+ * The implementation must use this event to indicate hotplug status of the
+ * port. the framework regards input devices with no available streams as
+ * disconnected, so the implementation can generate this event with no
+ * available streams to indicate that this device is disconnected, and vice
+ * versa.
+ */
+ STREAM_CONFIGURATIONS_CHANGED = 3,
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/TvInputType.aidl b/tv/input/aidl/android/hardware/tv/input/TvInputType.aidl
new file mode 100644
index 0000000..a0f8270
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/TvInputType.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+/**
+ * Type of physical TV input.
+ */
+@VintfStability
+@Backing(type="int")
+enum TvInputType {
+ OTHER = 1,
+ TUNER = 2,
+ COMPOSITE = 3,
+ SVIDEO = 4,
+ SCART = 5,
+ COMPONENT = 6,
+ VGA = 7,
+ DVI = 8,
+ HDMI = 9,
+ DISPLAY_PORT = 10,
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/TvStreamConfig.aidl b/tv/input/aidl/android/hardware/tv/input/TvStreamConfig.aidl
new file mode 100644
index 0000000..af86953
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/TvStreamConfig.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+@VintfStability
+parcelable TvStreamConfig {
+ int streamId;
+
+ /* Maximum video width in pixel. */
+ int maxVideoWidth;
+
+ /* Maximum video height in pixel. */
+ int maxVideoHeight;
+}
diff --git a/tv/input/aidl/default/Android.bp b/tv/input/aidl/default/Android.bp
new file mode 100644
index 0000000..66148c8
--- /dev/null
+++ b/tv/input/aidl/default/Android.bp
@@ -0,0 +1,31 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_binary {
+ name: "android.hardware.tv.input-service.example",
+ relative_install_path: "hw",
+ init_rc: ["input-default.rc"],
+ vintf_fragments: ["input-default.xml"],
+ vendor: true,
+ srcs: [
+ "TvInput.cpp",
+ "service.cpp",
+ ],
+ static_libs: [
+ "libaidlcommonsupport",
+ ],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libutils",
+ "libcutils",
+ "libbinder_ndk",
+ "android.hardware.tv.input-V1-ndk",
+ ],
+}
diff --git a/tv/input/aidl/default/TvInput.cpp b/tv/input/aidl/default/TvInput.cpp
new file mode 100644
index 0000000..ed12cbc
--- /dev/null
+++ b/tv/input/aidl/default/TvInput.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2022 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.
+ */
+
+#define LOG_TAG "android.hardware.tv.input-service.example"
+
+#include <utils/Log.h>
+
+#include "TvInput.h"
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace tv {
+namespace input {
+
+TvInput::TvInput() {}
+
+void TvInput::init() {
+ // Set up TvInputDeviceInfo and TvStreamConfig
+ mDeviceInfos[0] = shared_ptr<TvInputDeviceInfoWrapper>(
+ new TvInputDeviceInfoWrapper(0, TvInputType::TUNER, true));
+ mDeviceInfos[1] = shared_ptr<TvInputDeviceInfoWrapper>(
+ new TvInputDeviceInfoWrapper(1, TvInputType::HDMI, true));
+ mDeviceInfos[3] = shared_ptr<TvInputDeviceInfoWrapper>(
+ new TvInputDeviceInfoWrapper(3, TvInputType::DISPLAY_PORT, true));
+
+ mStreamConfigs[0] = {
+ {1, shared_ptr<TvStreamConfigWrapper>(new TvStreamConfigWrapper(1, 720, 1080, false))}};
+ mStreamConfigs[1] = {{11, shared_ptr<TvStreamConfigWrapper>(
+ new TvStreamConfigWrapper(11, 360, 480, false))}};
+ mStreamConfigs[3] = {{5, shared_ptr<TvStreamConfigWrapper>(
+ new TvStreamConfigWrapper(5, 1080, 1920, false))}};
+}
+
+::ndk::ScopedAStatus TvInput::setCallback(const shared_ptr<ITvInputCallback>& in_callback) {
+ ALOGV("%s", __FUNCTION__);
+
+ mCallback = in_callback;
+
+ TvInputEvent event;
+ event.type = TvInputEventType::DEVICE_AVAILABLE;
+
+ event.deviceInfo = mDeviceInfos[0]->deviceInfo;
+ mCallback->notify(event);
+
+ event.deviceInfo = mDeviceInfos[1]->deviceInfo;
+ mCallback->notify(event);
+
+ event.deviceInfo = mDeviceInfos[3]->deviceInfo;
+ mCallback->notify(event);
+
+ return ::ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus TvInput::getStreamConfigurations(int32_t in_deviceId,
+ vector<TvStreamConfig>* _aidl_return) {
+ ALOGV("%s", __FUNCTION__);
+
+ if (mStreamConfigs.count(in_deviceId) == 0) {
+ ALOGW("Device with id %d isn't available", in_deviceId);
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
+ }
+
+ for (auto const& iconfig : mStreamConfigs[in_deviceId]) {
+ _aidl_return->push_back(iconfig.second->streamConfig);
+ }
+
+ return ::ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus TvInput::openStream(int32_t in_deviceId, int32_t in_streamId,
+ NativeHandle* _aidl_return) {
+ ALOGV("%s", __FUNCTION__);
+
+ if (mStreamConfigs.count(in_deviceId) == 0 ||
+ mStreamConfigs[in_deviceId].count(in_streamId) == 0) {
+ ALOGW("Stream with device id %d, stream id %d isn't available", in_deviceId, in_streamId);
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
+ }
+ if (mStreamConfigs[in_deviceId][in_streamId]->isOpen) {
+ ALOGW("Stream with device id %d, stream id %d is already opened", in_deviceId, in_streamId);
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE);
+ }
+ mStreamConfigs[in_deviceId][in_streamId]->handle = createNativeHandle(in_streamId);
+ mStreamConfigs[in_deviceId][in_streamId]->isOpen = true;
+ *_aidl_return = makeToAidl(mStreamConfigs[in_deviceId][in_streamId]->handle);
+ return ::ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus TvInput::closeStream(int32_t in_deviceId, int32_t in_streamId) {
+ ALOGV("%s", __FUNCTION__);
+
+ if (mStreamConfigs.count(in_deviceId) == 0 ||
+ mStreamConfigs[in_deviceId].count(in_streamId) == 0) {
+ ALOGW("Stream with device id %d, stream id %d isn't available", in_deviceId, in_streamId);
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS);
+ }
+ if (!mStreamConfigs[in_deviceId][in_streamId]->isOpen) {
+ ALOGW("Stream with device id %d, stream id %d is already closed", in_deviceId, in_streamId);
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE);
+ }
+ releaseNativeHandle(mStreamConfigs[in_deviceId][in_streamId]->handle);
+ mStreamConfigs[in_deviceId][in_streamId]->handle = nullptr;
+ mStreamConfigs[in_deviceId][in_streamId]->isOpen = false;
+ return ::ndk::ScopedAStatus::ok();
+}
+
+native_handle_t* TvInput::createNativeHandle(int fd) {
+ native_handle_t* nativeHandle = native_handle_create(1, 0);
+ if (nativeHandle == nullptr) {
+ ALOGE("[TVInput] Failed to create native_handle %d", errno);
+ return nullptr;
+ }
+ if (nativeHandle->numFds > 0) {
+ nativeHandle->data[0] = dup(fd);
+ }
+ return nativeHandle;
+}
+
+void TvInput::releaseNativeHandle(native_handle_t* handle) {
+ native_handle_close(handle);
+ native_handle_delete(handle);
+}
+
+} // namespace input
+} // namespace tv
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/tv/input/aidl/default/TvInput.h b/tv/input/aidl/default/TvInput.h
new file mode 100644
index 0000000..a72bca3
--- /dev/null
+++ b/tv/input/aidl/default/TvInput.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2022 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/tv/input/BnTvInput.h>
+#include <utils/KeyedVector.h>
+
+#include <map>
+#include "TvInputDeviceInfoWrapper.h"
+#include "TvStreamConfigWrapper.h"
+
+using namespace android;
+using namespace std;
+using ::aidl::android::hardware::common::NativeHandle;
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace tv {
+namespace input {
+
+class TvInput : public BnTvInput {
+ public:
+ TvInput();
+
+ ::ndk::ScopedAStatus setCallback(const shared_ptr<ITvInputCallback>& in_callback) override;
+ ::ndk::ScopedAStatus getStreamConfigurations(int32_t in_deviceId,
+ vector<TvStreamConfig>* _aidl_return) override;
+ ::ndk::ScopedAStatus openStream(int32_t in_deviceId, int32_t in_streamId,
+ NativeHandle* _aidl_return) override;
+ ::ndk::ScopedAStatus closeStream(int32_t in_deviceId, int32_t in_streamId) override;
+
+ void init();
+
+ private:
+ native_handle_t* createNativeHandle(int fd);
+ void releaseNativeHandle(native_handle_t* handle);
+
+ shared_ptr<ITvInputCallback> mCallback;
+ map<int32_t, shared_ptr<TvInputDeviceInfoWrapper>> mDeviceInfos;
+ map<int32_t, map<int32_t, shared_ptr<TvStreamConfigWrapper>>> mStreamConfigs;
+};
+
+} // namespace input
+} // namespace tv
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/tv/input/aidl/default/TvInputDeviceInfoWrapper.h b/tv/input/aidl/default/TvInputDeviceInfoWrapper.h
new file mode 100644
index 0000000..d844cc8
--- /dev/null
+++ b/tv/input/aidl/default/TvInputDeviceInfoWrapper.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2022 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/tv/input/TvInputDeviceInfo.h>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace tv {
+namespace input {
+
+class TvInputDeviceInfoWrapper {
+ public:
+ TvInputDeviceInfoWrapper() {}
+ TvInputDeviceInfoWrapper(int32_t deviceId_, TvInputType type_, bool isAvailable_) {
+ deviceInfo.deviceId = deviceId_;
+ deviceInfo.type = type_;
+ isAvailable = isAvailable_;
+ }
+
+ TvInputDeviceInfo deviceInfo;
+ bool isAvailable;
+};
+} // namespace input
+} // namespace tv
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/tv/input/aidl/default/TvStreamConfigWrapper.h b/tv/input/aidl/default/TvStreamConfigWrapper.h
new file mode 100644
index 0000000..05c7ca3
--- /dev/null
+++ b/tv/input/aidl/default/TvStreamConfigWrapper.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2022 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/tv/input/TvStreamConfig.h>
+#include <aidlcommonsupport/NativeHandle.h>
+
+using namespace std;
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace tv {
+namespace input {
+
+class TvStreamConfigWrapper {
+ public:
+ TvStreamConfigWrapper() {}
+ TvStreamConfigWrapper(int32_t streamId_, int32_t maxVideoWidth_, int32_t maxVideoHeight_,
+ bool isOpen_) {
+ streamConfig.streamId = streamId_;
+ streamConfig.maxVideoWidth = maxVideoWidth_;
+ streamConfig.maxVideoHeight = maxVideoHeight_;
+ isOpen = isOpen_;
+ handle = nullptr;
+ }
+
+ TvStreamConfig streamConfig;
+ bool isOpen;
+ native_handle_t* handle;
+};
+} // namespace input
+} // namespace tv
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/tv/input/aidl/default/input-default.rc b/tv/input/aidl/default/input-default.rc
new file mode 100644
index 0000000..1958b5c
--- /dev/null
+++ b/tv/input/aidl/default/input-default.rc
@@ -0,0 +1,5 @@
+service vendor.input-default /vendor/bin/hw/android.hardware.tv.input-service.example
+ interface aidl android.hardware.tv.input.ITvInput/default
+ class hal
+ user system
+ group system
diff --git a/tv/input/aidl/default/input-default.xml b/tv/input/aidl/default/input-default.xml
new file mode 100644
index 0000000..38ba151
--- /dev/null
+++ b/tv/input/aidl/default/input-default.xml
@@ -0,0 +1,6 @@
+<manifest version="1.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.tv.input</name>
+ <fqname>ITvInput/default</fqname>
+ </hal>
+</manifest>
\ No newline at end of file
diff --git a/tv/input/aidl/default/service.cpp b/tv/input/aidl/default/service.cpp
new file mode 100644
index 0000000..1021206
--- /dev/null
+++ b/tv/input/aidl/default/service.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 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.
+ */
+
+#define LOG_TAG "android.hardware.tv.input-service.example"
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+#include <utils/Log.h>
+
+#include "TvInput.h"
+
+using ::aidl::android::hardware::tv::input::TvInput;
+
+int main() {
+ ABinderProcess_setThreadPoolMaxThreadCount(8);
+ std::shared_ptr<TvInput> tvInput = ndk::SharedRefBase::make<TvInput>();
+ tvInput->init();
+
+ const std::string instance = std::string() + TvInput::descriptor + "/default";
+ binder_status_t status =
+ AServiceManager_addService(tvInput->asBinder().get(), instance.c_str());
+ CHECK(status == STATUS_OK);
+
+ ABinderProcess_joinThreadPool();
+ return EXIT_FAILURE; // should not reached
+}
diff --git a/tv/input/aidl/vts/functional/Android.bp b/tv/input/aidl/vts/functional/Android.bp
new file mode 100644
index 0000000..9829b6d
--- /dev/null
+++ b/tv/input/aidl/vts/functional/Android.bp
@@ -0,0 +1,29 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_test {
+ name: "VtsHalTvInputTargetTest",
+ defaults: ["VtsHalTargetTestDefaults","use_libaidlvintf_gtest_helper_static",],
+ srcs: ["VtsHalTvInputTargetTest.cpp"],
+ static_libs: [
+ "android.hardware.tv.input-V1-ndk",
+ "android.media.audio.common.types-V1-ndk",
+ "android.hardware.common-V2-ndk",
+ "libaidlcommonsupport",
+ ],
+ test_suites: [
+ "general-tests",
+ "vts",
+ ],
+ shared_libs: [
+ "libbinder_ndk",
+ "libvndksupport",
+ ],
+ require_root: true,
+}
diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp
new file mode 100644
index 0000000..ec83e29
--- /dev/null
+++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2022 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.
+ */
+
+#include "VtsHalTvInputTargetTest.h"
+
+#include <android-base/properties.h>
+#include <android/binder_ibinder.h>
+#include <android/binder_process.h>
+#include <android/binder_status.h>
+
+using namespace VtsHalTvInputTargetTest;
+
+TvInputAidlTest::TvInputCallback::TvInputCallback(shared_ptr<TvInputAidlTest> parent)
+ : parent_(parent) {}
+
+::ndk::ScopedAStatus TvInputAidlTest::TvInputCallback::notify(const TvInputEvent& in_event) {
+ unique_lock<mutex> lock(parent_->mutex_);
+
+ switch (in_event.type) {
+ case TvInputEventType::DEVICE_AVAILABLE:
+ parent_->onDeviceAvailable(in_event.deviceInfo);
+ break;
+ case TvInputEventType::DEVICE_UNAVAILABLE:
+ parent_->onDeviceUnavailable(in_event.deviceInfo.deviceId);
+ break;
+ case TvInputEventType::STREAM_CONFIGURATIONS_CHANGED:
+ parent_->onStreamConfigurationsChanged(in_event.deviceInfo.deviceId);
+ break;
+ }
+ return ::ndk::ScopedAStatus::ok();
+}
+
+void TvInputAidlTest::SetUp() {
+ if (AServiceManager_isDeclared(GetParam().c_str())) {
+ ::ndk::SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str()));
+ tv_input_ = ITvInput::fromBinder(binder);
+ } else {
+ tv_input_ = nullptr;
+ }
+ ASSERT_NE(tv_input_, nullptr);
+
+ tv_input_callback_ =
+ ::ndk::SharedRefBase::make<TvInputCallback>(shared_ptr<TvInputAidlTest>(this));
+ ASSERT_NE(tv_input_callback_, nullptr);
+
+ tv_input_->setCallback(tv_input_callback_);
+ // All events received within the timeout should be handled.
+ sleep(WAIT_FOR_EVENT_TIMEOUT);
+}
+
+void TvInputAidlTest::TearDown() {
+ tv_input_ = nullptr;
+}
+
+void TvInputAidlTest::onDeviceAvailable(const TvInputDeviceInfo& deviceInfo) {
+ ALOGD("onDeviceAvailable for device id %d", deviceInfo.deviceId);
+ device_info_.add(deviceInfo.deviceId, deviceInfo);
+}
+
+void TvInputAidlTest::onDeviceUnavailable(int32_t deviceId) {
+ ALOGD("onDeviceUnavailable for device id %d", deviceId);
+ device_info_.removeItem(deviceId);
+ stream_config_.removeItem(deviceId);
+}
+
+::ndk::ScopedAStatus TvInputAidlTest::onStreamConfigurationsChanged(int32_t deviceId) {
+ ALOGD("onStreamConfigurationsChanged for device id %d", deviceId);
+ return updateStreamConfigurations(deviceId);
+}
+
+::ndk::ScopedAStatus TvInputAidlTest::updateStreamConfigurations(int32_t deviceId) {
+ stream_config_.removeItem(deviceId);
+ vector<TvStreamConfig> list;
+ ::ndk::ScopedAStatus status = tv_input_->getStreamConfigurations(deviceId, &list);
+ if (status.isOk()) {
+ stream_config_.add(deviceId, list);
+ }
+ return status;
+}
+
+void TvInputAidlTest::updateAllStreamConfigurations() {
+ for (size_t i = 0; i < device_info_.size(); i++) {
+ int32_t device_id = device_info_.keyAt(i);
+ updateStreamConfigurations(device_id);
+ }
+}
+
+vector<size_t> TvInputAidlTest::getConfigIndices() {
+ vector<size_t> indices;
+ for (size_t i = 0; i < stream_config_.size(); i++) {
+ if (stream_config_.valueAt(i).size() != 0) {
+ indices.push_back(i);
+ }
+ }
+ return indices;
+}
+
+int32_t TvInputAidlTest::getNumNotIn(vector<int32_t>& nums) {
+ int32_t result = DEFAULT_ID;
+ int32_t size = static_cast<int32_t>(nums.size());
+ for (int32_t i = 0; i < size; i++) {
+ // Put every element to its target position, if possible.
+ int32_t target_pos = nums[i];
+ while (target_pos >= 0 && target_pos < size && i != target_pos &&
+ nums[i] != nums[target_pos]) {
+ swap(nums[i], nums[target_pos]);
+ target_pos = nums[i];
+ }
+ }
+
+ for (int32_t i = 0; i < size; i++) {
+ if (nums[i] != i) {
+ return i;
+ }
+ }
+ return result;
+}
+
+/*
+ * GetStreamConfigTest:
+ * Calls updateStreamConfigurations() for each existing device
+ * Checks returned results
+ */
+TEST_P(TvInputAidlTest, GetStreamConfigTest) {
+ unique_lock<mutex> lock(mutex_);
+
+ for (size_t i = 0; i < device_info_.size(); i++) {
+ int32_t device_id = device_info_.keyAt(i);
+ ALOGD("GetStreamConfigTest: device_id=%d", device_id);
+ ASSERT_TRUE(updateStreamConfigurations(device_id).isOk());
+ }
+}
+
+/*
+ * OpenAndCloseStreamTest:
+ * Calls openStream() and then closeStream() for each existing stream
+ * Checks returned results
+ */
+TEST_P(TvInputAidlTest, OpenAndCloseStreamTest) {
+ unique_lock<mutex> lock(mutex_);
+
+ updateAllStreamConfigurations();
+
+ for (size_t j = 0; j < stream_config_.size(); j++) {
+ int32_t device_id = stream_config_.keyAt(j);
+ vector<TvStreamConfig> config = stream_config_.valueAt(j);
+ for (size_t i = 0; i < config.size(); i++) {
+ int32_t stream_id = config[i].streamId;
+ ALOGD("OpenAndCloseStreamTest: open stream, device_id=%d, stream_id=%d", device_id,
+ stream_id);
+ ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).isOk());
+ ALOGD("OpenAndCloseStreamTest: close stream, device_id=%d, stream_id=%d", device_id,
+ stream_id);
+ ASSERT_TRUE(tv_input_->closeStream(device_id, stream_id).isOk());
+ }
+ }
+}
+
+/*
+ * InvalidDeviceIdTest:
+ * Calls updateStreamConfigurations(), openStream(), and closeStream()
+ * for a non-existing device
+ * Checks returned results
+ * The results should be ITvInput::STATUS_INVALID_ARGUMENTS
+ */
+TEST_P(TvInputAidlTest, InvalidDeviceIdTest) {
+ unique_lock<mutex> lock(mutex_);
+
+ vector<int32_t> device_ids;
+ for (size_t i = 0; i < device_info_.size(); i++) {
+ device_ids.push_back(device_info_.keyAt(i));
+ }
+ // Get a non-existing device ID.
+ int32_t id = getNumNotIn(device_ids);
+ ALOGD("InvalidDeviceIdTest: update stream config, device_id=%d", id);
+ ASSERT_TRUE(updateStreamConfigurations(id).getServiceSpecificError() ==
+ ITvInput::STATUS_INVALID_ARGUMENTS);
+
+ int32_t stream_id = 0;
+
+ ALOGD("InvalidDeviceIdTest: open stream, device_id=%d, stream_id=%d", id, stream_id);
+ ASSERT_TRUE(tv_input_->openStream(id, stream_id, &handle_).getServiceSpecificError() ==
+ ITvInput::STATUS_INVALID_ARGUMENTS);
+
+ ALOGD("InvalidDeviceIdTest: close stream, device_id=%d, stream_id=%d", id, stream_id);
+ ASSERT_TRUE(tv_input_->closeStream(id, stream_id).getServiceSpecificError() ==
+ ITvInput::STATUS_INVALID_ARGUMENTS);
+}
+
+/*
+ * InvalidStreamIdTest:
+ * Calls openStream(), and closeStream() for a non-existing stream
+ * Checks returned results
+ * The results should be ITvInput::STATUS_INVALID_ARGUMENTS
+ */
+TEST_P(TvInputAidlTest, InvalidStreamIdTest) {
+ unique_lock<mutex> lock(mutex_);
+
+ if (device_info_.isEmpty()) {
+ return;
+ }
+ updateAllStreamConfigurations();
+
+ int32_t device_id = device_info_.keyAt(0);
+ // Get a non-existing stream ID.
+ int32_t id = DEFAULT_ID;
+ if (stream_config_.indexOfKey(device_id) >= 0) {
+ vector<int32_t> stream_ids;
+ vector<TvStreamConfig> config = stream_config_.valueFor(device_id);
+ for (size_t i = 0; i < config.size(); i++) {
+ stream_ids.push_back(config[i].streamId);
+ }
+ id = getNumNotIn(stream_ids);
+ }
+
+ ALOGD("InvalidStreamIdTest: open stream, device_id=%d, stream_id=%d", device_id, id);
+ ASSERT_TRUE(tv_input_->openStream(device_id, id, &handle_).getServiceSpecificError() ==
+ ITvInput::STATUS_INVALID_ARGUMENTS);
+
+ ALOGD("InvalidStreamIdTest: close stream, device_id=%d, stream_id=%d", device_id, id);
+ ASSERT_TRUE(tv_input_->closeStream(device_id, id).getServiceSpecificError() ==
+ ITvInput::STATUS_INVALID_ARGUMENTS);
+}
+
+/*
+ * OpenAnOpenedStreamsTest:
+ * Calls openStream() twice for a stream (if any)
+ * Checks returned results
+ * The result of the second call should be ITvInput::STATUS_INVALID_STATE
+ */
+TEST_P(TvInputAidlTest, OpenAnOpenedStreamsTest) {
+ unique_lock<mutex> lock(mutex_);
+
+ updateAllStreamConfigurations();
+ vector<size_t> indices = getConfigIndices();
+ if (indices.empty()) {
+ return;
+ }
+ int32_t device_id = stream_config_.keyAt(indices[0]);
+ int32_t stream_id = stream_config_.valueAt(indices[0])[0].streamId;
+
+ ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id);
+ ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).isOk());
+
+ ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id);
+ ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).getServiceSpecificError() ==
+ ITvInput::STATUS_INVALID_STATE);
+
+ // close stream as subsequent tests assume no open streams
+ ALOGD("OpenAnOpenedStreamsTest: close stream, device_id=%d, stream_id=%d", device_id,
+ stream_id);
+ ASSERT_TRUE(tv_input_->closeStream(device_id, stream_id).isOk());
+}
+
+/*
+ * CloseStreamBeforeOpenTest:
+ * Calls closeStream() without calling openStream() for a stream (if any)
+ * Checks the returned result
+ * The result should be ITvInput::STATUS_INVALID_STATE
+ */
+TEST_P(TvInputAidlTest, CloseStreamBeforeOpenTest) {
+ unique_lock<mutex> lock(mutex_);
+
+ updateAllStreamConfigurations();
+ vector<size_t> indices = getConfigIndices();
+ if (indices.empty()) {
+ return;
+ }
+ int32_t device_id = stream_config_.keyAt(indices[0]);
+ int32_t stream_id = stream_config_.valueAt(indices[0])[0].streamId;
+
+ ALOGD("CloseStreamBeforeOpenTest: close stream, device_id=%d, stream_id=%d", device_id,
+ stream_id);
+ ASSERT_TRUE(tv_input_->closeStream(device_id, stream_id).getServiceSpecificError() ==
+ ITvInput::STATUS_INVALID_STATE);
+}
+
+INSTANTIATE_TEST_SUITE_P(PerInstance, TvInputAidlTest,
+ testing::ValuesIn(android::getAidlHalInstanceNames(ITvInput::descriptor)),
+ android::PrintInstanceNameToString);
+
+// TODO remove from the allow list once the cf tv target is enabled for testing
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TvInputAidlTest);
diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h
new file mode 100644
index 0000000..c76e568
--- /dev/null
+++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2022 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.
+ */
+
+#pragma once
+
+#include <android/binder_manager.h>
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+
+#include <aidl/android/hardware/tv/input/BnTvInputCallback.h>
+#include <aidl/android/hardware/tv/input/ITvInput.h>
+#include <aidl/android/hardware/tv/input/TvInputDeviceInfo.h>
+#include <aidl/android/hardware/tv/input/TvInputEvent.h>
+#include <aidl/android/hardware/tv/input/TvStreamConfig.h>
+
+#include <log/log.h>
+#include <utils/KeyedVector.h>
+
+using namespace aidl::android::hardware::tv::input;
+using namespace std;
+
+using ::aidl::android::hardware::common::NativeHandle;
+
+#define WAIT_FOR_EVENT_TIMEOUT 5
+#define DEFAULT_ID INT32_MIN
+
+namespace VtsHalTvInputTargetTest {
+
+class TvInputAidlTest : public testing::TestWithParam<string> {
+ public:
+ class TvInputCallback : public BnTvInputCallback {
+ public:
+ TvInputCallback(shared_ptr<TvInputAidlTest> parent);
+ ::ndk::ScopedAStatus notify(const TvInputEvent& in_event) override;
+
+ private:
+ shared_ptr<TvInputAidlTest> parent_;
+ };
+
+ virtual void SetUp() override;
+ virtual void TearDown() override;
+
+ /* Called when a DEVICE_AVAILABLE event is received. */
+ void onDeviceAvailable(const TvInputDeviceInfo& deviceInfo);
+
+ /* Called when a DEVICE_UNAVAILABLE event is received. */
+ void onDeviceUnavailable(int32_t deviceId);
+
+ /* Called when a STREAM_CONFIGURATIONS_CHANGED event is received. */
+ ::ndk::ScopedAStatus onStreamConfigurationsChanged(int32_t deviceId);
+
+ /* Gets and updates the stream configurations for a device. */
+ ::ndk::ScopedAStatus updateStreamConfigurations(int32_t deviceId);
+
+ /* Gets and updates the stream configurations for all existing devices. */
+ void updateAllStreamConfigurations();
+
+ /* Returns a list of indices of stream_config_ whose corresponding values are not empty. */
+ vector<size_t> getConfigIndices();
+
+ /*
+ * Returns DEFAULT_ID if there is no missing integer in the range [0, the size of nums).
+ * Otherwise, returns the smallest missing non-negative integer.
+ */
+ int32_t getNumNotIn(vector<int32_t>& nums);
+
+ protected:
+ shared_ptr<ITvInput> tv_input_;
+ shared_ptr<TvInputCallback> tv_input_callback_;
+ android::KeyedVector<int32_t, TvInputDeviceInfo> device_info_;
+ android::KeyedVector<int32_t, vector<TvStreamConfig>> stream_config_;
+ mutex mutex_;
+ NativeHandle handle_;
+};
+
+} // namespace VtsHalTvInputTargetTest
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IDvr.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IDvr.aidl
index 450cd79..4648712 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IDvr.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IDvr.aidl
@@ -43,4 +43,5 @@
void stop();
void flush();
void close();
+ void setStatusCheckIntervalHint(in long milliseconds);
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/IDvr.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/IDvr.aidl
index 0534f9d..4cb5b15 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/IDvr.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/IDvr.aidl
@@ -18,7 +18,6 @@
import android.hardware.common.fmq.MQDescriptor;
import android.hardware.common.fmq.SynchronizedReadWrite;
-
import android.hardware.tv.tuner.DvrSettings;
import android.hardware.tv.tuner.IFilter;
@@ -101,4 +100,12 @@
* instance any more and all methods should return a failure.
*/
void close();
+
+ /**
+ * Set status check time interval.
+ *
+ * This time interval hint will be used by the Dvr to decide how often
+ * to evaluate data.
+ */
+ void setStatusCheckIntervalHint(in long milliseconds);
}
diff --git a/tv/tuner/aidl/default/Android.bp b/tv/tuner/aidl/default/Android.bp
index cb8f87b..65fa821 100644
--- a/tv/tuner/aidl/default/Android.bp
+++ b/tv/tuner/aidl/default/Android.bp
@@ -7,10 +7,9 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
-cc_binary {
- name: "android.hardware.tv.tuner-service.example",
+cc_defaults {
+ name: "tuner_hal_example_defaults",
relative_install_path: "hw",
- init_rc: ["tuner-default.rc"],
vintf_fragments: ["tuner-default.xml"],
vendor: true,
compile_multilib: "first",
@@ -30,7 +29,7 @@
],
shared_libs: [
"android.hardware.common.fmq-V1-ndk",
- "android.hardware.tv.tuner-V1-ndk",
+ "android.hardware.tv.tuner-V2-ndk",
"libbase",
"libbinder_ndk",
"libcutils",
@@ -44,3 +43,18 @@
"media_plugin_headers",
],
}
+
+cc_binary {
+ name: "android.hardware.tv.tuner-service.example",
+ defaults: ["tuner_hal_example_defaults"],
+ init_rc: ["tuner-default.rc"],
+}
+
+cc_binary {
+ name: "android.hardware.tv.tuner-service.example-lazy",
+ defaults: ["tuner_hal_example_defaults"],
+ init_rc: ["tuner-default-lazy.rc"],
+ cflags: [
+ "-DLAZY_HAL",
+ ],
+}
diff --git a/tv/tuner/aidl/default/Demux.cpp b/tv/tuner/aidl/default/Demux.cpp
index a94b4ad..60fd899 100644
--- a/tv/tuner/aidl/default/Demux.cpp
+++ b/tv/tuner/aidl/default/Demux.cpp
@@ -37,6 +37,7 @@
}
Demux::~Demux() {
+ ALOGV("%s", __FUNCTION__);
close();
}
@@ -180,7 +181,10 @@
mRecordFilterIds.clear();
mFilters.clear();
mLastUsedFilterId = -1;
- mTuner->removeDemux(mDemuxId);
+ if (mTuner != nullptr) {
+ mTuner->removeDemux(mDemuxId);
+ mTuner = nullptr;
+ }
return ::ndk::ScopedAStatus::ok();
}
diff --git a/tv/tuner/aidl/default/Dvr.cpp b/tv/tuner/aidl/default/Dvr.cpp
index c591d07..c9dd8ee 100644
--- a/tv/tuner/aidl/default/Dvr.cpp
+++ b/tv/tuner/aidl/default/Dvr.cpp
@@ -154,6 +154,14 @@
return ::ndk::ScopedAStatus::ok();
}
+::ndk::ScopedAStatus Dvr::setStatusCheckIntervalHint(int64_t /* in_milliseconds */) {
+ ALOGV("%s", __FUNCTION__);
+
+ // There is no active polling in this default implementation,
+ // so directly return ok here.
+ return ::ndk::ScopedAStatus::ok();
+}
+
bool Dvr::createDvrMQ() {
ALOGV("%s", __FUNCTION__);
@@ -427,7 +435,7 @@
map<int64_t, std::shared_ptr<IFilter>>::iterator it;
// Handle the output data per filter type
for (it = mFilters.begin(); it != mFilters.end(); it++) {
- if (mDemux->startFilterHandler(it->first).isOk()) {
+ if (!mDemux->startFilterHandler(it->first).isOk()) {
return false;
}
}
diff --git a/tv/tuner/aidl/default/Dvr.h b/tv/tuner/aidl/default/Dvr.h
index 6ff71cd..293c533 100644
--- a/tv/tuner/aidl/default/Dvr.h
+++ b/tv/tuner/aidl/default/Dvr.h
@@ -70,6 +70,7 @@
::ndk::ScopedAStatus stop() override;
::ndk::ScopedAStatus flush() override;
::ndk::ScopedAStatus close() override;
+ ::ndk::ScopedAStatus setStatusCheckIntervalHint(int64_t in_milliseconds) override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp
index 769ebe2..ade265c 100644
--- a/tv/tuner/aidl/default/Filter.cpp
+++ b/tv/tuner/aidl/default/Filter.cpp
@@ -432,12 +432,12 @@
if (mSharedAvMemHandle != nullptr) {
*out_avMemory = ::android::dupToAidl(mSharedAvMemHandle);
- *_aidl_return = BUFFER_SIZE_16M;
+ *_aidl_return = BUFFER_SIZE;
mUsingSharedAvMem = true;
return ::ndk::ScopedAStatus::ok();
}
- int av_fd = createAvIonFd(BUFFER_SIZE_16M);
+ int av_fd = createAvIonFd(BUFFER_SIZE);
if (av_fd < 0) {
return ::ndk::ScopedAStatus::fromServiceSpecificError(
static_cast<int32_t>(Result::OUT_OF_MEMORY));
@@ -454,7 +454,7 @@
mUsingSharedAvMem = true;
*out_avMemory = ::android::dupToAidl(mSharedAvMemHandle);
- *_aidl_return = BUFFER_SIZE_16M;
+ *_aidl_return = BUFFER_SIZE;
return ::ndk::ScopedAStatus::ok();
}
@@ -793,7 +793,8 @@
}
if (prefix == 0x000001) {
// TODO handle mulptiple Pes filters
- mPesSizeLeft = (mFilterOutput[i + 8] << 8) | mFilterOutput[i + 9];
+ mPesSizeLeft = (static_cast<uint8_t>(mFilterOutput[i + 8]) << 8) |
+ static_cast<uint8_t>(mFilterOutput[i + 9]);
mPesSizeLeft += 6;
if (DEBUG_FILTER) {
ALOGD("[Filter] pes data length %d", mPesSizeLeft);
@@ -803,7 +804,7 @@
}
}
- int endPoint = min(184, mPesSizeLeft);
+ uint32_t endPoint = min(184u, mPesSizeLeft);
// append data and check size
vector<int8_t>::const_iterator first = mFilterOutput.begin() + i + 4;
vector<int8_t>::const_iterator last = mFilterOutput.begin() + i + 4 + endPoint;
@@ -852,11 +853,17 @@
return ::ndk::ScopedAStatus::ok();
}
+// Read PES (Packetized Elementary Stream) Packets from TransportStreams
+// as defined in ISO/IEC 13818-1 Section 2.4.3.6. Create MediaEvents
+// containing only their data without TS or PES headers.
::ndk::ScopedAStatus Filter::startMediaFilterHandler() {
if (mFilterOutput.empty()) {
return ::ndk::ScopedAStatus::ok();
}
+ // mPts being set before our MediaFilterHandler begins indicates that all
+ // metadata has already been handled. We can therefore create an event
+ // with the existing data. This method is used when processing ES files.
::ndk::ScopedAStatus result;
if (mPts) {
result = createMediaFilterEventWithIon(mFilterOutput);
@@ -867,16 +874,38 @@
}
for (int i = 0; i < mFilterOutput.size(); i += 188) {
+ // Every packet has a 4 Byte TS Header preceding it
+ uint32_t headerSize = 4;
+
if (mPesSizeLeft == 0) {
- uint32_t prefix = (mFilterOutput[i + 4] << 16) | (mFilterOutput[i + 5] << 8) |
- mFilterOutput[i + 6];
+ // Packet Start Code Prefix is defined as the first 3 bytes of
+ // the PES Header and should always have the value 0x000001
+ uint32_t prefix = (static_cast<uint8_t>(mFilterOutput[i + 4]) << 16) |
+ (static_cast<uint8_t>(mFilterOutput[i + 5]) << 8) |
+ static_cast<uint8_t>(mFilterOutput[i + 6]);
if (DEBUG_FILTER) {
ALOGD("[Filter] prefix %d", prefix);
}
if (prefix == 0x000001) {
- // TODO handle mulptiple Pes filters
- mPesSizeLeft = (mFilterOutput[i + 8] << 8) | mFilterOutput[i + 9];
- mPesSizeLeft += 6;
+ // TODO handle multiple Pes filters
+ // Location of PES fields from ISO/IEC 13818-1 Section 2.4.3.6
+ mPesSizeLeft = (static_cast<uint8_t>(mFilterOutput[i + 8]) << 8) |
+ static_cast<uint8_t>(mFilterOutput[i + 9]);
+ bool hasPts = static_cast<uint8_t>(mFilterOutput[i + 11]) & 0x80;
+ uint8_t optionalFieldsLength = static_cast<uint8_t>(mFilterOutput[i + 12]);
+ headerSize += 9 + optionalFieldsLength;
+
+ if (hasPts) {
+ // Pts is a 33-bit field which is stored across 5 bytes, with
+ // bits in between as reserved fields which must be ignored
+ mPts = 0;
+ mPts |= (static_cast<uint8_t>(mFilterOutput[i + 13]) & 0x0e) << 29;
+ mPts |= (static_cast<uint8_t>(mFilterOutput[i + 14]) & 0xff) << 22;
+ mPts |= (static_cast<uint8_t>(mFilterOutput[i + 15]) & 0xfe) << 14;
+ mPts |= (static_cast<uint8_t>(mFilterOutput[i + 16]) & 0xff) << 7;
+ mPts |= (static_cast<uint8_t>(mFilterOutput[i + 17]) & 0xfe) >> 1;
+ }
+
if (DEBUG_FILTER) {
ALOGD("[Filter] pes data length %d", mPesSizeLeft);
}
@@ -885,10 +914,10 @@
}
}
- int endPoint = min(184, mPesSizeLeft);
+ uint32_t endPoint = min(188u - headerSize, mPesSizeLeft);
// append data and check size
- vector<int8_t>::const_iterator first = mFilterOutput.begin() + i + 4;
- vector<int8_t>::const_iterator last = mFilterOutput.begin() + i + 4 + endPoint;
+ vector<int8_t>::const_iterator first = mFilterOutput.begin() + i + headerSize;
+ vector<int8_t>::const_iterator last = mFilterOutput.begin() + i + headerSize + endPoint;
mPesOutput.insert(mPesOutput.end(), first, last);
// size does not match then continue
mPesSizeLeft -= endPoint;
@@ -900,7 +929,8 @@
}
result = createMediaFilterEventWithIon(mPesOutput);
- if (result.isOk()) {
+ if (!result.isOk()) {
+ mFilterOutput.clear();
return result;
}
}
@@ -961,24 +991,65 @@
return ::ndk::ScopedAStatus::ok();
}
+// Read PSI (Program Specific Information) Sections from TransportStreams
+// as defined in ISO/IEC 13818-1 Section 2.4.4
bool Filter::writeSectionsAndCreateEvent(vector<int8_t>& data) {
// TODO check how many sections has been read
ALOGD("[Filter] section handler");
- if (!writeDataToFilterMQ(data)) {
- return false;
- }
- DemuxFilterSectionEvent secEvent;
- secEvent = {
- // temp dump meta data
- .tableId = 0,
- .version = 1,
- .sectionNum = 1,
- .dataLength = static_cast<int32_t>(data.size()),
- };
- {
- std::lock_guard<std::mutex> lock(mFilterEventsLock);
- mFilterEvents.push_back(DemuxFilterEvent::make<DemuxFilterEvent::Tag::section>(secEvent));
+ // Transport Stream Packets are 188 bytes long, as defined in the
+ // Introduction of ISO/IEC 13818-1
+ for (int i = 0; i < data.size(); i += 188) {
+ if (mSectionSizeLeft == 0) {
+ // Location for sectionSize as defined by Section 2.4.4
+ // Note that the first 4 bytes skipped are the TsHeader
+ mSectionSizeLeft = ((static_cast<uint8_t>(data[i + 5]) & 0x0f) << 8) |
+ static_cast<uint8_t>(data[i + 6]);
+ mSectionSizeLeft += 3;
+ if (DEBUG_FILTER) {
+ ALOGD("[Filter] section data length %d", mSectionSizeLeft);
+ }
+ }
+
+ // 184 bytes per packet is derived by subtracting the 4 byte length of
+ // the TsHeader from its 188 byte packet size
+ uint32_t endPoint = min(184u, mSectionSizeLeft);
+ // append data and check size
+ vector<int8_t>::const_iterator first = data.begin() + i + 4;
+ vector<int8_t>::const_iterator last = data.begin() + i + 4 + endPoint;
+ mSectionOutput.insert(mSectionOutput.end(), first, last);
+ // size does not match then continue
+ mSectionSizeLeft -= endPoint;
+ if (DEBUG_FILTER) {
+ ALOGD("[Filter] section data left %d", mSectionSizeLeft);
+ }
+ if (mSectionSizeLeft > 0) {
+ continue;
+ }
+
+ if (!writeDataToFilterMQ(mSectionOutput)) {
+ mSectionOutput.clear();
+ return false;
+ }
+
+ DemuxFilterSectionEvent secEvent;
+ secEvent = {
+ // temp dump meta data
+ .tableId = 0,
+ .version = 1,
+ .sectionNum = 1,
+ .dataLength = static_cast<int32_t>(mSectionOutput.size()),
+ };
+ if (DEBUG_FILTER) {
+ ALOGD("[Filter] assembled section data length %" PRIu64, secEvent.dataLength);
+ }
+
+ {
+ std::lock_guard<std::mutex> lock(mFilterEventsLock);
+ mFilterEvents.push_back(
+ DemuxFilterEvent::make<DemuxFilterEvent::Tag::section>(secEvent));
+ }
+ mSectionOutput.clear();
}
return true;
@@ -1168,7 +1239,7 @@
mediaEvent.isPesPrivateData = true;
mediaEvent.extraMetaData.set<DemuxFilterMediaEventExtraMetaData::Tag::audio>(audio);
- int av_fd = createAvIonFd(BUFFER_SIZE_16M);
+ int av_fd = createAvIonFd(BUFFER_SIZE);
if (av_fd == -1) {
return;
}
diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h
index e301249..f2d9248 100644
--- a/tv/tuner/aidl/default/Filter.h
+++ b/tv/tuner/aidl/default/Filter.h
@@ -50,7 +50,8 @@
using ::android::hardware::EventFlag;
using FilterMQ = AidlMessageQueue<int8_t, SynchronizedReadWrite>;
-const uint32_t BUFFER_SIZE_16M = 0x1000000;
+
+const uint32_t BUFFER_SIZE = 0x800000; // 8 MB
class Demux;
class Dvr;
@@ -256,9 +257,13 @@
std::mutex mFilterOutputLock;
std::mutex mRecordFilterOutputLock;
+ // handle single Section filter
+ uint32_t mSectionSizeLeft = 0;
+ vector<int8_t> mSectionOutput;
+
// temp handle single PES filter
// TODO handle mulptiple Pes filters
- int mPesSizeLeft = 0;
+ uint32_t mPesSizeLeft = 0;
vector<int8_t> mPesOutput;
// A map from data id to ion handle
diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp
index 3f7797c..0573d08 100644
--- a/tv/tuner/aidl/default/Frontend.cpp
+++ b/tv/tuner/aidl/default/Frontend.cpp
@@ -28,10 +28,10 @@
namespace tv {
namespace tuner {
-Frontend::Frontend(FrontendType type, int32_t id, std::shared_ptr<Tuner> tuner) {
+Frontend::Frontend(FrontendType type, int32_t id) {
mType = type;
mId = id;
- mTuner = tuner;
+ mTuner = nullptr;
// Init callback to nullptr
mCallback = nullptr;
@@ -170,7 +170,12 @@
}
}
-Frontend::~Frontend() {}
+Frontend::~Frontend() {
+ ALOGV("%s", __FUNCTION__);
+ mCallback = nullptr;
+ mIsLocked = false;
+ mTuner = nullptr;
+}
::ndk::ScopedAStatus Frontend::close() {
ALOGV("%s", __FUNCTION__);
@@ -178,6 +183,7 @@
mCallback = nullptr;
mIsLocked = false;
mTuner->removeFrontend(mId);
+ mTuner = nullptr;
return ::ndk::ScopedAStatus::ok();
}
@@ -233,6 +239,10 @@
return ::ndk::ScopedAStatus::ok();
}
+void Frontend::setTunerService(std::shared_ptr<Tuner> tuner) {
+ mTuner = tuner;
+}
+
void Frontend::scanThreadLoop() {
if (mIsLocked) {
FrontendScanMessage msg;
diff --git a/tv/tuner/aidl/default/Frontend.h b/tv/tuner/aidl/default/Frontend.h
index 1d9ab53..85bd636 100644
--- a/tv/tuner/aidl/default/Frontend.h
+++ b/tv/tuner/aidl/default/Frontend.h
@@ -34,7 +34,7 @@
class Frontend : public BnFrontend {
public:
- Frontend(FrontendType type, int32_t id, std::shared_ptr<Tuner> tuner);
+ Frontend(FrontendType type, int32_t id);
::ndk::ScopedAStatus setCallback(
const std::shared_ptr<IFrontendCallback>& in_callback) override;
@@ -62,6 +62,7 @@
string getSourceFile();
bool isLocked();
void getFrontendInfo(FrontendInfo* _aidl_return);
+ void setTunerService(std::shared_ptr<Tuner> tuner);
private:
virtual ~Frontend();
diff --git a/tv/tuner/aidl/default/Tuner.cpp b/tv/tuner/aidl/default/Tuner.cpp
index fa74288..591f936 100644
--- a/tv/tuner/aidl/default/Tuner.cpp
+++ b/tv/tuner/aidl/default/Tuner.cpp
@@ -38,16 +38,16 @@
// Static Frontends array to maintain local frontends information
// Array index matches their FrontendId in the default impl
mFrontendSize = 10;
- mFrontends[0] = ndk::SharedRefBase::make<Frontend>(FrontendType::ISDBS, 0, this->ref<Tuner>());
- mFrontends[1] = ndk::SharedRefBase::make<Frontend>(FrontendType::ATSC3, 1, this->ref<Tuner>());
- mFrontends[2] = ndk::SharedRefBase::make<Frontend>(FrontendType::DVBC, 2, this->ref<Tuner>());
- mFrontends[3] = ndk::SharedRefBase::make<Frontend>(FrontendType::DVBS, 3, this->ref<Tuner>());
- mFrontends[4] = ndk::SharedRefBase::make<Frontend>(FrontendType::DVBT, 4, this->ref<Tuner>());
- mFrontends[5] = ndk::SharedRefBase::make<Frontend>(FrontendType::ISDBT, 5, this->ref<Tuner>());
- mFrontends[6] = ndk::SharedRefBase::make<Frontend>(FrontendType::ANALOG, 6, this->ref<Tuner>());
- mFrontends[7] = ndk::SharedRefBase::make<Frontend>(FrontendType::ATSC, 7, this->ref<Tuner>());
- mFrontends[8] = ndk::SharedRefBase::make<Frontend>(FrontendType::ISDBS3, 8, this->ref<Tuner>());
- mFrontends[9] = ndk::SharedRefBase::make<Frontend>(FrontendType::DTMB, 9, this->ref<Tuner>());
+ mFrontends[0] = ndk::SharedRefBase::make<Frontend>(FrontendType::ISDBS, 0);
+ mFrontends[1] = ndk::SharedRefBase::make<Frontend>(FrontendType::ATSC3, 1);
+ mFrontends[2] = ndk::SharedRefBase::make<Frontend>(FrontendType::DVBC, 2);
+ mFrontends[3] = ndk::SharedRefBase::make<Frontend>(FrontendType::DVBS, 3);
+ mFrontends[4] = ndk::SharedRefBase::make<Frontend>(FrontendType::DVBT, 4);
+ mFrontends[5] = ndk::SharedRefBase::make<Frontend>(FrontendType::ISDBT, 5);
+ mFrontends[6] = ndk::SharedRefBase::make<Frontend>(FrontendType::ANALOG, 6);
+ mFrontends[7] = ndk::SharedRefBase::make<Frontend>(FrontendType::ATSC, 7);
+ mFrontends[8] = ndk::SharedRefBase::make<Frontend>(FrontendType::ISDBS3, 8);
+ mFrontends[9] = ndk::SharedRefBase::make<Frontend>(FrontendType::DTMB, 9);
mMaxUsableFrontends[FrontendType::ISDBS] = 1;
mMaxUsableFrontends[FrontendType::ATSC3] = 1;
@@ -89,6 +89,7 @@
static_cast<int32_t>(Result::INVALID_ARGUMENT));
}
+ mFrontends[in_frontendId]->setTunerService(this->ref<Tuner>());
*_aidl_return = mFrontends[in_frontendId];
return ::ndk::ScopedAStatus::ok();
}
diff --git a/tv/tuner/aidl/default/service.cpp b/tv/tuner/aidl/default/service.cpp
index ac8d779..f980f4a 100644
--- a/tv/tuner/aidl/default/service.cpp
+++ b/tv/tuner/aidl/default/service.cpp
@@ -30,8 +30,15 @@
std::shared_ptr<Tuner> tuner = ndk::SharedRefBase::make<Tuner>();
tuner->init();
+ binder_status_t status;
const std::string instance = std::string() + Tuner::descriptor + "/default";
- binder_status_t status = AServiceManager_addService(tuner->asBinder().get(), instance.c_str());
+#ifdef LAZY_HAL
+ ALOGD("Start as a lazy HAL");
+ status = AServiceManager_registerLazyService(tuner->asBinder().get(), instance.c_str());
+#else
+ ALOGD("Start as a normal HAL");
+ status = AServiceManager_addService(tuner->asBinder().get(), instance.c_str());
+#endif
CHECK(status == STATUS_OK);
ABinderProcess_joinThreadPool();
diff --git a/tv/tuner/aidl/default/tuner-default-lazy.rc b/tv/tuner/aidl/default/tuner-default-lazy.rc
new file mode 100644
index 0000000..6b3b183
--- /dev/null
+++ b/tv/tuner/aidl/default/tuner-default-lazy.rc
@@ -0,0 +1,9 @@
+service vendor.tuner-default-lazy /vendor/bin/hw/android.hardware.tv.tuner-service.example-lazy
+ class hal
+ user media
+ group mediadrm drmrpc
+ ioprio rt 4
+ task_profiles ProcessCapacityHigh
+ interface aidl android.hardware.tv.tuner.ITuner/default
+ oneshot
+ disabled
diff --git a/tv/tuner/aidl/default/tuner-default.rc b/tv/tuner/aidl/default/tuner-default.rc
index d0248c2..f9315ae 100644
--- a/tv/tuner/aidl/default/tuner-default.rc
+++ b/tv/tuner/aidl/default/tuner-default.rc
@@ -3,5 +3,6 @@
user media
group mediadrm drmrpc
ioprio rt 4
- writepid /dev/cpuset/foreground/tasks
+ task_profiles ProcessCapacityHigh
onrestart restart media.tuner
+ interface aidl android.hardware.tv.tuner.ITuner/default
diff --git a/tv/tuner/aidl/vts/functional/Android.bp b/tv/tuner/aidl/vts/functional/Android.bp
index e5fb1e6..6a71544 100644
--- a/tv/tuner/aidl/vts/functional/Android.bp
+++ b/tv/tuner/aidl/vts/functional/Android.bp
@@ -53,7 +53,7 @@
"android.hardware.cas@1.2",
"android.hardware.common-V2-ndk",
"android.hardware.common.fmq-V1-ndk",
- "android.hardware.tv.tuner-V1-ndk",
+ "android.hardware.tv.tuner-V2-ndk",
"libaidlcommonsupport",
"libfmq",
"libcutils",
diff --git a/tv/tuner/aidl/vts/functional/DvrTests.cpp b/tv/tuner/aidl/vts/functional/DvrTests.cpp
index a9c3b51..50f4de2 100644
--- a/tv/tuner/aidl/vts/functional/DvrTests.cpp
+++ b/tv/tuner/aidl/vts/functional/DvrTests.cpp
@@ -323,3 +323,41 @@
ASSERT_TRUE(mDvrRecord);
ASSERT_TRUE(mDvrRecord->close().isOk());
}
+
+AssertionResult DvrTests::setPlaybackStatusCheckIntervalHint(int64_t milliseconds) {
+ ndk::ScopedAStatus status;
+ EXPECT_TRUE(mDemux) << "Test with openDemux first.";
+ EXPECT_TRUE(mDvrPlayback) << "Test with openDvr first.";
+
+ status = mDvrPlayback->setStatusCheckIntervalHint(milliseconds);
+
+ if (getDvrPlaybackInterfaceVersion() < 2) {
+ return AssertionResult(status.getStatus() == STATUS_UNKNOWN_TRANSACTION);
+ }
+ return AssertionResult(status.isOk());
+}
+
+AssertionResult DvrTests::setRecordStatusCheckIntervalHint(int64_t milliseconds) {
+ ndk::ScopedAStatus status;
+ EXPECT_TRUE(mDemux) << "Test with openDemux first.";
+ EXPECT_TRUE(mDvrRecord) << "Test with openDvr first.";
+
+ status = mDvrRecord->setStatusCheckIntervalHint(milliseconds);
+
+ if (getDvrRecordInterfaceVersion() < 2) {
+ return AssertionResult(status.getStatus() == STATUS_UNKNOWN_TRANSACTION);
+ }
+ return AssertionResult(status.isOk());
+}
+
+int32_t DvrTests::getDvrPlaybackInterfaceVersion() {
+ int32_t version;
+ mDvrPlayback->getInterfaceVersion(&version);
+ return version;
+}
+
+int32_t DvrTests::getDvrRecordInterfaceVersion() {
+ int32_t version;
+ mDvrRecord->getInterfaceVersion(&version);
+ return version;
+}
diff --git a/tv/tuner/aidl/vts/functional/DvrTests.h b/tv/tuner/aidl/vts/functional/DvrTests.h
index 6662637..a88ba24 100644
--- a/tv/tuner/aidl/vts/functional/DvrTests.h
+++ b/tv/tuner/aidl/vts/functional/DvrTests.h
@@ -162,8 +162,12 @@
AssertionResult startDvrPlayback();
AssertionResult stopDvrRecord();
AssertionResult startDvrRecord();
+ AssertionResult setPlaybackStatusCheckIntervalHint(int64_t milliseconds);
+ AssertionResult setRecordStatusCheckIntervalHint(int64_t milliseconds);
void closeDvrPlayback();
void closeDvrRecord();
+ int32_t getDvrPlaybackInterfaceVersion();
+ int32_t getDvrRecordInterfaceVersion();
protected:
static AssertionResult failure() { return ::testing::AssertionFailure(); }
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
index a1f51df..2ff0c3d 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#include <aidl/android/hardware/tv/tuner/Result.h>
-
#include "FrontendTests.h"
+#include <aidl/android/hardware/tv/tuner/Result.h>
+
ndk::ScopedAStatus FrontendCallback::onEvent(FrontendEventType frontendEventType) {
android::Mutex::Autolock autoLock(mMsgLock);
ALOGD("[vts] frontend event received. Type: %d", frontendEventType);
@@ -323,7 +323,10 @@
FrontendStatusType type = statusTypes[i];
switch (type) {
case FrontendStatusType::MODULATIONS: {
- // TODO: verify modulations
+ ASSERT_TRUE(std::equal(
+ realStatuses[i].get<FrontendStatus::Tag::modulations>().begin(),
+ realStatuses[i].get<FrontendStatus::Tag::modulations>().end(),
+ expectStatuses[i].get<FrontendStatus::Tag::modulations>().begin()));
break;
}
case FrontendStatusType::BERS: {
@@ -340,11 +343,13 @@
break;
}
case FrontendStatusType::GUARD_INTERVAL: {
- // TODO: verify interval
+ ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::interval>() ==
+ expectStatuses[i].get<FrontendStatus::Tag::interval>());
break;
}
case FrontendStatusType::TRANSMISSION_MODE: {
- // TODO: verify tranmission mode
+ ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::transmissionMode>() ==
+ expectStatuses[i].get<FrontendStatus::Tag::transmissionMode>());
break;
}
case FrontendStatusType::UEC: {
@@ -379,7 +384,8 @@
break;
}
case FrontendStatusType::ROLL_OFF: {
- // TODO: verify roll off
+ ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::rollOff>() ==
+ expectStatuses[i].get<FrontendStatus::Tag::rollOff>());
break;
}
case FrontendStatusType::IS_MISO: {
@@ -599,9 +605,10 @@
ASSERT_TRUE(tuneFrontend(frontendConf, false /*testWithDemux*/));
// TODO: find a better way to push all frontend status types
- for (int32_t i = 0; i < static_cast<int32_t>(FrontendStatusType::ATSC3_ALL_PLP_INFO); i++) {
+ for (int32_t i = 0; i <= static_cast<int32_t>(FrontendStatusType::ATSC3_ALL_PLP_INFO); i++) {
allTypes.push_back(static_cast<FrontendStatusType>(i));
}
+
ndk::ScopedAStatus status = mFrontend->getFrontendStatusReadiness(allTypes, &readiness);
ASSERT_TRUE(status.isOk());
ASSERT_TRUE(readiness.size() == allTypes.size());
diff --git a/tv/tuner/aidl/vts/functional/LnbTests.h b/tv/tuner/aidl/vts/functional/LnbTests.h
index d6b5a25..a21e68d 100644
--- a/tv/tuner/aidl/vts/functional/LnbTests.h
+++ b/tv/tuner/aidl/vts/functional/LnbTests.h
@@ -25,6 +25,8 @@
#include <utils/Mutex.h>
#include <map>
+#define INVALID_LNB_ID -1
+
using android::Condition;
using android::Mutex;
diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp
index 07e3e3c..6aa1e16 100644
--- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp
+++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp
@@ -129,8 +129,8 @@
mFrontendTests.getFrontendIdByType(frontendConf.type, feId);
ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
ASSERT_TRUE(mFrontendTests.setFrontendCallback());
- if (mLnbId) {
- ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId));
+ if (mLnbId != INVALID_LNB_ID) {
+ ASSERT_TRUE(mFrontendTests.setLnb(mLnbId));
}
if (frontendConf.isSoftwareFe) {
mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[live.dvrSoftwareFeId]);
@@ -162,18 +162,19 @@
ASSERT_TRUE(mLnbTests.getLnbIds(ids));
ASSERT_TRUE(ids.size() > 0);
ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
- mLnbId = &ids[0];
+ mLnbId = ids[0];
} else {
- mLnbId = (int32_t*)malloc(sizeof(int32_t));
- ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, *mLnbId));
+ ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, mLnbId));
}
ASSERT_TRUE(mLnbTests.setLnbCallback());
ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage));
ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone));
ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConf.position));
- broadcastSingleFilterTest(filterConf, frontendConf);
+ if (!frontendConf.isSoftwareFe) {
+ broadcastSingleFilterTest(filterConf, frontendConf);
+ }
ASSERT_TRUE(mLnbTests.closeLnb());
- mLnbId = nullptr;
+ mLnbId = INVALID_LNB_ID;
}
void TunerBroadcastAidlTest::mediaFilterUsingSharedMemoryTest(FilterConfig filterConf,
@@ -240,6 +241,28 @@
ASSERT_TRUE(mDemuxTests.closeDemux());
}
+void TunerPlaybackAidlTest::setStatusCheckIntervalHintTest(int64_t statusCheckIntervalHint,
+ DvrConfig dvrConf) {
+ int32_t demuxId;
+ std::shared_ptr<IDemux> demux;
+
+ ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
+ mDvrTests.setDemux(demux);
+ ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrConf.type, dvrConf.bufferSize));
+ ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrConf.settings));
+ ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor());
+
+ ASSERT_TRUE(mDvrTests.setPlaybackStatusCheckIntervalHint(statusCheckIntervalHint));
+
+ mDvrTests.startPlaybackInputThread(dvrConf.playbackInputFile,
+ dvrConf.settings.get<DvrSettings::Tag::playback>());
+ ASSERT_TRUE(mDvrTests.startDvrPlayback());
+ mDvrTests.stopPlaybackThread();
+ ASSERT_TRUE(mDvrTests.stopDvrPlayback());
+ mDvrTests.closeDvrPlayback();
+ ASSERT_TRUE(mDemuxTests.closeDemux());
+}
+
void TunerRecordAidlTest::recordSingleFilterTestWithLnb(FilterConfig filterConf,
FrontendConfig frontendConf,
DvrConfig dvrConf, LnbConfig lnbConf) {
@@ -248,10 +271,9 @@
ASSERT_TRUE(mLnbTests.getLnbIds(ids));
ASSERT_TRUE(ids.size() > 0);
ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
- mLnbId = &ids[0];
+ mLnbId = ids[0];
} else {
- mLnbId = (int32_t*)malloc(sizeof(int32_t));
- ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, *mLnbId));
+ ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, mLnbId));
}
ASSERT_TRUE(mLnbTests.setLnbCallback());
ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage));
@@ -260,9 +282,11 @@
for (auto msgName : lnbRecord.diseqcMsgs) {
ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName]));
}
- recordSingleFilterTest(filterConf, frontendConf, dvrConf);
+ if (!frontendConf.isSoftwareFe) {
+ recordSingleFilterTest(filterConf, frontendConf, dvrConf, Dataflow_Context::LNBRECORD);
+ }
ASSERT_TRUE(mLnbTests.closeLnb());
- mLnbId = nullptr;
+ mLnbId = INVALID_LNB_ID;
}
void TunerRecordAidlTest::attachSingleFilterToRecordDvrTest(FilterConfig filterConf,
@@ -318,29 +342,47 @@
}
void TunerRecordAidlTest::recordSingleFilterTest(FilterConfig filterConf,
- FrontendConfig frontendConf, DvrConfig dvrConf) {
+ FrontendConfig frontendConf, DvrConfig dvrConf,
+ Dataflow_Context context) {
int32_t demuxId;
std::shared_ptr<IDemux> demux;
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
mDvrTests.setDemux(demux);
DvrConfig dvrSourceConfig;
- if (record.hasFrontendConnection) {
+ if (context == Dataflow_Context::RECORD) {
+ if (record.hasFrontendConnection) {
+ int32_t feId;
+ mFrontendTests.getFrontendIdByType(frontendConf.type, feId);
+ ASSERT_TRUE(feId != INVALID_ID);
+ ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
+ ASSERT_TRUE(mFrontendTests.setFrontendCallback());
+ if (frontendConf.isSoftwareFe) {
+ mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[record.dvrSoftwareFeId]);
+ }
+ ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
+ mFrontendTests.setDvrTests(&mDvrTests);
+ } else {
+ dvrSourceConfig = dvrMap[record.dvrSourceId];
+ ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize));
+ ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings));
+ ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor());
+ }
+ } else if (context == Dataflow_Context::LNBRECORD) {
+ // If function arrives here, frontend should not be software, so no need to configure a dvr
+ // source or dvr fe connection that might be used for recording without an Lnb
int32_t feId;
mFrontendTests.getFrontendIdByType(frontendConf.type, feId);
ASSERT_TRUE(feId != INVALID_ID);
ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
ASSERT_TRUE(mFrontendTests.setFrontendCallback());
- if (frontendConf.isSoftwareFe) {
- mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[record.dvrSoftwareFeId]);
+ if (mLnbId != INVALID_LNB_ID) {
+ ASSERT_TRUE(mFrontendTests.setLnb(mLnbId));
+ } else {
+ FAIL();
}
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
mFrontendTests.setDvrTests(&mDvrTests);
- } else {
- dvrSourceConfig = dvrMap[record.dvrSourceId];
- ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize));
- ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings));
- ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor());
}
int64_t filterId;
@@ -360,24 +402,31 @@
ASSERT_TRUE(mDvrTests.startDvrRecord());
ASSERT_TRUE(mFilterTests.startFilter(filterId));
- if (record.hasFrontendConnection) {
+ if (context == Dataflow_Context::RECORD) {
+ if (record.hasFrontendConnection) {
+ ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/));
+ } else {
+ // Start DVR Source
+ mDvrTests.startPlaybackInputThread(
+ dvrSourceConfig.playbackInputFile,
+ dvrSourceConfig.settings.get<DvrSettings::Tag::playback>());
+ ASSERT_TRUE(mDvrTests.startDvrPlayback());
+ }
+ } else if (context == Dataflow_Context::LNBRECORD) {
ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/));
- } else {
- // Start DVR Source
- mDvrTests.startPlaybackInputThread(
- dvrSourceConfig.playbackInputFile,
- dvrSourceConfig.settings.get<DvrSettings::Tag::playback>());
- ASSERT_TRUE(mDvrTests.startDvrPlayback());
}
-
mDvrTests.testRecordOutput();
mDvrTests.stopRecordThread();
- if (record.hasFrontendConnection) {
+ if (context == Dataflow_Context::RECORD) {
+ if (record.hasFrontendConnection) {
+ ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/));
+ } else {
+ mDvrTests.stopPlaybackThread();
+ ASSERT_TRUE(mDvrTests.stopDvrPlayback());
+ }
+ } else if (context == Dataflow_Context::LNBRECORD) {
ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/));
- } else {
- mDvrTests.stopPlaybackThread();
- ASSERT_TRUE(mDvrTests.stopDvrPlayback());
}
ASSERT_TRUE(mFilterTests.stopFilter(filterId));
@@ -386,39 +435,99 @@
ASSERT_TRUE(mFilterTests.closeFilter(filterId));
mDvrTests.closeDvrRecord();
- if (record.hasFrontendConnection) {
+ if (context == Dataflow_Context::RECORD) {
+ if (record.hasFrontendConnection) {
+ ASSERT_TRUE(mFrontendTests.closeFrontend());
+ } else {
+ mDvrTests.closeDvrPlayback();
+ }
+ } else if (context == Dataflow_Context::LNBRECORD) {
ASSERT_TRUE(mFrontendTests.closeFrontend());
- } else {
- mDvrTests.closeDvrPlayback();
}
ASSERT_TRUE(mDemuxTests.closeDemux());
}
+void TunerRecordAidlTest::setStatusCheckIntervalHintTest(int64_t statusCheckIntervalHint,
+ FrontendConfig frontendConf,
+ DvrConfig dvrConf) {
+ int32_t demuxId;
+ std::shared_ptr<IDemux> demux;
+ ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
+ mDvrTests.setDemux(demux);
+
+ DvrConfig dvrSourceConfig;
+ if (record.hasFrontendConnection) {
+ int32_t feId;
+ mFrontendTests.getFrontendIdByType(frontendConf.type, feId);
+ ASSERT_TRUE(feId != INVALID_ID);
+ ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
+ ASSERT_TRUE(mFrontendTests.setFrontendCallback());
+ ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
+ } else {
+ dvrSourceConfig = dvrMap[record.dvrSourceId];
+ ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize));
+ ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings));
+ ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor());
+ }
+
+ ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrConf.type, dvrConf.bufferSize));
+ ASSERT_TRUE(mDvrTests.configDvrRecord(dvrConf.settings));
+ ASSERT_TRUE(mDvrTests.getDvrRecordMQDescriptor());
+
+ ASSERT_TRUE(mDvrTests.setRecordStatusCheckIntervalHint(statusCheckIntervalHint));
+
+ ASSERT_TRUE(mDvrTests.startDvrRecord());
+ ASSERT_TRUE(mDvrTests.stopDvrRecord());
+ mDvrTests.closeDvrRecord();
+ ASSERT_TRUE(mDemuxTests.closeDemux());
+
+ if (record.hasFrontendConnection) {
+ ASSERT_TRUE(mFrontendTests.closeFrontend());
+ }
+}
+
void TunerDescramblerAidlTest::scrambledBroadcastTest(set<struct FilterConfig> mediaFilterConfs,
FrontendConfig frontendConf,
- DescramblerConfig descConfig) {
+ DescramblerConfig descConfig,
+ Dataflow_Context context) {
int32_t demuxId;
std::shared_ptr<IDemux> demux;
ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
DvrConfig dvrSourceConfig;
- if (descrambling.hasFrontendConnection) {
+ if (context == Dataflow_Context::DESCRAMBLING) {
+ if (descrambling.hasFrontendConnection) {
+ int32_t feId;
+ mFrontendTests.getFrontendIdByType(frontendConf.type, feId);
+ ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
+ ASSERT_TRUE(mFrontendTests.setFrontendCallback());
+ if (frontendConf.isSoftwareFe) {
+ mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[descrambling.dvrSoftwareFeId]);
+ }
+ ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
+ mFrontendTests.setDemux(demux);
+ } else {
+ dvrSourceConfig = dvrMap[descrambling.dvrSourceId];
+ mDvrTests.setDemux(demux);
+ ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize));
+ ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings));
+ ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor());
+ }
+ } else if (context == Dataflow_Context::LNBDESCRAMBLING) {
int32_t feId;
mFrontendTests.getFrontendIdByType(frontendConf.type, feId);
ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
ASSERT_TRUE(mFrontendTests.setFrontendCallback());
- if (frontendConf.isSoftwareFe) {
- mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[descrambling.dvrSoftwareFeId]);
+ if (mLnbId != INVALID_LNB_ID) {
+ ASSERT_TRUE(mFrontendTests.setLnb(mLnbId));
+ } else {
+ // If, for some reason, the test got here without failing. We fail it here.
+ ALOGD("mLnbId is null. Something went wrong. Exiting ScrambledBroadcastWithLnbId.");
+ FAIL();
}
ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
mFrontendTests.setDemux(demux);
- } else {
- dvrSourceConfig = dvrMap[descrambling.dvrSourceId];
- mDvrTests.setDemux(demux);
- ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize));
- ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings));
- ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor());
}
set<int64_t> filterIds;
@@ -449,24 +558,32 @@
ASSERT_TRUE(mFilterTests.startFilter(*id));
}
- if (descrambling.hasFrontendConnection) {
- // tune test
+ if (context == Dataflow_Context::DESCRAMBLING) {
+ if (descrambling.hasFrontendConnection) {
+ // tune test
+ ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/));
+ } else {
+ // Start DVR Source
+ mDvrTests.startPlaybackInputThread(
+ dvrSourceConfig.playbackInputFile,
+ dvrSourceConfig.settings.get<DvrSettings::Tag::playback>());
+ ASSERT_TRUE(mDvrTests.startDvrPlayback());
+ }
+ } else if (context == Dataflow_Context::LNBDESCRAMBLING) {
ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/));
- } else {
- // Start DVR Source
- mDvrTests.startPlaybackInputThread(
- dvrSourceConfig.playbackInputFile,
- dvrSourceConfig.settings.get<DvrSettings::Tag::playback>());
- ASSERT_TRUE(mDvrTests.startDvrPlayback());
}
ASSERT_TRUE(filterDataOutputTest());
- if (descrambling.hasFrontendConnection) {
+ if (context == Dataflow_Context::DESCRAMBLING) {
+ if (descrambling.hasFrontendConnection) {
+ ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/));
+ } else {
+ mDvrTests.stopPlaybackThread();
+ ASSERT_TRUE(mDvrTests.stopDvrPlayback());
+ }
+ } else if (context == Dataflow_Context::LNBDESCRAMBLING) {
ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/));
- } else {
- mDvrTests.stopPlaybackThread();
- ASSERT_TRUE(mDvrTests.stopDvrPlayback());
}
for (id = filterIds.begin(); id != filterIds.end(); id++) {
@@ -480,37 +597,80 @@
ASSERT_TRUE(mFilterTests.closeFilter(*id));
}
- if (descrambling.hasFrontendConnection) {
+ if (context == Dataflow_Context::DESCRAMBLING) {
+ if (descrambling.hasFrontendConnection) {
+ ASSERT_TRUE(mFrontendTests.closeFrontend());
+ } else {
+ mDvrTests.closeDvrPlayback();
+ }
+ } else if (context == Dataflow_Context::LNBDESCRAMBLING) {
ASSERT_TRUE(mFrontendTests.closeFrontend());
- } else {
- mDvrTests.closeDvrPlayback();
}
ASSERT_TRUE(mDemuxTests.closeDemux());
}
+void TunerDescramblerAidlTest::scrambledBroadcastTestWithLnb(
+ set<struct FilterConfig>& mediaFilterConfs, FrontendConfig& frontendConf,
+ DescramblerConfig& descConfig, LnbConfig& lnbConfig) {
+ // We can test the Lnb individually and make sure it functions properly. If the frontend is
+ // software, we cannot test the whole dataflow. If the frontend is hardware, we can
+ if (lnbConfig.name.compare(emptyHardwareId) == 0) {
+ vector<int32_t> ids;
+ ASSERT_TRUE(mLnbTests.getLnbIds(ids));
+ ASSERT_TRUE(ids.size() > 0);
+ ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
+ mLnbId = ids[0];
+ } else {
+ ASSERT_TRUE(mLnbTests.openLnbByName(lnbConfig.name, mLnbId));
+ }
+ // Once Lnb is opened, test some of its basic functionality
+ ASSERT_TRUE(mLnbTests.setLnbCallback());
+ ASSERT_TRUE(mLnbTests.setVoltage(lnbConfig.voltage));
+ ASSERT_TRUE(mLnbTests.setTone(lnbConfig.tone));
+ ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConfig.position));
+ if (!frontendConf.isSoftwareFe) {
+ ALOGD("Frontend is not software, testing entire dataflow.");
+ scrambledBroadcastTest(mediaFilterConfs, frontendConf, descConfig,
+ Dataflow_Context::LNBDESCRAMBLING);
+ } else {
+ ALOGD("Frontend is software, did not test the entire dataflow, but tested the Lnb "
+ "individually.");
+ }
+ ASSERT_TRUE(mLnbTests.closeLnb());
+ mLnbId = INVALID_LNB_ID;
+}
+
TEST_P(TunerLnbAidlTest, SendDiseqcMessageToLnb) {
description("Open and configure an Lnb with specific settings then send a diseqc msg to it.");
if (!lnbLive.support) {
return;
}
- if (lnbMap[lnbLive.lnbId].name.compare(emptyHardwareId) == 0) {
- vector<int32_t> ids;
- ASSERT_TRUE(mLnbTests.getLnbIds(ids));
- ASSERT_TRUE(ids.size() > 0);
- ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
- } else {
- int32_t id;
- ASSERT_TRUE(mLnbTests.openLnbByName(lnbMap[lnbLive.lnbId].name, id));
+ vector<LnbLiveHardwareConnections> lnbLive_configs = generateLnbLiveConfigurations();
+ if (lnbLive_configs.empty()) {
+ ALOGD("No frontends that support satellites.");
+ return;
}
- ASSERT_TRUE(mLnbTests.setLnbCallback());
- ASSERT_TRUE(mLnbTests.setVoltage(lnbMap[lnbLive.lnbId].voltage));
- ASSERT_TRUE(mLnbTests.setTone(lnbMap[lnbLive.lnbId].tone));
- ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbMap[lnbLive.lnbId].position));
- for (auto msgName : lnbLive.diseqcMsgs) {
- ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName]));
+ for (auto& combination : lnbLive_configs) {
+ lnbLive = combination;
+ if (lnbMap[lnbLive.lnbId].name.compare(emptyHardwareId) == 0) {
+ vector<int32_t> ids;
+ ASSERT_TRUE(mLnbTests.getLnbIds(ids));
+ ASSERT_TRUE(ids.size() > 0);
+ ASSERT_TRUE(mLnbTests.openLnbById(ids[0]));
+ } else {
+ int32_t id;
+ ASSERT_TRUE(mLnbTests.openLnbByName(lnbMap[lnbLive.lnbId].name, id));
+ }
+ ASSERT_TRUE(mLnbTests.setLnbCallback());
+ ASSERT_TRUE(mLnbTests.setVoltage(lnbMap[lnbLive.lnbId].voltage));
+ ASSERT_TRUE(mLnbTests.setTone(lnbMap[lnbLive.lnbId].tone));
+ ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbMap[lnbLive.lnbId].position));
+ for (auto msgName : lnbLive.diseqcMsgs) {
+ ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName]));
+ }
+ ASSERT_TRUE(mLnbTests.closeLnb());
}
- ASSERT_TRUE(mLnbTests.closeLnb());
}
TEST_P(TunerDemuxAidlTest, openDemux) {
@@ -518,17 +678,21 @@
if (!live.hasFrontendConnection) {
return;
}
- int32_t feId;
- int32_t demuxId;
- std::shared_ptr<IDemux> demux;
- mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId);
- ASSERT_TRUE(feId != INVALID_ID);
- ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
- ASSERT_TRUE(mFrontendTests.setFrontendCallback());
- ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
- ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
- ASSERT_TRUE(mDemuxTests.closeDemux());
- ASSERT_TRUE(mFrontendTests.closeFrontend());
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ int32_t feId;
+ int32_t demuxId;
+ std::shared_ptr<IDemux> demux;
+ mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId);
+ ASSERT_TRUE(feId != INVALID_ID);
+ ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
+ ASSERT_TRUE(mFrontendTests.setFrontendCallback());
+ ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
+ ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
+ ASSERT_TRUE(mDemuxTests.closeDemux());
+ ASSERT_TRUE(mFrontendTests.closeFrontend());
+ }
}
TEST_P(TunerDemuxAidlTest, getAvSyncTime) {
@@ -536,40 +700,45 @@
if (!live.hasFrontendConnection) {
return;
}
- if (live.pcrFilterId.compare(emptyHardwareId) == 0) {
- return;
- }
- int32_t feId;
- int32_t demuxId;
- std::shared_ptr<IDemux> demux;
- int64_t mediaFilterId;
- int64_t pcrFilterId;
- int32_t avSyncHwId;
- std::shared_ptr<IFilter> mediaFilter;
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ if (live.pcrFilterId.compare(emptyHardwareId) == 0) {
+ continue;
+ }
+ int32_t feId;
+ int32_t demuxId;
+ std::shared_ptr<IDemux> demux;
+ int64_t mediaFilterId;
+ int64_t pcrFilterId;
+ int32_t avSyncHwId;
+ std::shared_ptr<IFilter> mediaFilter;
- mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId);
- ASSERT_TRUE(feId != INVALID_ID);
- ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
- ASSERT_TRUE(mFrontendTests.setFrontendCallback());
- ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
- ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
- mFilterTests.setDemux(demux);
- ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.videoFilterId].type,
- filterMap[live.videoFilterId].bufferSize));
- ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(mediaFilterId));
- ASSERT_TRUE(mFilterTests.configFilter(filterMap[live.videoFilterId].settings, mediaFilterId));
- mediaFilter = mFilterTests.getFilterById(mediaFilterId);
- ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.pcrFilterId].type,
- filterMap[live.pcrFilterId].bufferSize));
- ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(pcrFilterId));
- ASSERT_TRUE(mFilterTests.configFilter(filterMap[live.pcrFilterId].settings, pcrFilterId));
- ASSERT_TRUE(mDemuxTests.getAvSyncId(mediaFilter, avSyncHwId));
- ASSERT_TRUE(pcrFilterId == avSyncHwId);
- ASSERT_TRUE(mDemuxTests.getAvSyncTime(pcrFilterId));
- ASSERT_TRUE(mFilterTests.closeFilter(pcrFilterId));
- ASSERT_TRUE(mFilterTests.closeFilter(mediaFilterId));
- ASSERT_TRUE(mDemuxTests.closeDemux());
- ASSERT_TRUE(mFrontendTests.closeFrontend());
+ mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId);
+ ASSERT_TRUE(feId != INVALID_ID);
+ ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
+ ASSERT_TRUE(mFrontendTests.setFrontendCallback());
+ ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
+ ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
+ mFilterTests.setDemux(demux);
+ ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.videoFilterId].type,
+ filterMap[live.videoFilterId].bufferSize));
+ ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(mediaFilterId));
+ ASSERT_TRUE(
+ mFilterTests.configFilter(filterMap[live.videoFilterId].settings, mediaFilterId));
+ mediaFilter = mFilterTests.getFilterById(mediaFilterId);
+ ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.pcrFilterId].type,
+ filterMap[live.pcrFilterId].bufferSize));
+ ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(pcrFilterId));
+ ASSERT_TRUE(mFilterTests.configFilter(filterMap[live.pcrFilterId].settings, pcrFilterId));
+ ASSERT_TRUE(mDemuxTests.getAvSyncId(mediaFilter, avSyncHwId));
+ ASSERT_TRUE(pcrFilterId == avSyncHwId);
+ ASSERT_TRUE(mDemuxTests.getAvSyncTime(pcrFilterId));
+ ASSERT_TRUE(mFilterTests.closeFilter(pcrFilterId));
+ ASSERT_TRUE(mFilterTests.closeFilter(mediaFilterId));
+ ASSERT_TRUE(mDemuxTests.closeDemux());
+ ASSERT_TRUE(mFrontendTests.closeFrontend());
+ }
}
TEST_P(TunerFilterAidlTest, StartFilterInDemux) {
@@ -578,7 +747,11 @@
return;
}
// TODO use parameterized tests
- configSingleFilterInDemuxTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ configSingleFilterInDemuxTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerFilterAidlTest, ConfigIpFilterInDemuxWithCid) {
@@ -587,10 +760,14 @@
if (!live.hasFrontendConnection) {
return;
}
- if (live.ipFilterId.compare(emptyHardwareId) == 0) {
- return;
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ if (live.ipFilterId.compare(emptyHardwareId) == 0) {
+ continue;
+ }
+ configSingleFilterInDemuxTest(filterMap[live.ipFilterId], frontendMap[live.frontendId]);
}
- configSingleFilterInDemuxTest(filterMap[live.ipFilterId], frontendMap[live.frontendId]);
}
TEST_P(TunerFilterAidlTest, ReconfigFilterToReceiveStartId) {
@@ -599,8 +776,13 @@
return;
}
// TODO use parameterized tests
- reconfigSingleFilterInDemuxTest(filterMap[live.videoFilterId], filterMap[live.videoFilterId],
- frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ reconfigSingleFilterInDemuxTest(filterMap[live.videoFilterId],
+ filterMap[live.videoFilterId],
+ frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerFilterAidlTest, SetFilterLinkage) {
@@ -637,7 +819,11 @@
return;
}
// TODO use parameterized tests
- testTimeFilter(timeFilterMap[timeFilter.timeFilterId]);
+ auto timeFilter_configs = generateTimeFilterConfigurations();
+ for (auto& configuration : timeFilter_configs) {
+ timeFilter = configuration;
+ testTimeFilter(timeFilterMap[timeFilter.timeFilterId]);
+ }
}
static bool isEventProducingFilter(const FilterConfig& filterConfig) {
@@ -839,10 +1025,16 @@
TEST_P(TunerPlaybackAidlTest, PlaybackDataFlowWithTsSectionFilterTest) {
description("Feed ts data from playback and configure Ts section filter to get output");
- if (!playback.support || playback.sectionFilterId.compare(emptyHardwareId) == 0) {
+ if (!playback.support) {
return;
}
- playbackSingleFilterTest(filterMap[playback.sectionFilterId], dvrMap[playback.dvrId]);
+ vector<DvrPlaybackHardwareConnections> playback_configs = generatePlaybackConfigs();
+ for (auto& configuration : playback_configs) {
+ if (configuration.sectionFilterId.compare(emptyHardwareId) != 0) {
+ playback = configuration;
+ playbackSingleFilterTest(filterMap[playback.sectionFilterId], dvrMap[playback.dvrId]);
+ }
+ }
}
TEST_P(TunerPlaybackAidlTest, PlaybackDataFlowWithTsAudioFilterTest) {
@@ -850,7 +1042,11 @@
if (!playback.support) {
return;
}
- playbackSingleFilterTest(filterMap[playback.audioFilterId], dvrMap[playback.dvrId]);
+ vector<DvrPlaybackHardwareConnections> playback_configs = generatePlaybackConfigs();
+ for (auto& configuration : playback_configs) {
+ playback = configuration;
+ playbackSingleFilterTest(filterMap[playback.audioFilterId], dvrMap[playback.dvrId]);
+ }
}
TEST_P(TunerPlaybackAidlTest, PlaybackDataFlowWithTsVideoFilterTest) {
@@ -858,7 +1054,23 @@
if (!playback.support) {
return;
}
- playbackSingleFilterTest(filterMap[playback.videoFilterId], dvrMap[playback.dvrId]);
+ vector<DvrPlaybackHardwareConnections> playback_configs = generatePlaybackConfigs();
+ for (auto& configuration : playback_configs) {
+ playback = configuration;
+ playbackSingleFilterTest(filterMap[playback.videoFilterId], dvrMap[playback.dvrId]);
+ }
+}
+
+TEST_P(TunerPlaybackAidlTest, SetStatusCheckIntervalHintToPlaybackTest) {
+ description("Set status check interval hint to playback test.");
+ if (!playback.support) {
+ return;
+ }
+ vector<DvrPlaybackHardwareConnections> playback_configs = generatePlaybackConfigs();
+ for (auto& configuration : playback_configs) {
+ playback = configuration;
+ setStatusCheckIntervalHintTest(STATUS_CHECK_INTERVAL_MS, dvrMap[playback.dvrId]);
+ }
}
TEST_P(TunerRecordAidlTest, RecordDataFlowWithTsRecordFilterTest) {
@@ -866,8 +1078,12 @@
if (!record.support) {
return;
}
- recordSingleFilterTest(filterMap[record.recordFilterId], frontendMap[record.frontendId],
- dvrMap[record.dvrRecordId]);
+ auto record_configs = generateRecordConfigurations();
+ for (auto& configuration : record_configs) {
+ record = configuration;
+ recordSingleFilterTest(filterMap[record.recordFilterId], frontendMap[record.frontendId],
+ dvrMap[record.dvrRecordId], Dataflow_Context::RECORD);
+ }
}
TEST_P(TunerRecordAidlTest, AttachFiltersToRecordTest) {
@@ -876,8 +1092,13 @@
if (!record.support) {
return;
}
- attachSingleFilterToRecordDvrTest(filterMap[record.recordFilterId],
- frontendMap[record.frontendId], dvrMap[record.dvrRecordId]);
+ auto record_configs = generateRecordConfigurations();
+ for (auto& configuration : record_configs) {
+ record = configuration;
+ attachSingleFilterToRecordDvrTest(filterMap[record.recordFilterId],
+ frontendMap[record.frontendId],
+ dvrMap[record.dvrRecordId]);
+ }
}
TEST_P(TunerRecordAidlTest, LnbRecordDataFlowWithTsRecordFilterTest) {
@@ -885,9 +1106,30 @@
if (!lnbRecord.support) {
return;
}
- recordSingleFilterTestWithLnb(filterMap[lnbRecord.recordFilterId],
- frontendMap[lnbRecord.frontendId], dvrMap[lnbRecord.dvrRecordId],
- lnbMap[lnbRecord.lnbId]);
+ vector<LnbRecordHardwareConnections> lnbRecord_configs = generateLnbRecordConfigurations();
+ if (lnbRecord_configs.empty()) {
+ ALOGD("No frontends that support satellites.");
+ return;
+ }
+ for (auto& configuration : lnbRecord_configs) {
+ lnbRecord = configuration;
+ recordSingleFilterTestWithLnb(filterMap[lnbRecord.recordFilterId],
+ frontendMap[lnbRecord.frontendId],
+ dvrMap[lnbRecord.dvrRecordId], lnbMap[lnbRecord.lnbId]);
+ }
+}
+
+TEST_P(TunerRecordAidlTest, SetStatusCheckIntervalHintToRecordTest) {
+ description("Set status check interval hint to record test.");
+ if (!record.support) {
+ return;
+ }
+ auto record_configs = generateRecordConfigurations();
+ for (auto& configuration : record_configs) {
+ record = configuration;
+ setStatusCheckIntervalHintTest(STATUS_CHECK_INTERVAL_MS, frontendMap[record.frontendId],
+ dvrMap[record.dvrRecordId]);
+ }
}
TEST_P(TunerFrontendAidlTest, TuneFrontend) {
@@ -895,7 +1137,11 @@
if (!live.hasFrontendConnection) {
return;
}
- mFrontendTests.tuneTest(frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ mFrontendTests.tuneTest(frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerFrontendAidlTest, AutoScanFrontend) {
@@ -903,7 +1149,11 @@
if (!scan.hasFrontendConnection) {
return;
}
- mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_AUTO);
+ vector<ScanHardwareConnections> scan_configs = generateScanConfigurations();
+ for (auto& configuration : scan_configs) {
+ scan = configuration;
+ mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_AUTO);
+ }
}
TEST_P(TunerFrontendAidlTest, BlindScanFrontend) {
@@ -911,7 +1161,11 @@
if (!scan.hasFrontendConnection) {
return;
}
- mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND);
+ vector<ScanHardwareConnections> scan_configs = generateScanConfigurations();
+ for (auto& configuration : scan_configs) {
+ scan = configuration;
+ mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND);
+ }
}
TEST_P(TunerFrontendAidlTest, TuneFrontendWithFrontendSettings) {
@@ -919,7 +1173,11 @@
if (!live.hasFrontendConnection) {
return;
}
- mFrontendTests.tuneTest(frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ mFrontendTests.tuneTest(frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerFrontendAidlTest, BlindScanFrontendWithEndFrequency) {
@@ -927,7 +1185,11 @@
if (!scan.hasFrontendConnection) {
return;
}
- mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND);
+ vector<ScanHardwareConnections> scan_configs = generateScanConfigurations();
+ for (auto& configuration : scan_configs) {
+ scan = configuration;
+ mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND);
+ }
}
TEST_P(TunerFrontendAidlTest, LinkToCiCam) {
@@ -935,10 +1197,14 @@
if (!live.hasFrontendConnection) {
return;
}
- if (!frontendMap[live.frontendId].canConnectToCiCam) {
- return;
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ if (!frontendMap[live.frontendId].canConnectToCiCam) {
+ continue;
+ }
+ mFrontendTests.tuneTest(frontendMap[live.frontendId]);
}
- mFrontendTests.tuneTest(frontendMap[live.frontendId]);
}
TEST_P(TunerFrontendAidlTest, getHardwareInfo) {
@@ -946,7 +1212,11 @@
if (!live.hasFrontendConnection) {
return;
}
- mFrontendTests.debugInfoTest(frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ mFrontendTests.debugInfoTest(frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerFrontendAidlTest, maxNumberOfFrontends) {
@@ -962,7 +1232,11 @@
if (!live.hasFrontendConnection) {
return;
}
- mFrontendTests.statusReadinessTest(frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ mFrontendTests.statusReadinessTest(frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowVideoFilterTest) {
@@ -970,7 +1244,11 @@
if (!live.hasFrontendConnection) {
return;
}
- broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowAudioFilterTest) {
@@ -978,7 +1256,11 @@
if (!live.hasFrontendConnection) {
return;
}
- broadcastSingleFilterTest(filterMap[live.audioFilterId], frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ broadcastSingleFilterTest(filterMap[live.audioFilterId], frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowSectionFilterTest) {
@@ -986,10 +1268,14 @@
if (!live.hasFrontendConnection) {
return;
}
- if (live.sectionFilterId.compare(emptyHardwareId) == 0) {
- return;
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ if (live.sectionFilterId.compare(emptyHardwareId) == 0) {
+ continue;
+ }
+ broadcastSingleFilterTest(filterMap[live.sectionFilterId], frontendMap[live.frontendId]);
}
- broadcastSingleFilterTest(filterMap[live.sectionFilterId], frontendMap[live.frontendId]);
}
TEST_P(TunerBroadcastAidlTest, IonBufferTest) {
@@ -997,7 +1283,11 @@
if (!live.hasFrontendConnection) {
return;
}
- broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerBroadcastAidlTest, LnbBroadcastDataFlowVideoFilterTest) {
@@ -1005,8 +1295,16 @@
if (!lnbLive.support) {
return;
}
- broadcastSingleFilterTestWithLnb(filterMap[lnbLive.videoFilterId],
- frontendMap[lnbLive.frontendId], lnbMap[lnbLive.lnbId]);
+ vector<LnbLiveHardwareConnections> lnbLive_configs = generateLnbLiveConfigurations();
+ if (lnbLive_configs.empty()) {
+ ALOGD("No frontends that support satellites.");
+ return;
+ }
+ for (auto& combination : lnbLive_configs) {
+ lnbLive = combination;
+ broadcastSingleFilterTestWithLnb(filterMap[lnbLive.videoFilterId],
+ frontendMap[lnbLive.frontendId], lnbMap[lnbLive.lnbId]);
+ }
}
TEST_P(TunerBroadcastAidlTest, MediaFilterWithSharedMemoryHandle) {
@@ -1014,7 +1312,12 @@
if (!live.hasFrontendConnection) {
return;
}
- mediaFilterUsingSharedMemoryTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]);
+ auto live_configs = generateLiveConfigurations();
+ for (auto& configuration : live_configs) {
+ live = configuration;
+ mediaFilterUsingSharedMemoryTest(filterMap[live.videoFilterId],
+ frontendMap[live.frontendId]);
+ }
}
TEST_P(TunerDescramblerAidlTest, CreateDescrambler) {
@@ -1022,25 +1325,34 @@
if (!descrambling.support) {
return;
}
- int32_t demuxId;
- std::shared_ptr<IDemux> demux;
- ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
-
- if (descrambling.hasFrontendConnection) {
- int32_t feId;
- mFrontendTests.getFrontendIdByType(frontendMap[descrambling.frontendId].type, feId);
- ASSERT_TRUE(feId != INVALID_ID);
- ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
- ASSERT_TRUE(mFrontendTests.setFrontendCallback());
- ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
+ vector<DescramblingHardwareConnections> descrambling_configs =
+ generateDescramblingConfigurations();
+ if (descrambling_configs.empty()) {
+ ALOGD("No valid descrambling combinations in the configuration file.");
+ return;
}
+ for (auto& combination : descrambling_configs) {
+ descrambling = combination;
+ int32_t demuxId;
+ std::shared_ptr<IDemux> demux;
+ ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId));
- ASSERT_TRUE(mDescramblerTests.openDescrambler(demuxId));
- ASSERT_TRUE(mDescramblerTests.closeDescrambler());
- ASSERT_TRUE(mDemuxTests.closeDemux());
+ if (descrambling.hasFrontendConnection) {
+ int32_t feId;
+ mFrontendTests.getFrontendIdByType(frontendMap[descrambling.frontendId].type, feId);
+ ASSERT_TRUE(feId != INVALID_ID);
+ ASSERT_TRUE(mFrontendTests.openFrontendById(feId));
+ ASSERT_TRUE(mFrontendTests.setFrontendCallback());
+ ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId));
+ }
- if (descrambling.hasFrontendConnection) {
- ASSERT_TRUE(mFrontendTests.closeFrontend());
+ ASSERT_TRUE(mDescramblerTests.openDescrambler(demuxId));
+ ASSERT_TRUE(mDescramblerTests.closeDescrambler());
+ ASSERT_TRUE(mDemuxTests.closeDemux());
+
+ if (descrambling.hasFrontendConnection) {
+ ASSERT_TRUE(mFrontendTests.closeFrontend());
+ }
}
}
@@ -1049,11 +1361,42 @@
if (!descrambling.support) {
return;
}
- set<FilterConfig> filterConfs;
- filterConfs.insert(static_cast<FilterConfig>(filterMap[descrambling.audioFilterId]));
- filterConfs.insert(static_cast<FilterConfig>(filterMap[descrambling.videoFilterId]));
- scrambledBroadcastTest(filterConfs, frontendMap[descrambling.frontendId],
- descramblerMap[descrambling.descramblerId]);
+ vector<DescramblingHardwareConnections> descrambling_configs =
+ generateDescramblingConfigurations();
+ if (descrambling_configs.empty()) {
+ ALOGD("No valid descrambling combinations in the configuration file.");
+ return;
+ }
+ for (auto& combination : descrambling_configs) {
+ descrambling = combination;
+ set<FilterConfig> filterConfs;
+ filterConfs.insert(static_cast<FilterConfig>(filterMap[descrambling.audioFilterId]));
+ filterConfs.insert(static_cast<FilterConfig>(filterMap[descrambling.videoFilterId]));
+ scrambledBroadcastTest(filterConfs, frontendMap[descrambling.frontendId],
+ descramblerMap[descrambling.descramblerId],
+ Dataflow_Context::DESCRAMBLING);
+ }
+}
+
+TEST_P(TunerDescramblerAidlTest, ScrambledBroadcastDataFlowMediaFiltersTestWithLnb) {
+ description("Test media filters in scrambled broadcast use case with Lnb");
+ if (!lnbDescrambling.support) {
+ return;
+ }
+ auto lnbDescrambling_configs = generateLnbDescramblingConfigurations();
+ if (lnbDescrambling_configs.empty()) {
+ ALOGD("No frontends that support satellites.");
+ return;
+ }
+ for (auto& configuration : lnbDescrambling_configs) {
+ lnbDescrambling = configuration;
+ set<FilterConfig> filterConfs;
+ filterConfs.insert(static_cast<FilterConfig>(filterMap[lnbDescrambling.audioFilterId]));
+ filterConfs.insert(static_cast<FilterConfig>(filterMap[lnbDescrambling.videoFilterId]));
+ scrambledBroadcastTestWithLnb(filterConfs, frontendMap[lnbDescrambling.frontendId],
+ descramblerMap[lnbDescrambling.descramblerId],
+ lnbMap[lnbDescrambling.lnbId]);
+ }
}
INSTANTIATE_TEST_SUITE_P(PerInstance, TunerBroadcastAidlTest,
diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h
index 7f80d90..3bfa78f 100644
--- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h
+++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h
@@ -36,11 +36,17 @@
initFrontendConfig();
initFilterConfig();
initDvrConfig();
+ initTimeFilterConfig();
+ initDescramblerConfig();
+ initLnbConfig();
+ initDiseqcMsgsConfig();
connectHardwaresToTestCases();
if (!validateConnections()) {
ALOGW("[vts] failed to validate connections.");
return false;
}
+ determineDataFlows();
+
return true;
}
@@ -58,6 +64,24 @@
return success();
}
+void clearIds() {
+ lnbIds.clear();
+ diseqcMsgs.clear();
+ frontendIds.clear();
+ ipFilterIds.clear();
+ pcrFilterIds.clear();
+ recordDvrIds.clear();
+ timeFilterIds.clear();
+ descramblerIds.clear();
+ audioFilterIds.clear();
+ videoFilterIds.clear();
+ playbackDvrIds.clear();
+ recordFilterIds.clear();
+ sectionFilterIds.clear();
+}
+
+enum class Dataflow_Context { LNBRECORD, RECORD, DESCRAMBLING, LNBDESCRAMBLING };
+
class TunerLnbAidlTest : public testing::TestWithParam<std::string> {
public:
virtual void SetUp() override {
@@ -73,6 +97,11 @@
mLnbTests.setService(mService);
}
+ virtual void TearDown() override {
+ clearIds();
+ mService = nullptr;
+ }
+
protected:
static void description(const std::string& description) {
RecordProperty("description", description);
@@ -101,6 +130,11 @@
mFilterTests.setService(mService);
}
+ virtual void TearDown() override {
+ clearIds();
+ mService = nullptr;
+ }
+
protected:
static void description(const std::string& description) {
RecordProperty("description", description);
@@ -124,13 +158,18 @@
mService = nullptr;
}
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
mFilterTests.setService(mService);
}
+ virtual void TearDown() override {
+ clearIds();
+ mService = nullptr;
+ }
+
protected:
static void description(const std::string& description) {
RecordProperty("description", description);
@@ -197,6 +236,11 @@
mDvrTests.setService(mService);
}
+ virtual void TearDown() override {
+ clearIds();
+ mService = nullptr;
+ }
+
protected:
static void description(const std::string& description) {
RecordProperty("description", description);
@@ -211,6 +255,8 @@
AssertionResult filterDataOutputTest();
void playbackSingleFilterTest(FilterConfig filterConf, DvrConfig dvrConf);
+
+ void setStatusCheckIntervalHintTest(int64_t milliseconds, DvrConfig dvrConf);
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerPlaybackAidlTest);
@@ -225,7 +271,7 @@
mService = nullptr;
}
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
@@ -234,6 +280,11 @@
mLnbTests.setService(mService);
}
+ virtual void TearDown() override {
+ clearIds();
+ mService = nullptr;
+ }
+
protected:
static void description(const std::string& description) {
RecordProperty("description", description);
@@ -244,7 +295,9 @@
void recordSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf,
DvrConfig dvrConf, LnbConfig lnbConf);
void recordSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf,
- DvrConfig dvrConf);
+ DvrConfig dvrConf, Dataflow_Context context);
+ void setStatusCheckIntervalHintTest(int64_t milliseconds, FrontendConfig frontendConf,
+ DvrConfig dvrConf);
std::shared_ptr<ITuner> mService;
FrontendTests mFrontendTests;
@@ -254,7 +307,7 @@
LnbTests mLnbTests;
private:
- int32_t* mLnbId = nullptr;
+ int32_t mLnbId = INVALID_LNB_ID;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerRecordAidlTest);
@@ -269,11 +322,16 @@
mService = nullptr;
}
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
}
+ virtual void TearDown() override {
+ clearIds();
+ mService = nullptr;
+ }
+
protected:
static void description(const std::string& description) {
RecordProperty("description", description);
@@ -295,7 +353,7 @@
mService = nullptr;
}
ASSERT_NE(mService, nullptr);
- initConfiguration();
+ ASSERT_TRUE(initConfiguration());
mFrontendTests.setService(mService);
mDemuxTests.setService(mService);
@@ -304,6 +362,11 @@
mDvrTests.setService(mService);
}
+ virtual void TearDown() override {
+ clearIds();
+ mService = nullptr;
+ }
+
protected:
static void description(const std::string& description) {
RecordProperty("description", description);
@@ -324,7 +387,7 @@
void mediaFilterUsingSharedMemoryTest(FilterConfig filterConf, FrontendConfig frontendConf);
private:
- int32_t* mLnbId = nullptr;
+ int32_t mLnbId = INVALID_LNB_ID;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerBroadcastAidlTest);
@@ -348,6 +411,12 @@
mDvrTests.setService(mService);
mDescramblerTests.setService(mService);
mDescramblerTests.setCasService(mCasService);
+ mLnbTests.setService(mService);
+ }
+
+ virtual void TearDown() override {
+ clearIds();
+ mService = nullptr;
}
protected:
@@ -356,7 +425,11 @@
}
void scrambledBroadcastTest(set<struct FilterConfig> mediaFilterConfs,
- FrontendConfig frontendConf, DescramblerConfig descConfig);
+ FrontendConfig frontendConf, DescramblerConfig descConfig,
+ Dataflow_Context context);
+ void scrambledBroadcastTestWithLnb(set<struct FilterConfig>& mediaFilterConfs,
+ FrontendConfig& frontendConf, DescramblerConfig& descConfig,
+ LnbConfig& lnbConfig);
AssertionResult filterDataOutputTest();
std::shared_ptr<ITuner> mService;
@@ -366,6 +439,10 @@
FilterTests mFilterTests;
DescramblerTests mDescramblerTests;
DvrTests mDvrTests;
+ LnbTests mLnbTests;
+
+ private:
+ int32_t mLnbId = INVALID_LNB_ID;
};
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerDescramblerAidlTest);
diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h
index 5f1f9c5..516cb62 100644
--- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h
+++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h
@@ -55,6 +55,7 @@
const string configFilePath = "/vendor/etc/tuner_vts_config_aidl_V1.xml";
#define FILTER_MAIN_TYPE_BIT_COUNT 5
+#define STATUS_CHECK_INTERVAL_MS 100L
// Hardware configs
static map<string, FrontendConfig> frontendMap;
@@ -74,6 +75,512 @@
static LnbLiveHardwareConnections lnbLive;
static LnbRecordHardwareConnections lnbRecord;
static TimeFilterHardwareConnections timeFilter;
+static LnbDescramblingHardwareConnections lnbDescrambling;
+
+/*
+ * This function takes in a 2d vector of device Id's
+ * The n vectors correlate to the ids for n different devices (eg frontends, filters)
+ * The resultant 2d vector is every combination of id's with 1 id from each vector
+ */
+inline vector<vector<string>> generateIdCombinations(vector<vector<string>>& ids) {
+ vector<vector<string>> combinations;
+
+ // The index of each vector in ids that will be used in the next combination
+ // EG {0, 2} means combo {ids[0][0] ids[1][2]} will be next
+ const int size = static_cast<int>(ids.size());
+ vector<int> indexes_used_in_combination(size, 0);
+
+ // The vector number from ids whose elements we will cycle through to make combinations.
+ // First, start at the right most vector
+ int cycled_vector = size - 1;
+
+ while (cycled_vector >= 0) {
+ // Make a combination (one at a time)
+ vector<string> combo;
+ for (size_t i = 0; i < indexes_used_in_combination.size(); ++i) {
+ const int combo_index = indexes_used_in_combination[i];
+ combo.push_back(ids[i][combo_index]);
+ }
+ combinations.push_back(combo);
+
+ // Find the right most vector that still has space [elements left] to cycle through and
+ // create a combination
+ while (cycled_vector >= 0 &&
+ indexes_used_in_combination[cycled_vector] == ids[cycled_vector].size() - 1) {
+ cycled_vector--;
+ }
+
+ // Use this check to avoid segmentation faults
+ if (cycled_vector >= 0) {
+ // Once found, we have a vector we can cycle through, so increase to its next element
+ indexes_used_in_combination[cycled_vector]++;
+
+ // Reset the other vectors to the right to their first element so we can cycle through
+ // them again with the new element from cycled vector
+ for (size_t i = cycled_vector + 1; i < indexes_used_in_combination.size(); ++i) {
+ indexes_used_in_combination[i] = 0;
+ }
+
+ // all the vectors to the right were reset, so we can cycle through them again
+ // Start at the furthest right vector
+ cycled_vector = size - 1;
+ }
+ }
+
+ return combinations;
+}
+
+/*
+ * index 0 - playback dvr
+ * index 1 - audio filters
+ * index 2 - optional section filters
+ */
+static inline vector<DvrPlaybackHardwareConnections> generatePlaybackCombinations() {
+ vector<DvrPlaybackHardwareConnections> combinations;
+ vector<string> sectionFilterIds_optional = sectionFilterIds;
+ sectionFilterIds_optional.push_back(emptyHardwareId);
+ vector<vector<string>> deviceIds{playbackDvrIds, audioFilterIds, sectionFilterIds_optional};
+
+ const int dvrIndex = 0;
+ const int audioFilterIndex = 1;
+ const int sectionFilterIndex = 2;
+
+ auto idCombinations = generateIdCombinations(deviceIds);
+ for (auto& combo : idCombinations) {
+ DvrPlaybackHardwareConnections mPlayback;
+ mPlayback.dvrId = combo[dvrIndex];
+ mPlayback.audioFilterId = combo[audioFilterIndex];
+ mPlayback.sectionFilterId = combo[sectionFilterIndex];
+ const int videoFilterIndex =
+ find(audioFilterIds.begin(), audioFilterIds.end(), mPlayback.audioFilterId) -
+ audioFilterIds.begin();
+ mPlayback.videoFilterId = videoFilterIds[videoFilterIndex];
+ combinations.push_back(mPlayback);
+ }
+
+ return combinations;
+}
+
+static inline vector<DvrPlaybackHardwareConnections> generatePlaybackConfigs() {
+ vector<DvrPlaybackHardwareConnections> playback_configs;
+ if (configuredPlayback) {
+ ALOGD("Using DVR playback configuration provided.");
+ playback_configs = {playback};
+ } else {
+ ALOGD("Dvr playback not provided. Generating possible combinations. Consider adding it to "
+ "the configuration file.");
+ playback_configs = generatePlaybackCombinations();
+ }
+
+ return playback_configs;
+}
+
+/*
+ * index 0 - frontends
+ * index 1 - audio filters
+ * index 2 - lnbs
+ */
+static inline vector<LnbLiveHardwareConnections> generateLnbLiveCombinations() {
+ vector<LnbLiveHardwareConnections> combinations;
+ vector<vector<string>> deviceIds{frontendIds, audioFilterIds, lnbIds};
+
+ const int frontendIndex = 0;
+ const int audioFilterIndex = 1;
+ const int lnbIndex = 2;
+
+ // TODO: Find a better way to vary diseqcMsgs, if at all
+ auto idCombinations = generateIdCombinations(deviceIds);
+ for (auto& combo : idCombinations) {
+ const string feId = combo[frontendIndex];
+ auto type = frontendMap[feId].type;
+ if (type == FrontendType::DVBS || type == FrontendType::ISDBS ||
+ type == FrontendType::ISDBS3) {
+ LnbLiveHardwareConnections mLnbLive;
+ mLnbLive.frontendId = feId;
+ mLnbLive.audioFilterId = combo[audioFilterIndex];
+ const int videoFilterIndex =
+ find(audioFilterIds.begin(), audioFilterIds.end(), mLnbLive.audioFilterId) -
+ audioFilterIds.begin();
+ mLnbLive.videoFilterId = videoFilterIds[videoFilterIndex];
+ mLnbLive.lnbId = combo[lnbIndex];
+ mLnbLive.diseqcMsgs = diseqcMsgs;
+ combinations.push_back(mLnbLive);
+ }
+ }
+
+ return combinations;
+}
+
+static inline vector<LnbLiveHardwareConnections> generateLnbLiveConfigurations() {
+ vector<LnbLiveHardwareConnections> lnbLive_configs;
+ if (configuredLnbLive) {
+ ALOGD("Using LnbLive configuration provided.");
+ lnbLive_configs = {lnbLive};
+ } else {
+ ALOGD("LnbLive not provided. Generating possible combinations. Consider adding it to the "
+ "configuration file.");
+ lnbLive_configs = generateLnbLiveCombinations();
+ }
+
+ return lnbLive_configs;
+}
+
+static inline vector<ScanHardwareConnections> generateScanCombinations() {
+ vector<ScanHardwareConnections> combinations;
+
+ for (auto& id : frontendIds) {
+ ScanHardwareConnections mScan;
+ mScan.frontendId = id;
+ combinations.push_back(mScan);
+ }
+
+ return combinations;
+}
+
+static inline vector<ScanHardwareConnections> generateScanConfigurations() {
+ vector<ScanHardwareConnections> scan_configs;
+ if (configuredScan) {
+ ALOGD("Using scan configuration provided.");
+ scan_configs = {scan};
+ } else {
+ ALOGD("Scan not provided. Generating possible combinations. Consider adding it to "
+ "the configuration file.");
+ scan_configs = generateScanCombinations();
+ }
+
+ return scan_configs;
+}
+
+/*
+ * index 0 - frontends
+ * index 1 - record filter
+ * index 2 - Record Dvr
+ * index 3 - Lnb
+ */
+static inline vector<LnbRecordHardwareConnections> generateLnbRecordCombinations() {
+ vector<LnbRecordHardwareConnections> combinations;
+ vector<vector<string>> deviceIds{frontendIds, recordFilterIds, recordDvrIds, lnbIds};
+
+ const int frontendIndex = 0;
+ const int recordFilterIndex = 1;
+ const int dvrIndex = 2;
+ const int lnbIndex = 3;
+
+ auto idCombinations = generateIdCombinations(deviceIds);
+ // TODO : Find a better way to vary diseqcMsgs, if at all
+ for (auto& combo : idCombinations) {
+ const string feId = combo[frontendIndex];
+ auto type = frontendMap[feId].type;
+ if (type == FrontendType::DVBS || type == FrontendType::ISDBS ||
+ type == FrontendType::ISDBS3) {
+ LnbRecordHardwareConnections mLnbRecord;
+ mLnbRecord.frontendId = feId;
+ mLnbRecord.recordFilterId = combo[recordFilterIndex];
+ mLnbRecord.dvrRecordId = combo[dvrIndex];
+ mLnbRecord.lnbId = combo[lnbIndex];
+ mLnbRecord.diseqcMsgs = diseqcMsgs;
+ combinations.push_back(mLnbRecord);
+ }
+ }
+
+ return combinations;
+}
+
+static inline vector<LnbRecordHardwareConnections> generateLnbRecordConfigurations() {
+ vector<LnbRecordHardwareConnections> lnbRecord_configs;
+ if (configuredLnbRecord) {
+ ALOGD("Using LnbRecord configuration provided.");
+ lnbRecord_configs = {lnbRecord};
+ } else {
+ ALOGD("LnbRecord not provided. Generating possible combinations. Consider adding it to "
+ "the configuration file.");
+ lnbRecord_configs = generateLnbRecordCombinations();
+ }
+
+ return lnbRecord_configs;
+}
+
+/*
+ * index 0 - decramblers
+ * index 1 - frontends
+ * index 2 - audio filters
+ * index 3 - Dvr SW Fe Connections
+ * index 4 - DVR Source Connections
+ */
+static inline vector<DescramblingHardwareConnections> generateDescramblingCombinations() {
+ vector<DescramblingHardwareConnections> combinations;
+ vector<string> mfrontendIds = frontendIds;
+ vector<string> mDvrFeConnectionIds = playbackDvrIds;
+ vector<string> mDvrSourceConnectionIds = playbackDvrIds;
+
+ // Add the empty hardware id to each vector to include combinations where these 3 fields might
+ // be optional
+ mfrontendIds.push_back(emptyHardwareId);
+ mDvrFeConnectionIds.push_back(emptyHardwareId);
+ mDvrSourceConnectionIds.push_back(emptyHardwareId);
+
+ const int descramblerIndex = 0;
+ const int frontendIndex = 1;
+ const int audioFilterIndex = 2;
+ const int dvrFeIdIndex = 3;
+ const int dvrSourceIdIndex = 4;
+
+ vector<vector<string>> deviceIds{descramblerIds, mfrontendIds, audioFilterIds,
+ mDvrFeConnectionIds, mDvrSourceConnectionIds};
+ auto idCombinations = generateIdCombinations(deviceIds);
+ for (auto& combo : idCombinations) {
+ DescramblingHardwareConnections mDescrambling;
+ const string feId = combo[frontendIndex];
+ const string dvrSwFeId = combo[dvrFeIdIndex];
+ const string dvrSourceId = combo[dvrSourceIdIndex];
+ mDescrambling.hasFrontendConnection = feId.compare(emptyHardwareId) == 0 ? false : true;
+ if (!mDescrambling.hasFrontendConnection) {
+ if (dvrSourceId.compare(emptyHardwareId) == 0) {
+ // If combination does not have a frontend or dvr source connection, do not include
+ // it
+ continue;
+ }
+ } else {
+ if (frontendMap[feId].isSoftwareFe && dvrSwFeId.compare(emptyHardwareId) == 0) {
+ // If combination has a software frontend and no dvr->software frontend connection,
+ // do not include it
+ continue;
+ }
+ }
+ if (dvrSwFeId.compare(dvrSourceId) == 0) {
+ // If dvr->software frontend connection is the same as dvr source input to tuner, do not
+ // include it.
+ continue;
+ }
+ mDescrambling.frontendId = feId;
+ mDescrambling.audioFilterId = combo[audioFilterIndex];
+ const int videoFilterIndex =
+ find(audioFilterIds.begin(), audioFilterIds.end(), mDescrambling.audioFilterId) -
+ audioFilterIds.begin();
+ mDescrambling.videoFilterId = videoFilterIds[videoFilterIndex];
+ mDescrambling.dvrSoftwareFeId = dvrSwFeId;
+ mDescrambling.dvrSourceId = dvrSourceId;
+ mDescrambling.descramblerId = combo[descramblerIndex];
+ combinations.push_back(mDescrambling);
+ }
+
+ return combinations;
+}
+
+static inline vector<DescramblingHardwareConnections> generateDescramblingConfigurations() {
+ vector<DescramblingHardwareConnections> descrambling_configs;
+ if (configuredDescrambling) {
+ ALOGD("Using Descrambling configuration provided.");
+ descrambling_configs = {descrambling};
+ } else {
+ ALOGD("Descrambling not provided. Generating possible combinations. Consider adding it to "
+ "the "
+ "configuration file.");
+ descrambling_configs = generateDescramblingCombinations();
+ }
+
+ return descrambling_configs;
+}
+
+static inline vector<TimeFilterHardwareConnections> generateTimeFilterCombinations() {
+ vector<TimeFilterHardwareConnections> combinations;
+
+ for (auto& id : timeFilterIds) {
+ TimeFilterHardwareConnections mTimeFilter;
+ mTimeFilter.timeFilterId = id;
+ combinations.push_back(mTimeFilter);
+ }
+
+ return combinations;
+}
+
+static inline vector<TimeFilterHardwareConnections> generateTimeFilterConfigurations() {
+ vector<TimeFilterHardwareConnections> timeFilter_configs;
+ if (configuredTimeFilter) {
+ ALOGD("Using TimeFilter configuration provided.");
+ timeFilter_configs = {timeFilter};
+ } else {
+ ALOGD("TimeFilter not provided. Generating possible combinations. Consider adding it to "
+ "the "
+ "configuration file.");
+ timeFilter_configs = generateTimeFilterCombinations();
+ }
+
+ return timeFilter_configs;
+}
+
+/*
+ * index 0 - frontends
+ * index 1 - record dvrs
+ * index 2 - record filters
+ */
+static inline vector<DvrRecordHardwareConnections> generateRecordCombinations() {
+ vector<DvrRecordHardwareConnections> combinations;
+
+ const int frontendIdIndex = 0;
+ const int recordDvrIndex = 1;
+ const int recordFilterIndex = 2;
+
+ vector<vector<string>> deviceIds{frontendIds, recordDvrIds, recordFilterIds};
+
+ auto idCombinations = generateIdCombinations(deviceIds);
+ for (auto& combo : idCombinations) {
+ DvrRecordHardwareConnections mRecord;
+ const string feId = combo[frontendIdIndex];
+ mRecord.hasFrontendConnection = true;
+ if (frontendMap[feId].isSoftwareFe) {
+ // If we have a software frontend, do not include configuration for testing.
+ continue;
+ }
+ mRecord.frontendId = feId;
+ mRecord.support = true;
+ mRecord.dvrSourceId = emptyHardwareId;
+ mRecord.dvrSoftwareFeId = emptyHardwareId;
+ mRecord.recordFilterId = combo[recordFilterIndex];
+ mRecord.dvrRecordId = combo[recordDvrIndex];
+ combinations.push_back(mRecord);
+ }
+
+ return combinations;
+}
+
+static inline vector<DvrRecordHardwareConnections> generateRecordConfigurations() {
+ vector<DvrRecordHardwareConnections> record_configs;
+ if (configuredRecord) {
+ ALOGD("Using Record configuration provided.");
+ record_configs = {record};
+ } else {
+ ALOGD("Record not provided. Generating possible combinations. Consider adding it to "
+ "the "
+ "configuration file.");
+ record_configs = generateRecordCombinations();
+ }
+
+ return record_configs;
+}
+
+/*
+ * index 0 - frontends
+ * index 1 - audio filters
+ * index 2 - playback dvrs
+ * index 3 - section Filters
+ */
+static inline vector<LiveBroadcastHardwareConnections> generateLiveCombinations() {
+ vector<LiveBroadcastHardwareConnections> combinations;
+ vector<string> mSectionFilterIds = sectionFilterIds;
+ vector<string> mDvrSwConnectionIds = playbackDvrIds;
+
+ // Adding the empty hardware id to cover cases where fields are optional
+ mSectionFilterIds.push_back(emptyHardwareId);
+ mDvrSwConnectionIds.push_back(emptyHardwareId);
+
+ const int frontendIdIndex = 0;
+ const int audioFilterIdIndex = 1;
+ const int dvrSwConnectionIdIndex = 2;
+ const int sectionFilterIdIndex = 3;
+
+ vector<vector<string>> deviceIds{frontendIds, audioFilterIds, mDvrSwConnectionIds,
+ mSectionFilterIds};
+
+ auto idCombinations = generateIdCombinations(deviceIds);
+ for (auto& combo : idCombinations) {
+ LiveBroadcastHardwareConnections mLive;
+ const string feId = combo[frontendIdIndex];
+ const string dvrSwConnectionId = combo[dvrSwConnectionIdIndex];
+ mLive.hasFrontendConnection = true;
+
+ if (frontendMap[feId].isSoftwareFe && dvrSwConnectionId.compare(emptyHardwareId) == 0) {
+ // If the frontend is a software frontend and there is no dvr playback connected, do not
+ // include configuration
+ continue;
+ }
+ mLive.frontendId = feId;
+ mLive.dvrSoftwareFeId = dvrSwConnectionId;
+ mLive.audioFilterId = combo[audioFilterIdIndex];
+ const int videoFilterIdIndex =
+ find(audioFilterIds.begin(), audioFilterIds.end(), mLive.audioFilterId) -
+ audioFilterIds.begin();
+ mLive.videoFilterId = videoFilterIds[videoFilterIdIndex];
+ mLive.sectionFilterId = combo[sectionFilterIdIndex];
+
+ if (pcrFilterIds.empty()) {
+ // If pcr Filters have not been provided, set it to empty hardware id
+ mLive.pcrFilterId = emptyHardwareId;
+ } else {
+ // If pcr Filters have been provided, use the first index if there is only 1, or choose
+ // the filter that corresponds to the correct audio and video filter pair
+ const int pcrFilterIdIndex = pcrFilterIds.size() == 1 ? 0 : videoFilterIdIndex;
+ mLive.pcrFilterId = pcrFilterIds[pcrFilterIdIndex];
+ }
+
+ combinations.push_back(mLive);
+ }
+
+ return combinations;
+}
+
+static inline vector<LiveBroadcastHardwareConnections> generateLiveConfigurations() {
+ vector<LiveBroadcastHardwareConnections> live_configs;
+ if (configuredLive) {
+ ALOGD("Using Live configuration provided.");
+ live_configs = {live};
+ } else {
+ ALOGD("Live not provided. Generating possible combinations. Consider adding it to "
+ "the "
+ "configuration file.");
+ live_configs = generateLiveCombinations();
+ }
+
+ return live_configs;
+}
+
+static inline vector<LnbDescramblingHardwareConnections> generateLnbDescramblingCombinations() {
+ vector<LnbDescramblingHardwareConnections> combinations;
+ vector<vector<string>> deviceIds{frontendIds, audioFilterIds, lnbIds, descramblerIds};
+
+ const int frontendIdIndex = 0;
+ const int audioFilterIdIndex = 1;
+ const int lnbIdIndex = 2;
+ const int descramblerIdIndex = 3;
+
+ auto idCombinations = generateIdCombinations(deviceIds);
+ // TODO : Find a better way to vary diseqcMsgs, if at all
+ for (auto& combo : idCombinations) {
+ const string feId = combo[frontendIdIndex];
+ auto type = frontendMap[feId].type;
+ if (type == FrontendType::DVBS || type == FrontendType::ISDBS ||
+ type == FrontendType::ISDBS3) {
+ LnbDescramblingHardwareConnections mLnbDescrambling;
+ mLnbDescrambling.support = true;
+ mLnbDescrambling.frontendId = feId;
+ mLnbDescrambling.audioFilterId = combo[audioFilterIdIndex];
+ const int videoFilterIdIndex = find(audioFilterIds.begin(), audioFilterIds.end(),
+ mLnbDescrambling.audioFilterId) -
+ audioFilterIds.begin();
+ mLnbDescrambling.videoFilterId = videoFilterIds[videoFilterIdIndex];
+ mLnbDescrambling.lnbId = combo[lnbIdIndex];
+ mLnbDescrambling.descramblerId = combo[descramblerIdIndex];
+ mLnbDescrambling.diseqcMsgs = diseqcMsgs;
+ combinations.push_back(mLnbDescrambling);
+ }
+ }
+
+ return combinations;
+}
+
+static inline vector<LnbDescramblingHardwareConnections> generateLnbDescramblingConfigurations() {
+ vector<LnbDescramblingHardwareConnections> lnbDescrambling_configs;
+ if (configuredLnbDescrambling) {
+ ALOGD("Using LnbDescrambling configuration provided");
+ lnbDescrambling_configs = {lnbDescrambling};
+ } else {
+ ALOGD("LnbDescrambling not provided. Generating possible combinations. Consider adding it "
+ "to the configuration file.");
+ lnbDescrambling_configs = generateLnbDescramblingCombinations();
+ }
+
+ return lnbDescrambling_configs;
+}
/** Config all the frontends that would be used in the tests */
inline void initFrontendConfig() {
@@ -162,13 +669,141 @@
TunerTestingConfigAidlReader1_0::readDvrConfig1_0(dvrMap);
};
+inline void initTimeFilterConfig() {
+ // Read customized config
+ TunerTestingConfigAidlReader1_0::readTimeFilterConfig1_0(timeFilterMap);
+};
+
+inline void initDescramblerConfig() {
+ // Read customized config
+ TunerTestingConfigAidlReader1_0::readDescramblerConfig1_0(descramblerMap);
+}
+
+inline void initLnbConfig() {
+ // Read customized config
+ TunerTestingConfigAidlReader1_0::readLnbConfig1_0(lnbMap);
+};
+
+inline void initDiseqcMsgsConfig() {
+ // Read customized config
+ TunerTestingConfigAidlReader1_0::readDiseqcMessages(diseqcMsgMap);
+};
+
+inline void determineScan() {
+ if (!frontendMap.empty()) {
+ scan.hasFrontendConnection = true;
+ ALOGD("Can support scan");
+ }
+}
+
+inline void determineTimeFilter() {
+ if (!timeFilterMap.empty()) {
+ timeFilter.support = true;
+ ALOGD("Can support time filter");
+ }
+}
+
+inline void determineDvrPlayback() {
+ if (!playbackDvrIds.empty() && !audioFilterIds.empty() && !videoFilterIds.empty()) {
+ playback.support = true;
+ ALOGD("Can support dvr playback");
+ }
+}
+
+inline void determineLnbLive() {
+ if (!audioFilterIds.empty() && !videoFilterIds.empty() && !frontendMap.empty() &&
+ !lnbMap.empty()) {
+ lnbLive.support = true;
+ ALOGD("Can support lnb live");
+ }
+}
+
+inline void determineLnbRecord() {
+ if (!frontendMap.empty() && !recordFilterIds.empty() && !recordDvrIds.empty() &&
+ !lnbMap.empty()) {
+ lnbRecord.support = true;
+ ALOGD("Can support lnb record");
+ }
+}
+
+inline void determineLive() {
+ if (videoFilterIds.empty() || audioFilterIds.empty() || frontendMap.empty()) {
+ return;
+ }
+ if (hasSwFe && !hasHwFe && dvrMap.empty()) {
+ ALOGD("Cannot configure Live. Only software frontends and no dvr connections");
+ return;
+ }
+ ALOGD("Can support live");
+ live.hasFrontendConnection = true;
+}
+
+inline void determineDescrambling() {
+ if (descramblerMap.empty() || audioFilterIds.empty() || videoFilterIds.empty()) {
+ return;
+ }
+ if (frontendMap.empty() && playbackDvrIds.empty()) {
+ ALOGD("Cannot configure descrambling. No frontends or playback dvr's");
+ return;
+ }
+ if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) {
+ ALOGD("cannot configure descrambling. Only SW frontends and no playback dvr's");
+ return;
+ }
+ ALOGD("Can support descrambling");
+ descrambling.support = true;
+}
+
+inline void determineDvrRecord() {
+ if (recordDvrIds.empty() || recordFilterIds.empty()) {
+ return;
+ }
+ if (frontendMap.empty() && playbackDvrIds.empty()) {
+ ALOGD("Cannot support dvr record. No frontends and no playback dvr's");
+ return;
+ }
+ if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) {
+ ALOGD("Cannot support dvr record. Only SW frontends and no playback dvr's");
+ return;
+ }
+ ALOGD("Can support dvr record.");
+ record.support = true;
+}
+
+inline void determineLnbDescrambling() {
+ if (frontendIds.empty() || audioFilterIds.empty() || videoFilterIds.empty() || lnbIds.empty() ||
+ descramblerIds.empty()) {
+ return;
+ }
+ ALOGD("Can support LnbDescrambling.");
+ lnbDescrambling.support = true;
+}
+
/** Read the vendor configurations of which hardware to use for each test cases/data flows */
inline void connectHardwaresToTestCases() {
TunerTestingConfigAidlReader1_0::connectLiveBroadcast(live);
TunerTestingConfigAidlReader1_0::connectScan(scan);
TunerTestingConfigAidlReader1_0::connectDvrRecord(record);
+ TunerTestingConfigAidlReader1_0::connectTimeFilter(timeFilter);
+ TunerTestingConfigAidlReader1_0::connectDescrambling(descrambling);
+ TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive);
+ TunerTestingConfigAidlReader1_0::connectLnbRecord(lnbRecord);
+ TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback);
+ TunerTestingConfigAidlReader1_0::connectLnbDescrambling(lnbDescrambling);
};
+inline void determineDataFlows() {
+ determineScan();
+ determineTimeFilter();
+ determineDvrPlayback();
+ determineLnbLive();
+ determineLnbRecord();
+ determineLive();
+ determineDescrambling();
+ determineDvrRecord();
+ determineLnbDescrambling();
+}
+
inline bool validateConnections() {
if (record.support && !record.hasFrontendConnection &&
record.dvrSourceId.compare(emptyHardwareId) == 0) {
@@ -183,6 +818,18 @@
feIsValid &= record.support && record.hasFrontendConnection
? frontendMap.find(record.frontendId) != frontendMap.end()
: true;
+ feIsValid &= descrambling.support && descrambling.hasFrontendConnection
+ ? frontendMap.find(descrambling.frontendId) != frontendMap.end()
+ : true;
+
+ feIsValid &= lnbLive.support ? frontendMap.find(lnbLive.frontendId) != frontendMap.end() : true;
+
+ feIsValid &=
+ lnbRecord.support ? frontendMap.find(lnbRecord.frontendId) != frontendMap.end() : true;
+
+ feIsValid &= lnbDescrambling.support
+ ? frontendMap.find(lnbDescrambling.frontendId) != frontendMap.end()
+ : true;
if (!feIsValid) {
ALOGW("[vts config] dynamic config fe connection is invalid.");
@@ -204,6 +851,20 @@
dvrIsValid &= dvrMap.find(record.dvrRecordId) != dvrMap.end();
}
+ if (descrambling.support) {
+ if (descrambling.hasFrontendConnection) {
+ if (frontendMap[descrambling.frontendId].isSoftwareFe) {
+ dvrIsValid &= dvrMap.find(descrambling.dvrSoftwareFeId) != dvrMap.end();
+ }
+ } else {
+ dvrIsValid &= dvrMap.find(descrambling.dvrSourceId) != dvrMap.end();
+ }
+ }
+
+ dvrIsValid &= lnbRecord.support ? dvrMap.find(lnbRecord.dvrRecordId) != dvrMap.end() : true;
+
+ dvrIsValid &= playback.support ? dvrMap.find(playback.dvrId) != dvrMap.end() : true;
+
if (!dvrIsValid) {
ALOGW("[vts config] dynamic config dvr connection is invalid.");
return false;
@@ -216,10 +877,120 @@
filterIsValid &=
record.support ? filterMap.find(record.recordFilterId) != filterMap.end() : true;
+ filterIsValid &= descrambling.support
+ ? filterMap.find(descrambling.videoFilterId) != filterMap.end() &&
+ filterMap.find(descrambling.audioFilterId) != filterMap.end()
+ : true;
+
+ for (auto& filterId : descrambling.extraFilters) {
+ filterIsValid &= filterMap.find(filterId) != filterMap.end();
+ }
+
+ filterIsValid &= lnbLive.support
+ ? filterMap.find(lnbLive.audioFilterId) != filterMap.end() &&
+ filterMap.find(lnbLive.videoFilterId) != filterMap.end()
+ : true;
+
+ filterIsValid &=
+ lnbRecord.support ? filterMap.find(lnbRecord.recordFilterId) != filterMap.end() : true;
+
+ for (auto& filterId : lnbRecord.extraFilters) {
+ filterIsValid &= filterMap.find(filterId) != filterMap.end();
+ }
+
+ for (auto& filterId : lnbLive.extraFilters) {
+ filterIsValid &= filterMap.find(filterId) != filterMap.end();
+ }
+
+ filterIsValid &= playback.support
+ ? filterMap.find(playback.audioFilterId) != filterMap.end() &&
+ filterMap.find(playback.videoFilterId) != filterMap.end()
+ : true;
+ filterIsValid &= playback.sectionFilterId.compare(emptyHardwareId) == 0
+ ? true
+ : filterMap.find(playback.sectionFilterId) != filterMap.end();
+
+ for (auto& filterId : playback.extraFilters) {
+ filterIsValid &=
+ playback.hasExtraFilters ? filterMap.find(filterId) != filterMap.end() : true;
+ }
+
+ filterIsValid &=
+ lnbDescrambling.support
+ ? filterMap.find(lnbDescrambling.audioFilterId) != filterMap.end() &&
+ filterMap.find(lnbDescrambling.videoFilterId) != filterMap.end()
+ : true;
+
if (!filterIsValid) {
ALOGW("[vts config] dynamic config filter connection is invalid.");
return false;
}
+ if (audioFilterIds.size() != videoFilterIds.size()) {
+ ALOGW("[vts config] the number of audio and video filters should be equal");
+ return false;
+ }
+
+ if (!pcrFilterIds.empty() && pcrFilterIds.size() != 1 &&
+ pcrFilterIds.size() != audioFilterIds.size()) {
+ ALOGW("[vts config] When more than 1 pcr filter is configured, the number of pcr filters "
+ "must equal the number of audio and video filters.");
+ return false;
+ }
+
+ bool timeFilterIsValid =
+ timeFilter.support ? timeFilterMap.find(timeFilter.timeFilterId) != timeFilterMap.end()
+ : true;
+
+ if (!timeFilterIsValid) {
+ ALOGW("[vts config] dynamic config time filter connection is invalid.");
+ }
+
+ bool descramblerIsValid =
+ descrambling.support
+ ? descramblerMap.find(descrambling.descramblerId) != descramblerMap.end()
+ : true;
+
+ descramblerIsValid &=
+ lnbDescrambling.support
+ ? descramblerMap.find(lnbDescrambling.descramblerId) != descramblerMap.end()
+ : true;
+
+ if (!descramblerIsValid) {
+ ALOGW("[vts config] dynamic config descrambler connection is invalid.");
+ return false;
+ }
+
+ bool lnbIsValid = lnbLive.support ? lnbMap.find(lnbLive.lnbId) != lnbMap.end() : true;
+
+ lnbIsValid &= lnbRecord.support ? lnbMap.find(lnbRecord.lnbId) != lnbMap.end() : true;
+
+ lnbIsValid &=
+ lnbDescrambling.support ? lnbMap.find(lnbDescrambling.lnbId) != lnbMap.end() : true;
+
+ if (!lnbIsValid) {
+ ALOGW("[vts config] dynamic config lnb connection is invalid.");
+ return false;
+ }
+
+ bool diseqcMsgsIsValid = true;
+
+ for (auto& msg : lnbRecord.diseqcMsgs) {
+ diseqcMsgsIsValid &= diseqcMsgMap.find(msg) != diseqcMsgMap.end();
+ }
+
+ for (auto& msg : lnbLive.diseqcMsgs) {
+ diseqcMsgsIsValid &= diseqcMsgMap.find(msg) != diseqcMsgMap.end();
+ }
+
+ for (auto& msg : lnbDescrambling.diseqcMsgs) {
+ diseqcMsgsIsValid &= diseqcMsgMap.find(msg) != diseqcMsgMap.end();
+ }
+
+ if (!diseqcMsgsIsValid) {
+ ALOGW("[vts config] dynamic config diseqcMsg is invalid.");
+ return false;
+ }
+
return true;
}
diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
index 189f5fd..9517520 100644
--- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
+++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h
@@ -62,10 +62,37 @@
using namespace aidl::android::hardware::tv::tuner;
using namespace android::media::tuner::testing::configuration::V1_0;
+static bool hasHwFe = false;
+static bool hasSwFe = false;
+static bool configFileRead = false;
+static bool configuredLive = false;
+static bool configuredScan = false;
+static bool configuredRecord = false;
+static bool configuredLnbLive = false;
+static bool configuredPlayback = false;
+static bool configuredLnbRecord = false;
+static bool configuredTimeFilter = false;
+static bool configuredDescrambling = false;
+static bool configuredLnbDescrambling = false;
+
const string emptyHardwareId = "";
static string mConfigFilePath;
+static vector<string> playbackDvrIds;
+static vector<string> ipFilterIds;
+static vector<string> recordDvrIds;
+static vector<string> pcrFilterIds;
+static vector<string> timeFilterIds;
+static vector<string> audioFilterIds;
+static vector<string> videoFilterIds;
+static vector<string> recordFilterIds;
+static vector<string> sectionFilterIds;
+static vector<string> frontendIds;
+static vector<string> lnbIds;
+static vector<string> diseqcMsgs;
+static vector<string> descramblerIds;
+
#define PROVISION_STR \
"{ " \
" \"id\": 21140844, " \
@@ -137,6 +164,7 @@
string ipFilterId;
string pcrFilterId;
/* list string of extra filters; */
+ vector<string> extraFilters;
};
struct ScanHardwareConnections {
@@ -146,12 +174,13 @@
struct DvrPlaybackHardwareConnections {
bool support;
+ bool hasExtraFilters = false;
string frontendId;
string dvrId;
string audioFilterId;
string videoFilterId;
string sectionFilterId;
- /* list string of extra filters; */
+ vector<string> extraFilters;
};
struct DvrRecordHardwareConnections {
@@ -173,7 +202,7 @@
string videoFilterId;
string descramblerId;
string dvrSourceId;
- /* list string of extra filters; */
+ vector<string> extraFilters;
};
struct LnbLiveHardwareConnections {
@@ -183,7 +212,7 @@
string videoFilterId;
string lnbId;
vector<string> diseqcMsgs;
- /* list string of extra filters; */
+ vector<string> extraFilters;
};
struct LnbRecordHardwareConnections {
@@ -193,7 +222,7 @@
string recordFilterId;
string lnbId;
vector<string> diseqcMsgs;
- /* list string of extra filters; */
+ vector<string> extraFilters;
};
struct TimeFilterHardwareConnections {
@@ -201,6 +230,16 @@
string timeFilterId;
};
+struct LnbDescramblingHardwareConnections {
+ bool support;
+ string frontendId;
+ string audioFilterId;
+ string videoFilterId;
+ string lnbId;
+ string descramblerId;
+ vector<string> diseqcMsgs;
+};
+
struct TunerTestingConfigAidlReader1_0 {
public:
static void setConfigFilePath(string path) { mConfigFilePath = path; }
@@ -248,6 +287,7 @@
auto frontends = *hardwareConfig.getFirstFrontends();
for (auto feConfig : frontends.getFrontend()) {
string id = feConfig.getId();
+ frontendIds.push_back(id);
if (id.compare(string("FE_DEFAULT")) == 0) {
// overrid default
frontendMap.erase(string("FE_DEFAULT"));
@@ -263,6 +303,9 @@
break;
case FrontendTypeEnum::ATSC:
type = FrontendType::ATSC;
+ frontendMap[id].settings.set<
+ FrontendSettings::Tag::atsc>(
+ readAtscFrontendSettings(feConfig));
break;
case FrontendTypeEnum::ATSC3:
type = FrontendType::ATSC3;
@@ -283,12 +326,16 @@
}
case FrontendTypeEnum::ISDBS:
type = FrontendType::ISDBS;
+ frontendMap[id].settings.set<FrontendSettings::Tag::isdbs>(
+ readIsdbsFrontendSettings(feConfig));
break;
case FrontendTypeEnum::ISDBS3:
type = FrontendType::ISDBS3;
break;
case FrontendTypeEnum::ISDBT:
type = FrontendType::ISDBT;
+ frontendMap[id].settings.set<FrontendSettings::Tag::isdbt>(
+ readIsdbtFrontendSettings(feConfig));
break;
case FrontendTypeEnum::DTMB:
type = FrontendType::DTMB;
@@ -302,6 +349,11 @@
}
frontendMap[id].type = type;
frontendMap[id].isSoftwareFe = feConfig.getIsSoftwareFrontend();
+ if (frontendMap[id].isSoftwareFe) {
+ hasSwFe = true;
+ } else {
+ hasHwFe = true;
+ }
// TODO: b/182519645 complete the tune status config
frontendMap[id].tuneStatusTypes = types;
frontendMap[id].expectTuneStatuses = statuses;
@@ -376,11 +428,13 @@
DvrType type;
switch (dvrConfig.getType()) {
case DvrTypeEnum::PLAYBACK:
+ playbackDvrIds.push_back(id);
type = DvrType::PLAYBACK;
dvrMap[id].settings.set<DvrSettings::Tag::playback>(
readPlaybackSettings(dvrConfig));
break;
case DvrTypeEnum::RECORD:
+ recordDvrIds.push_back(id);
type = DvrType::RECORD;
dvrMap[id].settings.set<DvrSettings::Tag::record>(
readRecordSettings(dvrConfig));
@@ -404,6 +458,7 @@
auto lnbs = *hardwareConfig.getFirstLnbs();
for (auto lnbConfig : lnbs.getLnb()) {
string id = lnbConfig.getId();
+ lnbIds.push_back(id);
if (lnbConfig.hasName()) {
lnbMap[id].name = lnbConfig.getName();
} else {
@@ -422,6 +477,7 @@
auto descramblers = *hardwareConfig.getFirstDescramblers();
for (auto descramblerConfig : descramblers.getDescrambler()) {
string id = descramblerConfig.getId();
+ descramblerIds.push_back(id);
descramblerMap[id].casSystemId =
static_cast<int32_t>(descramblerConfig.getCasSystemId());
if (descramblerConfig.hasProvisionStr()) {
@@ -447,6 +503,7 @@
auto msgs = *hardwareConfig.getFirstDiseqcMessages();
for (auto msgConfig : msgs.getDiseqcMessage()) {
string name = msgConfig.getMsgName();
+ diseqcMsgs.push_back(name);
for (uint8_t atom : msgConfig.getMsgBody()) {
diseqcMsgMap[name].push_back(atom);
}
@@ -460,6 +517,7 @@
auto timeFilters = *hardwareConfig.getFirstTimeFilters();
for (auto timeFilterConfig : timeFilters.getTimeFilter()) {
string id = timeFilterConfig.getId();
+ timeFilterIds.push_back(id);
timeFilterMap[id].timeStamp = static_cast<int64_t>(timeFilterConfig.getTimeStamp());
}
}
@@ -469,6 +527,7 @@
auto dataFlow = getDataFlowConfiguration();
if (dataFlow.hasClearLiveBroadcast()) {
live.hasFrontendConnection = true;
+ configuredLive = true;
} else {
live.hasFrontendConnection = false;
return;
@@ -496,12 +555,17 @@
} else {
live.ipFilterId = emptyHardwareId;
}
+ if (liveConfig.hasOptionalFilters()) {
+ auto optionalFilters = liveConfig.getOptionalFilters();
+ live.extraFilters = optionalFilters;
+ }
}
static void connectScan(ScanHardwareConnections& scan) {
auto dataFlow = getDataFlowConfiguration();
if (dataFlow.hasScan()) {
scan.hasFrontendConnection = true;
+ configuredScan = true;
} else {
scan.hasFrontendConnection = false;
return;
@@ -514,6 +578,7 @@
auto dataFlow = getDataFlowConfiguration();
if (dataFlow.hasDvrPlayback()) {
playback.support = true;
+ configuredPlayback = true;
} else {
playback.support = false;
return;
@@ -527,12 +592,17 @@
} else {
playback.sectionFilterId = emptyHardwareId;
}
+ if (playbackConfig.hasOptionalFilters()) {
+ auto optionalFilters = playbackConfig.getOptionalFilters();
+ playback.extraFilters = optionalFilters;
+ }
}
static void connectDvrRecord(DvrRecordHardwareConnections& record) {
auto dataFlow = getDataFlowConfiguration();
if (dataFlow.hasDvrRecord()) {
record.support = true;
+ configuredRecord = true;
} else {
record.support = false;
return;
@@ -557,6 +627,7 @@
auto dataFlow = getDataFlowConfiguration();
if (dataFlow.hasDescrambling()) {
descrambling.support = true;
+ configuredDescrambling = true;
} else {
descrambling.support = false;
return;
@@ -576,12 +647,17 @@
descrambling.hasFrontendConnection = false;
descrambling.dvrSourceId = descConfig.getDvrSourceConnection();
}
+ if (descConfig.hasOptionalFilters()) {
+ auto optionalFilters = descConfig.getOptionalFilters();
+ descrambling.extraFilters = optionalFilters;
+ }
}
static void connectLnbLive(LnbLiveHardwareConnections& lnbLive) {
auto dataFlow = getDataFlowConfiguration();
if (dataFlow.hasLnbLive()) {
lnbLive.support = true;
+ configuredLnbLive = true;
} else {
lnbLive.support = false;
return;
@@ -596,12 +672,17 @@
lnbLive.diseqcMsgs.push_back(msgName);
}
}
+ if (lnbLiveConfig.hasOptionalFilters()) {
+ auto optionalFilters = lnbLiveConfig.getOptionalFilters();
+ lnbLive.extraFilters = optionalFilters;
+ }
}
static void connectLnbRecord(LnbRecordHardwareConnections& lnbRecord) {
auto dataFlow = getDataFlowConfiguration();
if (dataFlow.hasLnbRecord()) {
lnbRecord.support = true;
+ configuredLnbRecord = true;
} else {
lnbRecord.support = false;
return;
@@ -616,12 +697,17 @@
lnbRecord.diseqcMsgs.push_back(msgName);
}
}
+ if (lnbRecordConfig.hasOptionalFilters()) {
+ auto optionalFilters = lnbRecordConfig.getOptionalFilters();
+ lnbRecord.extraFilters = optionalFilters;
+ }
}
static void connectTimeFilter(TimeFilterHardwareConnections& timeFilter) {
auto dataFlow = getDataFlowConfiguration();
if (dataFlow.hasTimeFilter()) {
timeFilter.support = true;
+ configuredTimeFilter = true;
} else {
timeFilter.support = false;
return;
@@ -630,6 +716,28 @@
timeFilter.timeFilterId = timeFilterConfig.getTimeFilterConnection();
}
+ static void connectLnbDescrambling(LnbDescramblingHardwareConnections& lnbDescrambling) {
+ auto dataFlow = getDataFlowConfiguration();
+ if (dataFlow.hasLnbDescrambling()) {
+ lnbDescrambling.support = true;
+ configuredLnbDescrambling = true;
+ } else {
+ lnbDescrambling.support = false;
+ return;
+ }
+ auto lnbDescramblingConfig = *dataFlow.getFirstLnbDescrambling();
+ lnbDescrambling.frontendId = lnbDescramblingConfig.getFrontendConnection();
+ lnbDescrambling.audioFilterId = lnbDescramblingConfig.getAudioFilterConnection();
+ lnbDescrambling.videoFilterId = lnbDescramblingConfig.getVideoFilterConnection();
+ lnbDescrambling.lnbId = lnbDescramblingConfig.getLnbConnection();
+ lnbDescrambling.descramblerId = lnbDescramblingConfig.getDescramblerConnection();
+ if (lnbDescramblingConfig.hasDiseqcMsgSender()) {
+ for (auto& msgName : lnbDescramblingConfig.getDiseqcMsgSender()) {
+ lnbDescrambling.diseqcMsgs.push_back(msgName);
+ }
+ }
+ }
+
private:
static FrontendDvbtSettings readDvbtFrontendSettings(Frontend feConfig) {
ALOGW("[ConfigReader] fe type is dvbt");
@@ -677,25 +785,115 @@
ALOGW("[ConfigReader] no more dvbs settings");
return dvbsSettings;
}
- dvbsSettings.symbolRate = static_cast<int32_t>(
- feConfig.getFirstDvbsFrontendSettings_optional()->getSymbolRate());
- dvbsSettings.inputStreamId = static_cast<int32_t>(
- feConfig.getFirstDvbsFrontendSettings_optional()->getInputStreamId());
auto dvbs = feConfig.getFirstDvbsFrontendSettings_optional();
- if (dvbs->hasScanType()) {
- dvbsSettings.scanType = static_cast<FrontendDvbsScanType>(dvbs->getScanType());
- }
- if (dvbs->hasIsDiseqcRxMessage()) {
- dvbsSettings.isDiseqcRxMessage = dvbs->getIsDiseqcRxMessage();
- }
+ dvbsSettings.symbolRate = static_cast<int32_t>(dvbs->getSymbolRate());
+ dvbsSettings.inputStreamId = static_cast<int32_t>(dvbs->getInputStreamId());
+ dvbsSettings.scanType = static_cast<FrontendDvbsScanType>(dvbs->getScanType());
+ dvbsSettings.isDiseqcRxMessage = dvbs->getIsDiseqcRxMessage();
+ dvbsSettings.inversion = static_cast<FrontendSpectralInversion>(dvbs->getInversion());
+ dvbsSettings.modulation = static_cast<FrontendDvbsModulation>(dvbs->getModulation());
+ dvbsSettings.rolloff = static_cast<FrontendDvbsRolloff>(dvbs->getRolloff());
+ dvbsSettings.pilot = static_cast<FrontendDvbsPilot>(dvbs->getPilot());
+ dvbsSettings.standard = static_cast<FrontendDvbsStandard>(dvbs->getStandard());
+ dvbsSettings.vcmMode = static_cast<FrontendDvbsVcmMode>(dvbs->getVcmMode());
return dvbsSettings;
}
+ static FrontendAtscSettings readAtscFrontendSettings(Frontend& feConfig) {
+ ALOGW("[ConfigReader] fe type is atsc");
+ FrontendAtscSettings atscSettings{
+ .frequency = (int64_t)feConfig.getFrequency(),
+ };
+ if (feConfig.hasEndFrequency()) {
+ atscSettings.endFrequency = (int64_t)feConfig.getEndFrequency();
+ }
+ if (!feConfig.hasAtscFrontendSettings_optional()) {
+ ALOGW("[ConfigReader] no more atsc settings");
+ return atscSettings;
+ }
+ auto atsc = feConfig.getFirstAtscFrontendSettings_optional();
+ atscSettings.inversion = static_cast<FrontendSpectralInversion>(atsc->getInversion());
+ atscSettings.modulation = static_cast<FrontendAtscModulation>(atsc->getModulation());
+ return atscSettings;
+ }
+
+ static FrontendIsdbsSettings readIsdbsFrontendSettings(Frontend& feConfig) {
+ ALOGW("[ConfigReader] fe type is isdbs");
+ FrontendIsdbsSettings isdbsSettings{.frequency = (int64_t)feConfig.getFrequency()};
+ if (feConfig.hasEndFrequency()) {
+ isdbsSettings.endFrequency = (int64_t)feConfig.getEndFrequency();
+ }
+ if (!feConfig.hasIsdbsFrontendSettings_optional()) {
+ ALOGW("[ConfigReader] no more isdbs settings");
+ return isdbsSettings;
+ }
+ auto isdbs = feConfig.getFirstIsdbsFrontendSettings_optional();
+ isdbsSettings.streamId = (int32_t)isdbs->getStreamId();
+ isdbsSettings.symbolRate = (int32_t)isdbs->getSymbolRate();
+ isdbsSettings.modulation = static_cast<FrontendIsdbsModulation>(isdbs->getModulation());
+ isdbsSettings.coderate = static_cast<FrontendIsdbsCoderate>(isdbs->getCoderate());
+ isdbsSettings.rolloff = static_cast<FrontendIsdbsRolloff>(isdbs->getRolloff());
+ isdbsSettings.streamIdType =
+ static_cast<FrontendIsdbsStreamIdType>(isdbs->getStreamIdType());
+ return isdbsSettings;
+ }
+
+ static FrontendIsdbtSettings readIsdbtFrontendSettings(Frontend& feConfig) {
+ ALOGW("[ConfigReader] fe type is isdbt");
+ FrontendIsdbtSettings isdbtSettings{
+ .frequency = (int64_t)feConfig.getFrequency(),
+ };
+ if (feConfig.hasEndFrequency()) {
+ isdbtSettings.endFrequency = (int64_t)feConfig.getEndFrequency();
+ }
+ if (!feConfig.hasIsdbtFrontendSettings_optional()) {
+ ALOGW("[ConfigReader] no more isdbt settings");
+ return isdbtSettings;
+ }
+ auto isdbt = feConfig.getFirstIsdbtFrontendSettings_optional();
+ isdbtSettings.inversion = static_cast<FrontendSpectralInversion>(isdbt->getInversion());
+ isdbtSettings.bandwidth = static_cast<FrontendIsdbtBandwidth>(isdbt->getBandwidth());
+ isdbtSettings.mode = static_cast<FrontendIsdbtMode>(isdbt->getMode());
+ isdbtSettings.guardInterval =
+ static_cast<FrontendIsdbtGuardInterval>(isdbt->getGuardInterval());
+ isdbtSettings.serviceAreaId = (int32_t)isdbt->getServiceAreaId();
+ isdbtSettings.partialReceptionFlag =
+ static_cast<FrontendIsdbtPartialReceptionFlag>(isdbt->getPartialReceptionFlag());
+ if (!isdbt->hasFrontendIsdbtLayerSettings()) {
+ ALOGW("[ConfigReader] no isdbt layer settings");
+ return isdbtSettings;
+ }
+ auto layerSettings = isdbt->getFirstFrontendIsdbtLayerSettings();
+ ::aidl::android::hardware::tv::tuner::FrontendIsdbtLayerSettings mLayerSettings;
+ mLayerSettings.modulation =
+ static_cast<FrontendIsdbtModulation>(layerSettings->getModulation());
+ mLayerSettings.coderate = static_cast<FrontendIsdbtCoderate>(layerSettings->getCoderate());
+ mLayerSettings.timeInterleave =
+ static_cast<FrontendIsdbtTimeInterleaveMode>(layerSettings->getTimeInterleave());
+ mLayerSettings.numOfSegment = (int32_t)layerSettings->getNumOfSegment();
+ isdbtSettings.layerSettings.push_back(mLayerSettings);
+ return isdbtSettings;
+ }
+
static bool readFilterTypeAndSettings(Filter filterConfig, DemuxFilterType& type,
DemuxFilterSettings& settings) {
auto mainType = filterConfig.getMainType();
auto subType = filterConfig.getSubType();
+ if (subType == FilterSubTypeEnum::AUDIO) {
+ audioFilterIds.push_back(filterConfig.getId());
+ } else if (subType == FilterSubTypeEnum::VIDEO) {
+ videoFilterIds.push_back(filterConfig.getId());
+ } else if (subType == FilterSubTypeEnum::RECORD) {
+ recordFilterIds.push_back(filterConfig.getId());
+ } else if (subType == FilterSubTypeEnum::SECTION) {
+ sectionFilterIds.push_back(filterConfig.getId());
+ } else if (subType == FilterSubTypeEnum::PCR) {
+ pcrFilterIds.push_back(filterConfig.getId());
+ } else if (subType == FilterSubTypeEnum::IP) {
+ ipFilterIds.push_back(filterConfig.getId());
+ }
+
switch (mainType) {
case FilterMainTypeEnum::TS: {
ALOGW("[ConfigReader] filter main type is ts");
diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt
index 383d49f..dbd3486 100644
--- a/tv/tuner/config/api/current.txt
+++ b/tv/tuner/config/api/current.txt
@@ -1,6 +1,14 @@
// Signature format: 2.0
package android.media.tuner.testing.configuration.V1_0 {
+ public class AtscFrontendSettings {
+ ctor public AtscFrontendSettings();
+ method @Nullable public java.math.BigInteger getInversion();
+ method @Nullable public java.math.BigInteger getModulation();
+ method public void setInversion(@Nullable java.math.BigInteger);
+ method public void setModulation(@Nullable java.math.BigInteger);
+ }
+
public class AvFilterSettings {
ctor public AvFilterSettings();
method @Nullable public short getAudioStreamType_optional();
@@ -19,6 +27,7 @@
method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Descrambling getDescrambling();
method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback getDvrPlayback();
method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrRecord getDvrRecord();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbDescrambling getLnbDescrambling();
method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbLive getLnbLive();
method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbRecord getLnbRecord();
method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Scan getScan();
@@ -27,6 +36,7 @@
method public void setDescrambling(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Descrambling);
method public void setDvrPlayback(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback);
method public void setDvrRecord(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrRecord);
+ method public void setLnbDescrambling(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbDescrambling);
method public void setLnbLive(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbLive);
method public void setLnbRecord(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbRecord);
method public void setScan(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Scan);
@@ -39,6 +49,7 @@
method @Nullable public String getDvrSoftwareFeConnection();
method @Nullable public String getFrontendConnection();
method @Nullable public String getIpFilterConnection();
+ method @Nullable public java.util.List<java.lang.String> getOptionalFilters();
method @Nullable public String getPcrFilterConnection();
method @Nullable public String getSectionFilterConnection();
method @Nullable public String getVideoFilterConnection();
@@ -46,6 +57,7 @@
method public void setDvrSoftwareFeConnection(@Nullable String);
method public void setFrontendConnection(@Nullable String);
method public void setIpFilterConnection(@Nullable String);
+ method public void setOptionalFilters(@Nullable java.util.List<java.lang.String>);
method public void setPcrFilterConnection(@Nullable String);
method public void setSectionFilterConnection(@Nullable String);
method public void setVideoFilterConnection(@Nullable String);
@@ -59,6 +71,7 @@
method @Nullable public String getDvrSourceConnection();
method @Nullable public String getFrontendConnection();
method @Nullable public boolean getHasFrontendConnection();
+ method @Nullable public java.util.List<java.lang.String> getOptionalFilters();
method @Nullable public String getVideoFilterConnection();
method public void setAudioFilterConnection(@Nullable String);
method public void setDescramblerConnection(@Nullable String);
@@ -66,6 +79,7 @@
method public void setDvrSourceConnection(@Nullable String);
method public void setFrontendConnection(@Nullable String);
method public void setHasFrontendConnection(@Nullable boolean);
+ method public void setOptionalFilters(@Nullable java.util.List<java.lang.String>);
method public void setVideoFilterConnection(@Nullable String);
}
@@ -73,10 +87,12 @@
ctor public DataFlowConfiguration.DvrPlayback();
method @Nullable public String getAudioFilterConnection();
method @Nullable public String getDvrConnection();
+ method @Nullable public java.util.List<java.lang.String> getOptionalFilters();
method @Nullable public String getSectionFilterConnection();
method @Nullable public String getVideoFilterConnection();
method public void setAudioFilterConnection(@Nullable String);
method public void setDvrConnection(@Nullable String);
+ method public void setOptionalFilters(@Nullable java.util.List<java.lang.String>);
method public void setSectionFilterConnection(@Nullable String);
method public void setVideoFilterConnection(@Nullable String);
}
@@ -97,17 +113,35 @@
method public void setRecordFilterConnection(@Nullable String);
}
+ public static class DataFlowConfiguration.LnbDescrambling {
+ ctor public DataFlowConfiguration.LnbDescrambling();
+ method @Nullable public String getAudioFilterConnection();
+ method @Nullable public String getDescramblerConnection();
+ method @Nullable public java.util.List<java.lang.String> getDiseqcMsgSender();
+ method @Nullable public String getFrontendConnection();
+ method @Nullable public String getLnbConnection();
+ method @Nullable public String getVideoFilterConnection();
+ method public void setAudioFilterConnection(@Nullable String);
+ method public void setDescramblerConnection(@Nullable String);
+ method public void setDiseqcMsgSender(@Nullable java.util.List<java.lang.String>);
+ method public void setFrontendConnection(@Nullable String);
+ method public void setLnbConnection(@Nullable String);
+ method public void setVideoFilterConnection(@Nullable String);
+ }
+
public static class DataFlowConfiguration.LnbLive {
ctor public DataFlowConfiguration.LnbLive();
method @Nullable public String getAudioFilterConnection();
method @Nullable public java.util.List<java.lang.String> getDiseqcMsgSender();
method @Nullable public String getFrontendConnection();
method @Nullable public String getLnbConnection();
+ method @Nullable public java.util.List<java.lang.String> getOptionalFilters();
method @Nullable public String getVideoFilterConnection();
method public void setAudioFilterConnection(@Nullable String);
method public void setDiseqcMsgSender(@Nullable java.util.List<java.lang.String>);
method public void setFrontendConnection(@Nullable String);
method public void setLnbConnection(@Nullable String);
+ method public void setOptionalFilters(@Nullable java.util.List<java.lang.String>);
method public void setVideoFilterConnection(@Nullable String);
}
@@ -117,11 +151,13 @@
method @Nullable public String getDvrRecordConnection();
method @Nullable public String getFrontendConnection();
method @Nullable public String getLnbConnection();
+ method @Nullable public java.util.List<java.lang.String> getOptionalFilters();
method @Nullable public String getRecordFilterConnection();
method public void setDiseqcMsgSender(@Nullable java.util.List<java.lang.String>);
method public void setDvrRecordConnection(@Nullable String);
method public void setFrontendConnection(@Nullable String);
method public void setLnbConnection(@Nullable String);
+ method public void setOptionalFilters(@Nullable java.util.List<java.lang.String>);
method public void setRecordFilterConnection(@Nullable String);
}
@@ -160,13 +196,25 @@
public class DvbsFrontendSettings {
ctor public DvbsFrontendSettings();
method @Nullable public java.math.BigInteger getInputStreamId();
+ method @Nullable public java.math.BigInteger getInversion();
method @Nullable public boolean getIsDiseqcRxMessage();
+ method @Nullable public java.math.BigInteger getModulation();
+ method @Nullable public java.math.BigInteger getPilot();
+ method @Nullable public java.math.BigInteger getRolloff();
method @Nullable public android.media.tuner.testing.configuration.V1_0.DvbsScanType getScanType();
+ method @Nullable public java.math.BigInteger getStandard();
method @Nullable public java.math.BigInteger getSymbolRate();
+ method @Nullable public java.math.BigInteger getVcmMode();
method public void setInputStreamId(@Nullable java.math.BigInteger);
+ method public void setInversion(@Nullable java.math.BigInteger);
method public void setIsDiseqcRxMessage(@Nullable boolean);
+ method public void setModulation(@Nullable java.math.BigInteger);
+ method public void setPilot(@Nullable java.math.BigInteger);
+ method public void setRolloff(@Nullable java.math.BigInteger);
method public void setScanType(@Nullable android.media.tuner.testing.configuration.V1_0.DvbsScanType);
+ method public void setStandard(@Nullable java.math.BigInteger);
method public void setSymbolRate(@Nullable java.math.BigInteger);
+ method public void setVcmMode(@Nullable java.math.BigInteger);
}
public enum DvbsScanType {
@@ -310,6 +358,7 @@
public class Frontend {
ctor public Frontend();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.AtscFrontendSettings getAtscFrontendSettings_optional();
method @Nullable public java.math.BigInteger getConnectToCicamId();
method @Nullable public android.media.tuner.testing.configuration.V1_0.DvbsFrontendSettings getDvbsFrontendSettings_optional();
method @Nullable public android.media.tuner.testing.configuration.V1_0.DvbtFrontendSettings getDvbtFrontendSettings_optional();
@@ -317,8 +366,11 @@
method @Nullable public java.math.BigInteger getFrequency();
method @Nullable public String getId();
method @Nullable public boolean getIsSoftwareFrontend();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.IsdbsFrontendSettings getIsdbsFrontendSettings_optional();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.IsdbtFrontendSettings getIsdbtFrontendSettings_optional();
method @Nullable public java.math.BigInteger getRemoveOutputPid();
method @Nullable public android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum getType();
+ method public void setAtscFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.AtscFrontendSettings);
method public void setConnectToCicamId(@Nullable java.math.BigInteger);
method public void setDvbsFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.DvbsFrontendSettings);
method public void setDvbtFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.DvbtFrontendSettings);
@@ -326,10 +378,24 @@
method public void setFrequency(@Nullable java.math.BigInteger);
method public void setId(@Nullable String);
method public void setIsSoftwareFrontend(@Nullable boolean);
+ method public void setIsdbsFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.IsdbsFrontendSettings);
+ method public void setIsdbtFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.IsdbtFrontendSettings);
method public void setRemoveOutputPid(@Nullable java.math.BigInteger);
method public void setType(@Nullable android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum);
}
+ public class FrontendIsdbtLayerSettings {
+ ctor public FrontendIsdbtLayerSettings();
+ method @Nullable public java.math.BigInteger getCoderate();
+ method @Nullable public java.math.BigInteger getModulation();
+ method @Nullable public java.math.BigInteger getNumOfSegment();
+ method @Nullable public java.math.BigInteger getTimeInterleave();
+ method public void setCoderate(@Nullable java.math.BigInteger);
+ method public void setModulation(@Nullable java.math.BigInteger);
+ method public void setNumOfSegment(@Nullable java.math.BigInteger);
+ method public void setTimeInterleave(@Nullable java.math.BigInteger);
+ }
+
public enum FrontendTypeEnum {
method @NonNull public String getRawName();
enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum ANALOG;
@@ -422,6 +488,40 @@
method public void setSrcPort(@Nullable long);
}
+ public class IsdbsFrontendSettings {
+ ctor public IsdbsFrontendSettings();
+ method @Nullable public java.math.BigInteger getCoderate();
+ method @Nullable public java.math.BigInteger getModulation();
+ method @Nullable public java.math.BigInteger getRolloff();
+ method @Nullable public java.math.BigInteger getStreamId();
+ method @Nullable public java.math.BigInteger getStreamIdType();
+ method @Nullable public java.math.BigInteger getSymbolRate();
+ method public void setCoderate(@Nullable java.math.BigInteger);
+ method public void setModulation(@Nullable java.math.BigInteger);
+ method public void setRolloff(@Nullable java.math.BigInteger);
+ method public void setStreamId(@Nullable java.math.BigInteger);
+ method public void setStreamIdType(@Nullable java.math.BigInteger);
+ method public void setSymbolRate(@Nullable java.math.BigInteger);
+ }
+
+ public class IsdbtFrontendSettings {
+ ctor public IsdbtFrontendSettings();
+ method @Nullable public java.math.BigInteger getBandwidth();
+ method @Nullable public android.media.tuner.testing.configuration.V1_0.FrontendIsdbtLayerSettings getFrontendIsdbtLayerSettings();
+ method @Nullable public java.math.BigInteger getGuardInterval();
+ method @Nullable public java.math.BigInteger getInversion();
+ method @Nullable public java.math.BigInteger getMode();
+ method @Nullable public java.math.BigInteger getPartialReceptionFlag();
+ method @Nullable public java.math.BigInteger getServiceAreaId();
+ method public void setBandwidth(@Nullable java.math.BigInteger);
+ method public void setFrontendIsdbtLayerSettings(@Nullable android.media.tuner.testing.configuration.V1_0.FrontendIsdbtLayerSettings);
+ method public void setGuardInterval(@Nullable java.math.BigInteger);
+ method public void setInversion(@Nullable java.math.BigInteger);
+ method public void setMode(@Nullable java.math.BigInteger);
+ method public void setPartialReceptionFlag(@Nullable java.math.BigInteger);
+ method public void setServiceAreaId(@Nullable java.math.BigInteger);
+ }
+
public class Lnb {
ctor public Lnb();
method @Nullable public String getId();
@@ -462,6 +562,12 @@
enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_5V;
}
+ public class OptionalFilter {
+ ctor public OptionalFilter();
+ method @Nullable public String getFilterId();
+ method public void setFilterId(@Nullable String);
+ }
+
public class RecordFilterSettings {
ctor public RecordFilterSettings();
method @Nullable public android.media.tuner.testing.configuration.V1_0.ScIndexTypeEnum getScIndexType();
diff --git a/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml b/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml
index fefe86e..f74af7e 100644
--- a/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml
+++ b/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml
@@ -1,19 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (C) 2021 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.
-->
-
<!-- The Sample Tuner Testing Configuration.
Name the customized xml with "tuner_vts_config.xml" and push into the device
"/vendor/etc" path. Please use "tuner_testing_dynamic_configuration.xsd" to verify the xml.
@@ -32,7 +28,6 @@
- The default settings can be found in the sample_tuner_vts_configurations.xml.
- The users can also override the default frontend settings using id="FE_DEFAULT".
- The users can configure 1 or more frontend elements in the frontends sections.
-
Each frontend element contain the following attributes:
"id": unique id of the frontend that could be used to connect to the test the
"dataFlowConfiguration"
@@ -46,7 +41,6 @@
output. Supported in Tuner 2.0 or higher.
"frequency": the frequency used to configure tune and scan.
"endFrequency": the end frequency of scan. Supported in Tuner 1.1 or higher.
-
Each frontend element also contains one and only one type-related "frontendSettings".
- The settings type should match the frontend "type" attribute.
- For example, when frontend type="DVBT", dvbtFrontendSettings can be configured.
@@ -54,14 +48,36 @@
config only to the hal.
-->
<frontends>
- <frontend id="FE_DEFAULT" type="DVBT" isSoftwareFrontend="true"
+ <frontend id="FE_DEFAULT" type="ISDBS" isSoftwareFrontend="true"
connectToCicamId="0" removeOutputPid="10" frequency="578000000"
endFrequency="800000000">
- <dvbtFrontendSettings bandwidth="8" transmissionMode="128" isHighPriority="1"/>
+ <isdbsFrontendSettings streamId="0" symbolRate="0" streamIdType="0" modulation="0" coderate="0" rolloff="0"/>
+ </frontend>
+ <frontend id="FE_ATSC_0" type="ATSC" isSoftwareFrontend="true"
+ connectToCicamId="0" removeOutputPid="10" frequency="578000000"
+ endFrequency="800000000">
+ <atscFrontendSettings inversion="0" modulation="0"/>
+ </frontend>
+ <frontend id="FE_ISDBT_0" type="ISDBT" isSoftwareFrontend="true"
+ connectToCicamId="0" removeOutputPid="10" frequency="578000000"
+ endFrequency="800000000">
+ <isdbtFrontendSettings serviceAreaId="0" inversion="0" bandwidth="0" mode="0" guardInterval="0" partialReceptionFlag="0">
+ <FrontendIsdbtLayerSettings modulation="0" coderate="0" timeInterleave="0" numOfSegment="0"/>
+ </isdbtFrontendSettings>
</frontend>
<frontend id="FE_DVBS_0" type="DVBS" isSoftwareFrontend="true"
connectToCicamId="0" removeOutputPid="10" frequency="578000000"
endFrequency="800000000">
+ <dvbsFrontendSettings inputStreamId="0" symbolRate="0" inversion="0" modulation="0" coderate="0"
+ rolloff="0" pilot="0" standard="0" vcmMode="0" scanType="0" isDiseqcRxMessage="true"/>
+ </frontend>
+ <frontend id="FE_DVBT_0" type="DVBT" isSoftwareFrontend="true"
+ connectToCicamId="0" removeOutputPid="10" frequency="578000000"
+ endFrequency="800000000">
+ <dvbtFrontendSettings bandwidth="8" transmissionMode="1" isHighPriority="1"
+ constellation="1" hierarchy="1" hpCoderate="1" lpCoderate="1"
+ guardInterval="1" standard="1" isMiso="0" plpMode="1"
+ plpId="0" plpGroupId="0"/>
</frontend>
</frontends>
<!-- Filter section:
@@ -71,7 +87,6 @@
- The users can also override the default filter settings using
- id="FILTER_AUDIO_DEFAULT" or "FILTER_VIDEO_DEFAULT".
- The users can configure 1 or more filter elements in the filters sections.
-
Each filter element contain the following attributes:
"id": unique id of the filter that could be used to connect to the test the
"dataFlowConfiguration"
@@ -80,7 +95,6 @@
"bufferSize": the buffer size of the filter in hex.
"pid": the pid that would be used to configure the filter.
"useFMQ": if the filter uses FMQ.
-
Each filter element also contains at most one type-related "filterSettings".
- The settings type should match the filter "subType" attribute.
- For example, when filter subType is audio or video, the avFilterSettings can be
@@ -89,6 +103,9 @@
only to the hal.
-->
<filters>
+ <filter id="FILTER_SECTION_DEFAULT" mainType="TS" subType="SECTION"
+ bufferSize="16777216" pid="257" useFMQ="false" monitorEventTypes="3">
+ </filter>
<filter id="FILTER_AUDIO_DEFAULT" mainType="TS" subType="AUDIO"
bufferSize="16777216" pid="257" useFMQ="false" monitorEventTypes="3">
<avFilterSettings isPassthrough="false" isSecureMemory="false">
@@ -116,7 +133,6 @@
This section contains configurations of all the dvrs that would be used in the tests.
- This section is optional and can be skipped if DVR is not supported.
- The users can configure 1 or more dvr elements in the dvrs sections.
-
Each dvr element contain the following attributes:
"id": unique id of the dvr that could be used to connect to the test the
"dataFlowConfiguration"
@@ -140,8 +156,21 @@
statusMask="15" lowThreshold="4096" highThreshold="32767"
dataFormat="ES" packetSize="188" inputFilePath="/data/local/tmp/test.es"/>
</dvrs>
+ <descramblers>
+ <descrambler id="DESCRAMBLER_0" casSystemId="63192"/>
+ </descramblers>
+ <timeFilters>
+ <timeFilter id="TIME_FILTER_0" timeStamp="1"/>
+ </timeFilters>
+ <diseqcMessages>
+ <diseqcMessage msgName="DISEQC_POWER_ON" msgBody="14 0 0 0 0 3"/>
+ </diseqcMessages>
+ <lnbs>
+ <lnb id="LNB_0" voltage="VOLTAGE_12V" tone="NONE" position="UNDEFINED"/>
+ <lnb id="LNB_1" name="default_lnb_external" voltage="VOLTAGE_5V"
+ tone="NONE" position="UNDEFINED"/>
+ </lnbs>
</hardwareConfiguration>
-
<!-- Data flow configuration section connects each data flow under test to the ids of the
hardwares that would be used during the tests. -->
<dataFlowConfiguration>
@@ -151,13 +180,39 @@
ipFilterConnection="FILTER_IP_IP_0"
dvrSoftwareFeConnection="DVR_PLAYBACK_1"/>
<scan frontendConnection="FE_DEFAULT"/>
- <dvrPlayback dvrConnection="DVR_PLAYBACK_1"
- audioFilterConnection="FILTER_AUDIO_DEFAULT"
- videoFilterConnection="FILTER_VIDEO_DEFAULT"/>
<dvrRecord hasFrontendConnection="true"
frontendConnection="FE_DEFAULT"
recordFilterConnection="FILTER_TS_RECORD_0"
dvrRecordConnection="DVR_RECORD_0"
dvrSoftwareFeConnection="DVR_PLAYBACK_1"/>
+ <dvrPlayback dvrConnection="DVR_PLAYBACK_1"
+ audioFilterConnection="FILTER_AUDIO_DEFAULT"
+ videoFilterConnection="FILTER_VIDEO_DEFAULT"
+ sectionFilterConnection="FILTER_SECTION_DEFAULT"/>
+ <descrambling hasFrontendConnection="true"
+ frontendConnection="FE_DEFAULT"
+ descramblerConnection="DESCRAMBLER_0"
+ audioFilterConnection="FILTER_AUDIO_DEFAULT"
+ videoFilterConnection="FILTER_VIDEO_DEFAULT"
+ dvrSoftwareFeConnection="DVR_PLAYBACK_0"
+ dvrSourceConnection="DVR_PLAYBACK_1">
+ </descrambling>
+ <timeFilter timeFilterConnection="TIME_FILTER_0"/>
+ <lnbLive frontendConnection="FE_DVBS_0"
+ audioFilterConnection="FILTER_AUDIO_DEFAULT"
+ videoFilterConnection="FILTER_VIDEO_DEFAULT"
+ lnbConnection="LNB_1"
+ diseqcMsgSender="DISEQC_POWER_ON"/>
+ <lnbRecord frontendConnection="FE_DVBS_0"
+ recordFilterConnection="FILTER_TS_RECORD_0"
+ dvrRecordConnection="DVR_RECORD_0"
+ lnbConnection="LNB_0"
+ diseqcMsgSender="DISEQC_POWER_ON"/>
+ <lnbDescrambling frontendConnection="FE_DVBS_0"
+ audioFilterConnection="FILTER_AUDIO_DEFAULT"
+ videoFilterConnection="FILTER_VIDEO_DEFAULT"
+ lnbConnection="LNB_1"
+ descramblerConnection="DESCRAMBLER_0"/>
+
</dataFlowConfiguration>
</TunerConfiguration>
diff --git a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd
index 59abd9a..c51ac51 100644
--- a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd
+++ b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd
@@ -77,8 +77,41 @@
<xs:complexType name="dvbsFrontendSettings">
<xs:attribute name="inputStreamId" type="xs:nonNegativeInteger" use="required"/>
<xs:attribute name="symbolRate" type="xs:nonNegativeInteger" use="required"/>
- <xs:attribute name="scanType" type="dvbsScanType" use="optional"/>
- <xs:attribute name="isDiseqcRxMessage" type="xs:boolean" use="optional"/>
+ <xs:attribute name="scanType" type="dvbsScanType" use="required"/>
+ <xs:attribute name="isDiseqcRxMessage" type="xs:boolean" use="required"/>
+ <xs:attribute name="inversion" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="modulation" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="pilot" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="standard" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="vcmMode" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="rolloff" type="xs:nonNegativeInteger" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="atscFrontendSettings">
+ <xs:attribute name="inversion" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="modulation" type="xs:nonNegativeInteger" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="isdbsFrontendSettings">
+ <xs:attribute name="streamId" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="symbolRate" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="streamIdType" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="modulation" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="coderate" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="rolloff" type="xs:nonNegativeInteger" use="required"/>
+ </xs:complexType>
+ <xs:complexType name="isdbtFrontendSettings">
+ <xs:attribute name="serviceAreaId" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="inversion" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="bandwidth" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="mode" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="guardInterval" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="partialReceptionFlag" type="xs:nonNegativeInteger" use="required"/>
+ <xs:element name="FrontendIsdbtLayerSettings" type="FrontendIsdbtLayerSettings"/>
+ </xs:complexType>
+ <xs:complexType name="FrontendIsdbtLayerSettings">
+ <xs:attribute name="modulation" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="coderate" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="timeInterleave" type="xs:nonNegativeInteger" use="required"/>
+ <xs:attribute name="numOfSegment" type="xs:nonNegativeInteger" use="required"/>
</xs:complexType>
<xs:complexType name="frontend">
@@ -109,16 +142,16 @@
</xs:annotation>
<xs:choice minOccurs="0" maxOccurs="1">
<!-- TODO: b/182519645 finish all the frontend settings structures. -->
- <!--xs:element name="analog" type="analogSettings"/>
- <xs:element name="atsc" type="atscSettings"/>
- <xs:element name="atsc3" type="atsc3Settings"/>
+ <!--xs:element name="analog" type="analogSettings"/-->
+ <xs:element name="atscFrontendSettings" type="atscFrontendSettings"/>
+ <!--xs:element name="atsc3" type="atsc3Settings"/>
<xs:element name="dvbc" type="dvbcSettings"/-->
<xs:element name="dvbsFrontendSettings" type="dvbsFrontendSettings"/>
<xs:element name="dvbtFrontendSettings" type="dvbtFrontendSettings"/>
- <!--xs:element name="isdbs" type="isdbsSettings"/>
- <xs:element name="isdbs3" type="isdbs3Settings"/>
- <xs:element name="isdbt" type="isdbtSettings"/>
- <xs:element name="dtmb" type="dtmbSettings"/-->
+ <xs:element name="isdbsFrontendSettings" type="isdbsFrontendSettings"/>
+ <!--xs:element name="isdbs3" type="isdbs3Settings"/-->
+ <xs:element name="isdbtFrontendSettings" type="isdbtFrontendSettings"/>
+ <!--xs:element name="dtmb" type="dtmbSettings"/-->
</xs:choice>
<xs:attribute name="id" type="frontendId" use="required"/>
<xs:attribute name="type" type="frontendTypeEnum" use="required"/>
@@ -617,7 +650,7 @@
<xs:attribute name="pcrFilterConnection" type="filterId" use="optional"/>
<xs:attribute name="sectionFilterConnection" type="filterId" use="optional"/>
<xs:attribute name="ipFilterConnection" type="filterId" use="optional"/>
- <!-- TODO: b/182519645 allow the users to insert extra filters -->
+ <xs:element name="optionalFilters" type="filterConnections" minOccurs="0" maxOccurs="1"/>
<!-- DVR is only required when the frontend is using the software input -->
<xs:attribute name="dvrSoftwareFeConnection" type="dvrId" use="optional"/>
</xs:complexType>
@@ -638,7 +671,7 @@
<xs:attribute name="descramblerConnection" type="descramblerId" use="required"/>
<xs:attribute name="audioFilterConnection" type="filterId" use="required"/>
<xs:attribute name="videoFilterConnection" type="filterId" use="required"/>
- <!-- TODO: b/182519645 allow the users to insert extra filters -->
+ <xs:element name="optionalFilters" type="filterConnections" minOccurs="0" maxOccurs="1"/>
<!-- This DVR is only required when the frontend is using the software input -->
<xs:attribute name="dvrSoftwareFeConnection" type="dvrId" use="optional"/>
<!-- This Dvr is only required when there's no frontend(sw or hw) connection -->
@@ -651,7 +684,7 @@
<xs:attribute name="audioFilterConnection" type="filterId" use="required"/>
<xs:attribute name="videoFilterConnection" type="filterId" use="required"/>
<xs:attribute name="sectionFilterConnection" type="filterId" use="optional"/>
- <!-- TODO: b/182519645 allow the users to insert extra filters -->
+ <xs:element name="optionalFilters" type="filterConnections" minOccurs="0" maxOccurs="1"/>
</xs:complexType>
</xs:element>
<xs:element name="dvrRecord" minOccurs="0" maxOccurs="1">
@@ -675,7 +708,7 @@
<xs:attribute name="videoFilterConnection" type="filterId" use="required"/>
<xs:attribute name="lnbConnection" type="lnbId" use="required"/>
<xs:attribute name="diseqcMsgSender" type="diseqcMsgSender" use="optional"/>
- <!-- TODO: b/182519645 allow the users to insert extra filters -->
+ <xs:element name="optionalFilters" type="filterConnections" minOccurs="0" maxOccurs="1"/>
</xs:complexType>
</xs:element>
<xs:element name="lnbRecord" minOccurs="0" maxOccurs="1">
@@ -685,6 +718,7 @@
<xs:attribute name="dvrRecordConnection" type="dvrId" use="required"/>
<xs:attribute name="lnbConnection" type="lnbId" use="required"/>
<xs:attribute name="diseqcMsgSender" type="diseqcMsgSender" use="optional"/>
+ <xs:element name="optionalFilters" type="filterConnections" minOccurs="0" maxOccurs="1"/>
</xs:complexType>
</xs:element>
<xs:element name="timeFilter" minOccurs="0" maxOccurs="1">
@@ -692,6 +726,16 @@
<xs:attribute name="timeFilterConnection" type="timeFilterId" use="required"/>
</xs:complexType>
</xs:element>
+ <xs:element name="lnbDescrambling" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:attribute name="frontendConnection" type="frontendId" use="required"/>
+ <xs:attribute name="audioFilterConnection" type="filterId" use="required"/>
+ <xs:attribute name="videoFilterConnection" type="filterId" use="required"/>
+ <xs:attribute name="lnbConnection" type="lnbId" use="required"/>
+ <xs:attribute name="descramblerConnection" type="descramblerId" use="required"/>
+ <xs:attribute name="diseqcMsgSender" type="diseqcMsgSender" use="optional"/>
+ </xs:complexType>
+ </xs:element>
</xs:sequence>
</xs:complexType>
@@ -729,4 +773,7 @@
<xs:field xpath="@id"/>
</xs:key>
</xs:element>
+ <xs:complexType name="optionalFilter">
+ <xs:attribute name="filterId" type="filterId" use="required"/>
+ </xs:complexType>
</xs:schema>
diff --git a/uwb/aidl/Android.bp b/uwb/aidl/Android.bp
index 52f0605..7dc2b7f 100755
--- a/uwb/aidl/Android.bp
+++ b/uwb/aidl/Android.bp
@@ -47,6 +47,7 @@
aidl_interface {
name: "android.hardware.uwb.fira_android",
+ owner: "google",
vendor_available: true,
srcs: ["android/hardware/uwb/fira_android/*.aidl"],
stability: "vintf",
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
index cbe2068..39bb5d9 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
@@ -44,4 +44,8 @@
CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 166,
CCC_SUPPORTED_RAN_MULTIPLIER = 167,
SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227,
+ SUPPORTED_MIN_RANGING_INTERVAL_MS = 228,
+ SUPPORTED_RANGE_DATA_NTF_CONFIG = 229,
+ SUPPORTED_RSSI_REPORTING = 230,
+ SUPPORTED_DIAGNOSTICS = 231,
}
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
index cd2e122..fbcfbff 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
@@ -36,4 +36,5 @@
enum UwbVendorGidAndroidOids {
ANDROID_GET_POWER_STATS = 0,
ANDROID_SET_COUNTRY_CODE = 1,
+ ANDROID_RANGE_DIAGNOSTICS = 2,
}
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
index d35728f..8413f06 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
@@ -43,4 +43,6 @@
NB_OF_RANGE_MEASUREMENTS = 227,
NB_OF_AZIMUTH_MEASUREMENTS = 228,
NB_OF_ELEVATION_MEASUREMENTS = 229,
+ ENABLE_DIAGNOSTICS = 232,
+ DIAGRAMS_FRAME_REPORTS_FIELDS = 233,
}
diff --git a/uwb/aidl/android/hardware/uwb/IUwbChip.aidl b/uwb/aidl/android/hardware/uwb/IUwbChip.aidl
index 00cb8e0..6ee5799 100644
--- a/uwb/aidl/android/hardware/uwb/IUwbChip.aidl
+++ b/uwb/aidl/android/hardware/uwb/IUwbChip.aidl
@@ -71,8 +71,8 @@
* The UCI message format is as per UCI protocol and it is
* defined in "FiRa Consortium - UCI Generic Specification_v1.0" specification at FiRa
* consortium.
- * WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127.
- * TODO(b/196004116): Link to the published specification.
+ *
+ * UCI 1.1 specification: https://groups.firaconsortium.org/wg/members/document/1949.
*
* This method may queue writes and return immediately, or it may block until data is written.
* Implementation must guarantee that writes are executed in order.
diff --git a/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl b/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl
index 75853cd..f31aeba 100755
--- a/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl
+++ b/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl
@@ -28,8 +28,7 @@
* can use to pass incoming data to the stack. These include UCI
* responses and notifications from the UWB subsystem.
*
- * WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127.
- * TODO(b/196004116): Link to the published specification.
+ * UCI 1.1 specification: https://groups.firaconsortium.org/wg/members/document/1949.
*
* @param data UCI packet sent.
*/
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
index 0140fdd..86479fb 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
@@ -150,4 +150,33 @@
* 0 - Feature not supported.
*/
SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 0xE3,
+
+ /**
+ * 4 byte value to indicate supported min ranging interval in ms.
+ */
+ SUPPORTED_MIN_RANGING_INTERVAL_MS = 0xE4,
+
+ /**
+ * 4 byte bitmask to indicate the supported RANGE_DATA_NTF_CONFIG values
+ *
+ * Bitmask where each bit corresponds to values used in
+ * RANGE_DATA_NTF_CONFIG in SET_APP_CFG_CMD
+ */
+ SUPPORTED_RANGE_DATA_NTF_CONFIG = 0xE5,
+
+ /**
+ * 1 byte bitmask to indicate the supported RSSI_REPORTING values
+ * Values:
+ * 1 - Feature supported.
+ * 0 - Feature not supported.
+ */
+ SUPPORTED_RSSI_REPORTING = 0xE6,
+
+ /**
+ * 1 byte value to indicate support for diagnostics feature.
+ * Values:
+ * 1 - Feature supported.
+ * 0 - Feature not supported.
+ */
+ SUPPORTED_DIAGNOSTICS = 0xE7,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
index e389a2d..4768f55 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl
@@ -30,5 +30,11 @@
ANDROID_GET_POWER_STATS = 0x0,
// Used to set the current regulatory country code (determined usinag
// SIM or hardcoded by OEM).
+ // Country code is sent as a 2 byte value corresponding to ISO-3166 country code.
+ // Note: "00" is used to indicate that the country code is unknown.
ANDROID_SET_COUNTRY_CODE = 0x1,
+ // Used by the notification to get UWB ranging diagnostics stats.
+ // Supported only if the UwbVendorCapabilityTlvTypes.SUPPORTED_DIAGNOSTICS set
+ // to 1.
+ ANDROID_RANGE_DIAGNOSTICS = 0x2,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
index f43b249..f303ed9 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl
@@ -66,4 +66,23 @@
NB_OF_AZIMUTH_MEASUREMENTS = 0xE4,
/** 1 byte data */
NB_OF_ELEVATION_MEASUREMENTS = 0xE5,
+
+ /**
+ * Supported only if the UwbVendorCapabilityTlvTypes
+ * .SUPPORTED_DIAGNOSTICS set to 1.
+ */
+ /**
+ * 1 byte data
+ * 1 - Enable,
+ * 0 - Disable
+ */
+ ENABLE_DIAGNOSTICS = 0xE8,
+ /**
+ * 1 byte bitmask
+ * b0: Activate RSSIs field,
+ * b1: Activate AoAs field,
+ * b2: Activate CIRs field,
+ * b3 - b7: RFU
+ */
+ DIAGRAMS_FRAME_REPORTS_FIELDS = 0xE9,
}
diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp
index c7c00b1..920beb8 100644
--- a/wifi/1.6/default/wifi_chip.cpp
+++ b/wifi/1.6/default/wifi_chip.cpp
@@ -1926,9 +1926,10 @@
// concurrent STA and not dual AP, else start with idx 0.
std::string WifiChip::allocateApIfaceName() {
// Check if we have a dedicated iface for AP.
- std::vector<std::string> ifnames = getPredefinedApIfaceNames(false);
- if (!ifnames.empty()) {
- return ifnames[0];
+ std::vector<std::string> ifnames = getPredefinedApIfaceNames(true);
+ for (auto const& ifname : ifnames) {
+ if (findUsingName(ap_ifaces_, ifname)) continue;
+ return ifname;
}
return allocateApOrStaIfaceName(IfaceType::AP, startIdxOfApIface());
}
diff --git a/wifi/netlinkinterceptor/aidl/default/InterceptorRelay.cpp b/wifi/netlinkinterceptor/aidl/default/InterceptorRelay.cpp
index ded9122..e84a5cf 100644
--- a/wifi/netlinkinterceptor/aidl/default/InterceptorRelay.cpp
+++ b/wifi/netlinkinterceptor/aidl/default/InterceptorRelay.cpp
@@ -28,7 +28,7 @@
using namespace std::chrono_literals;
static constexpr std::chrono::milliseconds kPollTimeout = 300ms;
-static constexpr bool kSuperVerbose = true;
+static constexpr bool kSuperVerbose = false;
InterceptorRelay::InterceptorRelay(uint32_t nlFamily, uint32_t clientNlPid,
const std::string& clientName)
diff --git a/wifi/netlinkinterceptor/libnlinterceptor/include/libnlinterceptor/libnlinterceptor.h b/wifi/netlinkinterceptor/libnlinterceptor/include/libnlinterceptor/libnlinterceptor.h
index ac8653e..32e5a6e 100644
--- a/wifi/netlinkinterceptor/libnlinterceptor/include/libnlinterceptor/libnlinterceptor.h
+++ b/wifi/netlinkinterceptor/libnlinterceptor/include/libnlinterceptor/libnlinterceptor.h
@@ -117,14 +117,13 @@
int clientSocketFd, const char* clientName,
struct android_nlinterceptor_InterceptedSocket* interceptedSocket);
-void android_nlinterceptor_closeSocket(
- const struct android_nlinterceptor_InterceptedSocket* sock);
+void android_nlinterceptor_closeSocket(struct android_nlinterceptor_InterceptedSocket sock);
-bool android_nlinterceptor_subscribe(
- const struct android_nlinterceptor_InterceptedSocket* sock, uint32_t group);
+bool android_nlinterceptor_subscribe(struct android_nlinterceptor_InterceptedSocket sock,
+ uint32_t group);
-bool android_nlinterceptor_unsubscribe(
- const struct android_nlinterceptor_InterceptedSocket* sock, uint32_t group);
+bool android_nlinterceptor_unsubscribe(struct android_nlinterceptor_InterceptedSocket sock,
+ uint32_t group);
#ifdef __cplusplus
}
diff --git a/wifi/netlinkinterceptor/libnlinterceptor/libnlinterceptor.cpp b/wifi/netlinkinterceptor/libnlinterceptor/libnlinterceptor.cpp
index 575f900..aae7a3a 100644
--- a/wifi/netlinkinterceptor/libnlinterceptor/libnlinterceptor.cpp
+++ b/wifi/netlinkinterceptor/libnlinterceptor/libnlinterceptor.cpp
@@ -150,25 +150,18 @@
return true;
}
-extern "C" void android_nlinterceptor_closeSocket(
- const android_nlinterceptor_InterceptedSocket* sock) {
- if (!sock) {
- LOG(ERROR) << "Can't close socket identified by a null pointer!";
- return;
- }
- closeSocket({sock->nlFamily, sock->portId});
+extern "C" void android_nlinterceptor_closeSocket(android_nlinterceptor_InterceptedSocket sock) {
+ closeSocket({sock.nlFamily, sock.portId});
}
-extern "C" bool android_nlinterceptor_subscribe(
- const android_nlinterceptor_InterceptedSocket* sock, uint32_t group) {
- if (!sock) return false;
- return subscribe({sock->nlFamily, sock->portId}, group);
+extern "C" bool android_nlinterceptor_subscribe(android_nlinterceptor_InterceptedSocket sock,
+ uint32_t group) {
+ return subscribe({sock.nlFamily, sock.portId}, group);
}
-extern "C" bool android_nlinterceptor_unsubscribe(
- const android_nlinterceptor_InterceptedSocket* sock, uint32_t group) {
- if (!sock) return false;
- return unsubscribe({sock->nlFamily, sock->portId}, group);
+extern "C" bool android_nlinterceptor_unsubscribe(android_nlinterceptor_InterceptedSocket sock,
+ uint32_t group) {
+ return unsubscribe({sock.nlFamily, sock.portId}, group);
}
} // namespace android::nlinterceptor
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
index d95bd03..b7984fa 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
@@ -19,6 +19,7 @@
#include <aidl/Vintf.h>
#include <aidl/android/hardware/wifi/supplicant/BnSupplicant.h>
#include <aidl/android/hardware/wifi/supplicant/BnSupplicantP2pIfaceCallback.h>
+#include <aidl/android/hardware/wifi/supplicant/SupplicantStatusCode.h>
#include <android/binder_manager.h>
#include <android/binder_status.h>
#include <binder/IServiceManager.h>
@@ -38,6 +39,7 @@
using aidl::android::hardware::wifi::supplicant::P2pGroupCapabilityMask;
using aidl::android::hardware::wifi::supplicant::P2pProvDiscStatusCode;
using aidl::android::hardware::wifi::supplicant::P2pStatusCode;
+using aidl::android::hardware::wifi::supplicant::SupplicantStatusCode;
using aidl::android::hardware::wifi::supplicant::WpsConfigMethods;
using aidl::android::hardware::wifi::supplicant::WpsDevPasswordId;
using aidl::android::hardware::wifi::supplicant::WpsProvisionMethod;
@@ -413,7 +415,12 @@
*/
TEST_P(SupplicantP2pIfaceAidlTest, EnableMacRandomization) {
// Enable twice
- EXPECT_TRUE(p2p_iface_->setMacRandomization(true).isOk());
+ auto status = p2p_iface_->setMacRandomization(true);
+ if (!status.isOk() && status.getServiceSpecificError() ==
+ static_cast<int32_t>(SupplicantStatusCode::FAILURE_UNSUPPORTED)) {
+ GTEST_SKIP() << "Mac randomization is not supported.";
+ }
+ EXPECT_TRUE(status.isOk());
EXPECT_TRUE(p2p_iface_->setMacRandomization(true).isOk());
// Disable twice