Merge "[DPP R2] Support for DPP R2"
diff --git a/automotive/can/1.0/default/CanBus.cpp b/automotive/can/1.0/default/CanBus.cpp
index 86df5dc..454ab00 100644
--- a/automotive/can/1.0/default/CanBus.cpp
+++ b/automotive/can/1.0/default/CanBus.cpp
@@ -25,12 +25,7 @@
#include <linux/can/error.h>
#include <linux/can/raw.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
/** Whether to log sent/received packets. */
static constexpr bool kSuperVerbose = false;
@@ -345,9 +340,4 @@
if (errcb != nullptr) errcb();
}
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanBus.h b/automotive/can/1.0/default/CanBus.h
index da3fc5a..8b73258 100644
--- a/automotive/can/1.0/default/CanBus.h
+++ b/automotive/can/1.0/default/CanBus.h
@@ -26,12 +26,7 @@
#include <atomic>
#include <thread>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
struct CanBus : public ICanBus {
using ErrorCallback = std::function<void()>;
@@ -114,9 +109,4 @@
ErrorCallback mErrCb;
};
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanBusNative.cpp b/automotive/can/1.0/default/CanBusNative.cpp
index 365b749..88f9175 100644
--- a/automotive/can/1.0/default/CanBusNative.cpp
+++ b/automotive/can/1.0/default/CanBusNative.cpp
@@ -20,12 +20,7 @@
#include <libnetdevice/can.h>
#include <libnetdevice/libnetdevice.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
CanBusNative::CanBusNative(const std::string& ifname, uint32_t baudrate)
: CanBus(ifname), mBaudrate(baudrate) {}
@@ -49,9 +44,4 @@
return ICanController::Result::OK;
}
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanBusNative.h b/automotive/can/1.0/default/CanBusNative.h
index 126f1cb..7eda683 100644
--- a/automotive/can/1.0/default/CanBusNative.h
+++ b/automotive/can/1.0/default/CanBusNative.h
@@ -18,12 +18,7 @@
#include "CanBus.h"
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
struct CanBusNative : public CanBus {
CanBusNative(const std::string& ifname, uint32_t baudrate);
@@ -35,9 +30,4 @@
const uint32_t mBaudrate;
};
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanBusSlcan.cpp b/automotive/can/1.0/default/CanBusSlcan.cpp
index 7dce838..29d9d3c 100644
--- a/automotive/can/1.0/default/CanBusSlcan.cpp
+++ b/automotive/can/1.0/default/CanBusSlcan.cpp
@@ -25,12 +25,7 @@
#include <sys/stat.h>
#include <termios.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
namespace slcanprotocol {
static const std::string kOpenCommand = "O\r";
@@ -158,9 +153,4 @@
return true;
}
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanBusSlcan.h b/automotive/can/1.0/default/CanBusSlcan.h
index 2713da8..3328a9f 100644
--- a/automotive/can/1.0/default/CanBusSlcan.h
+++ b/automotive/can/1.0/default/CanBusSlcan.h
@@ -22,12 +22,7 @@
#include <termios.h>
#include "CanBus.h"
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
struct CanBusSlcan : public CanBus {
CanBusSlcan(const std::string& uartName, uint32_t bitrate);
@@ -42,9 +37,4 @@
base::unique_fd mFd;
};
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanBusVirtual.cpp b/automotive/can/1.0/default/CanBusVirtual.cpp
index cc59fa9..32fe8d6 100644
--- a/automotive/can/1.0/default/CanBusVirtual.cpp
+++ b/automotive/can/1.0/default/CanBusVirtual.cpp
@@ -19,12 +19,7 @@
#include <android-base/logging.h>
#include <libnetdevice/libnetdevice.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
CanBusVirtual::CanBusVirtual(const std::string& ifname) : CanBus(ifname) {}
@@ -52,9 +47,4 @@
return true;
}
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanBusVirtual.h b/automotive/can/1.0/default/CanBusVirtual.h
index c2d5794..3990b20 100644
--- a/automotive/can/1.0/default/CanBusVirtual.h
+++ b/automotive/can/1.0/default/CanBusVirtual.h
@@ -18,12 +18,7 @@
#include "CanBus.h"
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
struct CanBusVirtual : public CanBus {
CanBusVirtual(const std::string& ifname);
@@ -36,9 +31,4 @@
bool mWasCreated = false;
};
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanController.cpp b/automotive/can/1.0/default/CanController.cpp
index ffdc912..cd17dd8 100644
--- a/automotive/can/1.0/default/CanController.cpp
+++ b/automotive/can/1.0/default/CanController.cpp
@@ -25,12 +25,7 @@
#include <regex>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
using IfaceIdDisc = ICanController::BusConfiguration::InterfaceIdentifier::hidl_discriminator;
@@ -139,9 +134,4 @@
return success;
}
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanController.h b/automotive/can/1.0/default/CanController.h
index 0674d0e..99a551a 100644
--- a/automotive/can/1.0/default/CanController.h
+++ b/automotive/can/1.0/default/CanController.h
@@ -20,12 +20,7 @@
#include <android/hardware/automotive/can/1.0/ICanController.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
struct CanController : public ICanController {
Return<void> getSupportedInterfaceTypes(getSupportedInterfaceTypes_cb _hidl_cb) override;
@@ -39,9 +34,4 @@
std::map<std::string, sp<CanBus>> mCanBuses GUARDED_BY(mCanBusesGuard);
};
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanSocket.cpp b/automotive/can/1.0/default/CanSocket.cpp
index 86e12d1..86ccc0e 100644
--- a/automotive/can/1.0/default/CanSocket.cpp
+++ b/automotive/can/1.0/default/CanSocket.cpp
@@ -24,12 +24,7 @@
#include <chrono>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
using namespace std::chrono_literals;
@@ -152,9 +147,4 @@
LOG(VERBOSE) << "Reader thread stopped";
}
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CanSocket.h b/automotive/can/1.0/default/CanSocket.h
index c98330b..fd956b5 100644
--- a/automotive/can/1.0/default/CanSocket.h
+++ b/automotive/can/1.0/default/CanSocket.h
@@ -24,12 +24,7 @@
#include <chrono>
#include <thread>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
/** Wrapper around SocketCAN socket. */
struct CanSocket {
@@ -71,9 +66,4 @@
DISALLOW_COPY_AND_ASSIGN(CanSocket);
};
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CloseHandle.cpp b/automotive/can/1.0/default/CloseHandle.cpp
index aba2c49..e1ffe2b 100644
--- a/automotive/can/1.0/default/CloseHandle.cpp
+++ b/automotive/can/1.0/default/CloseHandle.cpp
@@ -16,12 +16,7 @@
#include "CloseHandle.h"
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
CloseHandle::CloseHandle(Callback callback) : mCallback(callback) {}
@@ -37,9 +32,4 @@
return {};
}
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/CloseHandle.h b/automotive/can/1.0/default/CloseHandle.h
index eade109..c332d74 100644
--- a/automotive/can/1.0/default/CloseHandle.h
+++ b/automotive/can/1.0/default/CloseHandle.h
@@ -19,12 +19,7 @@
#include <android-base/macros.h>
#include <android/hardware/automotive/can/1.0/ICloseHandle.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
/** Generic ICloseHandle implementation ignoring double-close events. */
struct CloseHandle : public ICloseHandle {
@@ -49,9 +44,4 @@
DISALLOW_COPY_AND_ASSIGN(CloseHandle);
};
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp
index 9845bc7..556debf 100644
--- a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp
+++ b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp
@@ -18,9 +18,7 @@
#include <android-base/logging.h>
-namespace android {
-namespace netdevice {
-namespace impl {
+namespace android::netdevice::impl {
static struct rtattr* nlmsg_tail(struct nlmsghdr* n) {
return reinterpret_cast<struct rtattr*>( //
@@ -53,6 +51,4 @@
nest->rta_len = nestLen;
}
-} // namespace impl
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice::impl
diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h
index ba9b65b..3e28d78 100644
--- a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h
+++ b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h
@@ -21,8 +21,7 @@
#include <string>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
typedef unsigned short rtattrtype_t; // as in rtnetlink.h
typedef __u16 nlmsgtype_t; // as in netlink.h
@@ -151,5 +150,4 @@
}
};
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp
index 0514764..6a7f506 100644
--- a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp
+++ b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp
@@ -18,8 +18,7 @@
#include <android-base/logging.h>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
NetlinkSocket::NetlinkSocket(int protocol) {
mFd.reset(socket(AF_NETLINK, SOCK_RAW, protocol));
@@ -110,5 +109,4 @@
return false;
}
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h
index 90e1f3f..2b40ea2 100644
--- a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h
+++ b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h
@@ -23,8 +23,7 @@
#include <linux/netlink.h>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
/**
* A wrapper around AF_NETLINK sockets.
@@ -64,5 +63,4 @@
DISALLOW_COPY_AND_ASSIGN(NetlinkSocket);
};
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/can.cpp b/automotive/can/1.0/default/libnetdevice/can.cpp
index 6452d9b..06d45d3 100644
--- a/automotive/can/1.0/default/libnetdevice/can.cpp
+++ b/automotive/can/1.0/default/libnetdevice/can.cpp
@@ -28,9 +28,7 @@
#include <linux/can/netlink.h>
#include <linux/can/raw.h>
-namespace android {
-namespace netdevice {
-namespace can {
+namespace android::netdevice::can {
static constexpr can_err_mask_t kErrMask = CAN_ERR_MASK;
@@ -95,6 +93,4 @@
return sock.send(req) && sock.receiveAck();
}
-} // namespace can
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice::can
diff --git a/automotive/can/1.0/default/libnetdevice/common.cpp b/automotive/can/1.0/default/libnetdevice/common.cpp
index 3deac3e..5c62443 100644
--- a/automotive/can/1.0/default/libnetdevice/common.cpp
+++ b/automotive/can/1.0/default/libnetdevice/common.cpp
@@ -20,8 +20,7 @@
#include <net/if.h>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
unsigned int nametoindex(const std::string& ifname) {
const auto ifidx = if_nametoindex(ifname.c_str());
@@ -34,5 +33,4 @@
return 0;
}
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/common.h b/automotive/can/1.0/default/libnetdevice/common.h
index 9bdff4d..8097f37 100644
--- a/automotive/can/1.0/default/libnetdevice/common.h
+++ b/automotive/can/1.0/default/libnetdevice/common.h
@@ -18,8 +18,7 @@
#include <string>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
/**
* Returns the index of a given network interface.
@@ -32,5 +31,4 @@
*/
unsigned int nametoindex(const std::string& ifname);
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/can.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/can.h
index d75361e..3886acf 100644
--- a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/can.h
+++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/can.h
@@ -20,9 +20,7 @@
#include <string>
-namespace android {
-namespace netdevice {
-namespace can {
+namespace android::netdevice::can {
/**
* Opens and binds SocketCAN socket.
@@ -40,6 +38,4 @@
*/
bool setBitrate(std::string ifname, uint32_t bitrate);
-} // namespace can
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice::can
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 e22eafb..3818a31 100644
--- a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h
+++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h
@@ -19,8 +19,7 @@
#include <optional>
#include <string>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
/**
* Checks, if the network interface exists.
@@ -71,5 +70,4 @@
*/
bool del(std::string dev);
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
index fc2b193..aee8205 100644
--- a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
+++ b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
@@ -25,8 +25,7 @@
#include <linux/can.h>
#include <net/if.h>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
bool exists(std::string ifname) {
return nametoindex(ifname) != 0;
@@ -96,5 +95,4 @@
return sock.send(req) && sock.receiveAck();
}
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/service.cpp b/automotive/can/1.0/default/service.cpp
index ebc2f8c..b52a54a 100644
--- a/automotive/can/1.0/default/service.cpp
+++ b/automotive/can/1.0/default/service.cpp
@@ -19,12 +19,7 @@
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace implementation {
+namespace android::hardware::automotive::can::V1_0::implementation {
static void canControllerService() {
base::SetDefaultTag("CanController");
@@ -42,12 +37,7 @@
joinRpcThreadpool();
}
-} // namespace implementation
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::implementation
int main() {
::android::hardware::automotive::can::V1_0::implementation::canControllerService();
diff --git a/automotive/can/1.0/hidl-utils/include/hidl-utils/hidl-utils.h b/automotive/can/1.0/hidl-utils/include/hidl-utils/hidl-utils.h
index 039f971..f63d43c 100644
--- a/automotive/can/1.0/hidl-utils/include/hidl-utils/hidl-utils.h
+++ b/automotive/can/1.0/hidl-utils/include/hidl-utils/hidl-utils.h
@@ -16,10 +16,7 @@
#pragma once
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace hidl_utils {
+namespace android::hardware::automotive::hidl_utils {
/**
* Helper functor to fetch results from multi-return HIDL calls.
@@ -61,7 +58,4 @@
}
};
-} // namespace hidl_utils
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::hidl_utils
diff --git a/automotive/can/1.0/tools/canhalctrl.cpp b/automotive/can/1.0/tools/canhalctrl.cpp
index fa1048d..5c9849b 100644
--- a/automotive/can/1.0/tools/canhalctrl.cpp
+++ b/automotive/can/1.0/tools/canhalctrl.cpp
@@ -22,10 +22,7 @@
#include <iostream>
#include <string>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
+namespace android::hardware::automotive::can {
using ICanController = V1_0::ICanController;
@@ -170,10 +167,7 @@
}
}
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can
int main(int argc, char* argv[]) {
if (argc < 1) return -1;
diff --git a/automotive/can/1.0/tools/canhaldump.cpp b/automotive/can/1.0/tools/canhaldump.cpp
index 55b2a34..2f5ca61 100644
--- a/automotive/can/1.0/tools/canhaldump.cpp
+++ b/automotive/can/1.0/tools/canhaldump.cpp
@@ -27,10 +27,7 @@
#include <string>
#include <thread>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
+namespace android::hardware::automotive::can {
using namespace std::chrono_literals;
@@ -128,10 +125,7 @@
return candump(argv[0]);
}
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can
int main(int argc, char* argv[]) {
if (argc < 1) return -1;
diff --git a/automotive/can/1.0/tools/canhalsend.cpp b/automotive/can/1.0/tools/canhalsend.cpp
index 29330c9..7e6833a 100644
--- a/automotive/can/1.0/tools/canhalsend.cpp
+++ b/automotive/can/1.0/tools/canhalsend.cpp
@@ -21,10 +21,7 @@
#include <iostream>
#include <string>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
+namespace android::hardware::automotive::can {
using ICanBus = V1_0::ICanBus;
using Result = V1_0::Result;
@@ -125,10 +122,7 @@
return cansend(busname, msgid, payload);
}
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can
int main(int argc, char* argv[]) {
if (argc < 1) return -1;
diff --git a/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp b/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp
index 250caf2..8deaed6 100644
--- a/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp
+++ b/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp
@@ -24,12 +24,7 @@
#include <gmock/gmock.h>
#include <hidl-utils/hidl-utils.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace vts {
+namespace android::hardware::automotive::can::V1_0::vts {
using hardware::hidl_vec;
@@ -173,12 +168,7 @@
ASSERT_NE(nullptr, closeHandle.get());
}
-} // namespace vts
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::vts
/**
* Example manual invocation:
diff --git a/automotive/can/1.0/vts/functional/VtsHalCanBusVirtualV1_0TargetTest.cpp b/automotive/can/1.0/vts/functional/VtsHalCanBusVirtualV1_0TargetTest.cpp
index 695b9fb..1663663 100644
--- a/automotive/can/1.0/vts/functional/VtsHalCanBusVirtualV1_0TargetTest.cpp
+++ b/automotive/can/1.0/vts/functional/VtsHalCanBusVirtualV1_0TargetTest.cpp
@@ -31,12 +31,7 @@
#include <chrono>
#include <thread>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace vts {
+namespace android::hardware::automotive::can::V1_0::vts {
using namespace std::chrono_literals;
@@ -290,12 +285,7 @@
ASSERT_EQ(expectedPositive, messagesPositive);
}
-} // namespace vts
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::vts
/**
* Example manual invocation:
diff --git a/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp b/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp
index 64e7a96..22dec2c 100644
--- a/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp
+++ b/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp
@@ -26,12 +26,7 @@
#include <gmock/gmock.h>
#include <hidl-utils/hidl-utils.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace vts {
+namespace android::hardware::automotive::can::V1_0::vts {
using hardware::hidl_vec;
using InterfaceType = ICanController::InterfaceType;
@@ -233,12 +228,7 @@
assertRegistered(name, false);
}
-} // namespace vts
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::vts
/**
* Example manual invocation:
diff --git a/automotive/can/1.0/vts/utils/include/can-vts-utils/can-hal-printers.h b/automotive/can/1.0/vts/utils/include/can-vts-utils/can-hal-printers.h
index 0923998..3c30744 100644
--- a/automotive/can/1.0/vts/utils/include/can-vts-utils/can-hal-printers.h
+++ b/automotive/can/1.0/vts/utils/include/can-vts-utils/can-hal-printers.h
@@ -18,11 +18,7 @@
#include <android/hardware/automotive/can/1.0/ICanController.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
+namespace android::hardware::automotive::can::V1_0 {
/**
* Define gTest printer for a given HIDL type, but skip definition for Return<T>.
@@ -48,8 +44,4 @@
#undef DEFINE_CAN_HAL_PRINTER
#undef DEFINE_CAN_HAL_PRINTER_SIMPLE
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0
diff --git a/automotive/can/1.0/vts/utils/include/can-vts-utils/environment-utils.h b/automotive/can/1.0/vts/utils/include/can-vts-utils/environment-utils.h
index a722dd0..3eb9cc1 100644
--- a/automotive/can/1.0/vts/utils/include/can-vts-utils/environment-utils.h
+++ b/automotive/can/1.0/vts/utils/include/can-vts-utils/environment-utils.h
@@ -18,13 +18,7 @@
#include <VtsHalHidlTargetTestEnvBase.h>
-namespace android {
-namespace hardware {
-namespace automotive {
-namespace can {
-namespace V1_0 {
-namespace vts {
-namespace utils {
+namespace android::hardware::automotive::can::V1_0::vts::utils {
/**
* Simple test environment.
@@ -63,10 +57,4 @@
}
};
-} // namespace utils
-} // namespace vts
-} // namespace V1_0
-} // namespace can
-} // namespace automotive
-} // namespace hardware
-} // namespace android
+} // namespace android::hardware::automotive::can::V1_0::vts::utils
diff --git a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleConnector.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleConnector.h
index 56ecd67..d40f122 100644
--- a/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleConnector.h
+++ b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleConnector.h
@@ -57,10 +57,14 @@
virtual std::vector<VehiclePropConfig> getAllPropertyConfig() const = 0;
// Send the set property request to server
- virtual StatusCode setProperty(const VehiclePropValue& value) = 0;
+ // updateStatus indicate if VHal should change the status of the value
+ // it should be false except injecting values for e2e tests
+ virtual StatusCode setProperty(const VehiclePropValue& value, bool updateStatus) = 0;
// Receive a new property value from server
- virtual void onPropertyValue(const VehiclePropValue& value) = 0;
+ // updateStatus is true if and only if the value is
+ // generated by car (ECU/fake generator/injected)
+ virtual void onPropertyValue(const VehiclePropValue& value, bool updateStatus) = 0;
};
/**
@@ -84,11 +88,15 @@
// Receive the set property request from HAL.
// Process the setting and return the status code
- virtual StatusCode onSetProperty(const VehiclePropValue& value) = 0;
+ // updateStatus indicate if VHal should change the status of the value
+ // it should be false except injecting values for e2e tests
+ virtual StatusCode onSetProperty(const VehiclePropValue& value, bool updateStatus) = 0;
// Receive a new property value from car (via direct connection to the car bus or the emulator)
// and forward the value to HAL
- virtual void onPropertyValueFromCar(const VehiclePropValue& value) = 0;
+ // updateStatus is true if and only if the value is
+ // generated by car (ECU/fake generator/injected)
+ virtual void onPropertyValueFromCar(const VehiclePropValue& value, bool updateStatus) = 0;
};
/**
@@ -118,12 +126,12 @@
return this->onGetAllPropertyConfig();
}
- StatusCode setProperty(const VehiclePropValue& value) override {
- return this->onSetProperty(value);
+ StatusCode setProperty(const VehiclePropValue& value, bool updateStatus) override {
+ return this->onSetProperty(value, updateStatus);
}
- void onPropertyValueFromCar(const VehiclePropValue& value) override {
- return this->onPropertyValue(value);
+ void onPropertyValueFromCar(const VehiclePropValue& value, bool updateStatus) override {
+ return this->onPropertyValue(value, updateStatus);
}
// To be implemented:
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp
index 168999d..222fe5e 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp
@@ -30,12 +30,12 @@
namespace impl {
-void EmulatedVehicleClient::onPropertyValue(const VehiclePropValue& value) {
+void EmulatedVehicleClient::onPropertyValue(const VehiclePropValue& value, bool updateStatus) {
if (!mPropCallback) {
LOG(ERROR) << __func__ << ": PropertyCallBackType is not registered!";
return;
}
- return mPropCallback(value);
+ return mPropCallback(value, updateStatus);
}
void EmulatedVehicleClient::registerPropertyValueCallback(PropertyCallBackType&& callback) {
@@ -65,12 +65,13 @@
}
void EmulatedVehicleServer::onFakeValueGenerated(const VehiclePropValue& value) {
+ constexpr bool updateStatus = true;
LOG(DEBUG) << __func__ << ": " << toString(value);
auto updatedPropValue = getValuePool()->obtain(value);
if (updatedPropValue) {
updatedPropValue->timestamp = value.timestamp;
updatedPropValue->status = VehiclePropertyStatus::AVAILABLE;
- onPropertyValueFromCar(*updatedPropValue);
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
}
}
@@ -86,6 +87,8 @@
}
StatusCode EmulatedVehicleServer::handleGenerateFakeDataRequest(const VehiclePropValue& request) {
+ constexpr bool updateStatus = true;
+
LOG(INFO) << __func__;
const auto& v = request.value;
if (!v.int32Values.size()) {
@@ -153,9 +156,11 @@
int32_t display = request.value.int32Values[3];
// Send back to HAL
onPropertyValueFromCar(
- *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_DOWN, keyCode, display));
+ *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_DOWN, keyCode, display),
+ updateStatus);
onPropertyValueFromCar(
- *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_UP, keyCode, display));
+ *createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_UP, keyCode, display),
+ updateStatus);
break;
}
default: {
@@ -191,9 +196,41 @@
return keyEvent;
}
-StatusCode EmulatedVehicleServer::onSetProperty(const VehiclePropValue& value) {
+StatusCode EmulatedVehicleServer::onSetProperty(const VehiclePropValue& value, bool updateStatus) {
// Some properties need to be treated non-trivially
switch (value.prop) {
+ case kGenerateFakeDataControllingProperty:
+ return handleGenerateFakeDataRequest(value);
+
+ // set the value from vehcile side, used in end to end test.
+ case kSetIntPropertyFromVehcileForTest: {
+ auto updatedPropValue = createVehiclePropValue(VehiclePropertyType::INT32, 1);
+ updatedPropValue->prop = value.value.int32Values[0];
+ updatedPropValue->value.int32Values[0] = value.value.int32Values[1];
+ updatedPropValue->timestamp = value.value.int64Values[0];
+ updatedPropValue->areaId = value.areaId;
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ return StatusCode::OK;
+ }
+ case kSetFloatPropertyFromVehcileForTest: {
+ auto updatedPropValue = createVehiclePropValue(VehiclePropertyType::FLOAT, 1);
+ updatedPropValue->prop = value.value.int32Values[0];
+ updatedPropValue->value.floatValues[0] = value.value.floatValues[0];
+ updatedPropValue->timestamp = value.value.int64Values[0];
+ updatedPropValue->areaId = value.areaId;
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ return StatusCode::OK;
+ }
+ case kSetBooleanPropertyFromVehcileForTest: {
+ auto updatedPropValue = createVehiclePropValue(VehiclePropertyType::BOOLEAN, 1);
+ updatedPropValue->prop = value.value.int32Values[1];
+ updatedPropValue->value.int32Values[0] = value.value.int32Values[0];
+ updatedPropValue->timestamp = value.value.int64Values[0];
+ updatedPropValue->areaId = value.areaId;
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ return StatusCode::OK;
+ }
+
case AP_POWER_STATE_REPORT:
switch (value.value.int32Values[0]) {
case toInt(VehicleApPowerStateReport::DEEP_SLEEP_EXIT):
@@ -201,15 +238,18 @@
case toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL):
// CPMS is in WAIT_FOR_VHAL state, simply move to ON
// Send back to HAL
- onPropertyValueFromCar(
- *createApPowerStateReq(VehicleApPowerStateReq::ON, 0));
+ // ALWAYS update status for generated property value
+ onPropertyValueFromCar(*createApPowerStateReq(VehicleApPowerStateReq::ON, 0),
+ true /* updateStatus */);
break;
case toInt(VehicleApPowerStateReport::DEEP_SLEEP_ENTRY):
case toInt(VehicleApPowerStateReport::SHUTDOWN_START):
// CPMS is in WAIT_FOR_FINISH state, send the FINISHED command
// Send back to HAL
+ // ALWAYS update status for generated property value
onPropertyValueFromCar(
- *createApPowerStateReq(VehicleApPowerStateReq::FINISHED, 0));
+ *createApPowerStateReq(VehicleApPowerStateReq::FINISHED, 0),
+ true /* updateStatus */);
break;
case toInt(VehicleApPowerStateReport::ON):
case toInt(VehicleApPowerStateReport::SHUTDOWN_POSTPONE):
@@ -226,19 +266,12 @@
}
// In the real vhal, the value will be sent to Car ECU.
- // We just pretend it is done here.
- return StatusCode::OK;
-}
+ // We just pretend it is done here and send back to HAL
+ auto updatedPropValue = getValuePool()->obtain(value);
+ updatedPropValue->timestamp = elapsedRealtimeNano();
-StatusCode EmulatedVehicleServer::onSetPropertyFromVehicle(const VehiclePropValue& value) {
- if (value.prop == kGenerateFakeDataControllingProperty) {
- auto status = handleGenerateFakeDataRequest(value);
- return status;
- } else {
- // Send back to HAL
- onPropertyValueFromCar(value);
- return StatusCode::OK;
- }
+ onPropertyValueFromCar(*updatedPropValue, updateStatus);
+ return StatusCode::OK;
}
EmulatedPassthroughConnectorPtr makeEmulatedPassthroughConnector() {
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h
index d424cd8..5fc6493 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h
@@ -35,13 +35,10 @@
class EmulatedVehicleClient : public IVehicleClient {
public:
// Type of callback function for handling the new property values
- using PropertyCallBackType = std::function<void(const VehiclePropValue&)>;
+ using PropertyCallBackType = std::function<void(const VehiclePropValue&, bool updateStatus)>;
// Method from IVehicleClient
- void onPropertyValue(const VehiclePropValue& value) override;
-
- // Request to change the value on the VEHICLE side (for testing)
- virtual StatusCode setPropertyFromVehicle(const VehiclePropValue& value) = 0;
+ void onPropertyValue(const VehiclePropValue& value, bool updateStatus) override;
void registerPropertyValueCallback(PropertyCallBackType&& callback);
@@ -55,10 +52,7 @@
std::vector<VehiclePropConfig> onGetAllPropertyConfig() const override;
- StatusCode onSetProperty(const VehiclePropValue& value) override;
-
- // Process the request to change the value on the VEHICLE side (for testing)
- StatusCode onSetPropertyFromVehicle(const VehiclePropValue& value);
+ StatusCode onSetProperty(const VehiclePropValue& value, bool updateStatus) override;
// Set the Property Value Pool used in this server
void setValuePool(VehiclePropValuePool* valuePool);
@@ -85,16 +79,10 @@
VehiclePropValuePool* mValuePool{nullptr};
};
-class EmulatedPassthroughConnector
- : public IPassThroughConnector<EmulatedVehicleClient, EmulatedVehicleServer> {
- public:
- StatusCode setPropertyFromVehicle(const VehiclePropValue& value) override {
- return this->onSetPropertyFromVehicle(value);
- }
-};
-
// Helper functions
+using EmulatedPassthroughConnector =
+ IPassThroughConnector<EmulatedVehicleClient, EmulatedVehicleServer>;
using EmulatedPassthroughConnectorPtr = std::unique_ptr<EmulatedPassthroughConnector>;
EmulatedPassthroughConnectorPtr makeEmulatedPassthroughConnector();
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
index 6508efe..5c16bf7 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
@@ -98,8 +98,9 @@
for (size_t i = 0; i < arraysize(kVehicleProperties); i++) {
mPropStore->registerProperty(kVehicleProperties[i].config);
}
- mVehicleClient->registerPropertyValueCallback(
- std::bind(&EmulatedVehicleHal::onPropertyValue, this, std::placeholders::_1));
+ mVehicleClient->registerPropertyValueCallback(std::bind(&EmulatedVehicleHal::onPropertyValue,
+ this, std::placeholders::_1,
+ std::placeholders::_2));
}
VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::get(
@@ -131,41 +132,15 @@
}
StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) {
- static constexpr bool shouldUpdateStatus = false;
-
- // set the value from vehcile side, used in end to end test.
- if (propValue.prop == kSetIntPropertyFromVehcileForTest) {
- auto mockValue = createVehiclePropValue(VehiclePropertyType::INT32, 1);
- mockValue->prop = propValue.value.int32Values[0];
- mockValue->value.int32Values[0] = propValue.value.int32Values[1];
- mockValue->timestamp = propValue.value.int64Values[0];
- mockValue->areaId = propValue.areaId;
- setPropertyFromVehicle(*mockValue);
- return StatusCode::OK;
- }
-
- if (propValue.prop == kSetFloatPropertyFromVehcileForTest) {
- auto mockValue = createVehiclePropValue(VehiclePropertyType::FLOAT, 1);
- mockValue->prop = propValue.value.int32Values[0];
- mockValue->value.floatValues[0] = propValue.value.floatValues[0];
- mockValue->timestamp = propValue.value.int64Values[0];
- mockValue->areaId = propValue.areaId;
- setPropertyFromVehicle(*mockValue);
- return StatusCode::OK;
- }
- if (propValue.prop == kSetBooleanPropertyFromVehcileForTest) {
- auto mockValue = createVehiclePropValue(VehiclePropertyType::BOOLEAN, 1);
- mockValue->prop = propValue.value.int32Values[1];
- mockValue->value.int32Values[0] = propValue.value.int32Values[0];
- mockValue->timestamp = propValue.value.int64Values[0];
- mockValue->areaId = propValue.areaId;
- setPropertyFromVehicle(*mockValue);
- return StatusCode::OK;
- }
+ constexpr bool updateStatus = false;
if (propValue.prop == kGenerateFakeDataControllingProperty) {
- // send the generator controlling request to the server
- auto status = mVehicleClient->setPropertyFromVehicle(propValue);
+ // Send the generator controlling request to the server.
+ // 'updateStatus' flag is only for the value sent by setProperty (propValue in this case)
+ // instead of the generated values triggered by it. 'propValue' works as a control signal
+ // here, since we never send the control signal back, the value of 'updateStatus' flag
+ // does not matter here.
+ auto status = mVehicleClient->setProperty(propValue, updateStatus);
if (status != StatusCode::OK) {
return status;
}
@@ -212,22 +187,13 @@
* After checking all conditions, such as the property is available, a real vhal will
* sent the events to Car ECU to take actions.
*/
- VehiclePropValuePtr updatedPropValue = getValuePool()->obtain(propValue);
- updatedPropValue->timestamp = elapsedRealtimeNano();
// Send the value to the vehicle server, the server will talk to the (real or emulated) car
- auto setValueStatus = mVehicleClient->setProperty(*updatedPropValue);
+ auto setValueStatus = mVehicleClient->setProperty(propValue, updateStatus);
if (setValueStatus != StatusCode::OK) {
return setValueStatus;
}
- if (!mPropStore->writeValue(*updatedPropValue, shouldUpdateStatus)) {
- return StatusCode::INTERNAL_ERROR;
- }
-
- getEmulatorOrDie()->doSetValueFromClient(*updatedPropValue);
- doHalEvent(std::move(updatedPropValue));
-
return StatusCode::OK;
}
@@ -314,7 +280,6 @@
}
if (v.get()) {
- v->timestamp = elapsedRealtimeNano();
doHalEvent(std::move(v));
}
}
@@ -347,18 +312,19 @@
}
bool EmulatedVehicleHal::setPropertyFromVehicle(const VehiclePropValue& propValue) {
- return mVehicleClient->setPropertyFromVehicle(propValue) == StatusCode::OK;
+ constexpr bool updateStatus = true;
+ return mVehicleClient->setProperty(propValue, updateStatus) == StatusCode::OK;
}
std::vector<VehiclePropValue> EmulatedVehicleHal::getAllProperties() const {
return mPropStore->readAllValues();
}
-void EmulatedVehicleHal::onPropertyValue(const VehiclePropValue& value) {
- static constexpr bool shouldUpdateStatus = true;
+void EmulatedVehicleHal::onPropertyValue(const VehiclePropValue& value, bool updateStatus) {
VehiclePropValuePtr updatedPropValue = getValuePool()->obtain(value);
- if (mPropStore->writeValue(*updatedPropValue, shouldUpdateStatus)) {
+ if (mPropStore->writeValue(*updatedPropValue, updateStatus)) {
+ getEmulatorOrDie()->doSetValueFromClient(*updatedPropValue);
doHalEvent(std::move(updatedPropValue));
}
}
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h
index 98315ec..a8378da 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h
@@ -68,7 +68,7 @@
}
StatusCode handleGenerateFakeDataRequest(const VehiclePropValue& request);
- void onPropertyValue(const VehiclePropValue& value);
+ void onPropertyValue(const VehiclePropValue& value, bool updateStatus);
void onContinuousPropertyTimer(const std::vector<int32_t>& properties);
bool isContinuousProperty(int32_t propId) const;