Merge "Add biometrics.fingerprint@2.2 to current.txt"
diff --git a/audio/core/all-versions/default/PrimaryDevice.cpp b/audio/core/all-versions/default/PrimaryDevice.cpp
index 679f85d..11c1c5a 100644
--- a/audio/core/all-versions/default/PrimaryDevice.cpp
+++ b/audio/core/all-versions/default/PrimaryDevice.cpp
@@ -203,6 +203,9 @@
case AudioMode::RINGTONE:
case AudioMode::IN_CALL:
case AudioMode::IN_COMMUNICATION:
+#if MAJOR_VERSION >= 6
+ case AudioMode::CALL_SCREEN:
+#endif
break; // Valid values
default:
return Result::INVALID_ARGUMENTS;
diff --git a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
index 709b7cd..b0eb2e0 100644
--- a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
@@ -244,7 +244,13 @@
TEST_P(AudioPrimaryHidlTest, setMode) {
doc::test("Make sure setMode always succeeds if mode is valid and fails otherwise");
// Test Invalid values
- for (int mode : {-2, -1, int(AudioMode::IN_COMMUNICATION) + 1}) {
+#if MAJOR_VERSION >= 6
+ int maxMode = int(AudioMode::CALL_SCREEN);
+#else
+ int maxMode = int(AudioMode::IN_COMMUNICATION);
+#endif
+
+ for (int mode : {-2, -1, maxMode + 1}) {
ASSERT_RESULT(Result::INVALID_ARGUMENTS, getDevice()->setMode(AudioMode(mode)))
<< "mode=" << mode;
}
@@ -253,6 +259,10 @@
AudioMode::NORMAL /* Make sure to leave the test in normal mode */}) {
ASSERT_OK(getDevice()->setMode(mode)) << "mode=" << toString(mode);
}
+ // AudioMode::CALL_SCREEN as support is optional
+#if MAJOR_VERSION >= 6
+ ASSERT_RESULT(okOrNotSupportedOrInvalidArgs, getDevice()->setMode(AudioMode::CALL_SCREEN));
+#endif
}
TEST_P(AudioPrimaryHidlTest, setBtHfpSampleRate) {
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index 2050038..a94a37e 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -82,6 +82,20 @@
],
}
+// VHal virtualization utils
+cc_library_static {
+ name: "android.hardware.automotive.vehicle@2.0-virtualization-utils",
+ vendor: true,
+ defaults: ["vhal_v2_0_defaults"],
+ srcs: [
+ "impl/vhal_v2_0/virtualization/Utils.cpp",
+ ],
+ export_include_dirs: ["impl"],
+ shared_libs: [
+ "libbase",
+ ],
+}
+
cc_test {
name: "android.hardware.automotive.vehicle@2.0-manager-unit-tests",
vendor: true,
@@ -133,3 +147,59 @@
"libqemu_pipe",
],
}
+
+cc_binary {
+ name: "android.hardware.automotive.vehicle@2.0-virtualization-service",
+ defaults: ["vhal_v2_0_defaults"],
+ init_rc: ["android.hardware.automotive.vehicle@2.0-virtualization-service.rc"],
+ vendor: true,
+ relative_install_path: "hw",
+ srcs: [
+ "impl/vhal_v2_0/virtualization/GrpcVehicleClient.cpp",
+ "VirtualizedVehicleService.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ "libcutils",
+ "libjsoncpp",
+ "libprotobuf-cpp-full",
+ "libgrpc++",
+ ],
+ static_libs: [
+ "android.hardware.automotive.vehicle@2.0-manager-lib",
+ "android.hardware.automotive.vehicle@2.0-default-impl-lib",
+ "android.hardware.automotive.vehicle@2.0-grpc",
+ "android.hardware.automotive.vehicle@2.0-virtualization-utils",
+ "libqemu_pipe",
+ ],
+ cflags: [
+ "-Wno-unused-parameter"
+ ],
+}
+
+cc_binary {
+ name: "android.hardware.automotive.vehicle@2.0-virtualization-grpc-server",
+ init_rc: ["android.hardware.automotive.vehicle@2.0-virtualization-grpc-server.rc"],
+ defaults: ["vhal_v2_0_defaults"],
+ vendor: true,
+ relative_install_path: "hw",
+ srcs: [
+ "impl/vhal_v2_0/virtualization/GrpcVehicleServer.cpp",
+ "VirtualizationGrpcServer.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ "libjsoncpp",
+ "libprotobuf-cpp-full",
+ "libgrpc++",
+ ],
+ static_libs: [
+ "android.hardware.automotive.vehicle@2.0-manager-lib",
+ "android.hardware.automotive.vehicle@2.0-default-impl-lib",
+ "android.hardware.automotive.vehicle@2.0-grpc",
+ "android.hardware.automotive.vehicle@2.0-virtualization-utils",
+ ],
+ cflags: [
+ "-Wno-unused-parameter"
+ ],
+}
diff --git a/automotive/vehicle/2.0/default/VirtualizationGrpcServer.cpp b/automotive/vehicle/2.0/default/VirtualizationGrpcServer.cpp
new file mode 100644
index 0000000..cca65d9
--- /dev/null
+++ b/automotive/vehicle/2.0/default/VirtualizationGrpcServer.cpp
@@ -0,0 +1,49 @@
+#include <android-base/logging.h>
+#include <getopt.h>
+#include <unistd.h>
+
+#include "vhal_v2_0/virtualization/GrpcVehicleServer.h"
+#include "vhal_v2_0/virtualization/Utils.h"
+
+int main(int argc, char* argv[]) {
+ namespace vhal_impl = android::hardware::automotive::vehicle::V2_0::impl;
+
+ vhal_impl::VsockServerInfo serverInfo;
+
+ // unique values to identify the options
+ constexpr int OPT_VHAL_SERVER_CID = 1001;
+ constexpr int OPT_VHAL_SERVER_PORT_NUMBER = 1002;
+
+ struct option longOptions[] = {
+ {"server_cid", 1, 0, OPT_VHAL_SERVER_CID},
+ {"server_port", 1, 0, OPT_VHAL_SERVER_PORT_NUMBER},
+ {nullptr, 0, nullptr, 0},
+ };
+
+ int optValue;
+ while ((optValue = getopt_long_only(argc, argv, ":", longOptions, 0)) != -1) {
+ switch (optValue) {
+ case OPT_VHAL_SERVER_CID:
+ serverInfo.serverCid = std::atoi(optarg);
+ LOG(DEBUG) << "Vehicle HAL server CID: " << serverInfo.serverCid;
+ break;
+ case OPT_VHAL_SERVER_PORT_NUMBER:
+ serverInfo.serverPort = std::atoi(optarg);
+ LOG(DEBUG) << "Vehicle HAL server port: " << serverInfo.serverPort;
+ break;
+ default:
+ // ignore other options
+ break;
+ }
+ }
+
+ if (serverInfo.serverCid == 0 || serverInfo.serverPort == 0) {
+ LOG(FATAL) << "Invalid server information, CID: " << serverInfo.serverCid
+ << "; port: " << serverInfo.serverPort;
+ // Will abort after logging
+ }
+
+ auto server = vhal_impl::makeGrpcVehicleServer(vhal_impl::getVsockUri(serverInfo));
+ server->Start();
+ return 0;
+}
diff --git a/automotive/vehicle/2.0/default/VirtualizedVehicleService.cpp b/automotive/vehicle/2.0/default/VirtualizedVehicleService.cpp
new file mode 100644
index 0000000..1de81ae
--- /dev/null
+++ b/automotive/vehicle/2.0/default/VirtualizedVehicleService.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2019 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-base/logging.h>
+#include <cutils/properties.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include <vhal_v2_0/EmulatedVehicleConnector.h>
+#include <vhal_v2_0/EmulatedVehicleHal.h>
+#include <vhal_v2_0/VehicleHalManager.h>
+#include <vhal_v2_0/virtualization/GrpcVehicleClient.h>
+#include <vhal_v2_0/virtualization/Utils.h>
+
+using namespace android;
+using namespace android::hardware;
+using namespace android::hardware::automotive::vehicle::V2_0;
+
+int main(int argc, char* argv[]) {
+ constexpr const char* VHAL_SERVER_CID_PROPERTY_KEY = "ro.vendor.vehiclehal.server.cid";
+ constexpr const char* VHAL_SERVER_PORT_PROPERTY_KEY = "ro.vendor.vehiclehal.server.port";
+
+ auto property_get_uint = [](const char* key, unsigned int default_value) {
+ auto value = property_get_int64(key, default_value);
+ if (value < 0 || value > UINT_MAX) {
+ LOG(DEBUG) << key << ": " << value << " is out of bound, using default value '"
+ << default_value << "' instead";
+ return default_value;
+ }
+ return static_cast<unsigned int>(value);
+ };
+
+ impl::VsockServerInfo serverInfo{property_get_uint(VHAL_SERVER_CID_PROPERTY_KEY, 0),
+ property_get_uint(VHAL_SERVER_PORT_PROPERTY_KEY, 0)};
+
+ if (serverInfo.serverCid == 0 || serverInfo.serverPort == 0) {
+ LOG(FATAL) << "Invalid server information, CID: " << serverInfo.serverCid
+ << "; port: " << serverInfo.serverPort;
+ // Will abort after logging
+ }
+
+ auto store = std::make_unique<VehiclePropertyStore>();
+ auto connector = impl::makeGrpcVehicleClient(impl::getVsockUri(serverInfo));
+ auto hal = std::make_unique<impl::EmulatedVehicleHal>(store.get(), connector.get());
+ auto emulator = std::make_unique<impl::VehicleEmulator>(hal.get());
+ auto service = std::make_unique<VehicleHalManager>(hal.get());
+
+ configureRpcThreadpool(4, true /* callerWillJoin */);
+
+ LOG(INFO) << "Registering as service...";
+ status_t status = service->registerAsService();
+
+ if (status != OK) {
+ LOG(ERROR) << "Unable to register vehicle service (" << status << ")";
+ return 1;
+ }
+
+ LOG(INFO) << "Ready";
+ joinRpcThreadpool();
+
+ return 1;
+}
diff --git a/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-virtualization-grpc-server.rc b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-virtualization-grpc-server.rc
new file mode 100644
index 0000000..29147ad
--- /dev/null
+++ b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-virtualization-grpc-server.rc
@@ -0,0 +1,10 @@
+# It is an interim state to run GRPC server as an Android service.
+# Eventually it will run outside of Android (e.g., AGL),
+# so the command line arguments are expected, though not conventionally used in Android
+service vendor.vehicle-hal-2.0-server \
+ /vendor/bin/hw/android.hardware.automotive.vehicle@2.0-virtualization-grpc-server \
+ -server_cid ${ro.vendor.vehiclehal.server.cid:-0} \
+ -server_port ${ro.vendor.vehiclehal.server.port:-0}
+ class hal
+ user vehicle_network
+ group system inet
diff --git a/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-virtualization-service.rc b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-virtualization-service.rc
new file mode 100644
index 0000000..234de59
--- /dev/null
+++ b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-virtualization-service.rc
@@ -0,0 +1,4 @@
+service vendor.vehicle-hal-2.0 /vendor/bin/hw/android.hardware.automotive.vehicle@2.0-virtualization-service
+ class hal
+ user vehicle_network
+ group system inet
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleServer.proto b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleServer.proto
index 2cc6595..6f71d65 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleServer.proto
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleServer.proto
@@ -35,13 +35,23 @@
VehicleHalStatusCode status_code = 1;
}
+message WrappedVehiclePropValue {
+ VehiclePropValue value = 1;
+ // An indicator on whether we should update the status of the property
+ // - true: if the value is generated by (emulated/real) car, or;
+ // if the value is injected to 'fake' a on car event (for debugging purpose)
+ // - false: if the value is set by VHal (public interface), since Android
+ // cannot change status of property on a real car
+ bool update_status = 2;
+}
+
service VehicleServer {
rpc GetAllPropertyConfig(google.protobuf.Empty) returns (stream VehiclePropConfig) {}
// Change the property value of the vehicle
- rpc SetProperty(VehiclePropValue) returns (VehicleHalCallStatus) {}
+ rpc SetProperty(WrappedVehiclePropValue) returns (VehicleHalCallStatus) {}
// Start a vehicle property value stream
- rpc StartPropertyValuesStream(google.protobuf.Empty) returns (stream VehiclePropValue) {}
+ rpc StartPropertyValuesStream(google.protobuf.Empty) returns (stream WrappedVehiclePropValue) {}
}
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleClient.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleClient.cpp
new file mode 100644
index 0000000..e329c5b
--- /dev/null
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleClient.cpp
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2019 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 "GrpcVehicleClient.h"
+
+#include <condition_variable>
+#include <mutex>
+
+#include <android-base/logging.h>
+#include <grpc++/grpc++.h>
+
+#include "VehicleServer.grpc.pb.h"
+#include "VehicleServer.pb.h"
+#include "vhal_v2_0/ProtoMessageConverter.h"
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace V2_0 {
+
+namespace impl {
+
+static std::shared_ptr<::grpc::ChannelCredentials> getChannelCredentials() {
+ // TODO(chenhaosjtuacm): get secured credentials here
+ return ::grpc::InsecureChannelCredentials();
+}
+
+class GrpcVehicleClientImpl : public EmulatedVehicleClient {
+ public:
+ GrpcVehicleClientImpl(const std::string& addr)
+ : mServiceAddr(addr),
+ mGrpcChannel(::grpc::CreateChannel(mServiceAddr, getChannelCredentials())),
+ mGrpcStub(vhal_proto::VehicleServer::NewStub(mGrpcChannel)) {
+ StartValuePollingThread();
+ }
+
+ ~GrpcVehicleClientImpl() {
+ mShuttingDownFlag.store(true);
+ mShutdownCV.notify_all();
+ if (mPollingThread.joinable()) {
+ mPollingThread.join();
+ }
+ }
+
+ // methods from IVehicleClient
+
+ std::vector<VehiclePropConfig> getAllPropertyConfig() const override;
+
+ StatusCode setProperty(const VehiclePropValue& value, bool updateStatus) override;
+
+ private:
+ void StartValuePollingThread();
+
+ // private data members
+
+ std::string mServiceAddr;
+ std::shared_ptr<::grpc::Channel> mGrpcChannel;
+ std::unique_ptr<vhal_proto::VehicleServer::Stub> mGrpcStub;
+ std::thread mPollingThread;
+
+ std::mutex mShutdownMutex;
+ std::condition_variable mShutdownCV;
+ std::atomic<bool> mShuttingDownFlag{false};
+};
+
+std::unique_ptr<EmulatedVehicleClient> makeGrpcVehicleClient(const std::string& addr) {
+ return std::make_unique<GrpcVehicleClientImpl>(addr);
+}
+
+std::vector<VehiclePropConfig> GrpcVehicleClientImpl::getAllPropertyConfig() const {
+ std::vector<VehiclePropConfig> configs;
+ ::grpc::ClientContext context;
+ auto config_stream = mGrpcStub->GetAllPropertyConfig(&context, ::google::protobuf::Empty());
+ vhal_proto::VehiclePropConfig protoConfig;
+ while (config_stream->Read(&protoConfig)) {
+ VehiclePropConfig config;
+ proto_msg_converter::fromProto(&config, protoConfig);
+ configs.emplace_back(std::move(config));
+ }
+ auto grpc_status = config_stream->Finish();
+ if (!grpc_status.ok()) {
+ LOG(ERROR) << __func__
+ << ": GRPC GetAllPropertyConfig Failed: " << grpc_status.error_message();
+ configs.clear();
+ }
+
+ return configs;
+}
+
+StatusCode GrpcVehicleClientImpl::setProperty(const VehiclePropValue& value, bool updateStatus) {
+ ::grpc::ClientContext context;
+ vhal_proto::WrappedVehiclePropValue wrappedProtoValue;
+ vhal_proto::VehicleHalCallStatus vhal_status;
+ proto_msg_converter::toProto(wrappedProtoValue.mutable_value(), value);
+ wrappedProtoValue.set_update_status(updateStatus);
+
+ auto grpc_status = mGrpcStub->SetProperty(&context, wrappedProtoValue, &vhal_status);
+ if (!grpc_status.ok()) {
+ LOG(ERROR) << __func__ << ": GRPC SetProperty Failed: " << grpc_status.error_message();
+ return StatusCode::INTERNAL_ERROR;
+ }
+
+ return static_cast<StatusCode>(vhal_status.status_code());
+}
+
+void GrpcVehicleClientImpl::StartValuePollingThread() {
+ mPollingThread = std::thread([this]() {
+ while (!mShuttingDownFlag.load()) {
+ ::grpc::ClientContext context;
+
+ std::atomic<bool> rpc_ok{true};
+ std::thread shuttingdown_watcher([this, &rpc_ok, &context]() {
+ std::unique_lock<std::mutex> shutdownLock(mShutdownMutex);
+ mShutdownCV.wait(shutdownLock, [this, &rpc_ok]() {
+ return !rpc_ok.load() || mShuttingDownFlag.load();
+ });
+ context.TryCancel();
+ });
+
+ auto value_stream =
+ mGrpcStub->StartPropertyValuesStream(&context, ::google::protobuf::Empty());
+ vhal_proto::WrappedVehiclePropValue wrappedProtoValue;
+ while (!mShuttingDownFlag.load() && value_stream->Read(&wrappedProtoValue)) {
+ VehiclePropValue value;
+ proto_msg_converter::fromProto(&value, wrappedProtoValue.value());
+ onPropertyValue(value, wrappedProtoValue.update_status());
+ }
+
+ rpc_ok.store(false);
+ mShutdownCV.notify_all();
+ shuttingdown_watcher.join();
+
+ auto grpc_status = value_stream->Finish();
+ // never reach here until connection lost
+ LOG(ERROR) << __func__
+ << ": GRPC Value Streaming Failed: " << grpc_status.error_message();
+
+ // try to reconnect
+ }
+ });
+}
+
+} // namespace impl
+
+} // namespace V2_0
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleClient.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleClient.h
new file mode 100644
index 0000000..14eae7f
--- /dev/null
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleClient.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 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_V2_0_impl_virtialization_GrpcVehicleClient_H_
+#define android_hardware_automotive_vehicle_V2_0_impl_virtialization_GrpcVehicleClient_H_
+
+#include "vhal_v2_0/EmulatedVehicleConnector.h"
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace V2_0 {
+
+namespace impl {
+
+std::unique_ptr<EmulatedVehicleClient> makeGrpcVehicleClient(const std::string& addr);
+
+} // namespace impl
+
+} // namespace V2_0
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_automotive_vehicle_V2_0_impl_virtialization_GrpcVehicleClient_H_
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleServer.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleServer.cpp
new file mode 100644
index 0000000..e30b3be
--- /dev/null
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleServer.cpp
@@ -0,0 +1,229 @@
+/*
+ * Copyright (C) 2019 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 "GrpcVehicleServer.h"
+
+#include <condition_variable>
+#include <mutex>
+#include <shared_mutex>
+
+#include <android-base/logging.h>
+#include <grpc++/grpc++.h>
+
+#include "VehicleServer.grpc.pb.h"
+#include "VehicleServer.pb.h"
+#include "vhal_v2_0/ProtoMessageConverter.h"
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace V2_0 {
+
+namespace impl {
+
+class GrpcVehicleServerImpl : public GrpcVehicleServer, public vhal_proto::VehicleServer::Service {
+ public:
+ GrpcVehicleServerImpl(const std::string& addr) : mServiceAddr(addr) {
+ setValuePool(&mValueObjectPool);
+ }
+
+ // method from GrpcVehicleServer
+ void Start() override;
+
+ // method from IVehicleServer
+ void onPropertyValueFromCar(const VehiclePropValue& value, bool updateStatus) override;
+
+ // methods from vhal_proto::VehicleServer::Service
+
+ ::grpc::Status GetAllPropertyConfig(
+ ::grpc::ServerContext* context, const ::google::protobuf::Empty* request,
+ ::grpc::ServerWriter<vhal_proto::VehiclePropConfig>* stream) override;
+
+ ::grpc::Status SetProperty(::grpc::ServerContext* context,
+ const vhal_proto::WrappedVehiclePropValue* wrappedPropValue,
+ vhal_proto::VehicleHalCallStatus* status) override;
+
+ ::grpc::Status StartPropertyValuesStream(
+ ::grpc::ServerContext* context, const ::google::protobuf::Empty* request,
+ ::grpc::ServerWriter<vhal_proto::WrappedVehiclePropValue>* stream) override;
+
+ private:
+ // We keep long-lasting connection for streaming the prop values.
+ // For us, each connection can be represented as a function to send the new value, and
+ // an ID to identify this connection
+ struct ConnectionDescriptor {
+ using ValueWriterType = std::function<bool(const vhal_proto::WrappedVehiclePropValue&)>;
+
+ ConnectionDescriptor(ValueWriterType&& value_writer)
+ : mValueWriter(std::move(value_writer)),
+ mConnectionID(CONNECTION_ID_COUNTER.fetch_add(1)) {}
+
+ ConnectionDescriptor(const ConnectionDescriptor&) = delete;
+
+ ConnectionDescriptor& operator=(const ConnectionDescriptor&) = delete;
+
+ // This move constructor is NOT THREAD-SAFE, which means it cannot be moved
+ // while using. Since the connection descriptors are pretected by mConnectionMutex
+ // then we are fine here
+ ConnectionDescriptor(ConnectionDescriptor&& cd)
+ : mValueWriter(std::move(cd.mValueWriter)),
+ mConnectionID(cd.mConnectionID),
+ mIsAlive(cd.mIsAlive.load()) {
+ cd.mIsAlive.store(false);
+ }
+
+ ValueWriterType mValueWriter;
+ uint64_t mConnectionID;
+ std::atomic<bool> mIsAlive{true};
+
+ static std::atomic<uint64_t> CONNECTION_ID_COUNTER;
+ };
+
+ std::string mServiceAddr;
+ VehiclePropValuePool mValueObjectPool;
+ mutable std::shared_mutex mConnectionMutex;
+ mutable std::shared_mutex mWriterMutex;
+ std::list<ConnectionDescriptor> mValueStreamingConnections;
+};
+
+std::atomic<uint64_t> GrpcVehicleServerImpl::ConnectionDescriptor::CONNECTION_ID_COUNTER = 0;
+
+static std::shared_ptr<::grpc::ServerCredentials> getServerCredentials() {
+ // TODO(chenhaosjtuacm): get secured credentials here
+ return ::grpc::InsecureServerCredentials();
+}
+
+GrpcVehicleServerPtr makeGrpcVehicleServer(const std::string& addr) {
+ return std::make_unique<GrpcVehicleServerImpl>(addr);
+}
+
+void GrpcVehicleServerImpl::Start() {
+ ::grpc::ServerBuilder builder;
+ builder.RegisterService(this);
+ builder.AddListeningPort(mServiceAddr, getServerCredentials());
+ std::unique_ptr<::grpc::Server> server(builder.BuildAndStart());
+
+ server->Wait();
+}
+
+void GrpcVehicleServerImpl::onPropertyValueFromCar(const VehiclePropValue& value,
+ bool updateStatus) {
+ vhal_proto::WrappedVehiclePropValue wrappedPropValue;
+ proto_msg_converter::toProto(wrappedPropValue.mutable_value(), value);
+ wrappedPropValue.set_update_status(updateStatus);
+ std::shared_lock read_lock(mConnectionMutex);
+
+ bool has_terminated_connections = 0;
+
+ for (auto& connection : mValueStreamingConnections) {
+ auto writeOK = connection.mValueWriter(wrappedPropValue);
+ if (!writeOK) {
+ LOG(ERROR) << __func__ << ": Server Write failed, connection lost. ID: "
+ << connection.mConnectionID;
+ has_terminated_connections = true;
+ connection.mIsAlive.store(false);
+ }
+ }
+
+ if (!has_terminated_connections) {
+ return;
+ }
+
+ read_lock.unlock();
+
+ std::unique_lock write_lock(mConnectionMutex);
+
+ for (auto itr = mValueStreamingConnections.begin(); itr != mValueStreamingConnections.end();) {
+ if (!itr->mIsAlive.load()) {
+ itr = mValueStreamingConnections.erase(itr);
+ } else {
+ ++itr;
+ }
+ }
+}
+
+::grpc::Status GrpcVehicleServerImpl::GetAllPropertyConfig(
+ ::grpc::ServerContext* context, const ::google::protobuf::Empty* request,
+ ::grpc::ServerWriter<vhal_proto::VehiclePropConfig>* stream) {
+ auto configs = onGetAllPropertyConfig();
+ for (auto& config : configs) {
+ vhal_proto::VehiclePropConfig protoConfig;
+ proto_msg_converter::toProto(&protoConfig, config);
+ if (!stream->Write(protoConfig)) {
+ return ::grpc::Status(::grpc::StatusCode::ABORTED, "Connection lost.");
+ }
+ }
+
+ return ::grpc::Status::OK;
+}
+
+::grpc::Status GrpcVehicleServerImpl::SetProperty(
+ ::grpc::ServerContext* context, const vhal_proto::WrappedVehiclePropValue* wrappedPropValue,
+ vhal_proto::VehicleHalCallStatus* status) {
+ VehiclePropValue value;
+ proto_msg_converter::fromProto(&value, wrappedPropValue->value());
+
+ auto set_status = static_cast<int32_t>(onSetProperty(value, wrappedPropValue->update_status()));
+ if (!vhal_proto::VehicleHalStatusCode_IsValid(set_status)) {
+ return ::grpc::Status(::grpc::StatusCode::INTERNAL, "Unknown status code");
+ }
+
+ status->set_status_code(static_cast<vhal_proto::VehicleHalStatusCode>(set_status));
+
+ return ::grpc::Status::OK;
+}
+
+::grpc::Status GrpcVehicleServerImpl::StartPropertyValuesStream(
+ ::grpc::ServerContext* context, const ::google::protobuf::Empty* request,
+ ::grpc::ServerWriter<vhal_proto::WrappedVehiclePropValue>* stream) {
+ std::mutex terminateMutex;
+ std::condition_variable terminateCV;
+ std::unique_lock<std::mutex> terminateLock(terminateMutex);
+ bool terminated{false};
+
+ auto callBack = [stream, &terminateMutex, &terminateCV, &terminated,
+ this](const vhal_proto::WrappedVehiclePropValue& value) {
+ std::unique_lock lock(mWriterMutex);
+ if (!stream->Write(value)) {
+ std::unique_lock<std::mutex> terminateLock(terminateMutex);
+ terminated = true;
+ terminateLock.unlock();
+ terminateCV.notify_all();
+ return false;
+ }
+ return true;
+ };
+
+ // Register connection
+ std::unique_lock lock(mConnectionMutex);
+ auto& conn = mValueStreamingConnections.emplace_back(std::move(callBack));
+ lock.unlock();
+
+ // Never stop until connection lost
+ terminateCV.wait(terminateLock, [&terminated]() { return terminated; });
+
+ LOG(ERROR) << __func__ << ": Stream lost, ID : " << conn.mConnectionID;
+
+ return ::grpc::Status(::grpc::StatusCode::ABORTED, "Connection lost.");
+}
+
+} // namespace impl
+
+} // namespace V2_0
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleServer.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleServer.h
new file mode 100644
index 0000000..32f4eb2
--- /dev/null
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/GrpcVehicleServer.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2019 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_V2_0_impl_virtialization_GrpcVehicleServer_H_
+#define android_hardware_automotive_vehicle_V2_0_impl_virtialization_GrpcVehicleServer_H_
+
+#include "vhal_v2_0/EmulatedVehicleConnector.h"
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace V2_0 {
+
+namespace impl {
+
+// Connect to the Vehicle Client via GRPC
+class GrpcVehicleServer : public EmulatedVehicleServer {
+ public:
+ // Start listening incoming calls, should never return if working normally
+ virtual void Start() = 0;
+};
+
+using GrpcVehicleServerPtr = std::unique_ptr<GrpcVehicleServer>;
+
+GrpcVehicleServerPtr makeGrpcVehicleServer(const std::string& addr);
+
+} // namespace impl
+
+} // namespace V2_0
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_automotive_vehicle_V2_0_impl_virtialization_GrpcVehicleServer_H_
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/Utils.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/Utils.cpp
new file mode 100644
index 0000000..41d4827
--- /dev/null
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/Utils.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 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 "Utils.h"
+
+#include <sstream>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace V2_0 {
+namespace impl {
+
+std::string getVsockUri(const VsockServerInfo& serverInfo) {
+ std::stringstream uri_stream;
+ uri_stream << "vsock:" << serverInfo.serverCid << ":" << serverInfo.serverPort;
+ return uri_stream.str();
+}
+
+} // namespace impl
+} // namespace V2_0
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/Utils.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/Utils.h
new file mode 100644
index 0000000..6b1049c
--- /dev/null
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/virtualization/Utils.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 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_V2_0_impl_virtualization_Utils_H_
+#define android_hardware_automotive_vehicle_V2_0_impl_virtualization_Utils_H_
+
+#include <string>
+
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+namespace V2_0 {
+namespace impl {
+
+struct VsockServerInfo {
+ unsigned int serverCid{0};
+ unsigned int serverPort{0};
+};
+
+std::string getVsockUri(const VsockServerInfo& serverInfo);
+
+} // namespace impl
+} // namespace V2_0
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+
+#endif // android_hardware_automotive_vehicle_V2_0_impl_virtualization_Utils_H_
diff --git a/camera/metadata/3.5/types.hal b/camera/metadata/3.5/types.hal
index 4c063dd..4e2252c 100644
--- a/camera/metadata/3.5/types.hal
+++ b/camera/metadata/3.5/types.hal
@@ -72,6 +72,23 @@
ANDROID_CONTROL_END_3_5,
+ /** android.scaler.availableRotateAndCropModes [static, byte[], public]
+ *
+ * <p>List of rotate-and-crop modes for ANDROID_SCALER_ROTATE_AND_CROP that are supported by this camera device.</p>
+ *
+ * @see ANDROID_SCALER_ROTATE_AND_CROP
+ */
+ ANDROID_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES = android.hardware.camera.metadata@3.4::CameraMetadataTag:ANDROID_SCALER_END_3_4,
+
+ /** android.scaler.rotateAndCrop [dynamic, enum, public]
+ *
+ * <p>Whether a rotation-and-crop operation is applied to processed
+ * outputs from the camera.</p>
+ */
+ ANDROID_SCALER_ROTATE_AND_CROP,
+
+ ANDROID_SCALER_END_3_5,
+
};
/*
@@ -103,3 +120,14 @@
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA,
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING,
};
+
+/** android.scaler.rotateAndCrop enumeration values
+ * @see ANDROID_SCALER_ROTATE_AND_CROP
+ */
+enum CameraMetadataEnumAndroidScalerRotateAndCrop : uint32_t {
+ ANDROID_SCALER_ROTATE_AND_CROP_NONE,
+ ANDROID_SCALER_ROTATE_AND_CROP_90,
+ ANDROID_SCALER_ROTATE_AND_CROP_180,
+ ANDROID_SCALER_ROTATE_AND_CROP_270,
+ ANDROID_SCALER_ROTATE_AND_CROP_AUTO,
+};
diff --git a/current.txt b/current.txt
index 608e1cc..f337c8e 100644
--- a/current.txt
+++ b/current.txt
@@ -677,10 +677,10 @@
##
# BEGIN Radio HAL Merge Conflict Avoidance Buffer - STOPSHIP if present
##
-430f8449ddb24c02284da561bfd24bb5a2a226d9ed2aec38e876e323e2b7eeee android.hardware.radio@1.5::types
-c68f5bd87f747f8e7968ff66ecc548b2d26f8e186b7bb805c11d6c883a838fc6 android.hardware.radio@1.5::IRadio
+3a303604d6c99a36c3d2a819b7908b3681b8488f89c26ea525768522c45f7f17 android.hardware.radio@1.5::types
+26216f3566aff76d8a29ee95f74bcb099a05f65ead8d6d4fadafee6967889b93 android.hardware.radio@1.5::IRadio
e96ae1c3a9c0689002ec2318e9c587f4f607c16a75a3cd38788b77eb91072021 android.hardware.radio@1.5::IRadioIndication
-9e962eff568dc8c712d83846f8c27460de5005ed9b836d3e08390e8aa56b5a46 android.hardware.radio@1.5::IRadioResponse
+1a3324125cae8f4ca9984225d2f14bafeb835b8d9a1717fc9ed794de701f197c android.hardware.radio@1.5::IRadioResponse
2fd107f3de1b7e36825e241a88dfae8edf3a77c166cb746f00ddf6440ab78db1 android.hardware.radio.config@1.3::types
a2977755bc5f1ef47f04b7f2400632efda6218e1515dba847da487145cfabc4f android.hardware.radio.config@1.3::IRadioConfig
742360c775313438b0f82256eac62fb5bbc76a6ae6f388573f3aa142fb2c1eea android.hardware.radio.config@1.3::IRadioConfigIndication
diff --git a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp
index b811149..88837db 100644
--- a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp
@@ -603,7 +603,9 @@
}
}
- if (testConfig.outputType != OutputType::FULLY_SPECIFIED &&
+ // The driver is allowed to reject executeFenced, and if they do, we should skip.
+ if ((testConfig.outputType != OutputType::FULLY_SPECIFIED ||
+ testConfig.executor == Executor::FENCED) &&
executionStatus == ErrorStatus::GENERAL_FAILURE) {
if (skipped != nullptr) {
*skipped = true;
@@ -674,7 +676,7 @@
case TestKind::GENERAL: {
outputTypesList = {OutputType::FULLY_SPECIFIED};
measureTimingList = {MeasureTiming::NO, MeasureTiming::YES};
- executorList = {Executor::ASYNC, Executor::SYNC, Executor::BURST, Executor::FENCED};
+ executorList = {Executor::ASYNC, Executor::SYNC, Executor::BURST};
} break;
case TestKind::DYNAMIC_SHAPE: {
outputTypesList = {OutputType::UNSPECIFIED, OutputType::INSUFFICIENT};
@@ -687,6 +689,11 @@
executorList = {Executor::ASYNC, Executor::SYNC};
memoryType = MemoryType::DEVICE;
} break;
+ case TestKind::FENCED_COMPUTE: {
+ outputTypesList = {OutputType::FULLY_SPECIFIED};
+ measureTimingList = {MeasureTiming::NO, MeasureTiming::YES};
+ executorList = {Executor::FENCED};
+ } break;
case TestKind::QUANTIZATION_COUPLING: {
LOG(FATAL) << "Wrong TestKind for EvaluatePreparedModel";
return;
@@ -748,7 +755,8 @@
switch (testKind) {
case TestKind::GENERAL:
case TestKind::DYNAMIC_SHAPE:
- case TestKind::MEMORY_DOMAIN: {
+ case TestKind::MEMORY_DOMAIN:
+ case TestKind::FENCED_COMPUTE: {
createPreparedModel(device, model, &preparedModel);
if (preparedModel == nullptr) return;
EvaluatePreparedModel(device, preparedModel, testModel, testKind);
@@ -811,6 +819,9 @@
// Tag for the memory domain tests
class MemoryDomainTest : public GeneratedTest {};
+// Tag for the fenced compute tests
+class FencedComputeTest : public GeneratedTest {};
+
// Tag for the dynamic output shape tests
class QuantizationCouplingTest : public GeneratedTest {};
@@ -826,6 +837,10 @@
Execute(kDevice, kTestModel, /*testKind=*/TestKind::MEMORY_DOMAIN);
}
+TEST_P(FencedComputeTest, Test) {
+ Execute(kDevice, kTestModel, /*testKind=*/TestKind::FENCED_COMPUTE);
+}
+
TEST_P(QuantizationCouplingTest, Test) {
Execute(kDevice, kTestModel, /*testKind=*/TestKind::QUANTIZATION_COUPLING);
}
@@ -840,6 +855,9 @@
INSTANTIATE_GENERATED_TEST(MemoryDomainTest,
[](const TestModel& testModel) { return !testModel.expectFailure; });
+INSTANTIATE_GENERATED_TEST(FencedComputeTest,
+ [](const TestModel& testModel) { return !testModel.expectFailure; });
+
INSTANTIATE_GENERATED_TEST(QuantizationCouplingTest, [](const TestModel& testModel) {
return testModel.hasQuant8CoupledOperands() && testModel.operations.size() == 1;
});
diff --git a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.h b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.h
index fe695b4..e597fac 100644
--- a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.h
+++ b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.h
@@ -65,6 +65,8 @@
DYNAMIC_SHAPE,
// Same as GENERAL but use device memories for inputs and outputs
MEMORY_DOMAIN,
+ // Same as GENERAL but use executeFenced for exeuction
+ FENCED_COMPUTE,
// Tests if quantized model with TENSOR_QUANT8_ASYMM produces the same result
// (OK/SKIPPED/FAILED) as the model with all such tensors converted to
// TENSOR_QUANT8_ASYMM_SIGNED.
diff --git a/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp b/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp
index 28cc8ff..c84f5b7 100644
--- a/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp
+++ b/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp
@@ -140,26 +140,14 @@
preparedModel->executeFenced(request, {hidl_handle(nullptr)}, V1_2::MeasureTiming::NO,
[](ErrorStatus error, const hidl_handle& handle,
const sp<IFencedExecutionCallback>& callback) {
- ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, error);
+ // TODO: fix this once sample driver impl is merged.
+ if (error != ErrorStatus::DEVICE_UNAVAILABLE) {
+ ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, error);
+ }
ASSERT_EQ(handle.getNativeHandle(), nullptr);
ASSERT_EQ(callback, nullptr);
});
ASSERT_TRUE(ret_null.isOk());
-
- native_handle_t* nativeHandle = native_handle_create(1, 0);
- ASSERT_NE(nullptr, nativeHandle);
- nativeHandle->data[0] = -1;
- hidl_handle hidlHandle;
- hidlHandle.setTo(nativeHandle, /*shouldOwn=*/true);
- Return<void> ret_invalid =
- preparedModel->executeFenced(request, {hidlHandle}, V1_2::MeasureTiming::NO,
- [](ErrorStatus error, const hidl_handle& handle,
- const sp<IFencedExecutionCallback>& callback) {
- ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, error);
- ASSERT_EQ(handle.getNativeHandle(), nullptr);
- ASSERT_EQ(callback, nullptr);
- });
- ASSERT_TRUE(ret_invalid.isOk());
}
void validateEverything(const sp<IDevice>& device, const Model& model, const Request& request,
diff --git a/radio/1.5/IRadio.hal b/radio/1.5/IRadio.hal
index ee4438d..bea0454 100644
--- a/radio/1.5/IRadio.hal
+++ b/radio/1.5/IRadio.hal
@@ -16,9 +16,10 @@
package android.hardware.radio@1.5;
+import @1.0::CdmaSmsMessage;
import @1.2::DataRequestReason;
-import @1.4::IRadio;
import @1.4::DataProfileInfo;
+import @1.4::IRadio;
import @1.5::AccessNetwork;
import @1.5::BarringInfo;
import @1.5::DataProfileInfo;
@@ -282,4 +283,15 @@
*/
oneway setNetworkSelectionModeManual_1_5(int32_t serial, string operatorNumeric,
RadioAccessNetworks ran);
+
+ /**
+ * Send an SMS message. Identical to sendCdmaSms,
+ * except that more messages are expected to be sent soon.
+ *
+ * @param serial Serial number of request.
+ * @param sms Cdma Sms to be sent described by CdmaSmsMessage in types.hal
+ *
+ * Response callback is IRadioResponse.sendCdmaSMSExpectMoreResponse()
+ */
+ oneway sendCdmaSmsExpectMore(int32_t serial, CdmaSmsMessage sms);
};
diff --git a/radio/1.5/IRadioResponse.hal b/radio/1.5/IRadioResponse.hal
index e66e00b..9fa521e 100644
--- a/radio/1.5/IRadioResponse.hal
+++ b/radio/1.5/IRadioResponse.hal
@@ -17,11 +17,12 @@
package android.hardware.radio@1.5;
import @1.0::RadioResponseInfo;
+import @1.0::SendSmsResult;
import @1.4::IRadioResponse;
import @1.5::BarringInfo;
import @1.5::CellInfo;
-import @1.5::SetupDataCallResult;
import @1.5::RegStateResult;
+import @1.5::SetupDataCallResult;
/**
* Interface declaring response functions to solicited radio requests.
@@ -236,4 +237,35 @@
* no retries needed, such as illegal SIM or ME.
*/
oneway setNetworkSelectionModeManualResponse_1_5(RadioResponseInfo info);
+
+ /**
+ * @param info Response info struct containing response type, serial no. and error
+ * @param sms Response to sms sent as defined by SendSmsResult in types.hal
+ *
+ * Valid errors returned:
+ * RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:SMS_SEND_FAIL_RETRY
+ * RadioError:NETWORK_REJECT
+ * RadioError:INVALID_STATE
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_MEMORY
+ * RadioError:REQUEST_RATE_LIMITED
+ * RadioError:INVALID_SMS_FORMAT
+ * RadioError:SYSTEM_ERR
+ * RadioError:FDN_CHECK_FAILURE
+ * RadioError:ENCODING_ERR
+ * RadioError:INVALID_SMSC_ADDRESS
+ * RadioError:MODEM_ERR
+ * RadioError:NETWORK_ERR
+ * RadioError:INTERNAL_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:NETWORK_NOT_READY
+ * RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:SIM_ABSENT
+ */
+ oneway sendCdmaSmsExpectMoreResponse(RadioResponseInfo info, SendSmsResult sms);
};
diff --git a/radio/1.5/types.hal b/radio/1.5/types.hal
index c0fa8af..82feced 100644
--- a/radio/1.5/types.hal
+++ b/radio/1.5/types.hal
@@ -427,16 +427,20 @@
bitfield<AddressProperty> properties;
/**
- * The UTC time that this link address will be deprecated. 0 indicates this information is not
- * available.
+ * The time, as reported by SystemClock.elapsedRealtime(), when this link address will be or
+ * was deprecated. -1 indicates this information is not available. At the time existing
+ * connections can still use this address until it expires, but new connections should use the
+ * new address. LONG_MAX(0x7FFFFFFFFFFFFFFF) indicates this link address will never be
+ * deprecated.
*/
- uint64_t deprecatedTime;
+ uint64_t deprecationTime;
/**
- * The UTC time that this link address will expire and no longer valid. 0 indicates this
- * information is not available.
+ * The time, as reported by SystemClock.elapsedRealtime(), when this link address will expire
+ * and be removed from the interface. -1 indicates this information is not available.
+ * LONG_MAX(0x7FFFFFFFFFFFFFFF) indicates this link address will never expire.
*/
- uint64_t expiredTime;
+ uint64_t expirationTime;
};
/**
diff --git a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
index a4095b7..09305de 100644
--- a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
@@ -1022,3 +1022,47 @@
CHECK_GENERAL_ERROR));
}
}
+
+/*
+ * Test IRadio.sendCdmaSmsExpectMore() for the response returned.
+ */
+TEST_F(RadioHidlTest_v1_5, sendCdmaSmsExpectMore) {
+ serial = GetRandomSerialNumber();
+
+ // Create a CdmaSmsAddress
+ CdmaSmsAddress cdmaSmsAddress;
+ cdmaSmsAddress.digitMode = CdmaSmsDigitMode::FOUR_BIT;
+ cdmaSmsAddress.numberMode = CdmaSmsNumberMode::NOT_DATA_NETWORK;
+ cdmaSmsAddress.numberType = CdmaSmsNumberType::UNKNOWN;
+ cdmaSmsAddress.numberPlan = CdmaSmsNumberPlan::UNKNOWN;
+ cdmaSmsAddress.digits = (std::vector<uint8_t>){11, 1, 6, 5, 10, 7, 7, 2, 10, 3, 10, 3};
+
+ // Create a CdmaSmsSubAddress
+ CdmaSmsSubaddress cdmaSmsSubaddress;
+ cdmaSmsSubaddress.subaddressType = CdmaSmsSubaddressType::NSAP;
+ cdmaSmsSubaddress.odd = false;
+ cdmaSmsSubaddress.digits = (std::vector<uint8_t>){};
+
+ // Create a CdmaSmsMessage
+ android::hardware::radio::V1_0::CdmaSmsMessage cdmaSmsMessage;
+ cdmaSmsMessage.teleserviceId = 4098;
+ cdmaSmsMessage.isServicePresent = false;
+ cdmaSmsMessage.serviceCategory = 0;
+ cdmaSmsMessage.address = cdmaSmsAddress;
+ cdmaSmsMessage.subAddress = cdmaSmsSubaddress;
+ cdmaSmsMessage.bearerData =
+ (std::vector<uint8_t>){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0};
+
+ radio_v1_5->sendCdmaSmsExpectMore(serial, cdmaSmsMessage);
+
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_v1_5->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_v1_5->rspInfo.serial);
+
+ if (cardStatus.base.base.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_v1_5->rspInfo.error,
+ {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT},
+ CHECK_GENERAL_ERROR));
+ }
+}
diff --git a/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h b/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h
index abab452..6e6576e 100644
--- a/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h
+++ b/radio/1.5/vts/functional/radio_hidl_hal_utils_v1_5.h
@@ -573,6 +573,9 @@
cellInfo);
Return<void> setNetworkSelectionModeManualResponse_1_5(const RadioResponseInfo& info);
+
+ Return<void> sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info,
+ const SendSmsResult& sms);
};
/* Callback class for radio indication */
diff --git a/radio/1.5/vts/functional/radio_response.cpp b/radio/1.5/vts/functional/radio_response.cpp
index d7197d5..223acd0 100644
--- a/radio/1.5/vts/functional/radio_response.cpp
+++ b/radio/1.5/vts/functional/radio_response.cpp
@@ -999,3 +999,8 @@
parent_v1_5.notify(info.serial);
return Void();
}
+
+Return<void> RadioResponse_v1_5::sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& /*info*/,
+ const SendSmsResult& /*sms*/) {
+ return Void();
+}