Merge "Merge "Snap tm-dev to android13-tests-dev" into tm-dev am: 5a1bde04ae" into tm-mainline-prod

This commit is contained in:
TreeHugger Robot 2023-01-17 21:37:52 +00:00 committed by Android (Google) Code Review
commit 2626641d4c
24 changed files with 194 additions and 143 deletions

View file

@ -1014,9 +1014,8 @@ class StreamWriter : public StreamWorker<StreamWriter> {
if (mDataPosition == 0) mOnDataStart();
const size_t dataSize = std::min(mData.size() - mDataPosition, mDataMQ->availableToWrite());
bool success = mDataMQ->write(mData.data() + mDataPosition, dataSize);
bool wrapped = false;
ALOGE_IF(!success, "data message queue write failed");
mDataPosition += dataSize;
if (mDataPosition >= mData.size()) mDataPosition = 0;
mEfGroup->wake(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY));
uint32_t efState = 0;
@ -1034,6 +1033,11 @@ class StreamWriter : public StreamWorker<StreamWriter> {
ALOGE("bad write status: %d", writeStatus.retval);
success = false;
}
mDataPosition += writeStatus.reply.written;
if (mDataPosition >= mData.size()) {
mDataPosition = 0;
wrapped = true;
}
}
if (ret == -EAGAIN || ret == -EINTR) {
// Spurious wakeup. This normally retries no more than once.
@ -1042,7 +1046,7 @@ class StreamWriter : public StreamWorker<StreamWriter> {
ALOGE("bad wait status: %d", ret);
success = false;
}
if (success && mDataPosition == 0) {
if (wrapped) {
success = mOnDataWrap();
}
return success;

View file

@ -217,6 +217,10 @@ package audio.policy.V1_0 {
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_GAME;
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_MEDIA;
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION;
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED;
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT;
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST;
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_EVENT;
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE;
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_UNKNOWN;
enum_constant public static final audio.policy.V1_0.UsageEnumType AUDIO_USAGE_VIRTUAL_SOURCE;

View file

@ -347,6 +347,11 @@
<xs:enumeration value="AUDIO_USAGE_ALARM"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE"/>
<!-- Note: the following 3 values were deprecated in Android T (13) SDK -->
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_REQUEST"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_INSTANT"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_COMMUNICATION_DELAYED"/>
<xs:enumeration value="AUDIO_USAGE_NOTIFICATION_EVENT"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE"/>
<xs:enumeration value="AUDIO_USAGE_ASSISTANCE_SONIFICATION"/>

View file

@ -250,8 +250,7 @@ protected:
// Stream configurations are found in metadata
RawStreamConfig *ptr = reinterpret_cast<RawStreamConfig *>(streamCfgs.data.i32);
for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) {
targetCfg.width = ptr->width;
targetCfg.height = ptr->height;
targetCfg.format = static_cast<PixelFormat>(ptr->format);
@ -2017,13 +2016,12 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
// Stream configurations are found in metadata
RawStreamConfig *ptr = reinterpret_cast<RawStreamConfig *>(streamCfgs.data.i32);
for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) {
if (ptr->width * ptr->height > maxArea &&
ptr->framerate >= minReqFps) {
targetCfg.width = ptr->width;
targetCfg.height = ptr->height;
targetCfg.format = static_cast<PixelFormat>(ptr->format);
maxArea = ptr->width * ptr->height;
foundCfg = true;
@ -2032,8 +2030,6 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
++ptr;
}
}
targetCfg.format =
static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);
if (!foundCfg) {
// Current EVS camera does not provide stream configurations in the
@ -2120,13 +2116,12 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
// Stream configurations are found in metadata
RawStreamConfig *ptr = reinterpret_cast<RawStreamConfig *>(streamCfgs.data.i32);
for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) {
if (ptr->width * ptr->height > maxArea &&
ptr->framerate >= minReqFps) {
targetCfg.width = ptr->width;
targetCfg.height = ptr->height;
targetCfg.format = static_cast<PixelFormat>(ptr->format);
maxArea = ptr->width * ptr->height;
foundCfg = true;
@ -2135,8 +2130,6 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
++ptr;
}
}
targetCfg.format =
static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);
if (!foundCfg) {
LOG(INFO) << "Device " << cam.v1.cameraId

View file

@ -231,8 +231,7 @@ class EvsAidlTest : public ::testing::TestWithParam<std::string> {
// Stream configurations are found in metadata
RawStreamConfig* ptr = reinterpret_cast<RawStreamConfig*>(streamCfgs.data.i32);
for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) {
targetCfg.width = ptr->width;
targetCfg.height = ptr->height;
targetCfg.format = static_cast<PixelFormat>(ptr->format);
@ -1732,11 +1731,11 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) {
// Stream configurations are found in metadata
RawStreamConfig* ptr = reinterpret_cast<RawStreamConfig*>(streamCfgs.data.i32);
for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) {
if (ptr->width * ptr->height > maxArea && ptr->framerate >= minReqFps) {
targetCfg.width = ptr->width;
targetCfg.height = ptr->height;
targetCfg.format = static_cast<PixelFormat>(ptr->format);
maxArea = ptr->width * ptr->height;
foundCfg = true;
@ -1745,7 +1744,6 @@ TEST_P(EvsAidlTest, CameraUseStreamConfigToDisplay) {
++ptr;
}
}
targetCfg.format = static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);
if (!foundCfg) {
// Current EVS camera does not provide stream configurations in the
@ -1829,11 +1827,11 @@ TEST_P(EvsAidlTest, MultiCameraStreamUseConfig) {
// Stream configurations are found in metadata
RawStreamConfig* ptr = reinterpret_cast<RawStreamConfig*>(streamCfgs.data.i32);
for (unsigned offset = 0; offset < streamCfgs.count; offset += kStreamCfgSz) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
ptr->format == HAL_PIXEL_FORMAT_RGBA_8888) {
if (ptr->direction == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT) {
if (ptr->width * ptr->height > maxArea && ptr->framerate >= minReqFps) {
targetCfg.width = ptr->width;
targetCfg.height = ptr->height;
targetCfg.format = static_cast<PixelFormat>(ptr->format);
maxArea = ptr->width * ptr->height;
foundCfg = true;
@ -1842,7 +1840,6 @@ TEST_P(EvsAidlTest, MultiCameraStreamUseConfig) {
++ptr;
}
}
targetCfg.format = static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);
if (!foundCfg) {
LOG(INFO) << "Device " << cam.id

View file

@ -20,8 +20,11 @@
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
<option name="bluetooth" value="off" />
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="settings put global ble_scan_always_enabled 0" />
<option name="run-command" value="su u$(am get-current-user)_system svc bluetooth disable" />
<option name="teardown-command" value="su u$(am get-current-user)_system svc bluetooth enable" />
<option name="teardown-command" value="settings put global ble_scan_always_enabled 1" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">

View file

@ -23,6 +23,7 @@
#include <android/binder_process.h>
#include <binder/IServiceManager.h>
#include <binder/ProcessState.h>
#include <cutils/properties.h>
#include <fmq/AidlMessageQueue.h>
#include <cstdint>
@ -248,7 +249,8 @@ class BluetoothAudioProviderFactoryAidl
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
case SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH:
case SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH: {
ASSERT_FALSE(temp_provider_capabilities_.empty());
// empty capability means offload is unsupported since capabilities are
// not hardcoded
for (auto audio_capability : temp_provider_capabilities_) {
ASSERT_EQ(audio_capability.getTag(),
AudioCapabilities::leAudioCapabilities);
@ -513,8 +515,9 @@ class BluetoothAudioProviderFactoryAidl
for (auto channel_mode : opus_capability->channelMode) {
OpusConfiguration opus_data{
.samplingFrequencyHz = samplingFrequencyHz,
.frameDurationUs = frameDurationUs,
.channelMode = channel_mode,
.frameDurationUs = frameDurationUs};
};
opus_codec_specifics.push_back(
CodecConfiguration::CodecSpecific(opus_data));
}
@ -623,8 +626,8 @@ TEST_P(BluetoothAudioProviderA2dpEncodingSoftwareAidl,
for (auto channel_mode : a2dp_channel_modes) {
PcmConfiguration pcm_config{
.sampleRateHz = sample_rate,
.bitsPerSample = bits_per_sample,
.channelMode = channel_mode,
.bitsPerSample = bits_per_sample,
};
bool is_codec_config_valid = IsPcmConfigSupported(pcm_config);
DataMQDesc mq_desc;
@ -937,8 +940,8 @@ TEST_P(BluetoothAudioProviderHearingAidSoftwareAidl,
for (auto channel_mode : hearing_aid_channel_modes_) {
PcmConfiguration pcm_config{
.sampleRateHz = sample_rate,
.bitsPerSample = bits_per_sample,
.channelMode = channel_mode,
.bitsPerSample = bits_per_sample,
};
bool is_codec_config_valid = IsPcmConfigSupported(pcm_config);
DataMQDesc mq_desc;
@ -1008,8 +1011,8 @@ TEST_P(BluetoothAudioProviderLeAudioOutputSoftwareAidl,
for (auto data_interval_us : le_audio_output_data_interval_us_) {
PcmConfiguration pcm_config{
.sampleRateHz = sample_rate,
.bitsPerSample = bits_per_sample,
.channelMode = channel_mode,
.bitsPerSample = bits_per_sample,
.dataIntervalUs = data_interval_us,
};
bool is_codec_config_valid =
@ -1081,8 +1084,8 @@ TEST_P(BluetoothAudioProviderLeAudioInputSoftwareAidl,
for (auto data_interval_us : le_audio_input_data_interval_us_) {
PcmConfiguration pcm_config{
.sampleRateHz = sample_rate,
.bitsPerSample = bits_per_sample,
.channelMode = channel_mode,
.bitsPerSample = bits_per_sample,
.dataIntervalUs = data_interval_us,
};
bool is_codec_config_valid =
@ -1144,7 +1147,7 @@ class BluetoothAudioProviderLeAudioOutputHardwareAidl
bool supported) {
std::vector<Lc3Configuration> le_audio_codec_configs;
if (!supported) {
Lc3Configuration lc3_config{.samplingFrequencyHz = 0, .pcmBitDepth = 0};
Lc3Configuration lc3_config{.pcmBitDepth = 0, .samplingFrequencyHz = 0};
le_audio_codec_configs.push_back(lc3_config);
return le_audio_codec_configs;
}
@ -1428,8 +1431,8 @@ TEST_P(BluetoothAudioProviderLeAudioBroadcastSoftwareAidl,
for (auto data_interval_us : le_audio_output_data_interval_us_) {
PcmConfiguration pcm_config{
.sampleRateHz = sample_rate,
.bitsPerSample = bits_per_sample,
.channelMode = channel_mode,
.bitsPerSample = bits_per_sample,
.dataIntervalUs = data_interval_us,
};
bool is_codec_config_valid =
@ -1490,7 +1493,7 @@ class BluetoothAudioProviderLeAudioBroadcastHardwareAidl
std::vector<Lc3Configuration> GetBroadcastLc3SupportedList(bool supported) {
std::vector<Lc3Configuration> le_audio_codec_configs;
if (!supported) {
Lc3Configuration lc3_config{.samplingFrequencyHz = 0, .pcmBitDepth = 0};
Lc3Configuration lc3_config{.pcmBitDepth = 0, .samplingFrequencyHz = 0};
le_audio_codec_configs.push_back(lc3_config);
return le_audio_codec_configs;
}
@ -1650,8 +1653,8 @@ TEST_P(BluetoothAudioProviderA2dpDecodingSoftwareAidl,
for (auto channel_mode : a2dp_channel_modes) {
PcmConfiguration pcm_config{
.sampleRateHz = sample_rate,
.bitsPerSample = bits_per_sample,
.channelMode = channel_mode,
.bitsPerSample = bits_per_sample,
};
bool is_codec_config_valid = IsPcmConfigSupported(pcm_config);
DataMQDesc mq_desc;

View file

@ -7883,6 +7883,7 @@ void CameraHidlTest::verifyLogicalOrUltraHighResCameraMetadata(
}
}
camera_metadata_t* staticMetadata;
camera_metadata_ro_entry physicalMultiResStreamConfigs;
camera_metadata_ro_entry physicalStreamConfigs;
camera_metadata_ro_entry physicalMaxResolutionStreamConfigs;
@ -7901,8 +7902,9 @@ void CameraHidlTest::verifyLogicalOrUltraHighResCameraMetadata(
ret = subDevice->getCameraCharacteristics([&](auto status, const auto& chars) {
ASSERT_EQ(Status::OK, status);
const camera_metadata_t* staticMetadata =
reinterpret_cast<const camera_metadata_t*>(chars.data());
staticMetadata = clone_camera_metadata(
reinterpret_cast<const camera_metadata_t*>(chars.data()));
ASSERT_NE(nullptr, staticMetadata);
rc = getSystemCameraKind(staticMetadata, &physSystemCameraKind);
ASSERT_EQ(rc, Status::OK);
// Make sure that the system camera kind of a non-hidden
@ -7936,7 +7938,9 @@ void CameraHidlTest::verifyLogicalOrUltraHighResCameraMetadata(
verifyCameraCharacteristics(status, chars);
verifyMonochromeCharacteristics(chars, deviceVersion);
auto staticMetadata = (const camera_metadata_t*)chars.data();
staticMetadata = clone_camera_metadata(
reinterpret_cast<const camera_metadata_t*>(chars.data()));
ASSERT_NE(nullptr, staticMetadata);
retcode = find_camera_metadata_ro_entry(
staticMetadata, ANDROID_CONTROL_ZOOM_RATIO_RANGE, &entry);
bool subCameraHasZoomRatioRange = (0 == retcode && entry.count == 2);
@ -8064,6 +8068,7 @@ void CameraHidlTest::verifyLogicalOrUltraHighResCameraMetadata(
}
}
}
free_camera_metadata(staticMetadata);
}
// If a multi-resolution stream is supported, there must be at least one

View file

@ -1181,6 +1181,7 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata(
camera_metadata_ro_entry physicalMultiResStreamConfigs;
camera_metadata_ro_entry physicalStreamConfigs;
camera_metadata_ro_entry physicalMaxResolutionStreamConfigs;
CameraMetadata physChars;
bool isUltraHighRes = false;
std::unordered_set<int32_t> subCameraPrivacyTestPatterns;
if (isPublicId) {
@ -1189,12 +1190,11 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata(
ASSERT_TRUE(ret.isOk());
ASSERT_NE(subDevice, nullptr);
CameraMetadata subDeviceChars;
ret = subDevice->getCameraCharacteristics(&subDeviceChars);
ret = subDevice->getCameraCharacteristics(&physChars);
ASSERT_TRUE(ret.isOk());
const camera_metadata_t* staticMetadata =
reinterpret_cast<const camera_metadata_t*>(subDeviceChars.metadata.data());
reinterpret_cast<const camera_metadata_t*>(physChars.metadata.data());
retStatus = getSystemCameraKind(staticMetadata, &physSystemCameraKind);
ASSERT_EQ(retStatus, Status::OK);
@ -1215,7 +1215,6 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata(
getPrivacyTestPatternModes(staticMetadata, &subCameraPrivacyTestPatterns);
} else {
// Check camera characteristics for hidden camera id
CameraMetadata physChars;
ndk::ScopedAStatus ret =
device->getPhysicalCameraCharacteristics(physicalId, &physChars);
ASSERT_TRUE(ret.isOk());

View file

@ -104,7 +104,7 @@ interface IGnss {
*
* The framework calls this method to instruct the GPS engine to prepare for serving requests
* from the framework. The GNSS HAL implementation must respond to all GNSS requests from the
* framework upon successful return from this method until cleanup() method is called to
* framework upon successful return from this method until close() method is called to
* close this interface.
*
* @param callback Callback interface for IGnss.

View file

@ -107,6 +107,17 @@ void GnssHalTest::SetUpGnssCallback() {
}
}
void GnssHalTest::TearDown() {
GnssHalTestTemplate<IGnss_V2_1>::TearDown();
if (aidl_gnss_hal_ != nullptr) {
aidl_gnss_hal_->close();
aidl_gnss_hal_ = nullptr;
}
// Set to nullptr to destruct the callback event queues and warn of any unprocessed events.
aidl_gnss_cb_ = nullptr;
}
void GnssHalTest::CheckLocation(const GnssLocation& location, bool check_speed) {
Utils::checkLocation(location, check_speed, /* check_more_accuracies= */ true);
}

View file

@ -64,6 +64,7 @@ class GnssHalTest : public android::hardware::gnss::common::GnssHalTestTemplate<
virtual void SetUp() override;
virtual void SetUpGnssCallback() override;
virtual void TearDown() override;
void CheckLocation(const android::hardware::gnss::GnssLocation& location,
const bool check_speed);

View file

@ -488,10 +488,13 @@ bool VtsComposerClient::verifyComposerCallbackParams() {
}
bool VtsComposerClient::destroyAllLayers() {
for (const auto& it : mDisplayResources) {
const auto& [display, resource] = it;
std::unordered_map<int64_t, DisplayResource> physicalDisplays;
while (!mDisplayResources.empty()) {
const auto& it = mDisplayResources.begin();
const auto& [display, resource] = *it;
for (auto layer : resource.layers) {
while (!resource.layers.empty()) {
auto layer = *resource.layers.begin();
const auto status = destroyLayer(display, layer);
if (!status.isOk()) {
ALOGE("Unable to destroy all the layers, failed at layer %" PRId64 " with error %s",
@ -507,8 +510,12 @@ bool VtsComposerClient::destroyAllLayers() {
status.getDescription().c_str());
return false;
}
} else {
auto extractIter = mDisplayResources.extract(it);
physicalDisplays.insert(std::move(extractIter));
}
}
mDisplayResources.swap(physicalDisplays);
mDisplayResources.clear();
return true;
}

View file

@ -232,26 +232,24 @@ size_t sizeForBinder(const Model& model) {
// currently 1Mb, which is shared by all transactions in progress
// for the process."
//
// Will our representation fit under this limit? There are two complications:
// Will our representation fit under this limit? There are three complications:
// - Our representation size is just approximate (see sizeForBinder()).
// - This object may not be the only occupant of the Binder transaction buffer.
// - This object may not be the only occupant of the Binder transaction buffer
// (although our VTS test suite should not be putting multiple objects in the
// buffer at once).
// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes.
// So we'll be very conservative: We want the representation size to be no
// larger than half the transaction buffer size.
// larger than half the recommended limit.
//
// If our representation grows large enough that it still fits within
// the transaction buffer but combined with other transactions may
// exceed the buffer size, then we may see intermittent HAL transport
// errors.
static bool exceedsBinderSizeLimit(size_t representationSize) {
// Instead of using this fixed buffer size, we might instead be able to use
// ProcessState::self()->getMmapSize(). However, this has a potential
// problem: The binder/mmap size of the current process does not necessarily
// indicate the binder/mmap size of the service (i.e., the other process).
// The only way it would be a good indication is if both the current process
// and the service use the default size.
static const size_t kHalfBufferSize = 1024 * 1024 / 2;
// There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE.
static const size_t kHalfMaxIPCSize = 64 * 1024 / 2;
return representationSize > kHalfBufferSize;
return representationSize > kHalfMaxIPCSize;
}
///////////////////////// VALIDATE EXECUTION ORDER ////////////////////////////

View file

@ -252,26 +252,24 @@ size_t sizeForBinder(const Model& model) {
// currently 1Mb, which is shared by all transactions in progress
// for the process."
//
// Will our representation fit under this limit? There are two complications:
// Will our representation fit under this limit? There are three complications:
// - Our representation size is just approximate (see sizeForBinder()).
// - This object may not be the only occupant of the Binder transaction buffer.
// - This object may not be the only occupant of the Binder transaction buffer
// (although our VTS test suite should not be putting multiple objects in the
// buffer at once).
// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes.
// So we'll be very conservative: We want the representation size to be no
// larger than half the transaction buffer size.
// larger than half the recommended limit.
//
// If our representation grows large enough that it still fits within
// the transaction buffer but combined with other transactions may
// exceed the buffer size, then we may see intermittent HAL transport
// errors.
static bool exceedsBinderSizeLimit(size_t representationSize) {
// Instead of using this fixed buffer size, we might instead be able to use
// ProcessState::self()->getMmapSize(). However, this has a potential
// problem: The binder/mmap size of the current process does not necessarily
// indicate the binder/mmap size of the service (i.e., the other process).
// The only way it would be a good indication is if both the current process
// and the service use the default size.
static const size_t kHalfBufferSize = 1024 * 1024 / 2;
// There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE.
static const size_t kHalfMaxIPCSize = 64 * 1024 / 2;
return representationSize > kHalfBufferSize;
return representationSize > kHalfMaxIPCSize;
}
///////////////////////// VALIDATE EXECUTION ORDER ////////////////////////////

View file

@ -291,26 +291,24 @@ size_t sizeForBinder(const Model& model) {
// currently 1Mb, which is shared by all transactions in progress
// for the process."
//
// Will our representation fit under this limit? There are two complications:
// Will our representation fit under this limit? There are three complications:
// - Our representation size is just approximate (see sizeForBinder()).
// - This object may not be the only occupant of the Binder transaction buffer.
// - This object may not be the only occupant of the Binder transaction buffer
// (although our VTS test suite should not be putting multiple objects in the
// buffer at once).
// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes.
// So we'll be very conservative: We want the representation size to be no
// larger than half the transaction buffer size.
// larger than half the recommended limit.
//
// If our representation grows large enough that it still fits within
// the transaction buffer but combined with other transactions may
// exceed the buffer size, then we may see intermittent HAL transport
// errors.
static bool exceedsBinderSizeLimit(size_t representationSize) {
// Instead of using this fixed buffer size, we might instead be able to use
// ProcessState::self()->getMmapSize(). However, this has a potential
// problem: The binder/mmap size of the current process does not necessarily
// indicate the binder/mmap size of the service (i.e., the other process).
// The only way it would be a good indication is if both the current process
// and the service use the default size.
static const size_t kHalfBufferSize = 1024 * 1024 / 2;
// There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE.
static const size_t kHalfMaxIPCSize = 64 * 1024 / 2;
return representationSize > kHalfBufferSize;
return representationSize > kHalfMaxIPCSize;
}
///////////////////////// VALIDATE EXECUTION ORDER ////////////////////////////

View file

@ -308,26 +308,24 @@ size_t sizeForBinder(const Model& model) {
// currently 1Mb, which is shared by all transactions in progress
// for the process."
//
// Will our representation fit under this limit? There are two complications:
// Will our representation fit under this limit? There are three complications:
// - Our representation size is just approximate (see sizeForBinder()).
// - This object may not be the only occupant of the Binder transaction buffer.
// - This object may not be the only occupant of the Binder transaction buffer
// (although our VTS test suite should not be putting multiple objects in the
// buffer at once).
// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes.
// So we'll be very conservative: We want the representation size to be no
// larger than half the transaction buffer size.
// larger than half the recommended limit.
//
// If our representation grows large enough that it still fits within
// the transaction buffer but combined with other transactions may
// exceed the buffer size, then we may see intermittent HAL transport
// errors.
static bool exceedsBinderSizeLimit(size_t representationSize) {
// Instead of using this fixed buffer size, we might instead be able to use
// ProcessState::self()->getMmapSize(). However, this has a potential
// problem: The binder/mmap size of the current process does not necessarily
// indicate the binder/mmap size of the service (i.e., the other process).
// The only way it would be a good indication is if both the current process
// and the service use the default size.
static const size_t kHalfBufferSize = 1024 * 1024 / 2;
// There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE.
static const size_t kHalfMaxIPCSize = 64 * 1024 / 2;
return representationSize > kHalfBufferSize;
return representationSize > kHalfMaxIPCSize;
}
///////////////////////// VALIDATE EXECUTION ORDER ////////////////////////////

View file

@ -344,26 +344,24 @@ size_t sizeForBinder(const Model& model) {
// currently 1Mb, which is shared by all transactions in progress
// for the process."
//
// Will our representation fit under this limit? There are two complications:
// Will our representation fit under this limit? There are three complications:
// - Our representation size is just approximate (see sizeForBinder()).
// - This object may not be the only occupant of the Binder transaction buffer.
// - This object may not be the only occupant of the Binder transaction buffer
// (although our VTS test suite should not be putting multiple objects in the
// buffer at once).
// - IBinder.MAX_IPC_SIZE recommends limiting a transaction to 64 * 1024 bytes.
// So we'll be very conservative: We want the representation size to be no
// larger than half the transaction buffer size.
// larger than half the recommended limit.
//
// If our representation grows large enough that it still fits within
// the transaction buffer but combined with other transactions may
// exceed the buffer size, then we may see intermittent HAL transport
// errors.
static bool exceedsBinderSizeLimit(size_t representationSize) {
// Instead of using this fixed buffer size, we might instead be able to use
// ProcessState::self()->getMmapSize(). However, this has a potential
// problem: The binder/mmap size of the current process does not necessarily
// indicate the binder/mmap size of the service (i.e., the other process).
// The only way it would be a good indication is if both the current process
// and the service use the default size.
static const size_t kHalfBufferSize = 1024 * 1024 / 2;
// There is no C++ API to retrieve the value of the Java variable IBinder.MAX_IPC_SIZE.
static const size_t kHalfMaxIPCSize = 64 * 1024 / 2;
return representationSize > kHalfBufferSize;
return representationSize > kHalfMaxIPCSize;
}
///////////////////////// VALIDATE EXECUTION ORDER ////////////////////////////

View file

@ -92,6 +92,10 @@ bool isDsDsEnabled() {
return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "dsds");
}
bool isDsDaEnabled() {
return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "dsda");
}
bool isTsTsEnabled() {
return testing::checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "tsts");
}

View file

@ -103,6 +103,11 @@ bool isSsSsEnabled();
*/
bool isDsDsEnabled();
/*
* Check if device is in DSDA (Dual SIM Dual Active).
*/
bool isDsDaEnabled();
/*
* Check if device is in TSTS (Triple SIM Triple Standby).
*/

View file

@ -176,7 +176,7 @@ TEST_P(RadioConfigTest, setSimSlotsMapping) {
slotPortMapping.physicalSlotId = -1;
slotPortMapping.portId = -1;
std::vector<SlotPortMapping> slotPortMappingList = {slotPortMapping};
if (isDsDsEnabled()) {
if (isDsDsEnabled() || isDsDaEnabled()) {
slotPortMappingList.push_back(slotPortMapping);
} else if (isTsTsEnabled()) {
slotPortMappingList.push_back(slotPortMapping);
@ -252,7 +252,7 @@ TEST_P(RadioConfigTest, checkPortInfoExistsAndPortActive) {
}
if (isSsSsEnabled()) {
EXPECT_EQ(1, simCount);
} else if (isDsDsEnabled()) {
} else if (isDsDsEnabled() || isDsDaEnabled()) {
EXPECT_EQ(2, simCount);
} else if (isTsTsEnabled()) {
EXPECT_EQ(3, simCount);

View file

@ -66,7 +66,7 @@ bool findAnyModeSupportingIfaceType(
bool configureChipToSupportIfaceTypeInternal(const sp<IWifiChip>& wifi_chip,
IfaceType type,
ChipModeId* configured_mode_id) {
if (!configured_mode_id) {
if (!configured_mode_id || !wifi_chip.get()) {
return false;
}
const auto& status_and_modes = HIDL_INVOKE(wifi_chip, getAvailableModes);

View file

@ -28,6 +28,6 @@
// These helper functions should be modified to return vectors if we support
// multiple instances.
android::sp<android::hardware::wifi::V1_4::IWifiChip> getWifiChip_1_4(
const std::string& instance_name);
const std::string& instance_name);
android::sp<android::hardware::wifi::V1_4::IWifiApIface> getWifiApIface_1_4(
const std::string& instance_name);
const std::string& instance_name);

View file

@ -122,7 +122,8 @@ class HostapdHidlTest
IHostapd::IfaceParams getIfaceParamsWithAcs(std::string iface_name) {
// First get the settings for WithoutAcs and then make changes
IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs(iface_name);
IHostapd::IfaceParams iface_params_1_2 =
getIfaceParamsWithoutAcs(iface_name);
iface_params_1_2.V1_1.V1_0.channelParams.enableAcs = true;
iface_params_1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs = true;
iface_params_1_2.V1_1.V1_0.channelParams.channel = 0;
@ -132,8 +133,10 @@ class HostapdHidlTest
return iface_params_1_2;
}
IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange(std::string iface_name) {
IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcs(iface_name);
IHostapd::IfaceParams getIfaceParamsWithAcsAndFreqRange(
std::string iface_name) {
IHostapd::IfaceParams iface_params_1_2 =
getIfaceParamsWithAcs(iface_name);
::android::hardware::wifi::hostapd::V1_2::IHostapd::AcsFrequencyRange
acsFrequencyRange;
acsFrequencyRange.start = 2412;
@ -147,8 +150,10 @@ class HostapdHidlTest
return iface_params_1_2;
}
IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange(std::string iface_name) {
IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcsAndFreqRange(iface_name);
IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidFreqRange(
std::string iface_name) {
IHostapd::IfaceParams iface_params_1_2 =
getIfaceParamsWithAcsAndFreqRange(iface_name);
iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].start = 222;
iface_params_1_2.channelParams.acsChannelFreqRangesMhz[0].end = 999;
return iface_params_1_2;
@ -210,8 +215,10 @@ class HostapdHidlTest
return nw_params_1_2;
}
IHostapd::IfaceParams getIfaceParamsWithInvalidChannel(std::string iface_name) {
IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs(iface_name);
IHostapd::IfaceParams getIfaceParamsWithInvalidChannel(
std::string iface_name) {
IHostapd::IfaceParams iface_params_1_2 =
getIfaceParamsWithoutAcs(iface_name);
iface_params_1_2.V1_1.V1_0.channelParams.channel = kIfaceInvalidChannel;
return iface_params_1_2;
}
@ -237,8 +244,8 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname),
getPskNwParams());
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithAcs(ifname), getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@ -252,7 +259,8 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) {
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithAcsAndFreqRange(ifname), getPskNwParams());
getIfaceParamsWithAcsAndFreqRange(ifname),
getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@ -266,7 +274,8 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) {
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithAcsAndInvalidFreqRange(ifname), getPskNwParams());
getIfaceParamsWithAcsAndInvalidFreqRange(ifname),
getPskNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@ -279,8 +288,8 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname),
getOpenNwParams());
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithAcs(ifname), getOpenNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@ -292,8 +301,9 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname),
getPskNwParams());
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithoutAcs(ifname), getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@ -305,8 +315,9 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname),
getOpenNwParams());
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithoutAcs(ifname), getOpenNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@ -319,7 +330,8 @@ TEST_P(HostapdHidlTest, AddSaeTransitionAccessPointWithoutAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname),
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithoutAcs(ifname),
getSaeTransitionNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@ -333,8 +345,9 @@ TEST_P(HostapdHidlTest, AddSAEAccessPointWithoutAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname),
getSaeNwParams());
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithoutAcs(ifname), getSaeNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
}
@ -347,8 +360,9 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname),
getPskNwParams());
auto status_1_2 =
HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname),
getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
auto status = HIDL_INVOKE(hostapd_, removeAccessPoint, ifname);
EXPECT_EQ(
@ -364,8 +378,9 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname),
getPskNwParams());
auto status_1_2 =
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithoutAcs(ifname), getPskNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
auto status = HIDL_INVOKE(hostapd_, removeAccessPoint, ifname);
EXPECT_EQ(
@ -381,8 +396,9 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithInvalidChannel(ifname), getPskNwParams());
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithInvalidChannel(ifname), getPskNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@ -394,8 +410,9 @@ TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname),
getInvalidPskNwParams());
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithoutAcs(ifname), getInvalidPskNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@ -408,7 +425,8 @@ TEST_P(HostapdHidlTest, AddInvalidSaeTransitionAccessPointWithoutAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname),
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithoutAcs(ifname),
getInvalidSaeTransitionNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@ -422,8 +440,9 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname),
getInvalidSaeNwParams());
auto status =
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithoutAcs(ifname), getInvalidSaeNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
@ -433,8 +452,8 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) {
*/
TEST_P(HostapdHidlTest, DisconnectClientWhenIfaceNotAvailable) {
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, kTestZeroMacAddr,
kTestDisconnectReasonCode);
auto status = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname,
kTestZeroMacAddr, kTestDisconnectReasonCode);
EXPECT_EQ(HostapdStatusCode::FAILURE_IFACE_UNKNOWN, status.code);
}
@ -446,12 +465,13 @@ TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) {
if (is_1_3(hostapd_))
GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3";
std::string ifname = setupApIfaceIfNeededAndGetName();
auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname),
getOpenNwParams());
auto status_1_2 =
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
getIfaceParamsWithoutAcs(ifname), getOpenNwParams());
EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
status_1_2 = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, kTestZeroMacAddr,
kTestDisconnectReasonCode);
status_1_2 = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname,
kTestZeroMacAddr, kTestDisconnectReasonCode);
EXPECT_EQ(HostapdStatusCode::FAILURE_CLIENT_UNKNOWN, status_1_2.code);
}