Merge "Remove note for ADAS properties." into udc-dev
diff --git a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h
index c1d5669..f6271ff 100644
--- a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h
+++ b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h
@@ -41,15 +41,10 @@
class PolicyConfig {
public:
- explicit PolicyConfig(const std::string& configFileName)
- : mConfigFileName{configFileName},
- mFilePath{findExistingConfigurationFile(mConfigFileName)},
- mConfig{xsd::read(mFilePath.c_str())} {
- init();
- }
PolicyConfig(const std::string& configPath, const std::string& configFileName)
: mConfigFileName{configFileName},
- mFilePath{configPath + "/" + mConfigFileName},
+ mFilePath{configPath.empty() ? findExistingConfigurationFile(mConfigFileName)
+ : configPath + "/" + mConfigFileName},
mConfig{xsd::read(mFilePath.c_str())} {
init();
}
diff --git a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h
index 9aabad6..b18986a 100644
--- a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h
+++ b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h
@@ -105,6 +105,8 @@
size_t mRetryWaitInMs = 10'000;
std::shared_ptr<DebugRemoteTaskCallback> mDebugCallback;
+ std::thread mInjectDebugTaskThread;
+
void runTaskLoop();
void maybeStartTaskLoop();
void maybeStopTaskLoop();
@@ -116,6 +118,8 @@
void printCurrentStatus(int fd);
std::string clientIdToTaskCountToStringLocked() REQUIRES(mLock);
void debugInjectTask(int fd, std::string_view clientId, std::string_view taskData);
+ void debugInjectTaskNextReboot(int fd, std::string_view clientId, std::string_view taskData,
+ const char* latencyInSecStr);
void updateGrpcConnected(bool connected);
android::base::Result<void> deliverRemoteTaskThroughCallback(const std::string& clientId,
std::string_view taskData);
diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp
index bbda9df..dbe8150 100644
--- a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp
+++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp
@@ -18,12 +18,16 @@
#include <VehicleUtils.h>
#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
+#include <android-base/parseint.h>
#include <android-base/stringprintf.h>
#include <android/binder_status.h>
#include <grpc++/grpc++.h>
#include <private/android_filesystem_config.h>
+#include <sys/stat.h>
#include <utils/Log.h>
#include <chrono>
+#include <fstream>
+#include <iostream>
#include <thread>
namespace android {
@@ -37,6 +41,7 @@
using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback;
using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
using ::android::base::Error;
+using ::android::base::ParseInt;
using ::android::base::Result;
using ::android::base::ScopedLockAssertion;
using ::android::base::StringAppendF;
@@ -57,8 +62,12 @@
constexpr char COMMAND_SHOW_TASK[] = "--show-task";
constexpr char COMMAND_GET_VEHICLE_ID[] = "--get-vehicle-id";
constexpr char COMMAND_INJECT_TASK[] = "--inject-task";
+constexpr char COMMAND_INJECT_TASK_NEXT_REBOOT[] = "--inject-task-next-reboot";
constexpr char COMMAND_STATUS[] = "--status";
+constexpr char DEBUG_TASK_FOLDER[] = "/data/local/tests";
+constexpr char DEBUG_TASK_FILE[] = "/data/local/tests/debugTask";
+
std::vector<uint8_t> stringToBytes(std::string_view s) {
const char* data = s.data();
return std::vector<uint8_t>(data, data + s.size());
@@ -92,10 +101,43 @@
} // namespace
RemoteAccessService::RemoteAccessService(WakeupClient::StubInterface* grpcStub)
- : mGrpcStub(grpcStub){};
+ : mGrpcStub(grpcStub) {
+ std::ifstream debugTaskFile;
+ debugTaskFile.open(DEBUG_TASK_FILE, std::ios::in);
+ if (!debugTaskFile.is_open()) {
+ ALOGD("No debug task available");
+ return;
+ }
+
+ char buffer[1024] = {};
+ debugTaskFile.getline(buffer, sizeof(buffer));
+ std::string clientId = std::string(buffer);
+ debugTaskFile.getline(buffer, sizeof(buffer));
+ std::string taskData = std::string(buffer);
+ int latencyInSec;
+ debugTaskFile >> latencyInSec;
+ debugTaskFile.close();
+
+ ALOGD("Task for client: %s, data: [%s], latency: %d\n", clientId.c_str(), taskData.c_str(),
+ latencyInSec);
+
+ mInjectDebugTaskThread = std::thread([this, clientId, taskData, latencyInSec] {
+ std::this_thread::sleep_for(std::chrono::seconds(latencyInSec));
+ if (auto result = deliverRemoteTaskThroughCallback(clientId, taskData); !result.ok()) {
+ ALOGE("Failed to inject debug task, clientID: %s, taskData: %s, error: %s",
+ clientId.c_str(), taskData.c_str(), result.error().message().c_str());
+ return;
+ }
+ ALOGD("Task for client: %s, data: [%s] successfully injected\n", clientId.c_str(),
+ taskData.c_str());
+ });
+}
RemoteAccessService::~RemoteAccessService() {
maybeStopTaskLoop();
+ if (mInjectDebugTaskThread.joinable()) {
+ mInjectDebugTaskThread.join();
+ }
}
void RemoteAccessService::maybeStartTaskLoop() {
@@ -286,9 +328,12 @@
"%s: Show tasks received by debug callback\n"
"%s: Get vehicle id\n"
"%s [client_id] [task_data]: Inject a task\n"
+ "%s [client_id] [task_data] [latencyInSec]: "
+ "Inject a task on next reboot after latencyInSec seconds\n"
"%s: Show status\n",
COMMAND_SET_AP_STATE, COMMAND_START_DEBUG_CALLBACK, COMMAND_STOP_DEBUG_CALLBACK,
- COMMAND_SHOW_TASK, COMMAND_GET_VEHICLE_ID, COMMAND_INJECT_TASK, COMMAND_STATUS);
+ COMMAND_SHOW_TASK, COMMAND_GET_VEHICLE_ID, COMMAND_INJECT_TASK,
+ COMMAND_INJECT_TASK_NEXT_REBOOT, COMMAND_STATUS);
}
binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t numArgs) {
@@ -365,6 +410,12 @@
return STATUS_OK;
}
debugInjectTask(fd, args[1], args[2]);
+ } else if (!strcmp(args[0], COMMAND_INJECT_TASK_NEXT_REBOOT)) {
+ if (numArgs < 4) {
+ dumpHelp(fd);
+ return STATUS_OK;
+ }
+ debugInjectTaskNextReboot(fd, args[1], args[2], args[3]);
} else if (!strcmp(args[0], COMMAND_STATUS)) {
printCurrentStatus(fd);
} else {
@@ -389,13 +440,41 @@
std::string_view taskData) {
std::string clientIdCopy = std::string(clientId);
if (auto result = deliverRemoteTaskThroughCallback(clientIdCopy, taskData); !result.ok()) {
- dprintf(fd, "Failed to inject task: %s", result.error().message().c_str());
+ dprintf(fd, "Failed to inject task: %s\n", result.error().message().c_str());
return;
}
dprintf(fd, "Task for client: %s, data: [%s] successfully injected\n", clientId.data(),
taskData.data());
}
+void RemoteAccessService::debugInjectTaskNextReboot(int fd, std::string_view clientId,
+ std::string_view taskData,
+ const char* latencyInSecStr) {
+ int latencyInSec;
+ if (!ParseInt(latencyInSecStr, &latencyInSec)) {
+ dprintf(fd, "The input latency in second is not a valid integer");
+ return;
+ }
+ std::ofstream debugTaskFile;
+ debugTaskFile.open(DEBUG_TASK_FILE, std::ios::out);
+ if (!debugTaskFile.is_open()) {
+ dprintf(fd,
+ "Failed to open debug task file, please run the command: "
+ "'adb shell touch %s' first\n",
+ DEBUG_TASK_FILE);
+ return;
+ }
+ if (taskData.find("\n") != std::string::npos) {
+ dprintf(fd, "Task data must not contain newline\n");
+ return;
+ }
+ debugTaskFile << clientId << "\n" << taskData << "\n" << latencyInSec;
+ debugTaskFile.close();
+ dprintf(fd,
+ "Task with clientId: %s, task data: %s, latency: %d sec scheduled for next reboot\n",
+ clientId.data(), taskData.data(), latencyInSec);
+}
+
std::string RemoteAccessService::clientIdToTaskCountToStringLocked() {
// Print the table header
std::string output = "| ClientId | Count |\n";
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 84395a2..c3ebd3b 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
@@ -159,6 +159,7 @@
const std::string mDefaultConfigDir;
const std::string mOverrideConfigDir;
const bool mForceOverride;
+ bool mAddExtraTestVendorConfigs;
// Only used during initialization.
JsonConfigLoader mLoader;
@@ -248,6 +249,8 @@
std::string genFakeDataCommand(const std::vector<std::string>& options);
void sendHvacPropertiesCurrentValues(int32_t areaId);
void sendAdasPropertiesState(int32_t propertyId, int32_t state);
+ void generateVendorConfigs(
+ std::vector<aidl::android::hardware::automotive::vehicle::VehiclePropConfig>&) const;
static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp(
aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action,
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 577442e..740d3f6 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
@@ -64,6 +64,7 @@
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::VehiclePropertyAccess;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType;
@@ -79,6 +80,11 @@
using ::android::base::StartsWith;
using ::android::base::StringPrintf;
+// In order to test large number of vehicle property configs, we might generate additional fake
+// property config start from this ID. Note these fake properties are for getAllPropertyConfigs
+// testing only.
+constexpr int32_t STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST = 0x5000;
+constexpr int32_t NUMBER_OF_TEST_VENDOR_CODES = 0x3000;
// 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/";
@@ -291,7 +297,11 @@
}
std::vector<VehiclePropConfig> FakeVehicleHardware::getAllPropertyConfigs() const {
- return mServerSidePropStore->getAllConfigs();
+ std::vector<VehiclePropConfig> allConfigs = mServerSidePropStore->getAllConfigs();
+ if (mAddExtraTestVendorConfigs) {
+ generateVendorConfigs(/* outAllConfigs= */ allConfigs);
+ }
+ return allConfigs;
}
VehiclePropValuePool::RecyclableType FakeVehicleHardware::createApPowerStateReq(
@@ -953,6 +963,12 @@
result.buffer = mFakeUserHal->dump();
} else if (EqualsIgnoreCase(option, "--genfakedata")) {
result.buffer = genFakeDataCommand(options);
+ } else if (EqualsIgnoreCase(option, "--genTestVendorConfigs")) {
+ mAddExtraTestVendorConfigs = true;
+ result.refreshPropertyConfigs = true;
+ } else if (EqualsIgnoreCase(option, "--restoreVendorConfigs")) {
+ mAddExtraTestVendorConfigs = false;
+ result.refreshPropertyConfigs = true;
} else {
result.buffer = StringPrintf("Invalid option: %s\n", option.c_str());
}
@@ -1003,6 +1019,13 @@
[pressure(float)] [size(float)]
Generate a motion input event. --pointer option can be specified multiple times.
+--genTestVendorConfigs: Generates fake VehiclePropConfig ranging from 0x5000 to 0x8000 all with
+ vendor property group, global vehicle area, and int32 vehicle property type. This is mainly used
+ for testing
+
+--restoreVendorConfigs: Restores to to the default state if genTestVendorConfigs was used.
+ Otherwise this will do nothing.
+
)";
}
@@ -1012,6 +1035,19 @@
value.c_str(), genFakeDataHelp().c_str());
}
+void FakeVehicleHardware::generateVendorConfigs(
+ std::vector<VehiclePropConfig>& outAllConfigs) const {
+ for (int i = STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST;
+ i < STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST + NUMBER_OF_TEST_VENDOR_CODES; i++) {
+ VehiclePropConfig config;
+ config.prop = i | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) |
+ toInt(propertyutils_impl::VehicleArea::GLOBAL) |
+ toInt(propertyutils_impl::VehiclePropertyType::INT32);
+ config.access = VehiclePropertyAccess::READ_WRITE;
+ outAllConfigs.push_back(config);
+ }
+}
+
std::string FakeVehicleHardware::genFakeDataCommand(const std::vector<std::string>& options) {
if (options.size() < 2) {
return "No subcommand specified for genfakedata\n" + genFakeDataHelp();
diff --git a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h
index d92ccfd..e53947e 100644
--- a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h
@@ -35,6 +35,8 @@
bool callerShouldDumpState;
// The dumped information for the caller to print.
std::string buffer;
+ // To pass if DefaultVehicleHal should refresh the property configs
+ bool refreshPropertyConfigs = false;
};
// A structure to represent a set value error event reported from vehicle.
diff --git a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h
index 0439ac6..2c2cf1a 100644
--- a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h
+++ b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h
@@ -164,6 +164,7 @@
static constexpr int64_t TIMEOUT_IN_NANO = 30'000'000'000;
// heart beat event interval: 3s
static constexpr int64_t HEART_BEAT_INTERVAL_IN_NANO = 3'000'000'000;
+ bool mShouldRefreshPropertyConfigs;
std::unique_ptr<IVehicleHardware> mVehicleHardware;
// mConfigsByPropId and mConfigFile are only modified during initialization, so no need to
@@ -212,7 +213,6 @@
android::base::Result<std::vector<int64_t>> checkDuplicateRequests(
const std::vector<aidl::android::hardware::automotive::vehicle::SetValueRequest>&
requests);
-
VhalResult<void> checkSubscribeOptions(
const std::vector<aidl::android::hardware::automotive::vehicle::SubscribeOptions>&
options);
@@ -236,6 +236,8 @@
bool checkDumpPermission();
+ bool getAllPropConfigsFromHardware();
+
// The looping handler function to process all onBinderDied or onBinderUnlinked events in
// mBinderEvents.
void onBinderDiedUnlinkedHandler();
diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
index a7ac1b4..98cfc39 100644
--- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
+++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp
@@ -128,23 +128,10 @@
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) {
- mConfigsByPropId[config.prop] = config;
- }
- VehiclePropConfigs vehiclePropConfigs;
- vehiclePropConfigs.payloads = std::move(configs);
- auto result = LargeParcelableBase::parcelableToStableLargeParcelable(vehiclePropConfigs);
- if (!result.ok()) {
- ALOGE("failed to convert configs to shared memory file, error: %s, code: %d",
- result.error().message().c_str(), static_cast<int>(result.error().code()));
+ if (!getAllPropConfigsFromHardware()) {
return;
}
- if (result.value() != nullptr) {
- mConfigFile = std::move(result.value());
- }
-
mSubscriptionClients = std::make_shared<SubscriptionClients>(mPendingRequestPool);
auto subscribeIdByClient = std::make_shared<SubscribeIdByClient>();
@@ -304,6 +291,27 @@
mPendingRequestPool = std::make_unique<PendingRequestPool>(timeoutInNano);
}
+bool DefaultVehicleHal::getAllPropConfigsFromHardware() {
+ auto configs = mVehicleHardware->getAllPropertyConfigs();
+ for (auto& config : configs) {
+ mConfigsByPropId[config.prop] = config;
+ }
+ VehiclePropConfigs vehiclePropConfigs;
+ vehiclePropConfigs.payloads = std::move(configs);
+ auto result = LargeParcelableBase::parcelableToStableLargeParcelable(vehiclePropConfigs);
+ if (!result.ok()) {
+ ALOGE("failed to convert configs to shared memory file, error: %s, code: %d",
+ result.error().message().c_str(), static_cast<int>(result.error().code()));
+ mConfigFile = nullptr;
+ return false;
+ }
+
+ if (result.value() != nullptr) {
+ mConfigFile = std::move(result.value());
+ }
+ return true;
+}
+
ScopedAStatus DefaultVehicleHal::getAllPropConfigs(VehiclePropConfigs* output) {
if (mConfigFile != nullptr) {
output->payloads.clear();
@@ -798,6 +806,9 @@
options.clear();
}
DumpResult result = mVehicleHardware->dump(options);
+ if (result.refreshPropertyConfigs) {
+ getAllPropConfigsFromHardware();
+ }
dprintf(fd, "%s", (result.buffer + "\n").c_str());
if (!result.callerShouldDumpState) {
return STATUS_OK;
diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp
index fe224c9..16302eb 100644
--- a/biometrics/fingerprint/aidl/default/Android.bp
+++ b/biometrics/fingerprint/aidl/default/Android.bp
@@ -110,6 +110,32 @@
require_root: true,
}
+cc_test {
+ name: "android.hardware.biometrics.fingerprint.SessionTest",
+ local_include_dirs: ["include"],
+ srcs: [
+ "tests/SessionTest.cpp",
+ "Session.cpp",
+ "FakeFingerprintEngine.cpp",
+ "FakeLockoutTracker.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ "libbinder_ndk",
+ "android.hardware.biometrics.common.thread",
+ ],
+ static_libs: [
+ "libandroid.hardware.biometrics.fingerprint.VirtualProps",
+ "android.hardware.biometrics.fingerprint-V3-ndk",
+ "android.hardware.biometrics.common-V3-ndk",
+ "android.hardware.keymaster-V4-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"],
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index 7808a13..f00a49d 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -103,6 +103,8 @@
mSession = SharedRefBase::make<Session>(sensorId, userId, cb, mEngine.get(), &mWorker);
*out = mSession;
+ mSession->linkToDeath(cb->asBinder().get());
+
LOG(INFO) << "createSession: sensorId:" << sensorId << " userId:" << userId;
return ndk::ScopedAStatus::ok();
}
diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp
index 38d6a13..c06c931 100644
--- a/biometrics/fingerprint/aidl/default/Session.cpp
+++ b/biometrics/fingerprint/aidl/default/Session.cpp
@@ -25,6 +25,14 @@
namespace aidl::android::hardware::biometrics::fingerprint {
+void onClientDeath(void* cookie) {
+ LOG(INFO) << "FingerprintService has died";
+ Session* session = static_cast<Session*>(cookie);
+ if (session && !session->isClosed()) {
+ session->close();
+ }
+}
+
Session::Session(int sensorId, int userId, std::shared_ptr<ISessionCallback> cb,
FakeFingerprintEngine* engine, WorkerThread* worker)
: mSensorId(sensorId),
@@ -39,6 +47,12 @@
CHECK(mEngine);
CHECK(mWorker);
CHECK(mCb);
+
+ mDeathRecipient = AIBinder_DeathRecipient_new(onClientDeath);
+}
+
+binder_status_t Session::linkToDeath(AIBinder* binder) {
+ return AIBinder_linkToDeath(binder, mDeathRecipient, this);
}
void Session::scheduleStateOrCrash(SessionState state) {
@@ -228,6 +242,7 @@
// Crashing.";
mCurrentState = SessionState::CLOSED;
mCb->onSessionClosed();
+ AIBinder_DeathRecipient_delete(mDeathRecipient);
return ndk::ScopedAStatus::ok();
}
diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h
index b596d9e..526d579 100644
--- a/biometrics/fingerprint/aidl/default/include/Session.h
+++ b/biometrics/fingerprint/aidl/default/include/Session.h
@@ -42,6 +42,8 @@
RESETTING_LOCKOUT,
};
+void onClientDeath(void* cookie);
+
class Session : public BnSession {
public:
Session(int sensorId, int userId, std::shared_ptr<ISessionCallback> cb,
@@ -101,6 +103,8 @@
ndk::ScopedAStatus setIgnoreDisplayTouches(bool shouldIgnore) override;
+ binder_status_t linkToDeath(AIBinder* binder);
+
bool isClosed();
private:
@@ -139,6 +143,9 @@
// modified from both the main and the worker threads.
std::atomic<SessionState> mScheduledState;
std::atomic<SessionState> mCurrentState;
+
+ // Binder death handler.
+ AIBinder_DeathRecipient* mDeathRecipient;
};
} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/tests/SessionTest.cpp b/biometrics/fingerprint/aidl/default/tests/SessionTest.cpp
new file mode 100644
index 0000000..3b96d7f
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/tests/SessionTest.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2023 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 <aidl/android/hardware/biometrics/fingerprint/BnSessionCallback.h>
+
+#include "Session.h"
+#include "thread/WorkerThread.h"
+#include "util/Util.h"
+
+using namespace ::android::fingerprint::virt;
+using namespace ::aidl::android::hardware::biometrics::fingerprint;
+
+namespace aidl::android::hardware::biometrics::fingerprint {
+
+class TestSessionCallback : public BnSessionCallback {
+ public:
+ ndk::ScopedAStatus onChallengeGenerated(int64_t /*challenge*/) override {
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onChallengeRevoked(int64_t /*challenge*/) override {
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onError(fingerprint::Error /*error*/, int32_t /*vendorCode*/) override {
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onEnrollmentProgress(int32_t /*enrollmentId*/,
+ int32_t /*remaining*/) override {
+ return ndk::ScopedAStatus::ok();
+ };
+
+ ::ndk::ScopedAStatus onAuthenticationSucceeded(int32_t /*enrollmentId*/,
+ const keymaster::HardwareAuthToken&) override {
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticationFailed() override { return ndk::ScopedAStatus::ok(); };
+ ::ndk::ScopedAStatus onInteractionDetected() override { return ndk::ScopedAStatus::ok(); };
+ ndk::ScopedAStatus onAcquired(AcquiredInfo /*info*/, int32_t /*vendorCode*/) override {
+ return ndk::ScopedAStatus::ok();
+ }
+ ::ndk::ScopedAStatus onEnrollmentsEnumerated(
+ const std::vector<int32_t>& /*enrollmentIds*/) override {
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onEnrollmentsRemoved(
+ const std::vector<int32_t>& /*enrollmentIds*/) override {
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticatorIdRetrieved(int64_t /*authenticatorId*/) override {
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onAuthenticatorIdInvalidated(int64_t /*authenticatorId*/) override {
+ return ndk::ScopedAStatus::ok();
+ };
+ ::ndk::ScopedAStatus onLockoutPermanent() override { 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 {
+ mIsClosed = true;
+ return ndk::ScopedAStatus::ok();
+ }
+
+ bool mIsClosed = false;
+};
+
+class SessionTest : public ::testing::Test {
+ public:
+ SessionTest() : mWorker(2) {}
+
+ protected:
+ void SetUp() override {
+ mCb = ndk::SharedRefBase::make<TestSessionCallback>();
+ mSession = ndk::SharedRefBase::make<Session>(1, 2, mCb, &mFakeFingerprintEngine, &mWorker);
+ ASSERT_TRUE(mSession != nullptr);
+ mSession->linkToDeath(mCb->asBinder().get());
+ }
+
+ void TearDown() override {}
+
+ std::shared_ptr<Session> mSession;
+ std::shared_ptr<TestSessionCallback> mCb;
+
+ private:
+ FakeFingerprintEngine mFakeFingerprintEngine;
+ WorkerThread mWorker;
+};
+
+TEST_F(SessionTest, close) {
+ ASSERT_TRUE(!mSession->isClosed());
+ ASSERT_TRUE(!mCb->mIsClosed);
+ onClientDeath(nullptr);
+ ASSERT_TRUE(!mSession->isClosed());
+ ASSERT_TRUE(!mCb->mIsClosed);
+ onClientDeath(static_cast<void*>(mSession.get()));
+ ASSERT_TRUE(mSession->isClosed());
+ ASSERT_TRUE(mCb->mIsClosed);
+}
+
+} // 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/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index 622b20b..f8d301f 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -3081,7 +3081,11 @@
ASSERT_EQ(blobMinDurations.size(), blobStallDurations.size());
}
- // Validate other aspects of stream configuration metadata...
+ // TODO (b/280887191): Validate other aspects of stream configuration metadata...
+
+ ndk::ScopedAStatus ret = mSession->close();
+ mSession = nullptr;
+ ASSERT_TRUE(ret.isOk());
}
}
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index ed4f28c..18d36e4 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -655,8 +655,15 @@
return;
}
const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities();
+ const auto& [status2, hdrCapabilities] =
+ mComposerClient->getHdrCapabilities(getPrimaryDisplayId());
+ const auto& hdrTypes = hdrCapabilities.types;
for (auto conversionCapability : conversionCapabilities) {
if (conversionCapability.outputType != common::Hdr::INVALID) {
+ if (std::find(hdrTypes.begin(), hdrTypes.end(), conversionCapability.outputType) ==
+ hdrTypes.end()) {
+ continue;
+ }
common::HdrConversionStrategy hdrConversionStrategy;
hdrConversionStrategy.set<common::HdrConversionStrategy::Tag::forceHdrConversion>(
conversionCapability.outputType);
@@ -674,6 +681,11 @@
return;
}
const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities();
+ const auto& [status2, hdrCapabilities] =
+ mComposerClient->getHdrCapabilities(getPrimaryDisplayId());
+ if (hdrCapabilities.types.size() <= 0) {
+ return;
+ }
std::vector<aidl::android::hardware::graphics::common::Hdr> autoHdrTypes;
for (auto conversionCapability : conversionCapabilities) {
if (conversionCapability.outputType != common::Hdr::INVALID) {