Merge "Added automotiveSvV1.0_fuzzer"
diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
index fa3ee7f..435c62d 100644
--- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
+++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
@@ -34,6 +34,7 @@
#include <hwbinder/IPCThreadState.h>
+#include <android-base/expected.h>
#include <android-base/logging.h>
#include <system/audio_config.h>
@@ -130,6 +131,33 @@
using IDevice = ::android::hardware::audio::CPP_VERSION::IDevice;
using IDevicesFactory = ::android::hardware::audio::CPP_VERSION::IDevicesFactory;
+ static android::base::expected<std::vector<std::string>, std::string> getAllFactoryInstances() {
+ using ::android::hardware::audio::CPP_VERSION::IDevicesFactory;
+ const std::string factoryDescriptor = IDevicesFactory::descriptor;
+ // Make sure that the instance is the exact minor version.
+ // Using a 7.1 factory for 7.0 test is not always possible because
+ // 7.1 can be configured via the XML config to use features that are
+ // absent in 7.0.
+ auto instances = ::android::hardware::getAllHalInstanceNames(factoryDescriptor);
+ if (instances.empty()) return instances;
+ // Use the default instance for checking the implementation version.
+ auto defaultInstance = IDevicesFactory::getService("default");
+ if (defaultInstance == nullptr) {
+ return ::android::base::unexpected("Failed to obtain IDevicesFactory/default");
+ }
+ std::string actualDescriptor;
+ auto intDescRet = defaultInstance->interfaceDescriptor(
+ [&](const auto& descriptor) { actualDescriptor = descriptor; });
+ if (!intDescRet.isOk()) {
+ return ::android::base::unexpected("Failed to obtain interface descriptor: " +
+ intDescRet.description());
+ }
+ if (factoryDescriptor == actualDescriptor)
+ return instances;
+ else
+ return {};
+ }
+
virtual ~HidlTest() = default;
// public access to avoid annoyances when using this method in template classes
// derived from test classes
@@ -174,9 +202,11 @@
}
TEST(CheckConfig, audioPolicyConfigurationValidation) {
- const auto factories = ::android::hardware::getAllHalInstanceNames(
- ::android::hardware::audio::CPP_VERSION::IDevicesFactory::descriptor);
- if (factories.size() == 0) {
+ const auto factories = HidlTest::getAllFactoryInstances();
+ if (!factories.ok()) {
+ FAIL() << factories.error();
+ }
+ if (factories.value().size() == 0) {
GTEST_SKIP() << "Skipping audioPolicyConfigurationValidation because no factory instances "
"are found.";
}
@@ -205,11 +235,11 @@
const std::vector<DeviceParameter>& getDeviceParameters() {
static std::vector<DeviceParameter> parameters = [] {
std::vector<DeviceParameter> result;
- const auto factories = ::android::hardware::getAllHalInstanceNames(
- ::android::hardware::audio::CPP_VERSION::IDevicesFactory::descriptor);
+ const auto factories = HidlTest::getAllFactoryInstances();
+ if (!factories.ok()) return result;
const auto devices = getCachedPolicyConfig().getModulesWithDevicesNames();
result.reserve(devices.size());
- for (const auto& factoryName : factories) {
+ for (const auto& factoryName : factories.value()) {
for (const auto& deviceName : devices) {
if (DeviceManager::getInstance().get(factoryName, deviceName) != nullptr) {
result.emplace_back(factoryName, deviceName);
@@ -224,9 +254,9 @@
const std::vector<DeviceParameter>& getDeviceParametersForFactoryTests() {
static std::vector<DeviceParameter> parameters = [] {
std::vector<DeviceParameter> result;
- const auto factories = ::android::hardware::getAllHalInstanceNames(
- ::android::hardware::audio::CPP_VERSION::IDevicesFactory::descriptor);
- for (const auto& factoryName : factories) {
+ const auto factories = HidlTest::getAllFactoryInstances();
+ if (!factories.ok()) return result;
+ for (const auto& factoryName : factories.value()) {
result.emplace_back(factoryName,
DeviceManager::getInstance().getPrimary(factoryName) != nullptr
? DeviceManager::kPrimaryDevice
diff --git a/bluetooth/1.0/default/test/fuzzer/Android.bp b/bluetooth/1.0/default/test/fuzzer/Android.bp
index 81f328e..691136f 100644
--- a/bluetooth/1.0/default/test/fuzzer/Android.bp
+++ b/bluetooth/1.0/default/test/fuzzer/Android.bp
@@ -46,7 +46,6 @@
"android.hardware.bluetooth-async",
"android.hardware.bluetooth-hci",
"libcutils",
- "libutils",
],
shared_libs: [
"android.hardware.bluetooth@1.0",
@@ -54,6 +53,7 @@
"libhidlbase",
"libbt-vendor-fuzz",
"liblog",
+ "libutils",
],
fuzz_config: {
cc: [
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
index 0dd8148..2a88959 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.cpp
@@ -45,6 +45,7 @@
latency_modes_ = latencyModes;
audio_config_ = std::make_unique<AudioConfiguration>(audio_config);
stack_iface_ = host_if;
+ is_binder_died = false;
AIBinder_linkToDeath(stack_iface_->asBinder().get(), death_recipient_.get(),
this);
@@ -59,8 +60,10 @@
if (stack_iface_ != nullptr) {
BluetoothAudioSessionReport::OnSessionEnded(session_type_);
- AIBinder_unlinkToDeath(stack_iface_->asBinder().get(),
- death_recipient_.get(), this);
+ if (!is_binder_died) {
+ AIBinder_unlinkToDeath(stack_iface_->asBinder().get(),
+ death_recipient_.get(), this);
+ }
} else {
LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
<< " has NO session";
@@ -147,6 +150,7 @@
LOG(ERROR) << __func__ << ": Null AudioProvider HAL died";
return;
}
+ provider->is_binder_died = true;
provider->endSession();
}
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h
index a9f830a..dbfff7d 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProvider.h
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProvider.h
@@ -62,6 +62,7 @@
std::unique_ptr<AudioConfiguration> audio_config_ = nullptr;
SessionType session_type_;
std::vector<LatencyMode> latency_modes_;
+ bool is_binder_died = false;
};
} // namespace audio
diff --git a/health/aidl/OWNERS b/health/aidl/OWNERS
index cd06415..fcad499 100644
--- a/health/aidl/OWNERS
+++ b/health/aidl/OWNERS
@@ -1,2 +1,4 @@
# Bug component: 30545
elsk@google.com
+smoreland@google.com
+stayfan@google.com
diff --git a/keymaster/4.0/support/fuzzer/Android.bp b/keymaster/4.0/support/fuzzer/Android.bp
index 3a3f4d5..8bc681a 100644
--- a/keymaster/4.0/support/fuzzer/Android.bp
+++ b/keymaster/4.0/support/fuzzer/Android.bp
@@ -30,12 +30,12 @@
"libbase",
"liblog",
"libkeymaster4support",
- "libutils",
],
shared_libs: [
"android.hardware.keymaster@4.0",
"libcrypto",
"libhidlbase",
+ "libutils",
],
fuzz_config: {
cc: [
diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
index 14c756d..dd6b0f7 100644
--- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -2866,8 +2866,8 @@
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
string plaintext;
- ErrorCode error = Finish(message, &plaintext);
- if (error == ErrorCode::INVALID_INPUT_LENGTH) {
+ ErrorCode error = Finish(ciphertext, &plaintext);
+ if (error == ErrorCode::INVALID_ARGUMENT) {
// This is the expected error, we can exit the test now.
return;
} else {
diff --git a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
index d9a6363..5fa13e7 100644
--- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
+++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
@@ -24,6 +24,7 @@
#include <android-base/strings.h>
#include <android/api-level.h>
+#include <VtsCoreUtil.h>
#include <android/hardware/media/omx/1.0/IOmx.h>
#include <android/hardware/media/omx/1.0/IOmxNode.h>
#include <android/hardware/media/omx/1.0/IOmxObserver.h>
@@ -377,6 +378,10 @@
return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__);
}
+static bool isTV() {
+ return testing::deviceSupportsFeature("android.software.leanback");
+}
+
// list components and roles.
TEST_P(StoreHidlTest, OmxCodecAllowedTest) {
hidl_vec<IOmx::ComponentInfo> componentInfos = getComponentInfoList(omx);
@@ -384,9 +389,16 @@
for (std::string role : info.mRoles) {
if (role.find("video_decoder") != std::string::npos ||
role.find("video_encoder") != std::string::npos) {
- ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__)
- << " Component: " << info.mName.c_str() << " Role: " << role.c_str()
- << " not allowed for devices launching with Android S and above";
+ // Codec2 is not mandatory on Android TV devices that launched with Android S
+ if (isTV()) {
+ ASSERT_LT(getFirstApiLevel(), __ANDROID_API_T__)
+ << " Component: " << info.mName.c_str() << " Role: " << role.c_str()
+ << " not allowed for devices launching with Android T and above";
+ } else {
+ ASSERT_LT(getFirstApiLevel(), __ANDROID_API_S__)
+ << " Component: " << info.mName.c_str() << " Role: " << role.c_str()
+ << " not allowed for devices launching with Android S and above";
+ }
}
if (role.find("audio_decoder") != std::string::npos ||
role.find("audio_encoder") != std::string::npos) {
diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp
index c5a3a8b..e1808af 100644
--- a/radio/aidl/Android.bp
+++ b/radio/aidl/Android.bp
@@ -10,6 +10,7 @@
aidl_interface {
name: "android.hardware.radio",
vendor_available: true,
+ host_supported: true,
srcs: ["android/hardware/radio/*.aidl"],
stability: "vintf",
backend: {
@@ -30,6 +31,7 @@
aidl_interface {
name: "android.hardware.radio.config",
vendor_available: true,
+ host_supported: true,
srcs: ["android/hardware/radio/config/*.aidl"],
stability: "vintf",
imports: ["android.hardware.radio"],
@@ -51,6 +53,7 @@
aidl_interface {
name: "android.hardware.radio.data",
vendor_available: true,
+ host_supported: true,
srcs: ["android/hardware/radio/data/*.aidl"],
stability: "vintf",
imports: ["android.hardware.radio"],
@@ -72,6 +75,7 @@
aidl_interface {
name: "android.hardware.radio.messaging",
vendor_available: true,
+ host_supported: true,
srcs: ["android/hardware/radio/messaging/*.aidl"],
stability: "vintf",
imports: ["android.hardware.radio"],
@@ -93,6 +97,7 @@
aidl_interface {
name: "android.hardware.radio.modem",
vendor_available: true,
+ host_supported: true,
srcs: ["android/hardware/radio/modem/*.aidl"],
stability: "vintf",
imports: ["android.hardware.radio"],
@@ -114,6 +119,7 @@
aidl_interface {
name: "android.hardware.radio.network",
vendor_available: true,
+ host_supported: true,
srcs: ["android/hardware/radio/network/*.aidl"],
stability: "vintf",
imports: ["android.hardware.radio"],
@@ -135,6 +141,7 @@
aidl_interface {
name: "android.hardware.radio.sim",
vendor_available: true,
+ host_supported: true,
srcs: ["android/hardware/radio/sim/*.aidl"],
stability: "vintf",
imports: [
@@ -159,6 +166,7 @@
aidl_interface {
name: "android.hardware.radio.voice",
vendor_available: true,
+ host_supported: true,
srcs: ["android/hardware/radio/voice/*.aidl"],
stability: "vintf",
imports: ["android.hardware.radio"],
diff --git a/radio/aidl/android/hardware/radio/data/IRadioData.aidl b/radio/aidl/android/hardware/radio/data/IRadioData.aidl
index e1ba568..0171d39 100644
--- a/radio/aidl/android/hardware/radio/data/IRadioData.aidl
+++ b/radio/aidl/android/hardware/radio/data/IRadioData.aidl
@@ -65,6 +65,7 @@
/**
* Deactivate packet data connection and remove from the data call list. An
* unsolDataCallListChanged() must be sent when data connection is deactivated.
+ * Any return value other than RadioError::NONE will remove the network from the list.
*
* @param serial Serial number of request.
* @param cid Data call id.
@@ -76,8 +77,7 @@
/**
* Returns the data call list. An entry is added when a setupDataCall() is issued and removed
- * on a deactivateDataCall(). The list is emptied when setRadioPower() off/on issued or when
- * the vendor HAL or modem crashes.
+ * on a deactivateDataCall(). The list is emptied when the vendor HAL crashes.
*
* @param serial Serial number of request.
*
diff --git a/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl b/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl
index bbc8d07..88b6c1b 100644
--- a/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl
+++ b/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl
@@ -67,7 +67,7 @@
*
* Valid errors returned:
* RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported.
- * RadioError:NONE
+ * RadioError:NONE indicates success. Any other error will remove the network from the list.
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:INVALID_CALL_ID
* RadioError:INVALID_STATE
diff --git a/radio/aidl/vts/radio_config_test.cpp b/radio/aidl/vts/radio_config_test.cpp
index 5e1c811..258b172 100644
--- a/radio/aidl/vts/radio_config_test.cpp
+++ b/radio/aidl/vts/radio_config_test.cpp
@@ -59,6 +59,7 @@
serial = GetRandomSerialNumber();
ndk::ScopedAStatus res = radio_config->getHalDeviceCapabilities(serial);
ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
ALOGI("getHalDeviceCapabilities, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
}
@@ -70,6 +71,7 @@
serial = GetRandomSerialNumber();
ndk::ScopedAStatus res = radio_config->getSimSlotsStatus(serial);
ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
ALOGI("getSimSlotsStatus, rspInfo.error = %s\n",
toString(radioRsp_config->rspInfo.error).c_str());
}
@@ -166,31 +168,60 @@
* Test IRadioConfig.setSimSlotsMapping() for the response returned.
*/
TEST_P(RadioConfigTest, setSimSlotsMapping) {
- serial = GetRandomSerialNumber();
- SlotPortMapping slotPortMapping;
- slotPortMapping.physicalSlotId = 0;
- slotPortMapping.portId = 0;
- std::vector<SlotPortMapping> slotPortMappingList = {slotPortMapping};
- if (isDsDsEnabled()) {
- slotPortMapping.physicalSlotId = 1;
- slotPortMappingList.push_back(slotPortMapping);
- } else if (isTsTsEnabled()) {
- slotPortMapping.physicalSlotId = 1;
- slotPortMappingList.push_back(slotPortMapping);
- slotPortMapping.physicalSlotId = 2;
- slotPortMappingList.push_back(slotPortMapping);
- }
- ndk::ScopedAStatus res = radio_config->setSimSlotsMapping(serial, slotPortMappingList);
- ASSERT_OK(res);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
- EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
- ALOGI("setSimSlotsMapping, rspInfo.error = %s\n",
- toString(radioRsp_config->rspInfo.error).c_str());
- ASSERT_TRUE(CheckAnyOfErrors(radioRsp_config->rspInfo.error, {RadioError::NONE}));
+ // get slot status and set SIM slots mapping based on the result.
+ updateSimSlotStatus();
+ if (radioRsp_config->rspInfo.error == RadioError::NONE) {
+ SlotPortMapping slotPortMapping;
+ // put invalid value at first and adjust by slotStatusResponse.
+ slotPortMapping.physicalSlotId = -1;
+ slotPortMapping.portId = -1;
+ std::vector<SlotPortMapping> slotPortMappingList = {slotPortMapping};
+ if (isDsDsEnabled()) {
+ slotPortMappingList.push_back(slotPortMapping);
+ } else if (isTsTsEnabled()) {
+ slotPortMappingList.push_back(slotPortMapping);
+ slotPortMappingList.push_back(slotPortMapping);
+ }
+ for (size_t i = 0; i < radioRsp_config->simSlotStatus.size(); i++) {
+ ASSERT_TRUE(radioRsp_config->simSlotStatus[i].portInfo.size() > 0);
+ for (size_t j = 0; j < radioRsp_config->simSlotStatus[i].portInfo.size(); j++) {
+ if (radioRsp_config->simSlotStatus[i].portInfo[j].portActive) {
+ int32_t logicalSlotId =
+ radioRsp_config->simSlotStatus[i].portInfo[j].logicalSlotId;
+ // logicalSlotId should be 0 or positive numbers if the port
+ // is active.
+ EXPECT_GE(logicalSlotId, 0);
+ // logicalSlotId should be less than the maximum number of
+ // supported SIM slots.
+ EXPECT_LT(logicalSlotId, slotPortMappingList.size());
+ if (logicalSlotId >= 0 && logicalSlotId < slotPortMappingList.size()) {
+ slotPortMappingList[logicalSlotId].physicalSlotId = i;
+ slotPortMappingList[logicalSlotId].portId = j;
+ }
+ }
+ }
+ }
- // Give some time for modem to fully switch SIM configuration
- sleep(MODEM_SET_SIM_SLOT_MAPPING_DELAY_IN_SECONDS);
+ // set SIM slots mapping
+ for (size_t i = 0; i < slotPortMappingList.size(); i++) {
+ // physicalSlotId and portId should be 0 or positive numbers for the
+ // input of setSimSlotsMapping.
+ EXPECT_GE(slotPortMappingList[i].physicalSlotId, 0);
+ EXPECT_GE(slotPortMappingList[i].portId, 0);
+ }
+ serial = GetRandomSerialNumber();
+ ndk::ScopedAStatus res = radio_config->setSimSlotsMapping(serial, slotPortMappingList);
+ ASSERT_OK(res);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
+ ALOGI("setSimSlotsMapping, rspInfo.error = %s\n",
+ toString(radioRsp_config->rspInfo.error).c_str());
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_config->rspInfo.error, {RadioError::NONE}));
+
+ // Give some time for modem to fully switch SIM configuration
+ sleep(MODEM_SET_SIM_SLOT_MAPPING_DELAY_IN_SECONDS);
+ }
}
/*
@@ -207,12 +238,24 @@
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type);
EXPECT_EQ(serial, radioRsp_config->rspInfo.serial);
if (radioRsp_config->rspInfo.error == RadioError::NONE) {
+ uint8_t simCount = 0;
// check if cardState is present, portInfo size should be more than 0
for (const SimSlotStatus& slotStatusResponse : radioRsp_config->simSlotStatus) {
if (slotStatusResponse.cardState == CardStatus::STATE_PRESENT) {
ASSERT_TRUE(slotStatusResponse.portInfo.size() > 0);
- ASSERT_TRUE(slotStatusResponse.portInfo[0].portActive);
+ for (const SimPortInfo& simPortInfo : slotStatusResponse.portInfo) {
+ if (simPortInfo.portActive) {
+ simCount++;
+ }
+ }
}
}
+ if (isSsSsEnabled()) {
+ EXPECT_EQ(1, simCount);
+ } else if (isDsDsEnabled()) {
+ EXPECT_EQ(2, simCount);
+ } else if (isTsTsEnabled()) {
+ EXPECT_EQ(3, simCount);
+ }
}
}
diff --git a/radio/aidl/vts/radio_modem_response.cpp b/radio/aidl/vts/radio_modem_response.cpp
index d2715a8..20b44c5 100644
--- a/radio/aidl/vts/radio_modem_response.cpp
+++ b/radio/aidl/vts/radio_modem_response.cpp
@@ -24,6 +24,7 @@
ndk::ScopedAStatus RadioModemResponse::enableModemResponse(const RadioResponseInfo& info) {
rspInfo = info;
+ enableModemResponseToggle = !enableModemResponseToggle;
parent_modem.notify(info.serial);
return ndk::ScopedAStatus::ok();
}
diff --git a/radio/aidl/vts/radio_modem_utils.h b/radio/aidl/vts/radio_modem_utils.h
index 8779e0c..49e1891 100644
--- a/radio/aidl/vts/radio_modem_utils.h
+++ b/radio/aidl/vts/radio_modem_utils.h
@@ -37,7 +37,7 @@
RadioResponseInfo rspInfo;
bool isModemEnabled;
- bool enableModemResponseToggle;
+ bool enableModemResponseToggle = false;
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
diff --git a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintOperation.aidl b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintOperation.aidl
index ca89555..c30c183 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintOperation.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintOperation.aidl
@@ -242,7 +242,8 @@
* not a multiple of the AES block size, finish() must return
* ErrorCode::INVALID_INPUT_LENGTH. If padding is PaddingMode::PKCS7, pad the data per the
* PKCS#7 specification, including adding an additional padding block if the data is a
- * multiple of the block length.
+ * multiple of the block length. If padding is PaddingMode::PKCS7 and decryption does not
+ * result in valid padding, return ErrorCode::INVALID_ARGUMENT.
*
* o BlockMode::GCM. During encryption, after processing all plaintext, compute the tag
* (Tag::MAC_LENGTH bytes) and append it to the returned ciphertext. During decryption,
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index 3b75c50..384c135 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -5481,18 +5481,45 @@
EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
string plaintext;
- ErrorCode error = Finish(message, &plaintext);
- if (error == ErrorCode::INVALID_INPUT_LENGTH) {
+ ErrorCode error = Finish(ciphertext, &plaintext);
+ if (error == ErrorCode::INVALID_ARGUMENT) {
// This is the expected error, we can exit the test now.
return;
} else {
// Very small chance we got valid decryption, so try again.
- ASSERT_EQ(error, ErrorCode::OK);
+ ASSERT_EQ(error, ErrorCode::OK)
+ << "Expected INVALID_ARGUMENT or (rarely) OK, got " << error;
}
}
FAIL() << "Corrupt ciphertext should have failed to decrypt by now.";
}
+/*
+ * EncryptionOperationsTest.AesEcbPkcs7CiphertextTooShort
+ *
+ * Verifies that AES decryption fails in the correct way when the padding is corrupted.
+ */
+TEST_P(EncryptionOperationsTest, AesEcbPkcs7CiphertextTooShort) {
+ ASSERT_EQ(ErrorCode::OK, GenerateKey(AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .AesEncryptionKey(128)
+ .Authorization(TAG_BLOCK_MODE, BlockMode::ECB)
+ .Padding(PaddingMode::PKCS7)));
+
+ auto params = AuthorizationSetBuilder().BlockMode(BlockMode::ECB).Padding(PaddingMode::PKCS7);
+
+ string message = "a";
+ string ciphertext = EncryptMessage(message, params);
+ EXPECT_EQ(16U, ciphertext.size());
+ EXPECT_NE(ciphertext, message);
+
+ // Shorten the ciphertext.
+ ciphertext.resize(ciphertext.size() - 1);
+ EXPECT_EQ(ErrorCode::OK, Begin(KeyPurpose::DECRYPT, params));
+ string plaintext;
+ EXPECT_EQ(ErrorCode::INVALID_INPUT_LENGTH, Finish(ciphertext, &plaintext));
+}
+
vector<uint8_t> CopyIv(const AuthorizationSet& set) {
auto iv = set.GetTagValue(TAG_NONCE);
EXPECT_TRUE(iv);
diff --git a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc
index abff430..3fe6b52 100644
--- a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc
+++ b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc
@@ -7,4 +7,4 @@
user media
group mediadrm drmrpc
ioprio rt 4
- writepid /dev/cpuset/foreground/tasks
\ No newline at end of file
+ task_profiles ProcessCapacityHigh
diff --git a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc
index 3718a93..bc62c7d 100644
--- a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc
+++ b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc
@@ -3,4 +3,4 @@
user media
group mediadrm drmrpc
ioprio rt 4
- writepid /dev/cpuset/foreground/tasks
\ No newline at end of file
+ task_profiles ProcessCapacityHigh
diff --git a/vibrator/aidl/default/Android.bp b/vibrator/aidl/default/Android.bp
index acdbdcd..c4140be 100644
--- a/vibrator/aidl/default/Android.bp
+++ b/vibrator/aidl/default/Android.bp
@@ -63,7 +63,6 @@
"libbinder_random_parcel",
"libcutils",
"liblog",
- "libutils",
"libvibratorexampleimpl",
],
target: {
@@ -71,12 +70,14 @@
shared_libs: [
"libbinder_ndk",
"libbinder",
+ "libutils",
],
},
host: {
static_libs: [
"libbinder_ndk",
"libbinder",
+ "libutils",
],
},
darwin: {