Merge changes from topic 'vts_deps' am: 7d149a564f
am: 7f8774ef80
Change-Id: Ieb521a2e25f9483d68d33a8c9d4b2d957da978c7
diff --git a/audio/2.0/config/audio_policy_configuration.xsd b/audio/2.0/config/audio_policy_configuration.xsd
index 48b9a9b..c94da80 100644
--- a/audio/2.0/config/audio_policy_configuration.xsd
+++ b/audio/2.0/config/audio_policy_configuration.xsd
@@ -188,6 +188,7 @@
<xs:complexType>
<xs:sequence>
<xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="gains" type="gains" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:token" use="required"/>
<xs:attribute name="role" type="role" use="required"/>
@@ -199,6 +200,10 @@
<xs:field xpath="samplingRate"/>
<xs:field xpath="channelMasks"/>
</xs:unique>
+ <xs:unique name="mixPortGainUniqueness">
+ <xs:selector xpath="gains/gain"/>
+ <xs:field xpath="@name"/>
+ </xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
@@ -365,16 +370,42 @@
<xs:attribute name="samplingRates" type="samplingRates" use="required"/>
<xs:attribute name="channelMasks" type="channelMask" use="required"/>
</xs:complexType>
+ <xs:simpleType name="gainMode">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="AUDIO_GAIN_MODE_JOINT"/>
+ <xs:enumeration value="AUDIO_GAIN_MODE_CHANNELS"/>
+ <xs:enumeration value="AUDIO_GAIN_MODE_RAMP"/>
+ </xs:restriction>
+ </xs:simpleType>
+ <xs:complexType name="gains">
+ <xs:sequence>
+ <xs:element name="gain" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:token" use="required"/>
+ <xs:attribute name="mode" type="gainMode" use="required"/>
+ <xs:attribute name="channel_mask" type="channelMask" use="optional"/>
+ <xs:attribute name="minValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="maxValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="defaultValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="stepValueMB" type="xs:int" use="optional"/>
+ <xs:attribute name="minRampMs" type="xs:int" use="optional"/>
+ <xs:attribute name="maxRampMs" type="xs:int" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
<xs:complexType name="devicePorts">
<xs:sequence>
<xs:element name="devicePort" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="profile" type="profile" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="gains" type="gains" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="tagName" type="xs:token" use="required"/>
<xs:attribute name="type" type="audioDevice" use="required"/>
<xs:attribute name="role" type="role" use="required"/>
+ <xs:attribute name="address" type="xs:string" use="optional"/>
</xs:complexType>
<xs:unique name="devicePortProfileUniqueness">
<xs:selector xpath="profile"/>
@@ -382,6 +413,10 @@
<xs:field xpath="samplingRate"/>
<xs:field xpath="channelMasks"/>
</xs:unique>
+ <xs:unique name="devicePortGainUniqueness">
+ <xs:selector xpath="gains/gain"/>
+ <xs:field xpath="@name"/>
+ </xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index 85312c1..14d7c50 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -31,9 +31,14 @@
"libcamera_metadata",
"libbinder",
"libgui",
- "libui"
+ "libui",
+ "libfmq",
],
- static_libs: ["VtsHalHidlTargetTestBase", "libgrallocusage"],
+ static_libs: [
+ "VtsHalHidlTargetTestBase",
+ "libgrallocusage",
+ "android.hardware.camera.common@1.0-helper",
+ ],
cflags: [
"-O0",
"-g",
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index efec7cb..0fc53e2 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -15,29 +15,34 @@
*/
#define LOG_TAG "camera_hidl_hal_test"
-#include <VtsHalHidlTargetTestBase.h>
+
+#include <chrono>
+#include <mutex>
+#include <regex>
+#include <unordered_map>
+#include <condition_variable>
+
+#include <inttypes.h>
+
#include <android/hardware/camera/device/1.0/ICameraDevice.h>
#include <android/hardware/camera/device/3.2/ICameraDevice.h>
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
-#include <android/log.h>
+#include <android/hidl/manager/1.0/IServiceManager.h>
#include <binder/MemoryHeapBase.h>
+#include <CameraMetadata.h>
+#include <CameraParameters.h>
+#include <fmq/MessageQueue.h>
#include <grallocusage/GrallocUsageConversion.h>
#include <gui/BufferItemConsumer.h>
#include <gui/BufferQueue.h>
#include <gui/Surface.h>
#include <hardware/gralloc.h>
#include <hardware/gralloc1.h>
-#include <inttypes.h>
#include <system/camera.h>
+#include <system/camera_metadata.h>
#include <ui/GraphicBuffer.h>
-#include <utils/Errors.h>
-#include <chrono>
-#include <condition_variable>
-#include <mutex>
-#include <regex>
-#include <unordered_map>
-#include "CameraParameters.h"
-#include "system/camera_metadata.h"
+
+#include <VtsHalHidlTargetTestBase.h>
using ::android::hardware::Return;
using ::android::hardware::Void;
@@ -89,8 +94,13 @@
using ::android::hardware::camera::device::V1_0::ICameraDevicePreviewCallback;
using ::android::hardware::camera::device::V1_0::FrameCallbackFlag;
using ::android::hardware::camera::device::V1_0::HandleTimestampMessage;
+using ::android::hardware::MessageQueue;
+using ::android::hardware::kSynchronizedReadWrite;
+using ResultMetadataQueue = MessageQueue<uint8_t, kSynchronizedReadWrite>;
+using ::android::hidl::manager::V1_0::IServiceManager;
const char kCameraPassthroughServiceName[] = "legacy/0";
+const char *kProviderFQName = "android.hardware.camera.provider@2.4::ICameraProvider";
const uint32_t kMaxPreviewWidth = 1920;
const uint32_t kMaxPreviewHeight = 1080;
const uint32_t kMaxVideoWidth = 4096;
@@ -114,25 +124,41 @@
namespace {
// "device@<version>/legacy/<id>"
- const char *kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/legacy/(.+)";
+ const char *kDeviceNameRE = "device@([0-9]+\\.[0-9]+)/%s/(.+)";
const int CAMERA_DEVICE_API_VERSION_3_2 = 0x302;
const int CAMERA_DEVICE_API_VERSION_1_0 = 0x100;
const char *kHAL3_2 = "3.2";
const char *kHAL1_0 = "1.0";
- bool matchDeviceName(const hidl_string& deviceName, std::smatch& sm) {
- std::regex e(kDeviceNameRE);
+ bool matchDeviceName(const hidl_string& deviceName,
+ const hidl_string &providerType,
+ std::string* deviceVersion,
+ std::string* cameraId) {
+ ::android::String8 pattern;
+ pattern.appendFormat(kDeviceNameRE, providerType.c_str());
+ std::regex e(pattern.string());
std::string deviceNameStd(deviceName.c_str());
- return std::regex_match(deviceNameStd, sm, e);
+ std::smatch sm;
+ if (std::regex_match(deviceNameStd, sm, e)) {
+ if (deviceVersion != nullptr) {
+ *deviceVersion = sm[1];
+ }
+ if (cameraId != nullptr) {
+ *cameraId = sm[2];
+ }
+ return true;
+ }
+ return false;
}
- int getCameraDeviceVersion(const hidl_string& deviceName) {
- std::smatch sm;
- bool match = matchDeviceName(deviceName, sm);
+ int getCameraDeviceVersion(const hidl_string& deviceName,
+ const hidl_string &providerType) {
+ std::string version;
+ bool match = matchDeviceName(deviceName, providerType, &version, nullptr);
if (!match) {
return -1;
}
- std::string version = sm[1].str();
+
if (version.compare(kHAL3_2) == 0) {
// maybe switched to 3.4 or define the hidl version enumlater
return CAMERA_DEVICE_API_VERSION_3_2;
@@ -142,6 +168,45 @@
return 0;
}
+ bool parseProviderName(const std::string& name, std::string *type /*out*/,
+ uint32_t *id /*out*/) {
+ if (!type || !id) {
+ ADD_FAILURE();
+ return false;
+ }
+
+ std::string::size_type slashIdx = name.find('/');
+ if (slashIdx == std::string::npos || slashIdx == name.size() - 1) {
+ ADD_FAILURE() << "Provider name does not have / separator between type"
+ "and id";
+ return false;
+ }
+
+ std::string typeVal = name.substr(0, slashIdx);
+
+ char *endPtr;
+ errno = 0;
+ long idVal = strtol(name.c_str() + slashIdx + 1, &endPtr, 10);
+ if (errno != 0) {
+ ADD_FAILURE() << "cannot parse provider id as an integer:" <<
+ name.c_str() << strerror(errno) << errno;
+ return false;
+ }
+ if (endPtr != name.c_str() + name.size()) {
+ ADD_FAILURE() << "provider id has unexpected length " << name.c_str();
+ return false;
+ }
+ if (idVal < 0) {
+ ADD_FAILURE() << "id is negative: " << name.c_str() << idVal;
+ return false;
+ }
+
+ *type = typeVal;
+ *id = static_cast<uint32_t>(idVal);
+
+ return true;
+ }
+
Status mapToStatus(::android::status_t s) {
switch(s) {
case ::android::OK:
@@ -176,7 +241,7 @@
virtual void SetUp() override;
virtual void TearDown() override;
- sp<ICameraProvider> mProvider;
+ std::unordered_map<std::string, sp<ICameraProvider> > mProviders;
private:
CameraHidlEnvironment() {}
@@ -185,11 +250,41 @@
};
void CameraHidlEnvironment::SetUp() {
- // TODO: test the binderized mode
- mProvider = ::testing::VtsHalHidlTargetTestBase::getService<ICameraProvider>(kCameraPassthroughServiceName);
- // TODO: handle the device doesn't have any camera case
- ALOGI_IF(mProvider, "provider is not nullptr, %p", mProvider.get());
- ASSERT_NE(mProvider, nullptr);
+ sp<IServiceManager> manager = IServiceManager::getService();
+ ASSERT_NE(manager, nullptr);
+
+ manager->listByInterface(kProviderFQName,
+ [this](const hidl_vec<hidl_string> ®istered) {
+ std::string name;
+ uint32_t id;
+ sp<ICameraProvider> provider = nullptr;
+ for (size_t i = 0; i < registered.size(); i++) {
+ ASSERT_TRUE(parseProviderName(registered[i],
+ &name /*out*/, &id /*out*/));
+ provider = ICameraProvider::tryGetService(registered[i]);
+ ALOGI_IF(provider, "provider is not nullptr, %p", provider.get());
+ if (nullptr != provider.get()) {
+ mProviders.emplace(name, provider);
+ }
+ }
+ });
+
+
+ std::string legacyName;
+ uint32_t legacyId;
+ ASSERT_TRUE(parseProviderName(kCameraPassthroughServiceName,
+ &legacyName /*out*/, &legacyId /*out*/));
+ auto legacyIt = mProviders.find(legacyName);
+ //Add any legacy passthrough implementations
+ if (legacyIt == mProviders.end()) {
+ sp<ICameraProvider> provider = ICameraProvider::tryGetService(
+ kCameraPassthroughServiceName);
+ if (nullptr != provider.get()) {
+ mProviders.emplace(legacyName, provider);
+ }
+ }
+
+ ASSERT_FALSE(mProviders.empty());
}
void CameraHidlEnvironment::TearDown() {
@@ -253,9 +348,7 @@
size_t result = 1;
result = 31 * result + buf->numFds;
- result = 31 * result + buf->numInts;
- int length = buf->numFds + buf->numInts;
- for (int i = 0; i < length; i++) {
+ for (int i = 0; i < buf->numFds; i++) {
result = 31 * result + buf->data[i];
}
return result;
@@ -265,10 +358,8 @@
struct BufferComparator {
bool operator()(const buffer_handle_t& buf1,
const buffer_handle_t& buf2) const {
- if ((buf1->numFds == buf2->numFds) &&
- (buf1->numInts == buf2->numInts)) {
- int length = buf1->numFds + buf1->numInts;
- for (int i = 0; i < length; i++) {
+ if (buf1->numFds == buf2->numFds) {
+ for (int i = 0; i < buf1->numFds; i++) {
if (buf1->data[i] != buf2->data[i]) {
return false;
}
@@ -445,7 +536,7 @@
virtual void SetUp() override {}
virtual void TearDown() override {}
- hidl_vec<hidl_string> getCameraDeviceNames();
+ hidl_vec<hidl_string> getCameraDeviceNames(sp<ICameraProvider> provider);
struct EmptyDeviceCb : public ICameraDeviceCallback {
virtual Return<void> processCaptureResult(const hidl_vec<CaptureResult>& /*results*/) override {
@@ -521,7 +612,7 @@
CameraHidlTest *mParent; // Parent object
};
- void openCameraDevice(const std::string &name,const CameraHidlEnvironment* env,
+ void openCameraDevice(const std::string &name, sp<ICameraProvider> provider,
sp<::android::hardware::camera::device::V1_0::ICameraDevice> *device /*out*/);
void setupPreviewWindow(
const sp<::android::hardware::camera::device::V1_0::ICameraDevice> &device,
@@ -544,15 +635,17 @@
void waitForFrameLocked(DataCallbackMsg msgFrame,
std::unique_lock<std::mutex> &l);
void openEmptyDeviceSession(const std::string &name,
- const CameraHidlEnvironment* env,
+ sp<ICameraProvider> provider,
sp<ICameraDeviceSession> *session /*out*/,
camera_metadata_t **staticMeta /*out*/);
void configurePreviewStream(const std::string &name,
- const CameraHidlEnvironment* env,
+ sp<ICameraProvider> provider,
const AvailableStream *previewThreshold,
sp<ICameraDeviceSession> *session /*out*/,
Stream *previewStream /*out*/,
- HalStreamConfiguration *halStreamConfig /*out*/);
+ HalStreamConfiguration *halStreamConfig /*out*/,
+ bool *supportsPartialResults /*out*/,
+ uint32_t *partialResultCount /*out*/);
static Status getAvailableOutputStreams(camera_metadata_t *staticMeta,
std::vector<AvailableStream> &outputStreams,
const AvailableStream *threshold = nullptr);
@@ -569,11 +662,75 @@
::android::CameraParameters &cameraParams, const char *mode) ;
protected:
+
+ // In-flight queue for tracking completion of capture requests.
+ struct InFlightRequest {
+ // Set by notify() SHUTTER call.
+ nsecs_t shutterTimestamp;
+
+ bool errorCodeValid;
+ ErrorCode errorCode;
+
+ //Is partial result supported
+ bool usePartialResult;
+
+ //Partial result count expected
+ uint32_t numPartialResults;
+
+ // Message queue
+ std::shared_ptr<ResultMetadataQueue> resultQueue;
+
+ // Set by process_capture_result call with valid metadata
+ bool haveResultMetadata;
+
+ // Decremented by calls to process_capture_result with valid output
+ // and input buffers
+ ssize_t numBuffersLeft;
+
+ // A 64bit integer to index the frame number associated with this result.
+ int64_t frameNumber;
+
+ // The partial result count (index) for this capture result.
+ int32_t partialResultCount;
+
+ // For buffer drop errors, the stream ID for the stream that lost a buffer.
+ // Otherwise -1.
+ int32_t errorStreamId;
+
+ // If this request has any input buffer
+ bool hasInputBuffer;
+
+ // Result metadata
+ ::android::hardware::camera::common::V1_0::helper::CameraMetadata collectedResult;
+
+ // Buffers are added by process_capture_result when output buffers
+ // return from HAL but framework.
+ ::android::Vector<StreamBuffer> resultOutputBuffers;
+
+ InFlightRequest(ssize_t numBuffers, bool hasInput,
+ bool partialResults, uint32_t partialCount,
+ std::shared_ptr<ResultMetadataQueue> queue = nullptr) :
+ shutterTimestamp(0),
+ errorCodeValid(false),
+ errorCode(ErrorCode::ERROR_BUFFER),
+ usePartialResult(partialResults),
+ numPartialResults(partialCount),
+ resultQueue(queue),
+ haveResultMetadata(false),
+ numBuffersLeft(numBuffers),
+ frameNumber(0),
+ partialResultCount(0),
+ errorStreamId(-1),
+ hasInputBuffer(hasInput) {}
+ };
+
+ // Map from frame number to the in-flight request state
+ typedef ::android::KeyedVector<uint32_t, InFlightRequest*> InFlightMap;
+
std::mutex mLock; // Synchronize access to member variables
std::condition_variable mResultCondition; // Condition variable for incoming results
- uint32_t mResultFrameNumber; // Expected result frame number
- std::vector<StreamBuffer> mResultBuffers; // Holds stream buffers from capture result
- std::vector<ErrorMsg> mErrors; // Holds incoming error notifications
+ InFlightMap mInflightMap; // Map of all inflight requests
+
DataCallbackMsg mDataMessageTypeReceived; // Most recent message type received through data callbacks
uint32_t mVideoBufferIndex; // Buffer index of the most recent video buffer
uint32_t mVideoData; // Buffer data of the most recent video buffer
@@ -696,53 +853,180 @@
return Void();
}
+ bool notify = false;
std::unique_lock<std::mutex> l(mParent->mLock);
- const CaptureResult& result = results[0];
+ for (size_t i = 0 ; i < results.size(); i++) {
+ uint32_t frameNumber = results[i].frameNumber;
- if(mParent->mResultFrameNumber != result.frameNumber) {
- ALOGE("%s: Unexpected frame number! Expected: %u received: %u",
- __func__, mParent->mResultFrameNumber, result.frameNumber);
- ADD_FAILURE();
+ if ((results[i].result.size() == 0) &&
+ (results[i].outputBuffers.size() == 0) &&
+ (results[i].inputBuffer.buffer == nullptr) &&
+ (results[i].fmqResultSize == 0)) {
+ ALOGE("%s: No result data provided by HAL for frame %d result count: %d",
+ __func__, frameNumber, (int) results[i].fmqResultSize);
+ ADD_FAILURE();
+ break;
+ }
+
+ ssize_t idx = mParent->mInflightMap.indexOfKey(frameNumber);
+ if (::android::NAME_NOT_FOUND == idx) {
+ ALOGE("%s: Unexpected frame number! received: %u",
+ __func__, frameNumber);
+ ADD_FAILURE();
+ break;
+ }
+
+ bool isPartialResult = false;
+ bool hasInputBufferInRequest = false;
+ InFlightRequest *request = mParent->mInflightMap.editValueAt(idx);
+ ::android::hardware::camera::device::V3_2::CameraMetadata resultMetadata;
+ size_t resultSize = 0;
+ if (results[i].fmqResultSize > 0) {
+ resultMetadata.resize(results[i].fmqResultSize);
+ if (request->resultQueue == nullptr) {
+ ADD_FAILURE();
+ break;
+ }
+ if (!request->resultQueue->read(resultMetadata.data(),
+ results[i].fmqResultSize)) {
+ ALOGE("%s: Frame %d: Cannot read camera metadata from fmq,"
+ "size = %" PRIu64, __func__, frameNumber,
+ results[i].fmqResultSize);
+ ADD_FAILURE();
+ break;
+ }
+ resultSize = resultMetadata.size();
+ } else if (results[i].result.size() > 0) {
+ resultMetadata.setToExternal(const_cast<uint8_t *>(
+ results[i].result.data()), results[i].result.size());
+ resultSize = resultMetadata.size();
+ }
+
+ if (!request->usePartialResult && (resultSize > 0) &&
+ (results[i].partialResult != 1)) {
+ ALOGE("%s: Result is malformed for frame %d: partial_result %u "
+ "must be 1 if partial result is not supported", __func__,
+ frameNumber, results[i].partialResult);
+ ADD_FAILURE();
+ break;
+ }
+
+ if (results[i].partialResult != 0) {
+ request->partialResultCount = results[i].partialResult;
+ }
+
+ // Check if this result carries only partial metadata
+ if (request->usePartialResult && (resultSize > 0)) {
+ if ((results[i].partialResult > request->numPartialResults) ||
+ (results[i].partialResult < 1)) {
+ ALOGE("%s: Result is malformed for frame %d: partial_result %u"
+ " must be in the range of [1, %d] when metadata is "
+ "included in the result", __func__, frameNumber,
+ results[i].partialResult, request->numPartialResults);
+ ADD_FAILURE();
+ break;
+ }
+ request->collectedResult.append(
+ reinterpret_cast<const camera_metadata_t*>(
+ resultMetadata.data()));
+
+ isPartialResult =
+ (results[i].partialResult < request->numPartialResults);
+ }
+
+ hasInputBufferInRequest = request->hasInputBuffer;
+
+ // Did we get the (final) result metadata for this capture?
+ if ((resultSize > 0) && !isPartialResult) {
+ if (request->haveResultMetadata) {
+ ALOGE("%s: Called multiple times with metadata for frame %d",
+ __func__, frameNumber);
+ ADD_FAILURE();
+ break;
+ }
+ request->haveResultMetadata = true;
+ request->collectedResult.sort();
+ }
+
+ uint32_t numBuffersReturned = results[i].outputBuffers.size();
+ if (results[i].inputBuffer.buffer != nullptr) {
+ if (hasInputBufferInRequest) {
+ numBuffersReturned += 1;
+ } else {
+ ALOGW("%s: Input buffer should be NULL if there is no input"
+ " buffer sent in the request", __func__);
+ }
+ }
+ request->numBuffersLeft -= numBuffersReturned;
+ if (request->numBuffersLeft < 0) {
+ ALOGE("%s: Too many buffers returned for frame %d", __func__,
+ frameNumber);
+ ADD_FAILURE();
+ break;
+ }
+
+ request->resultOutputBuffers.appendArray(results[i].outputBuffers.data(),
+ results[i].outputBuffers.size());
+ // If shutter event is received notify the pending threads.
+ if (request->shutterTimestamp != 0) {
+ notify = true;
+ }
}
- size_t resultLength = result.outputBuffers.size();
- for (size_t i = 0; i < resultLength; i++) {
- mParent->mResultBuffers.push_back(result.outputBuffers[i]);
- }
-
- // TODO(epeev): Handle partial results in case client supports them and
- // verify the result against request settings.
-
l.unlock();
- mParent->mResultCondition.notify_one();
+ if (notify) {
+ mParent->mResultCondition.notify_one();
+ }
return Void();
}
Return<void> CameraHidlTest::DeviceCb::notify(
const hidl_vec<NotifyMsg>& messages) {
- const NotifyMsg& message = messages[0];
+ std::lock_guard<std::mutex> l(mParent->mLock);
- if (MsgType::ERROR == message.type) {
- {
- std::lock_guard<std::mutex> l(mParent->mLock);
- mParent->mErrors.push_back(message.msg.error);
+ for (size_t i = 0; i < messages.size(); i++) {
+ ssize_t idx = mParent->mInflightMap.indexOfKey(
+ messages[i].msg.shutter.frameNumber);
+ if (::android::NAME_NOT_FOUND == idx) {
+ ALOGE("%s: Unexpected frame number! received: %u",
+ __func__, messages[i].msg.shutter.frameNumber);
+ ADD_FAILURE();
+ break;
}
+ InFlightRequest *r = mParent->mInflightMap.editValueAt(idx);
- if ((ErrorCode::ERROR_REQUEST == message.msg.error.errorCode)
- || (ErrorCode::ERROR_BUFFER == message.msg.error.errorCode)) {
- mParent->mResultCondition.notify_one();
+ switch(messages[i].type) {
+ case MsgType::ERROR:
+ if (ErrorCode::ERROR_DEVICE == messages[i].msg.error.errorCode) {
+ ALOGE("%s: Camera reported serious device error",
+ __func__);
+ ADD_FAILURE();
+ } else {
+ r->errorCodeValid = true;
+ r->errorCode = messages[i].msg.error.errorCode;
+ r->errorStreamId = messages[i].msg.error.errorStreamId;
+ }
+ break;
+ case MsgType::SHUTTER:
+ r->shutterTimestamp = messages[i].msg.shutter.timestamp;
+ break;
+ default:
+ ALOGE("%s: Unsupported notify message %d", __func__,
+ messages[i].type);
+ ADD_FAILURE();
+ break;
}
}
+ mParent->mResultCondition.notify_one();
return Void();
}
-hidl_vec<hidl_string> CameraHidlTest::getCameraDeviceNames() {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
+hidl_vec<hidl_string> CameraHidlTest::getCameraDeviceNames(sp<ICameraProvider> provider) {
hidl_vec<hidl_string> cameraDeviceNames;
Return<void> ret;
- ret = env->mProvider->getCameraIdList(
+ ret = provider->getCameraIdList(
[&](auto status, const auto& idList) {
ALOGI("getCameraIdList returns status:%d", (int)status);
for (size_t i = 0; i < idList.size(); i++) {
@@ -760,58 +1044,63 @@
// Test if ICameraProvider::isTorchModeSupported returns Status::OK
TEST_F(CameraHidlTest, isTorchModeSupported) {
Return<void> ret;
- ret = CameraHidlEnvironment::Instance()->mProvider->isSetTorchModeSupported(
- [&](auto status, bool support) {
- ALOGI("isSetTorchModeSupported returns status:%d supported:%d",
- (int)status, support);
- ASSERT_EQ(Status::OK, status);
- });
- ASSERT_TRUE(ret.isOk());
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ ret = provider.second->isSetTorchModeSupported(
+ [&](auto status, bool support) {
+ ALOGI("isSetTorchModeSupported returns status:%d supported:%d",
+ (int)status, support);
+ ASSERT_EQ(Status::OK, status);
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
// TODO: consider removing this test if getCameraDeviceNames() has the same coverage
TEST_F(CameraHidlTest, getCameraIdList) {
Return<void> ret;
- ret = CameraHidlEnvironment::Instance()->mProvider->getCameraIdList(
- [&](auto status, const auto& idList) {
- ALOGI("getCameraIdList returns status:%d", (int)status);
- for (size_t i = 0; i < idList.size(); i++) {
- ALOGI("Camera Id[%zu] is %s", i, idList[i].c_str());
- }
- ASSERT_EQ(Status::OK, status);
- // This is true for internal camera provider.
- // Not necessary hold for external cameras providers
- ASSERT_GT(idList.size(), 0u);
- });
- ASSERT_TRUE(ret.isOk());
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ ret = provider.second->getCameraIdList(
+ [&](auto status, const auto& idList) {
+ ALOGI("getCameraIdList returns status:%d", (int)status);
+ for (size_t i = 0; i < idList.size(); i++) {
+ ALOGI("Camera Id[%zu] is %s", i, idList[i].c_str());
+ }
+ ASSERT_EQ(Status::OK, status);
+ // This is true for internal camera provider.
+ // Not necessary hold for external cameras providers
+ ASSERT_GT(idList.size(), 0u);
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
// Test if ICameraProvider::getVendorTags returns Status::OK
TEST_F(CameraHidlTest, getVendorTags) {
Return<void> ret;
- ret = CameraHidlEnvironment::Instance()->mProvider->getVendorTags(
- [&](auto status, const auto& vendorTagSecs) {
- ALOGI("getVendorTags returns status:%d numSections %zu",
- (int)status, vendorTagSecs.size());
- for (size_t i = 0; i < vendorTagSecs.size(); i++) {
- ALOGI("Vendor tag section %zu name %s",
- i, vendorTagSecs[i].sectionName.c_str());
- for (size_t j = 0; j < vendorTagSecs[i].tags.size(); j++) {
- const auto& tag = vendorTagSecs[i].tags[j];
- ALOGI("Vendor tag id %u name %s type %d",
- tag.tagId,
- tag.tagName.c_str(),
- (int) tag.tagType);
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ ret = provider.second->getVendorTags(
+ [&](auto status, const auto& vendorTagSecs) {
+ ALOGI("getVendorTags returns status:%d numSections %zu",
+ (int)status, vendorTagSecs.size());
+ for (size_t i = 0; i < vendorTagSecs.size(); i++) {
+ ALOGI("Vendor tag section %zu name %s",
+ i, vendorTagSecs[i].sectionName.c_str());
+ for (size_t j = 0; j < vendorTagSecs[i].tags.size(); j++) {
+ const auto& tag = vendorTagSecs[i].tags[j];
+ ALOGI("Vendor tag id %u name %s type %d",
+ tag.tagId,
+ tag.tagName.c_str(),
+ (int) tag.tagType);
+ }
}
- }
- ASSERT_EQ(Status::OK, status);
- });
- ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Status::OK, status);
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
// Test if ICameraProvider::setCallback returns Status::OK
TEST_F(CameraHidlTest, setCallback) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
struct ProviderCb : public ICameraProviderCallback {
virtual Return<void> cameraDeviceStatusChange(
const hidl_string& cameraDeviceName,
@@ -830,37 +1119,49 @@
}
};
sp<ProviderCb> cb = new ProviderCb;
- auto status = env->mProvider->setCallback(cb);
- ASSERT_TRUE(status.isOk());
- ASSERT_EQ(Status::OK, status);
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ auto status = provider.second->setCallback(cb);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_EQ(Status::OK, status);
+ // Reset callback since cb will go out of scope
+ status = provider.second->setCallback(nullptr);
+ ASSERT_TRUE(status.isOk());
+ ASSERT_EQ(Status::OK, status);
+ }
}
// Test if ICameraProvider::getCameraDeviceInterface returns Status::OK and non-null device
TEST_F(CameraHidlTest, getCameraDeviceInterface) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V3_x(
- name,
- [&](auto status, const auto& device3_2) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device3_2, nullptr);
- });
- ASSERT_TRUE(ret.isOk());
- } else if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V1_x(
- name,
- [&](auto status, const auto& device1) {
- ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device1, nullptr);
- });
- ASSERT_TRUE(ret.isOk());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ Return<void> ret;
+ ret = provider.second->getCameraDeviceInterface_V3_x(
+ name,
+ [&](auto status, const auto& device3_2) {
+ ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device3_2, nullptr);
+ });
+ ASSERT_TRUE(ret.isOk());
+ } else if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ Return<void> ret;
+ ret = provider.second->getCameraDeviceInterface_V1_x(
+ name,
+ [&](auto status, const auto& device1) {
+ ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device1, nullptr);
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
@@ -868,60 +1169,66 @@
// Verify that the device resource cost can be retrieved and the values are
// sane.
TEST_F(CameraHidlTest, getResourceCost) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
- ALOGI("getResourceCost: Testing camera device %s", name.c_str());
- Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V3_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device3_2 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+ ALOGI("getResourceCost: Testing camera device %s", name.c_str());
+ Return<void> ret;
+ ret = provider.second->getCameraDeviceInterface_V3_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device3_2 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- ret = device3_2->getResourceCost(
- [&](auto status, const auto& resourceCost) {
- ALOGI("getResourceCost returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ALOGI(" Resource cost is %d", resourceCost.resourceCost);
- ASSERT_LE(resourceCost.resourceCost, 100u);
- for (const auto& name : resourceCost.conflictingDevices) {
- ALOGI(" Conflicting device: %s", name.c_str());
- }
- });
- ASSERT_TRUE(ret.isOk());
- } else {
- ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- ALOGI("getResourceCost: Testing camera device %s", name.c_str());
- Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V1_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device1 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ ret = device3_2->getResourceCost(
+ [&](auto status, const auto& resourceCost) {
+ ALOGI("getResourceCost returns status:%d", (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ALOGI(" Resource cost is %d", resourceCost.resourceCost);
+ ASSERT_LE(resourceCost.resourceCost, 100u);
+ for (const auto& name : resourceCost.conflictingDevices) {
+ ALOGI(" Conflicting device: %s", name.c_str());
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ } else {
+ ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ ALOGI("getResourceCost: Testing camera device %s", name.c_str());
+ Return<void> ret;
+ ret = provider.second->getCameraDeviceInterface_V1_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device1 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- ret = device1->getResourceCost(
- [&](auto status, const auto& resourceCost) {
- ALOGI("getResourceCost returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ALOGI(" Resource cost is %d", resourceCost.resourceCost);
- ASSERT_LE(resourceCost.resourceCost, 100u);
- for (const auto& name : resourceCost.conflictingDevices) {
- ALOGI(" Conflicting device: %s", name.c_str());
- }
- });
- ASSERT_TRUE(ret.isOk());
+ ret = device1->getResourceCost(
+ [&](auto status, const auto& resourceCost) {
+ ALOGI("getResourceCost returns status:%d", (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ALOGI(" Resource cost is %d",
+ resourceCost.resourceCost);
+ ASSERT_LE(resourceCost.resourceCost, 100u);
+ for (const auto& name : resourceCost.conflictingDevices) {
+ ALOGI(" Conflicting device: %s", name.c_str());
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
@@ -929,126 +1236,143 @@
// Verify that the static camera info can be retrieved
// successfully.
TEST_F(CameraHidlTest, getCameraInfo) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- ALOGI("getCameraCharacteristics: Testing camera device %s", name.c_str());
- Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V1_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device1 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ ALOGI("getCameraCharacteristics: Testing camera device %s",
+ name.c_str());
+ Return<void> ret;
+ ret = provider.second->getCameraDeviceInterface_V1_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device1 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- ret = device1->getCameraInfo(
- [&](auto status, const auto& info) {
- ALOGI("getCameraInfo returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- switch(info.orientation) {
- case 0:
- case 90:
- case 180:
- case 270:
- //Expected cases
- ALOGI("camera orientation: %d", info.orientation);
- break;
- default:
- FAIL() << "Unexpected camera orientation:" << info.orientation;
- }
- switch(info.facing) {
- case CameraFacing::BACK:
- case CameraFacing::FRONT:
- case CameraFacing::EXTERNAL:
- //Expected cases
- ALOGI("camera facing: %d", info.facing);
- break;
- default:
- FAIL() << "Unexpected camera facing:" << static_cast<uint32_t> (info.facing);
- }
- });
- ASSERT_TRUE(ret.isOk());
+ ret = device1->getCameraInfo(
+ [&](auto status, const auto& info) {
+ ALOGI("getCameraInfo returns status:%d", (int)status);
+ ASSERT_EQ(Status::OK, status);
+ switch(info.orientation) {
+ case 0:
+ case 90:
+ case 180:
+ case 270:
+ //Expected cases
+ ALOGI("camera orientation: %d", info.orientation);
+ break;
+ default:
+ FAIL() << "Unexpected camera orientation:" << info.orientation;
+ }
+ switch(info.facing) {
+ case CameraFacing::BACK:
+ case CameraFacing::FRONT:
+ case CameraFacing::EXTERNAL:
+ //Expected cases
+ ALOGI("camera facing: %d", info.facing);
+ break;
+ default:
+ FAIL() << "Unexpected camera facing:" << static_cast<uint32_t> (
+ info.facing);
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
// Check whether preview window can be configured
TEST_F(CameraHidlTest, setPreviewWindow) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1,
- &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1,
+ &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
- Return<void> ret;
- ret = device1->close();
- ASSERT_TRUE(ret.isOk());
+ Return<void> ret;
+ ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
// Verify that setting preview window fails in case device is not open
TEST_F(CameraHidlTest, setPreviewWindowInvalid) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- ALOGI("getCameraCharacteristics: Testing camera device %s", name.c_str());
- Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V1_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device1 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ ALOGI("getCameraCharacteristics: Testing camera device %s",
+ name.c_str());
+ Return<void> ret;
+ ret = provider.second->getCameraDeviceInterface_V1_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device1 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- Return<Status> returnStatus = device1->setPreviewWindow(nullptr);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OPERATION_NOT_SUPPORTED, returnStatus);
+ Return<Status> returnStatus = device1->setPreviewWindow(nullptr);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OPERATION_NOT_SUPPORTED, returnStatus);
+ }
}
}
}
// Start and stop preview checking whether it gets enabled in between.
TEST_F(CameraHidlTest, startStopPreview) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1,
- &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1,
+ &bufferItemConsumer /*out*/, &bufferHandler /*out*/);
- startPreview(device1);
+ startPreview(device1);
- Return<bool> returnBoolStatus = device1->previewEnabled();
- ASSERT_TRUE(returnBoolStatus.isOk());
- ASSERT_TRUE(returnBoolStatus);
+ Return<bool> returnBoolStatus = device1->previewEnabled();
+ ASSERT_TRUE(returnBoolStatus.isOk());
+ ASSERT_TRUE(returnBoolStatus);
- stopPreviewAndClose(device1);
+ stopPreviewAndClose(device1);
+ }
}
}
}
@@ -1056,599 +1380,646 @@
// Start preview without active preview window. Preview should start as soon
// as a valid active window gets configured.
TEST_F(CameraHidlTest, startStopPreviewDelayed) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
- Return<Status> returnStatus = device1->setPreviewWindow(nullptr);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
+ Return<Status> returnStatus = device1->setPreviewWindow(nullptr);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
- startPreview(device1);
+ startPreview(device1);
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
- &bufferHandler /*out*/);
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
+ &bufferHandler /*out*/);
- //Preview should get enabled now
- Return<bool> returnBoolStatus = device1->previewEnabled();
- ASSERT_TRUE(returnBoolStatus.isOk());
- ASSERT_TRUE(returnBoolStatus);
+ //Preview should get enabled now
+ Return<bool> returnBoolStatus = device1->previewEnabled();
+ ASSERT_TRUE(returnBoolStatus.isOk());
+ ASSERT_TRUE(returnBoolStatus);
- stopPreviewAndClose(device1);
+ stopPreviewAndClose(device1);
+ }
}
}
}
// Verify that image capture behaves as expected along with preview callbacks.
TEST_F(CameraHidlTest, takePicture) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
- &bufferHandler /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
+ &bufferHandler /*out*/);
- {
- std::unique_lock<std::mutex> l(mLock);
- mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
+ }
+
+ enableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME,
+ device1);
+ startPreview(device1);
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ waitForFrameLocked(DataCallbackMsg::PREVIEW_FRAME, l);
+ }
+
+ disableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME,
+ device1);
+ enableMsgType((unsigned int)DataCallbackMsg::COMPRESSED_IMAGE,
+ device1);
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
+ }
+
+ Return<Status> returnStatus = device1->takePicture();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ waitForFrameLocked(DataCallbackMsg::COMPRESSED_IMAGE, l);
+ }
+
+ disableMsgType((unsigned int)DataCallbackMsg::COMPRESSED_IMAGE,
+ device1);
+ stopPreviewAndClose(device1);
}
-
- enableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME, device1);
- startPreview(device1);
-
- {
- std::unique_lock<std::mutex> l(mLock);
- waitForFrameLocked(DataCallbackMsg::PREVIEW_FRAME, l);
- }
-
- disableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME,
- device1);
- enableMsgType((unsigned int)DataCallbackMsg::COMPRESSED_IMAGE,
- device1);
-
- {
- std::unique_lock<std::mutex> l(mLock);
- mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
- }
-
- Return<Status> returnStatus = device1->takePicture();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
-
- {
- std::unique_lock<std::mutex> l(mLock);
- waitForFrameLocked(DataCallbackMsg::COMPRESSED_IMAGE, l);
- }
-
- disableMsgType((unsigned int)DataCallbackMsg::COMPRESSED_IMAGE,
- device1);
- stopPreviewAndClose(device1);
}
}
}
// Image capture should fail in case preview didn't get enabled first.
TEST_F(CameraHidlTest, takePictureFail) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
- Return<Status> returnStatus = device1->takePicture();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_NE(Status::OK, returnStatus);
+ Return<Status> returnStatus = device1->takePicture();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_NE(Status::OK, returnStatus);
- Return<void> ret = device1->close();
- ASSERT_TRUE(ret.isOk());
+ Return<void> ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
// Verify that image capture can be cancelled.
TEST_F(CameraHidlTest, cancelPicture) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
- &bufferHandler /*out*/);
- startPreview(device1);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
+ &bufferHandler /*out*/);
+ startPreview(device1);
- Return<Status> returnStatus = device1->takePicture();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
+ Return<Status> returnStatus = device1->takePicture();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
- returnStatus = device1->cancelPicture();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
+ returnStatus = device1->cancelPicture();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
- stopPreviewAndClose(device1);
+ stopPreviewAndClose(device1);
+ }
}
}
}
// Image capture cancel should fail when image capture is not running.
TEST_F(CameraHidlTest, cancelPictureFail) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
- &bufferHandler /*out*/);
- startPreview(device1);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
+ &bufferHandler /*out*/);
+ startPreview(device1);
- Return<Status> returnStatus = device1->cancelPicture();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_NE(Status::OK, returnStatus);
+ Return<Status> returnStatus = device1->cancelPicture();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_NE(Status::OK, returnStatus);
- stopPreviewAndClose(device1);
+ stopPreviewAndClose(device1);
+ }
}
}
}
// Test basic video recording.
TEST_F(CameraHidlTest, startStopRecording) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
- &bufferHandler /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
+ &bufferHandler /*out*/);
- {
- std::unique_lock<std::mutex> l(mLock);
- mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
- }
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
+ }
- enableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME, device1);
- startPreview(device1);
-
- {
- std::unique_lock<std::mutex> l(mLock);
- waitForFrameLocked(DataCallbackMsg::PREVIEW_FRAME, l);
- mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
- mVideoBufferIndex = UINT32_MAX;
- }
-
- disableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME, device1);
-
- bool videoMetaEnabled = false;
- Return<Status> returnStatus = device1->storeMetaDataInBuffers(true);
- ASSERT_TRUE(returnStatus.isOk());
- // It is allowed for devices to not support this feature
- ASSERT_TRUE((Status::OK == returnStatus) ||
- (Status::OPERATION_NOT_SUPPORTED == returnStatus));
- if (Status::OK == returnStatus) {
- videoMetaEnabled = true;
- }
-
- enableMsgType((unsigned int)DataCallbackMsg::VIDEO_FRAME, device1);
- Return<bool> returnBoolStatus = device1->recordingEnabled();
- ASSERT_TRUE(returnBoolStatus.isOk());
- ASSERT_FALSE(returnBoolStatus);
-
- returnStatus = device1->startRecording();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
-
- {
- std::unique_lock<std::mutex> l(mLock);
- waitForFrameLocked(DataCallbackMsg::VIDEO_FRAME, l);
- ASSERT_NE(UINT32_MAX, mVideoBufferIndex);
- disableMsgType((unsigned int)DataCallbackMsg::VIDEO_FRAME,
+ enableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME,
device1);
- }
+ startPreview(device1);
- returnBoolStatus = device1->recordingEnabled();
- ASSERT_TRUE(returnBoolStatus.isOk());
- ASSERT_TRUE(returnBoolStatus);
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ waitForFrameLocked(DataCallbackMsg::PREVIEW_FRAME, l);
+ mDataMessageTypeReceived = DataCallbackMsg::RAW_IMAGE_NOTIFY;
+ mVideoBufferIndex = UINT32_MAX;
+ }
- Return<void> ret;
- if (videoMetaEnabled) {
- ret = device1->releaseRecordingFrameHandle(mVideoData,
- mVideoBufferIndex, mVideoNativeHandle);
+ disableMsgType((unsigned int)DataCallbackMsg::PREVIEW_FRAME,
+ device1);
+
+ bool videoMetaEnabled = false;
+ Return<Status> returnStatus = device1->storeMetaDataInBuffers(
+ true);
+ ASSERT_TRUE(returnStatus.isOk());
+ // It is allowed for devices to not support this feature
+ ASSERT_TRUE((Status::OK == returnStatus) ||
+ (Status::OPERATION_NOT_SUPPORTED == returnStatus));
+ if (Status::OK == returnStatus) {
+ videoMetaEnabled = true;
+ }
+
+ enableMsgType((unsigned int)DataCallbackMsg::VIDEO_FRAME,
+ device1);
+ Return<bool> returnBoolStatus = device1->recordingEnabled();
+ ASSERT_TRUE(returnBoolStatus.isOk());
+ ASSERT_FALSE(returnBoolStatus);
+
+ returnStatus = device1->startRecording();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ waitForFrameLocked(DataCallbackMsg::VIDEO_FRAME, l);
+ ASSERT_NE(UINT32_MAX, mVideoBufferIndex);
+ disableMsgType((unsigned int)DataCallbackMsg::VIDEO_FRAME,
+ device1);
+ }
+
+ returnBoolStatus = device1->recordingEnabled();
+ ASSERT_TRUE(returnBoolStatus.isOk());
+ ASSERT_TRUE(returnBoolStatus);
+
+ Return<void> ret;
+ if (videoMetaEnabled) {
+ ret = device1->releaseRecordingFrameHandle(mVideoData,
+ mVideoBufferIndex, mVideoNativeHandle);
+ ASSERT_TRUE(ret.isOk());
+ } else {
+ ret = device1->releaseRecordingFrame(mVideoData,
+ mVideoBufferIndex);
+ ASSERT_TRUE(ret.isOk());
+ }
+
+ ret = device1->stopRecording();
ASSERT_TRUE(ret.isOk());
- } else {
- ret = device1->releaseRecordingFrame(mVideoData, mVideoBufferIndex);
- ASSERT_TRUE(ret.isOk());
+
+ stopPreviewAndClose(device1);
}
-
- ret = device1->stopRecording();
- ASSERT_TRUE(ret.isOk());
-
- stopPreviewAndClose(device1);
}
}
}
// It shouldn't be possible to start recording without enabling preview first.
TEST_F(CameraHidlTest, startRecordingFail) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
- Return<bool> returnBoolStatus = device1->recordingEnabled();
- ASSERT_TRUE(returnBoolStatus.isOk());
- ASSERT_FALSE(returnBoolStatus);
+ Return<bool> returnBoolStatus = device1->recordingEnabled();
+ ASSERT_TRUE(returnBoolStatus.isOk());
+ ASSERT_FALSE(returnBoolStatus);
- Return<Status> returnStatus = device1->startRecording();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_NE(Status::OK, returnStatus);
+ Return<Status> returnStatus = device1->startRecording();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_NE(Status::OK, returnStatus);
- Return<void> ret = device1->close();
- ASSERT_TRUE(ret.isOk());
+ Return<void> ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
// Check autofocus support if available.
TEST_F(CameraHidlTest, autoFocus) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<const char *> focusModes = {CameraParameters::FOCUS_MODE_AUTO,
- CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE,
- CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO};
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<const char *> focusModes = {CameraParameters::FOCUS_MODE_AUTO,
+ CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE,
+ CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO};
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
- getParameters(device1, &cameraParams /*out*/);
+ ::android::CameraParameters cameraParams;
+ getParameters(device1, &cameraParams /*out*/);
- if (Status::OK != isAutoFocusModeAvailable(cameraParams,
- CameraParameters::FOCUS_MODE_AUTO)) {
- Return<void> ret = device1->close();
- ASSERT_TRUE(ret.isOk());
- continue;
- }
-
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
- &bufferHandler /*out*/);
- startPreview(device1);
- enableMsgType((unsigned int)NotifyCallbackMsg::FOCUS, device1);
-
- for (auto &iter : focusModes) {
if (Status::OK != isAutoFocusModeAvailable(cameraParams,
- iter)) {
+ CameraParameters::FOCUS_MODE_AUTO)) {
+ Return<void> ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
continue;
}
- cameraParams.set(CameraParameters::KEY_FOCUS_MODE, iter);
- setParameters(device1, cameraParams);
- {
- std::unique_lock<std::mutex> l(mLock);
- mNotifyMessage = NotifyCallbackMsg::ERROR;
- }
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
+ &bufferHandler /*out*/);
+ startPreview(device1);
+ enableMsgType((unsigned int)NotifyCallbackMsg::FOCUS, device1);
- Return<Status> returnStatus = device1->autoFocus();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
+ for (auto &iter : focusModes) {
+ if (Status::OK != isAutoFocusModeAvailable(cameraParams,
+ iter)) {
+ continue;
+ }
- {
- std::unique_lock<std::mutex> l(mLock);
- while (NotifyCallbackMsg::FOCUS != mNotifyMessage) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kAutoFocusTimeoutSec);
- ASSERT_NE(std::cv_status::timeout,
- mResultCondition.wait_until(l, timeout));
+ cameraParams.set(CameraParameters::KEY_FOCUS_MODE, iter);
+ setParameters(device1, cameraParams);
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ mNotifyMessage = NotifyCallbackMsg::ERROR;
+ }
+
+ Return<Status> returnStatus = device1->autoFocus();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ while (NotifyCallbackMsg::FOCUS != mNotifyMessage) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kAutoFocusTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout,
+ mResultCondition.wait_until(l, timeout));
+ }
}
}
- }
- disableMsgType((unsigned int)NotifyCallbackMsg::FOCUS, device1);
- stopPreviewAndClose(device1);
+ disableMsgType((unsigned int)NotifyCallbackMsg::FOCUS, device1);
+ stopPreviewAndClose(device1);
+ }
}
}
}
// In case autofocus is supported verify that it can be cancelled.
TEST_F(CameraHidlTest, cancelAutoFocus) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
- getParameters(device1, &cameraParams /*out*/);
+ ::android::CameraParameters cameraParams;
+ getParameters(device1, &cameraParams /*out*/);
- if (Status::OK != isAutoFocusModeAvailable(cameraParams,
- CameraParameters::FOCUS_MODE_AUTO)) {
- Return<void> ret = device1->close();
- ASSERT_TRUE(ret.isOk());
- continue;
+ if (Status::OK != isAutoFocusModeAvailable(cameraParams,
+ CameraParameters::FOCUS_MODE_AUTO)) {
+ Return<void> ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
+ continue;
+ }
+
+ // It should be fine to call before preview starts.
+ ASSERT_EQ(Status::OK, device1->cancelAutoFocus());
+
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
+ &bufferHandler /*out*/);
+ startPreview(device1);
+
+ // It should be fine to call after preview starts too.
+ Return<Status> returnStatus = device1->cancelAutoFocus();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+
+ returnStatus = device1->autoFocus();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+
+ returnStatus = device1->cancelAutoFocus();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+
+ stopPreviewAndClose(device1);
}
-
- // It should be fine to call before preview starts.
- ASSERT_EQ(Status::OK, device1->cancelAutoFocus());
-
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
- &bufferHandler /*out*/);
- startPreview(device1);
-
- // It should be fine to call after preview starts too.
- Return<Status> returnStatus = device1->cancelAutoFocus();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
-
- returnStatus = device1->autoFocus();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
-
- returnStatus = device1->cancelAutoFocus();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
-
- stopPreviewAndClose(device1);
}
}
}
// Check whether face detection is available and try to enable&disable.
TEST_F(CameraHidlTest, sendCommandFaceDetection) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
- getParameters(device1, &cameraParams /*out*/);
+ ::android::CameraParameters cameraParams;
+ getParameters(device1, &cameraParams /*out*/);
- int32_t hwFaces = cameraParams.getInt(
- CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW);
- int32_t swFaces = cameraParams.getInt(
- CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW);
- if ((0 >= hwFaces) && (0 >= swFaces)) {
- Return<void> ret = device1->close();
- ASSERT_TRUE(ret.isOk());
- continue;
+ int32_t hwFaces = cameraParams.getInt(
+ CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW);
+ int32_t swFaces = cameraParams.getInt(
+ CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW);
+ if ((0 >= hwFaces) && (0 >= swFaces)) {
+ Return<void> ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
+ continue;
+ }
+
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
+ &bufferHandler /*out*/);
+ startPreview(device1);
+
+ if (0 < hwFaces) {
+ Return<Status> returnStatus = device1->sendCommand(
+ CommandType::START_FACE_DETECTION,
+ CAMERA_FACE_DETECTION_HW, 0);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+ // TODO(epeev) : Enable and check for face notifications
+ returnStatus = device1->sendCommand(
+ CommandType::STOP_FACE_DETECTION,
+ CAMERA_FACE_DETECTION_HW, 0);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+ }
+
+ if (0 < swFaces) {
+ Return<Status> returnStatus = device1->sendCommand(
+ CommandType::START_FACE_DETECTION,
+ CAMERA_FACE_DETECTION_SW, 0);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+ // TODO(epeev) : Enable and check for face notifications
+ returnStatus = device1->sendCommand(
+ CommandType::STOP_FACE_DETECTION,
+ CAMERA_FACE_DETECTION_SW, 0);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+ }
+
+ stopPreviewAndClose(device1);
}
-
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
- &bufferHandler /*out*/);
- startPreview(device1);
-
- if (0 < hwFaces) {
- Return<Status> returnStatus = device1->sendCommand(
- CommandType::START_FACE_DETECTION,
- CAMERA_FACE_DETECTION_HW, 0);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
- // TODO(epeev) : Enable and check for face notifications
- returnStatus = device1->sendCommand(
- CommandType::STOP_FACE_DETECTION,
- CAMERA_FACE_DETECTION_HW, 0);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
- }
-
- if (0 < swFaces) {
- Return<Status> returnStatus = device1->sendCommand(
- CommandType::START_FACE_DETECTION,
- CAMERA_FACE_DETECTION_SW, 0);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
- // TODO(epeev) : Enable and check for face notifications
- returnStatus = device1->sendCommand(
- CommandType::STOP_FACE_DETECTION,
- CAMERA_FACE_DETECTION_SW, 0);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
- }
-
- stopPreviewAndClose(device1);
}
}
}
// Check whether smooth zoom is available and try to enable&disable.
TEST_F(CameraHidlTest, sendCommandSmoothZoom) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
- getParameters(device1, &cameraParams /*out*/);
+ ::android::CameraParameters cameraParams;
+ getParameters(device1, &cameraParams /*out*/);
- const char *smoothZoomStr = cameraParams.get(
- CameraParameters::KEY_SMOOTH_ZOOM_SUPPORTED);
- bool smoothZoomSupported = ((nullptr != smoothZoomStr) &&
- (strcmp(smoothZoomStr, CameraParameters::TRUE) == 0)) ?
- true : false;
- if (!smoothZoomSupported) {
- Return<void> ret = device1->close();
- ASSERT_TRUE(ret.isOk());
- continue;
+ const char *smoothZoomStr = cameraParams.get(
+ CameraParameters::KEY_SMOOTH_ZOOM_SUPPORTED);
+ bool smoothZoomSupported = ((nullptr != smoothZoomStr) &&
+ (strcmp(smoothZoomStr, CameraParameters::TRUE) == 0)) ?
+ true : false;
+ if (!smoothZoomSupported) {
+ Return<void> ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
+ continue;
+ }
+
+ int32_t maxZoom = cameraParams.getInt(
+ CameraParameters::KEY_MAX_ZOOM);
+ ASSERT_TRUE(0 < maxZoom);
+
+ sp<BufferItemConsumer> bufferItemConsumer;
+ sp<BufferItemHander> bufferHandler;
+ setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
+ &bufferHandler /*out*/);
+ startPreview(device1);
+ setParameters(device1, cameraParams);
+
+ Return<Status> returnStatus = device1->sendCommand(
+ CommandType::START_SMOOTH_ZOOM, maxZoom, 0);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+ // TODO(epeev) : Enable and check for face notifications
+ returnStatus = device1->sendCommand(
+ CommandType::STOP_SMOOTH_ZOOM, 0, 0);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+
+ stopPreviewAndClose(device1);
}
-
- int32_t maxZoom = cameraParams.getInt(
- CameraParameters::KEY_MAX_ZOOM);
- ASSERT_TRUE(0 < maxZoom);
-
- sp<BufferItemConsumer> bufferItemConsumer;
- sp<BufferItemHander> bufferHandler;
- setupPreviewWindow(device1, &bufferItemConsumer /*out*/,
- &bufferHandler /*out*/);
- startPreview(device1);
- setParameters(device1, cameraParams);
-
- Return<Status> returnStatus = device1->sendCommand(
- CommandType::START_SMOOTH_ZOOM, maxZoom, 0);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
- // TODO(epeev) : Enable and check for face notifications
- returnStatus = device1->sendCommand(CommandType::STOP_SMOOTH_ZOOM,
- 0, 0);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
-
- stopPreviewAndClose(device1);
}
}
}
// Basic sanity tests related to camera parameters.
TEST_F(CameraHidlTest, getSetParameters) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
- ::android::CameraParameters cameraParams;
- getParameters(device1, &cameraParams /*out*/);
+ ::android::CameraParameters cameraParams;
+ getParameters(device1, &cameraParams /*out*/);
- int32_t width, height;
- cameraParams.getPictureSize(&width, &height);
- ASSERT_TRUE((0 < width) && (0 < height));
- cameraParams.getPreviewSize(&width, &height);
- ASSERT_TRUE((0 < width) && (0 < height));
- int32_t minFps, maxFps;
- cameraParams.getPreviewFpsRange(&minFps, &maxFps);
- ASSERT_TRUE((0 < minFps) && (0 < maxFps));
- ASSERT_NE(nullptr, cameraParams.getPreviewFormat());
- ASSERT_NE(nullptr, cameraParams.getPictureFormat());
- ASSERT_TRUE(strcmp(CameraParameters::PIXEL_FORMAT_JPEG,
- cameraParams.getPictureFormat()) == 0);
+ int32_t width, height;
+ cameraParams.getPictureSize(&width, &height);
+ ASSERT_TRUE((0 < width) && (0 < height));
+ cameraParams.getPreviewSize(&width, &height);
+ ASSERT_TRUE((0 < width) && (0 < height));
+ int32_t minFps, maxFps;
+ cameraParams.getPreviewFpsRange(&minFps, &maxFps);
+ ASSERT_TRUE((0 < minFps) && (0 < maxFps));
+ ASSERT_NE(nullptr, cameraParams.getPreviewFormat());
+ ASSERT_NE(nullptr, cameraParams.getPictureFormat());
+ ASSERT_TRUE(strcmp(CameraParameters::PIXEL_FORMAT_JPEG,
+ cameraParams.getPictureFormat()) == 0);
- const char *flashMode = cameraParams.get(
- CameraParameters::KEY_FLASH_MODE);
- ASSERT_TRUE((nullptr == flashMode) || (strcmp(
- CameraParameters::FLASH_MODE_OFF, flashMode) == 0));
+ const char *flashMode = cameraParams.get(
+ CameraParameters::KEY_FLASH_MODE);
+ ASSERT_TRUE((nullptr == flashMode) || (strcmp(
+ CameraParameters::FLASH_MODE_OFF, flashMode) == 0));
- const char *wbMode = cameraParams.get(
- CameraParameters::KEY_WHITE_BALANCE);
- ASSERT_TRUE((nullptr == wbMode) || (strcmp(
- CameraParameters::WHITE_BALANCE_AUTO, wbMode) == 0));
+ const char *wbMode = cameraParams.get(
+ CameraParameters::KEY_WHITE_BALANCE);
+ ASSERT_TRUE((nullptr == wbMode) || (strcmp(
+ CameraParameters::WHITE_BALANCE_AUTO, wbMode) == 0));
- const char *effect = cameraParams.get(CameraParameters::KEY_EFFECT);
- ASSERT_TRUE((nullptr == effect) || (strcmp(
- CameraParameters::EFFECT_NONE, effect) == 0));
+ const char *effect = cameraParams.get(
+ CameraParameters::KEY_EFFECT);
+ ASSERT_TRUE((nullptr == effect) || (strcmp(
+ CameraParameters::EFFECT_NONE, effect) == 0));
- ::android::Vector<::android::Size> previewSizes;
- cameraParams.getSupportedPreviewSizes(previewSizes);
- ASSERT_FALSE(previewSizes.empty());
- ::android::Vector<::android::Size> pictureSizes;
- cameraParams.getSupportedPictureSizes(pictureSizes);
- ASSERT_FALSE(pictureSizes.empty());
- const char *previewFormats = cameraParams.get(
- CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS);
- ASSERT_NE(nullptr, previewFormats);
- ::android::String8 previewFormatsString(previewFormats);
- ASSERT_TRUE(previewFormatsString.contains(
- CameraParameters::PIXEL_FORMAT_YUV420SP));
- ASSERT_NE(nullptr, cameraParams.get(
- CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS));
- ASSERT_NE(nullptr, cameraParams.get(
- CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES));
- const char *focusModes = cameraParams.get(
- CameraParameters::KEY_SUPPORTED_FOCUS_MODES);
- ASSERT_NE(nullptr, focusModes);
- ::android::String8 focusModesString(focusModes);
- const char *focusMode = cameraParams.get(
- CameraParameters::KEY_FOCUS_MODE);
- ASSERT_NE(nullptr, focusMode);
- // Auto focus mode should be default
- if (focusModesString.contains(CameraParameters::FOCUS_MODE_AUTO)) {
- ASSERT_TRUE(strcmp(
- CameraParameters::FOCUS_MODE_AUTO, focusMode) == 0);
+ ::android::Vector<::android::Size> previewSizes;
+ cameraParams.getSupportedPreviewSizes(previewSizes);
+ ASSERT_FALSE(previewSizes.empty());
+ ::android::Vector<::android::Size> pictureSizes;
+ cameraParams.getSupportedPictureSizes(pictureSizes);
+ ASSERT_FALSE(pictureSizes.empty());
+ const char *previewFormats = cameraParams.get(
+ CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS);
+ ASSERT_NE(nullptr, previewFormats);
+ ::android::String8 previewFormatsString(previewFormats);
+ ASSERT_TRUE(previewFormatsString.contains(
+ CameraParameters::PIXEL_FORMAT_YUV420SP));
+ ASSERT_NE(nullptr, cameraParams.get(
+ CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS));
+ ASSERT_NE(nullptr, cameraParams.get(
+ CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES));
+ const char *focusModes = cameraParams.get(
+ CameraParameters::KEY_SUPPORTED_FOCUS_MODES);
+ ASSERT_NE(nullptr, focusModes);
+ ::android::String8 focusModesString(focusModes);
+ const char *focusMode = cameraParams.get(
+ CameraParameters::KEY_FOCUS_MODE);
+ ASSERT_NE(nullptr, focusMode);
+ // Auto focus mode should be default
+ if (focusModesString.contains(
+ CameraParameters::FOCUS_MODE_AUTO)) {
+ ASSERT_TRUE(strcmp(
+ CameraParameters::FOCUS_MODE_AUTO, focusMode) == 0);
+ }
+ ASSERT_TRUE(0 < cameraParams.getInt(
+ CameraParameters::KEY_FOCAL_LENGTH));
+ int32_t horizontalViewAngle = cameraParams.getInt(
+ CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE);
+ ASSERT_TRUE((0 < horizontalViewAngle) &&
+ (360 >= horizontalViewAngle));
+ int32_t verticalViewAngle = cameraParams.getInt(
+ CameraParameters::KEY_VERTICAL_VIEW_ANGLE);
+ ASSERT_TRUE((0 < verticalViewAngle) &&
+ (360 >= verticalViewAngle));
+ int32_t jpegQuality = cameraParams.getInt(
+ CameraParameters::KEY_JPEG_QUALITY);
+ ASSERT_TRUE((1 <= jpegQuality) && (100 >= jpegQuality));
+ int32_t jpegThumbQuality = cameraParams.getInt(
+ CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY);
+ ASSERT_TRUE((1 <= jpegThumbQuality) &&
+ (100 >= jpegThumbQuality));
+
+ cameraParams.setPictureSize(pictureSizes[0].width,
+ pictureSizes[0].height);
+ cameraParams.setPreviewSize(previewSizes[0].width,
+ previewSizes[0].height);
+
+ setParameters(device1, cameraParams);
+ getParameters(device1, &cameraParams /*out*/);
+
+ cameraParams.getPictureSize(&width, &height);
+ ASSERT_TRUE((pictureSizes[0].width == width) &&
+ (pictureSizes[0].height == height));
+ cameraParams.getPreviewSize(&width, &height);
+ ASSERT_TRUE((previewSizes[0].width == width) &&
+ (previewSizes[0].height == height));
+
+ Return<void> ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
}
- ASSERT_TRUE(0 < cameraParams.getInt(
- CameraParameters::KEY_FOCAL_LENGTH));
- int32_t horizontalViewAngle = cameraParams.getInt(
- CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE);
- ASSERT_TRUE((0 < horizontalViewAngle) && (360 >= horizontalViewAngle));
- int32_t verticalViewAngle = cameraParams.getInt(
- CameraParameters::KEY_VERTICAL_VIEW_ANGLE);
- ASSERT_TRUE((0 < verticalViewAngle) && (360 >= verticalViewAngle));
- int32_t jpegQuality = cameraParams.getInt(
- CameraParameters::KEY_JPEG_QUALITY);
- ASSERT_TRUE((1 <= jpegQuality) && (100 >= jpegQuality));
- int32_t jpegThumbQuality = cameraParams.getInt(
- CameraParameters::KEY_JPEG_THUMBNAIL_QUALITY);
- ASSERT_TRUE((1 <= jpegThumbQuality) && (100 >= jpegThumbQuality));
-
- cameraParams.setPictureSize(pictureSizes[0].width,
- pictureSizes[0].height);
- cameraParams.setPreviewSize(previewSizes[0].width,
- previewSizes[0].height);
-
- setParameters(device1, cameraParams);
- getParameters(device1, &cameraParams /*out*/);
-
- cameraParams.getPictureSize(&width, &height);
- ASSERT_TRUE((pictureSizes[0].width == width) &&
- (pictureSizes[0].height == height));
- cameraParams.getPreviewSize(&width, &height);
- ASSERT_TRUE((previewSizes[0].width == width) &&
- (previewSizes[0].height == height));
-
- Return<void> ret = device1->close();
- ASSERT_TRUE(ret.isOk());
}
}
}
@@ -1656,39 +2027,50 @@
// Verify that the static camera characteristics can be retrieved
// successfully.
TEST_F(CameraHidlTest, getCameraCharacteristics) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
- ALOGI("getCameraCharacteristics: Testing camera device %s", name.c_str());
- Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V3_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device3_2 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+ ALOGI("getCameraCharacteristics: Testing camera device %s",
+ name.c_str());
+ Return<void> ret;
+ ret = provider.second->getCameraDeviceInterface_V3_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device3_2 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- ret = device3_2->getCameraCharacteristics(
- [&](auto status, const auto& chars) {
- ALOGI("getCameraCharacteristics returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- const camera_metadata_t* metadata = (camera_metadata_t*) chars.data();
- size_t expectedSize = chars.size();
- int result = validate_camera_metadata_structure(metadata, &expectedSize);
- ASSERT_TRUE(result == 0 || result == CAMERA_METADATA_VALIDATION_SHIFTED);
- size_t entryCount = get_camera_metadata_entry_count(metadata);
- // TODO: we can do better than 0 here. Need to check how many required
- // characteristics keys we've defined.
- ASSERT_GT(entryCount, 0u);
- ALOGI("getCameraCharacteristics metadata entry count is %zu", entryCount);
- });
- ASSERT_TRUE(ret.isOk());
+ ret = device3_2->getCameraCharacteristics(
+ [&](auto status, const auto& chars) {
+ ALOGI("getCameraCharacteristics returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ const camera_metadata_t* metadata =
+ (camera_metadata_t*) chars.data();
+ size_t expectedSize = chars.size();
+ int result = validate_camera_metadata_structure(
+ metadata, &expectedSize);
+ ASSERT_TRUE((result == 0) ||
+ (result == CAMERA_METADATA_VALIDATION_SHIFTED));
+ size_t entryCount = get_camera_metadata_entry_count(
+ metadata);
+ // TODO: we can do better than 0 here. Need to check how many required
+ // characteristics keys we've defined.
+ ASSERT_GT(entryCount, 0u);
+ ALOGI("getCameraCharacteristics metadata entry count is %zu",
+ entryCount);
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
@@ -1696,252 +2078,273 @@
//In case it is supported verify that torch can be enabled.
//Check for corresponding toch callbacks as well.
TEST_F(CameraHidlTest, setTorchMode) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- bool torchControlSupported = false;
- Return<void> ret;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ bool torchControlSupported = false;
+ Return<void> ret;
- ret = CameraHidlEnvironment::Instance()->mProvider->isSetTorchModeSupported(
- [&](auto status, bool support) {
- ALOGI("isSetTorchModeSupported returns status:%d supported:%d",
- (int)status, support);
- ASSERT_EQ(Status::OK, status);
- torchControlSupported = support;
- });
+ ret = provider.second->isSetTorchModeSupported(
+ [&](auto status, bool support) {
+ ALOGI("isSetTorchModeSupported returns status:%d supported:%d",
+ (int)status, support);
+ ASSERT_EQ(Status::OK, status);
+ torchControlSupported = support;
+ });
- sp<TorchProviderCb> cb = new TorchProviderCb(this);
- Return<Status> returnStatus = env->mProvider->setCallback(cb);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
+ sp<TorchProviderCb> cb = new TorchProviderCb(this);
+ Return<Status> returnStatus = provider.second->setCallback(cb);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
- ALOGI("setTorchMode: Testing camera device %s", name.c_str());
- ret = env->mProvider->getCameraDeviceInterface_V3_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device3_2 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+ ALOGI("setTorchMode: Testing camera device %s", name.c_str());
+ ret = provider.second->getCameraDeviceInterface_V3_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device3_2 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
- returnStatus = device3_2->setTorchMode(TorchMode::ON);
- ASSERT_TRUE(returnStatus.isOk());
- if (!torchControlSupported) {
- ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, returnStatus);
- } else {
- ASSERT_TRUE(returnStatus == Status::OK ||
- returnStatus == Status::OPERATION_NOT_SUPPORTED);
- if (returnStatus == Status::OK) {
- {
- std::unique_lock<std::mutex> l(mTorchLock);
- while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kTorchTimeoutSec);
- ASSERT_NE(std::cv_status::timeout,
- mTorchCond.wait_until(l, timeout));
+ mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
+ returnStatus = device3_2->setTorchMode(TorchMode::ON);
+ ASSERT_TRUE(returnStatus.isOk());
+ if (!torchControlSupported) {
+ ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, returnStatus);
+ } else {
+ ASSERT_TRUE(returnStatus == Status::OK ||
+ returnStatus == Status::OPERATION_NOT_SUPPORTED);
+ if (returnStatus == Status::OK) {
+ {
+ std::unique_lock<std::mutex> l(mTorchLock);
+ while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kTorchTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout,
+ mTorchCond.wait_until(l, timeout));
+ }
+ ASSERT_EQ(TorchModeStatus::AVAILABLE_ON,
+ mTorchStatus);
+ mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
}
- ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus);
- mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
- }
- returnStatus = device3_2->setTorchMode(TorchMode::OFF);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
+ returnStatus = device3_2->setTorchMode(TorchMode::OFF);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
- {
- std::unique_lock<std::mutex> l(mTorchLock);
- while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kTorchTimeoutSec);
- ASSERT_NE(std::cv_status::timeout,
- mTorchCond.wait_until(l, timeout));
+ {
+ std::unique_lock<std::mutex> l(mTorchLock);
+ while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kTorchTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout,
+ mTorchCond.wait_until(l, timeout));
+ }
+ ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF,
+ mTorchStatus);
}
- ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF, mTorchStatus);
}
}
- }
- } else if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- ALOGI("dumpState: Testing camera device %s", name.c_str());
- ret = env->mProvider->getCameraDeviceInterface_V1_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device1 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ } else if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ ALOGI("dumpState: Testing camera device %s", name.c_str());
+ ret = provider.second->getCameraDeviceInterface_V1_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device1 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
- returnStatus = device1->setTorchMode(TorchMode::ON);
- ASSERT_TRUE(returnStatus.isOk());
- if (!torchControlSupported) {
- ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, returnStatus);
- } else {
- ASSERT_TRUE(returnStatus == Status::OK ||
- returnStatus == Status::OPERATION_NOT_SUPPORTED);
- if (returnStatus == Status::OK) {
- {
- std::unique_lock<std::mutex> l(mTorchLock);
- while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kTorchTimeoutSec);
- ASSERT_NE(std::cv_status::timeout,
- mTorchCond.wait_until(l, timeout));
+ mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
+ returnStatus = device1->setTorchMode(TorchMode::ON);
+ ASSERT_TRUE(returnStatus.isOk());
+ if (!torchControlSupported) {
+ ASSERT_EQ(Status::METHOD_NOT_SUPPORTED, returnStatus);
+ } else {
+ ASSERT_TRUE(returnStatus == Status::OK ||
+ returnStatus == Status::OPERATION_NOT_SUPPORTED);
+ if (returnStatus == Status::OK) {
+ {
+ std::unique_lock<std::mutex> l(mTorchLock);
+ while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kTorchTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout,
+ mTorchCond.wait_until(l, timeout));
+ }
+ ASSERT_EQ(TorchModeStatus::AVAILABLE_ON,
+ mTorchStatus);
+ mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
}
- ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus);
- mTorchStatus = TorchModeStatus::NOT_AVAILABLE;
- }
- returnStatus = device1->setTorchMode(TorchMode::OFF);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
+ returnStatus = device1->setTorchMode(TorchMode::OFF);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
- {
- std::unique_lock<std::mutex> l(mTorchLock);
- while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kTorchTimeoutSec);
- ASSERT_NE(std::cv_status::timeout,
- mTorchCond.wait_until(l, timeout));
+ {
+ std::unique_lock<std::mutex> l(mTorchLock);
+ while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kTorchTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout,
+ mTorchCond.wait_until(l, timeout));
+ }
+ ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF,
+ mTorchStatus);
}
- ASSERT_EQ(TorchModeStatus::AVAILABLE_OFF, mTorchStatus);
}
}
+ ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
}
- ret = device1->close();
- ASSERT_TRUE(ret.isOk());
}
- }
- returnStatus = env->mProvider->setCallback(nullptr);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
+ returnStatus = provider.second->setCallback(nullptr);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+ }
}
// Check dump functionality.
TEST_F(CameraHidlTest, dumpState) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- Return<void> ret;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ Return<void> ret;
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
- ALOGI("dumpState: Testing camera device %s", name.c_str());
- ret = env->mProvider->getCameraDeviceInterface_V3_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device3_2 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ ::android::sp<ICameraDevice> device3_2;
+ ALOGI("dumpState: Testing camera device %s", name.c_str());
+ ret = provider.second->getCameraDeviceInterface_V3_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device3_2 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- native_handle_t* raw_handle = native_handle_create(1, 0);
- raw_handle->data[0] = open(kDumpOutput, O_RDWR);
- ASSERT_GE(raw_handle->data[0], 0);
- hidl_handle handle = raw_handle;
- ret= device3_2->dumpState(handle);
- ASSERT_TRUE(ret.isOk());
- close(raw_handle->data[0]);
- native_handle_delete(raw_handle);
- } else if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- ALOGI("dumpState: Testing camera device %s", name.c_str());
- ret = env->mProvider->getCameraDeviceInterface_V1_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V1_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device1 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ native_handle_t* raw_handle = native_handle_create(1, 0);
+ raw_handle->data[0] = open(kDumpOutput, O_RDWR);
+ ASSERT_GE(raw_handle->data[0], 0);
+ hidl_handle handle = raw_handle;
+ ret= device3_2->dumpState(handle);
+ ASSERT_TRUE(ret.isOk());
+ close(raw_handle->data[0]);
+ native_handle_delete(raw_handle);
+ } else if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ ::android::sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ ALOGI("dumpState: Testing camera device %s", name.c_str());
+ ret = provider.second->getCameraDeviceInterface_V1_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device1 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- native_handle_t* raw_handle = native_handle_create(1, 0);
- raw_handle->data[0] = open(kDumpOutput, O_RDWR);
- ASSERT_GE(raw_handle->data[0], 0);
- hidl_handle handle = raw_handle;
- Return<Status> returnStatus = device1->dumpState(handle);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
- close(raw_handle->data[0]);
- native_handle_delete(raw_handle);
+ native_handle_t* raw_handle = native_handle_create(1, 0);
+ raw_handle->data[0] = open(kDumpOutput, O_RDWR);
+ ASSERT_GE(raw_handle->data[0], 0);
+ hidl_handle handle = raw_handle;
+ Return<Status> returnStatus = device1->dumpState(handle);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+ close(raw_handle->data[0]);
+ native_handle_delete(raw_handle);
+ }
}
}
}
// Open, dumpStates, then close
TEST_F(CameraHidlTest, openClose) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- Return<void> ret;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ Return<void> ret;
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
- ALOGI("openClose: Testing camera device %s", name.c_str());
- ret = env->mProvider->getCameraDeviceInterface_V3_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device3_2 = device;
- });
- ASSERT_TRUE(ret.isOk());
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+ ALOGI("openClose: Testing camera device %s", name.c_str());
+ ret = provider.second->getCameraDeviceInterface_V3_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device3_2 = device;
+ });
+ ASSERT_TRUE(ret.isOk());
- sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
- sp<ICameraDeviceSession> session;
- ret = device3_2->open(
- cb,
- [&](auto status, const auto& newSession) {
- ALOGI("device::open returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(newSession, nullptr);
- session = newSession;
- });
- ASSERT_TRUE(ret.isOk());
+ sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
+ sp<ICameraDeviceSession> session;
+ ret = device3_2->open(
+ cb,
+ [&](auto status, const auto& newSession) {
+ ALOGI("device::open returns status:%d", (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(newSession, nullptr);
+ session = newSession;
+ });
+ ASSERT_TRUE(ret.isOk());
- native_handle_t* raw_handle = native_handle_create(1, 0);
- raw_handle->data[0] = open(kDumpOutput, O_RDWR);
- ASSERT_GE(raw_handle->data[0], 0);
- hidl_handle handle = raw_handle;
- ret = device3_2->dumpState(handle);
- ASSERT_TRUE(ret.isOk());
- close(raw_handle->data[0]);
- native_handle_delete(raw_handle);
+ native_handle_t* raw_handle = native_handle_create(1, 0);
+ raw_handle->data[0] = open(kDumpOutput, O_RDWR);
+ ASSERT_GE(raw_handle->data[0], 0);
+ hidl_handle handle = raw_handle;
+ ret = device3_2->dumpState(handle);
+ ASSERT_TRUE(ret.isOk());
+ close(raw_handle->data[0]);
+ native_handle_delete(raw_handle);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
- // TODO: test all session API calls return INTERNAL_ERROR after close
- // TODO: keep a wp copy here and verify session cannot be promoted out of this scope
- } else if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_1_0) {
- sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
- openCameraDevice(name, env, &device1 /*out*/);
- ASSERT_NE(nullptr, device1.get());
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ // TODO: test all session API calls return INTERNAL_ERROR after close
+ // TODO: keep a wp copy here and verify session cannot be promoted out of this scope
+ } else if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_1_0) {
+ sp<::android::hardware::camera::device::V1_0::ICameraDevice> device1;
+ openCameraDevice(name, provider.second, &device1 /*out*/);
+ ASSERT_NE(nullptr, device1.get());
- native_handle_t* raw_handle = native_handle_create(1, 0);
- raw_handle->data[0] = open(kDumpOutput, O_RDWR);
- ASSERT_GE(raw_handle->data[0], 0);
- hidl_handle handle = raw_handle;
- Return<Status> returnStatus = device1->dumpState(handle);
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
- close(raw_handle->data[0]);
- native_handle_delete(raw_handle);
+ native_handle_t* raw_handle = native_handle_create(1, 0);
+ raw_handle->data[0] = open(kDumpOutput, O_RDWR);
+ ASSERT_GE(raw_handle->data[0], 0);
+ hidl_handle handle = raw_handle;
+ Return<Status> returnStatus = device1->dumpState(handle);
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+ close(raw_handle->data[0]);
+ native_handle_delete(raw_handle);
- ret = device1->close();
- ASSERT_TRUE(ret.isOk());
+ ret = device1->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
@@ -1949,71 +2352,81 @@
// Check whether all common default request settings can be sucessfully
// constructed.
TEST_F(CameraHidlTest, constructDefaultRequestSettings) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
- Return<void> ret;
- ALOGI("constructDefaultRequestSettings: Testing camera device %s", name.c_str());
- ret = env->mProvider->getCameraDeviceInterface_V3_x(
- name,
- [&](auto status, const auto& device) {
- ALOGI("getCameraDeviceInterface_V3_x returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(device, nullptr);
- device3_2 = device;
- });
- ASSERT_TRUE(ret.isOk());
-
- sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
- sp<ICameraDeviceSession> session;
- ret = device3_2->open(
- cb,
- [&](auto status, const auto& newSession) {
- ALOGI("device::open returns status:%d", (int)status);
- ASSERT_EQ(Status::OK, status);
- ASSERT_NE(newSession, nullptr);
- session = newSession;
- });
- ASSERT_TRUE(ret.isOk());
-
- for (uint32_t t = (uint32_t) RequestTemplate::PREVIEW;
- t <= (uint32_t) RequestTemplate::MANUAL; t++) {
- RequestTemplate reqTemplate = (RequestTemplate) t;
- ret = session->constructDefaultRequestSettings(
- reqTemplate,
- [&](auto status, const auto& req) {
- ALOGI("constructDefaultRequestSettings returns status:%d", (int)status);
- if (reqTemplate == RequestTemplate::ZERO_SHUTTER_LAG ||
- reqTemplate == RequestTemplate::MANUAL) {
- // optional templates
- ASSERT_TRUE(status == Status::OK || status == Status::ILLEGAL_ARGUMENT);
- } else {
- ASSERT_EQ(Status::OK, status);
- }
-
- if (status == Status::OK) {
- const camera_metadata_t* metadata =
- (camera_metadata_t*) req.data();
- size_t expectedSize = req.size();
- int result = validate_camera_metadata_structure(
- metadata, &expectedSize);
- ASSERT_TRUE(result == 0 || result == CAMERA_METADATA_VALIDATION_SHIFTED);
- size_t entryCount = get_camera_metadata_entry_count(metadata);
- // TODO: we can do better than 0 here. Need to check how many required
- // request keys we've defined for each template
- ASSERT_GT(entryCount, 0u);
- ALOGI("template %u metadata entry count is %zu", t, entryCount);
- } else {
- ASSERT_EQ(0u, req.size());
- }
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ ::android::sp<::android::hardware::camera::device::V3_2::ICameraDevice> device3_2;
+ Return<void> ret;
+ ALOGI("constructDefaultRequestSettings: Testing camera device %s",
+ name.c_str());
+ ret = provider.second->getCameraDeviceInterface_V3_x(
+ name,
+ [&](auto status, const auto& device) {
+ ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
+ (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(device, nullptr);
+ device3_2 = device;
});
ASSERT_TRUE(ret.isOk());
+
+ sp<EmptyDeviceCb> cb = new EmptyDeviceCb;
+ sp<ICameraDeviceSession> session;
+ ret = device3_2->open(
+ cb,
+ [&](auto status, const auto& newSession) {
+ ALOGI("device::open returns status:%d", (int)status);
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_NE(newSession, nullptr);
+ session = newSession;
+ });
+ ASSERT_TRUE(ret.isOk());
+
+ for (uint32_t t = (uint32_t) RequestTemplate::PREVIEW;
+ t <= (uint32_t) RequestTemplate::MANUAL; t++) {
+ RequestTemplate reqTemplate = (RequestTemplate) t;
+ ret = session->constructDefaultRequestSettings(
+ reqTemplate,
+ [&](auto status, const auto& req) {
+ ALOGI("constructDefaultRequestSettings returns status:%d",
+ (int)status);
+ if (reqTemplate == RequestTemplate::ZERO_SHUTTER_LAG ||
+ reqTemplate == RequestTemplate::MANUAL) {
+ // optional templates
+ ASSERT_TRUE((status == Status::OK) ||
+ (status == Status::ILLEGAL_ARGUMENT));
+ } else {
+ ASSERT_EQ(Status::OK, status);
+ }
+
+ if (status == Status::OK) {
+ const camera_metadata_t* metadata =
+ (camera_metadata_t*) req.data();
+ size_t expectedSize = req.size();
+ int result = validate_camera_metadata_structure(
+ metadata, &expectedSize);
+ ASSERT_TRUE((result == 0) ||
+ (result == CAMERA_METADATA_VALIDATION_SHIFTED));
+ size_t entryCount =
+ get_camera_metadata_entry_count(metadata);
+ // TODO: we can do better than 0 here. Need to check how many required
+ // request keys we've defined for each template
+ ASSERT_GT(entryCount, 0u);
+ ALOGI("template %u metadata entry count is %zu",
+ t, entryCount);
+ } else {
+ ASSERT_EQ(0u, req.size());
+ }
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
}
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
}
}
}
@@ -2021,105 +2434,98 @@
// Verify that all supported stream formats and sizes can be configured
// successfully.
TEST_F(CameraHidlTest, configureStreamsAvailableOutputs) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<AvailableStream> outputStreams;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<AvailableStream> outputStreams;
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- camera_metadata_t *staticMeta;
- Return<void> ret;
- sp<ICameraDeviceSession> session;
- openEmptyDeviceSession(name, env, &session /*out*/,
- &staticMeta /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ camera_metadata_t *staticMeta;
+ Return<void> ret;
+ sp<ICameraDeviceSession> session;
+ openEmptyDeviceSession(name, provider.second, &session /*out*/,
+ &staticMeta /*out*/);
- outputStreams.clear();
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
- outputStreams));
- ASSERT_NE(0u, outputStreams.size());
+ outputStreams.clear();
+ ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
+ outputStreams));
+ ASSERT_NE(0u, outputStreams.size());
- int32_t streamId = 0;
- for (auto &it : outputStreams) {
- Stream stream = {streamId, StreamType::OUTPUT,
- static_cast<uint32_t> (it.width),
- static_cast<uint32_t> (it.height),
- static_cast<PixelFormat> (it.format), 0, 0,
- StreamRotation::ROTATION_0};
- ::android::hardware::hidl_vec<Stream> streams = {stream};
- StreamConfiguration config = {streams,
- StreamConfigurationMode::NORMAL_MODE};
- ret = session->configureStreams(config, [streamId] (Status s,
- HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(1u, halConfig.streams.size());
- ASSERT_EQ(halConfig.streams[0].id, streamId);
- });
+ int32_t streamId = 0;
+ for (auto &it : outputStreams) {
+ Stream stream = {streamId, StreamType::OUTPUT,
+ static_cast<uint32_t> (it.width),
+ static_cast<uint32_t> (it.height),
+ static_cast<PixelFormat> (it.format),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ StreamRotation::ROTATION_0};
+ ::android::hardware::hidl_vec<Stream> streams = {stream};
+ StreamConfiguration config = {streams,
+ StreamConfigurationMode::NORMAL_MODE};
+ ret = session->configureStreams(config, [streamId] (Status s,
+ HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ ASSERT_EQ(halConfig.streams[0].id, streamId);
+ });
+ ASSERT_TRUE(ret.isOk());
+ streamId++;
+ }
+
+ free_camera_metadata(staticMeta);
+ ret = session->close();
ASSERT_TRUE(ret.isOk());
- streamId++;
}
-
- free_camera_metadata(staticMeta);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
}
}
}
// Check for correct handling of invalid/incorrect configuration parameters.
TEST_F(CameraHidlTest, configureStreamsInvalidOutputs) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<AvailableStream> outputStreams;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<AvailableStream> outputStreams;
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- camera_metadata_t *staticMeta;
- Return<void> ret;
- sp<ICameraDeviceSession> session;
- openEmptyDeviceSession(name, env, &session /*out*/,
- &staticMeta /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ camera_metadata_t *staticMeta;
+ Return<void> ret;
+ sp<ICameraDeviceSession> session;
+ openEmptyDeviceSession(name, provider.second, &session /*out*/,
+ &staticMeta /*out*/);
- outputStreams.clear();
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
- outputStreams));
- ASSERT_NE(0u, outputStreams.size());
+ outputStreams.clear();
+ ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
+ outputStreams));
+ ASSERT_NE(0u, outputStreams.size());
- int32_t streamId = 0;
- Stream stream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (0),
- static_cast<uint32_t> (0),
- static_cast<PixelFormat> (outputStreams[0].format),
- 0, 0, StreamRotation::ROTATION_0};
- ::android::hardware::hidl_vec<Stream> streams = {stream};
- StreamConfiguration config = {streams,
- StreamConfigurationMode::NORMAL_MODE};
- ret = session->configureStreams(config, [] (Status s,
- HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
- (Status::INTERNAL_ERROR == s));
- });
- ASSERT_TRUE(ret.isOk());
+ int32_t streamId = 0;
+ Stream stream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (0),
+ static_cast<uint32_t> (0),
+ static_cast<PixelFormat> (outputStreams[0].format),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ StreamRotation::ROTATION_0};
+ ::android::hardware::hidl_vec<Stream> streams = {stream};
+ StreamConfiguration config = {streams,
+ StreamConfigurationMode::NORMAL_MODE};
+ ret = session->configureStreams(config, [] (Status s,
+ HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
+ ASSERT_TRUE(ret.isOk());
- stream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (UINT32_MAX),
- static_cast<uint32_t> (UINT32_MAX),
- static_cast<PixelFormat> (outputStreams[0].format),
- 0, 0, StreamRotation::ROTATION_0};
- streams[0] = stream;
- config = {streams,
- StreamConfigurationMode::NORMAL_MODE};
- ret = session->configureStreams(config, [] (Status s,
- HalStreamConfiguration) {
- ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
- });
- ASSERT_TRUE(ret.isOk());
-
- for (auto &it : outputStreams) {
stream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (it.width),
- static_cast<uint32_t> (it.height),
- static_cast<PixelFormat> (UINT32_MAX),
- 0, 0, StreamRotation::ROTATION_0};
+ static_cast<uint32_t> (UINT32_MAX),
+ static_cast<uint32_t> (UINT32_MAX),
+ static_cast<PixelFormat> (outputStreams[0].format),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ StreamRotation::ROTATION_0};
streams[0] = stream;
config = {streams,
StreamConfigurationMode::NORMAL_MODE};
@@ -2129,24 +2535,42 @@
});
ASSERT_TRUE(ret.isOk());
- stream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (it.width),
- static_cast<uint32_t> (it.height),
- static_cast<PixelFormat> (it.format),
- 0, 0, static_cast<StreamRotation> (UINT32_MAX)};
- streams[0] = stream;
- config = {streams,
- StreamConfigurationMode::NORMAL_MODE};
- ret = session->configureStreams(config, [] (Status s,
- HalStreamConfiguration) {
- ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
- });
+ for (auto &it : outputStreams) {
+ stream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (it.width),
+ static_cast<uint32_t> (it.height),
+ static_cast<PixelFormat> (UINT32_MAX),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ StreamRotation::ROTATION_0};
+ streams[0] = stream;
+ config = {streams,
+ StreamConfigurationMode::NORMAL_MODE};
+ ret = session->configureStreams(config, [] (Status s,
+ HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ ASSERT_TRUE(ret.isOk());
+
+ stream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (it.width),
+ static_cast<uint32_t> (it.height),
+ static_cast<PixelFormat> (it.format),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ static_cast<StreamRotation> (UINT32_MAX)};
+ streams[0] = stream;
+ config = {streams,
+ StreamConfigurationMode::NORMAL_MODE};
+ ret = session->configureStreams(config, [] (Status s,
+ HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
+
+ free_camera_metadata(staticMeta);
+ ret = session->close();
ASSERT_TRUE(ret.isOk());
}
-
- free_camera_metadata(staticMeta);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
}
}
}
@@ -2154,83 +2578,88 @@
// Check whether all supported ZSL output stream combinations can be
// configured successfully.
TEST_F(CameraHidlTest, configureStreamsZSLInputOutputs) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<AvailableStream> inputStreams;
- std::vector<AvailableZSLInputOutput> inputOutputMap;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<AvailableStream> inputStreams;
+ std::vector<AvailableZSLInputOutput> inputOutputMap;
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- camera_metadata_t *staticMeta;
- Return<void> ret;
- sp<ICameraDeviceSession> session;
- openEmptyDeviceSession(name, env, &session /*out*/,
- &staticMeta /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ camera_metadata_t *staticMeta;
+ Return<void> ret;
+ sp<ICameraDeviceSession> session;
+ openEmptyDeviceSession(name, provider.second, &session /*out*/,
+ &staticMeta /*out*/);
- Status rc = isZSLModeAvailable(staticMeta);
- if (Status::METHOD_NOT_SUPPORTED == rc) {
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
- continue;
- }
- ASSERT_EQ(Status::OK, rc);
+ Status rc = isZSLModeAvailable(staticMeta);
+ if (Status::METHOD_NOT_SUPPORTED == rc) {
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ continue;
+ }
+ ASSERT_EQ(Status::OK, rc);
- inputStreams.clear();
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
- inputStreams));
- ASSERT_NE(0u, inputStreams.size());
-
- inputOutputMap.clear();
- ASSERT_EQ(Status::OK, getZSLInputOutputMap(staticMeta,
- inputOutputMap));
- ASSERT_NE(0u, inputOutputMap.size());
-
- int32_t streamId = 0;
- for (auto &inputIter : inputOutputMap) {
- AvailableStream input;
- ASSERT_EQ(Status::OK,
- findLargestSize(inputStreams, inputIter.inputFormat, input));
+ inputStreams.clear();
+ ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
+ inputStreams));
ASSERT_NE(0u, inputStreams.size());
- AvailableStream outputThreshold = {INT32_MAX, INT32_MAX,
- inputIter.outputFormat};
- std::vector<AvailableStream> outputStreams;
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
- outputStreams, &outputThreshold));
- for (auto &outputIter : outputStreams) {
- Stream zslStream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (input.width),
- static_cast<uint32_t> (input.height),
- static_cast<PixelFormat> (input.format),
- GRALLOC_USAGE_HW_CAMERA_ZSL, 0,
- StreamRotation::ROTATION_0};
- Stream inputStream = {streamId++, StreamType::INPUT,
- static_cast<uint32_t> (input.width),
- static_cast<uint32_t> (input.height),
- static_cast<PixelFormat> (input.format), 0, 0,
- StreamRotation::ROTATION_0};
- Stream outputStream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (outputIter.width),
- static_cast<uint32_t> (outputIter.height),
- static_cast<PixelFormat> (outputIter.format), 0, 0,
- StreamRotation::ROTATION_0};
+ inputOutputMap.clear();
+ ASSERT_EQ(Status::OK, getZSLInputOutputMap(staticMeta,
+ inputOutputMap));
+ ASSERT_NE(0u, inputOutputMap.size());
- ::android::hardware::hidl_vec<Stream> streams = {
- inputStream, zslStream, outputStream};
- StreamConfiguration config = {streams,
- StreamConfigurationMode::NORMAL_MODE};
- ret = session->configureStreams(config,
- [](Status s, HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(3u, halConfig.streams.size());
- });
- ASSERT_TRUE(ret.isOk());
+ int32_t streamId = 0;
+ for (auto &inputIter : inputOutputMap) {
+ AvailableStream input;
+ ASSERT_EQ(Status::OK,
+ findLargestSize(inputStreams, inputIter.inputFormat, input));
+ ASSERT_NE(0u, inputStreams.size());
+
+ AvailableStream outputThreshold = {INT32_MAX, INT32_MAX,
+ inputIter.outputFormat};
+ std::vector<AvailableStream> outputStreams;
+ ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
+ outputStreams, &outputThreshold));
+ for (auto &outputIter : outputStreams) {
+ Stream zslStream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (input.width),
+ static_cast<uint32_t> (input.height),
+ static_cast<PixelFormat> (input.format),
+ GRALLOC_USAGE_HW_CAMERA_ZSL, 0,
+ StreamRotation::ROTATION_0};
+ Stream inputStream = {streamId++, StreamType::INPUT,
+ static_cast<uint32_t> (input.width),
+ static_cast<uint32_t> (input.height),
+ static_cast<PixelFormat> (input.format),
+ 0, 0,
+ StreamRotation::ROTATION_0};
+ Stream outputStream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (outputIter.width),
+ static_cast<uint32_t> (outputIter.height),
+ static_cast<PixelFormat> (outputIter.format),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ StreamRotation::ROTATION_0};
+
+ ::android::hardware::hidl_vec<Stream> streams = {
+ inputStream, zslStream, outputStream};
+ StreamConfiguration config = {streams,
+ StreamConfigurationMode::NORMAL_MODE};
+ ret = session->configureStreams(config, [] (Status s,
+ HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(3u, halConfig.streams.size());
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
- }
- free_camera_metadata(staticMeta);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
+ free_camera_metadata(staticMeta);
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
@@ -2238,62 +2667,67 @@
// Verify that all supported preview + still capture stream combinations
// can be configured successfully.
TEST_F(CameraHidlTest, configureStreamsPreviewStillOutputs) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<AvailableStream> outputBlobStreams;
- std::vector<AvailableStream> outputPreviewStreams;
- AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
- AvailableStream blobThreshold = {INT32_MAX, INT32_MAX,
- static_cast<int32_t>(PixelFormat::BLOB)};
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<AvailableStream> outputBlobStreams;
+ std::vector<AvailableStream> outputPreviewStreams;
+ AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+ AvailableStream blobThreshold = {INT32_MAX, INT32_MAX,
+ static_cast<int32_t>(PixelFormat::BLOB)};
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- camera_metadata_t *staticMeta;
- Return<void> ret;
- sp<ICameraDeviceSession> session;
- openEmptyDeviceSession(name, env, &session /*out*/,
- &staticMeta /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ camera_metadata_t *staticMeta;
+ Return<void> ret;
+ sp<ICameraDeviceSession> session;
+ openEmptyDeviceSession(name, provider.second, &session /*out*/,
+ &staticMeta /*out*/);
- outputBlobStreams.clear();
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
- outputBlobStreams, &blobThreshold));
- ASSERT_NE(0u, outputBlobStreams.size());
+ outputBlobStreams.clear();
+ ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
+ outputBlobStreams, &blobThreshold));
+ ASSERT_NE(0u, outputBlobStreams.size());
- outputPreviewStreams.clear();
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
- outputPreviewStreams, &previewThreshold));
- ASSERT_NE(0u, outputPreviewStreams.size());
+ outputPreviewStreams.clear();
+ ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
+ outputPreviewStreams, &previewThreshold));
+ ASSERT_NE(0u, outputPreviewStreams.size());
- int32_t streamId = 0;
- for (auto &blobIter : outputBlobStreams) {
- for (auto &previewIter : outputPreviewStreams) {
- Stream previewStream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (previewIter.width),
- static_cast<uint32_t> (previewIter.height),
- static_cast<PixelFormat> (previewIter.format), 0, 0,
- StreamRotation::ROTATION_0};
- Stream blobStream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (blobIter.width),
- static_cast<uint32_t> (blobIter.height),
- static_cast<PixelFormat> (blobIter.format), 0, 0,
- StreamRotation::ROTATION_0};
- ::android::hardware::hidl_vec<Stream> streams = {
- previewStream, blobStream};
- StreamConfiguration config = {streams,
- StreamConfigurationMode::NORMAL_MODE};
- ret = session->configureStreams(config,
- [](Status s, HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(2u, halConfig.streams.size());
- });
- ASSERT_TRUE(ret.isOk());
+ int32_t streamId = 0;
+ for (auto &blobIter : outputBlobStreams) {
+ for (auto &previewIter : outputPreviewStreams) {
+ Stream previewStream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (previewIter.width),
+ static_cast<uint32_t> (previewIter.height),
+ static_cast<PixelFormat> (previewIter.format),
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0,
+ StreamRotation::ROTATION_0};
+ Stream blobStream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (blobIter.width),
+ static_cast<uint32_t> (blobIter.height),
+ static_cast<PixelFormat> (blobIter.format),
+ GRALLOC1_CONSUMER_USAGE_CPU_READ, 0,
+ StreamRotation::ROTATION_0};
+ ::android::hardware::hidl_vec<Stream> streams = {
+ previewStream, blobStream};
+ StreamConfiguration config = {streams,
+ StreamConfigurationMode::NORMAL_MODE};
+ ret = session->configureStreams(config, [] (Status s,
+ HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(2u, halConfig.streams.size());
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
- }
- free_camera_metadata(staticMeta);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
+ free_camera_metadata(staticMeta);
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
@@ -2302,89 +2736,99 @@
// configured. Additionally check for common invalid inputs when
// using this mode.
TEST_F(CameraHidlTest, configureStreamsConstrainedOutputs) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- camera_metadata_t *staticMeta;
- Return<void> ret;
- sp<ICameraDeviceSession> session;
- openEmptyDeviceSession(name, env, &session /*out*/,
- &staticMeta /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ camera_metadata_t *staticMeta;
+ Return<void> ret;
+ sp<ICameraDeviceSession> session;
+ openEmptyDeviceSession(name, provider.second, &session /*out*/,
+ &staticMeta /*out*/);
- Status rc = isConstrainedModeAvailable(staticMeta);
- if (Status::METHOD_NOT_SUPPORTED == rc) {
+ Status rc = isConstrainedModeAvailable(staticMeta);
+ if (Status::METHOD_NOT_SUPPORTED == rc) {
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ continue;
+ }
+ ASSERT_EQ(Status::OK, rc);
+
+ AvailableStream hfrStream;
+ rc = pickConstrainedModeSize(staticMeta, hfrStream);
+ ASSERT_EQ(Status::OK, rc);
+
+ int32_t streamId = 0;
+ Stream stream = {streamId, StreamType::OUTPUT,
+ static_cast<uint32_t> (hfrStream.width),
+ static_cast<uint32_t> (hfrStream.height),
+ static_cast<PixelFormat> (hfrStream.format),
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
+ StreamRotation::ROTATION_0};
+ ::android::hardware::hidl_vec<Stream> streams = {stream};
+ StreamConfiguration config = {streams,
+ StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
+ ret = session->configureStreams(config, [streamId] (Status s,
+ HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(1u, halConfig.streams.size());
+ ASSERT_EQ(halConfig.streams[0].id, streamId);
+ });
+ ASSERT_TRUE(ret.isOk());
+
+ stream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (0),
+ static_cast<uint32_t> (0),
+ static_cast<PixelFormat> (hfrStream.format),
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
+ StreamRotation::ROTATION_0};
+ streams[0] = stream;
+ config = {streams,
+ StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
+ ret = session->configureStreams(config, [] (Status s,
+ HalStreamConfiguration) {
+ ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
+ (Status::INTERNAL_ERROR == s));
+ });
+ ASSERT_TRUE(ret.isOk());
+
+ stream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (UINT32_MAX),
+ static_cast<uint32_t> (UINT32_MAX),
+ static_cast<PixelFormat> (hfrStream.format),
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
+ StreamRotation::ROTATION_0};
+ streams[0] = stream;
+ config = {streams,
+ StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
+ ret = session->configureStreams(config, [] (Status s,
+ HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ ASSERT_TRUE(ret.isOk());
+
+ stream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (hfrStream.width),
+ static_cast<uint32_t> (hfrStream.height),
+ static_cast<PixelFormat> (UINT32_MAX),
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
+ StreamRotation::ROTATION_0};
+ streams[0] = stream;
+ config = {streams,
+ StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
+ ret = session->configureStreams(config, [] (Status s,
+ HalStreamConfiguration) {
+ ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
+ });
+ ASSERT_TRUE(ret.isOk());
+
+ free_camera_metadata(staticMeta);
ret = session->close();
ASSERT_TRUE(ret.isOk());
- continue;
}
- ASSERT_EQ(Status::OK, rc);
-
- AvailableStream hfrStream;
- rc = pickConstrainedModeSize(staticMeta, hfrStream);
- ASSERT_EQ(Status::OK, rc);
-
- int32_t streamId = 0;
- Stream stream = {streamId, StreamType::OUTPUT,
- static_cast<uint32_t> (hfrStream.width),
- static_cast<uint32_t> (hfrStream.height),
- static_cast<PixelFormat> (hfrStream.format), 0, 0,
- StreamRotation::ROTATION_0};
- ::android::hardware::hidl_vec<Stream> streams = {stream};
- StreamConfiguration config = {streams,
- StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
- ret = session->configureStreams(config, [streamId] (Status s,
- HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(1u, halConfig.streams.size());
- ASSERT_EQ(halConfig.streams[0].id, streamId);
- });
- ASSERT_TRUE(ret.isOk());
-
- stream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (0),
- static_cast<uint32_t> (0),
- static_cast<PixelFormat> (hfrStream.format), 0, 0,
- StreamRotation::ROTATION_0};
- streams[0] = stream;
- config = {streams,
- StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
- ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
- ASSERT_TRUE((Status::ILLEGAL_ARGUMENT == s) ||
- (Status::INTERNAL_ERROR == s));
- });
- ASSERT_TRUE(ret.isOk());
-
- stream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (UINT32_MAX),
- static_cast<uint32_t> (UINT32_MAX),
- static_cast<PixelFormat> (hfrStream.format), 0, 0,
- StreamRotation::ROTATION_0};
- streams[0] = stream;
- config = {streams,
- StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
- ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
- ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
- });
- ASSERT_TRUE(ret.isOk());
-
- stream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (hfrStream.width),
- static_cast<uint32_t> (hfrStream.height),
- static_cast<PixelFormat> (UINT32_MAX), 0, 0,
- StreamRotation::ROTATION_0};
- streams[0] = stream;
- config = {streams,
- StreamConfigurationMode::CONSTRAINED_HIGH_SPEED_MODE};
- ret = session->configureStreams(config, [](Status s, HalStreamConfiguration) {
- ASSERT_EQ(Status::ILLEGAL_ARGUMENT, s);
- });
- ASSERT_TRUE(ret.isOk());
-
- free_camera_metadata(staticMeta);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
}
}
}
@@ -2392,176 +2836,218 @@
// Verify that all supported video + snapshot stream combinations can
// be configured successfully.
TEST_F(CameraHidlTest, configureStreamsVideoStillOutputs) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<AvailableStream> outputBlobStreams;
- std::vector<AvailableStream> outputVideoStreams;
- AvailableStream videoThreshold = {kMaxVideoWidth, kMaxVideoHeight,
- static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
- AvailableStream blobThreshold = {kMaxVideoWidth, kMaxVideoHeight,
- static_cast<int32_t>(PixelFormat::BLOB)};
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<AvailableStream> outputBlobStreams;
+ std::vector<AvailableStream> outputVideoStreams;
+ AvailableStream videoThreshold = {kMaxVideoWidth, kMaxVideoHeight,
+ static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+ AvailableStream blobThreshold = {kMaxVideoWidth, kMaxVideoHeight,
+ static_cast<int32_t>(PixelFormat::BLOB)};
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- camera_metadata_t *staticMeta;
- Return<void> ret;
- sp<ICameraDeviceSession> session;
- openEmptyDeviceSession(name, env, &session /*out*/,
- &staticMeta /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ camera_metadata_t *staticMeta;
+ Return<void> ret;
+ sp<ICameraDeviceSession> session;
+ openEmptyDeviceSession(name, provider.second, &session /*out*/,
+ &staticMeta /*out*/);
- outputBlobStreams.clear();
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
- outputBlobStreams, &blobThreshold));
- ASSERT_NE(0u, outputBlobStreams.size());
+ outputBlobStreams.clear();
+ ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
+ outputBlobStreams, &blobThreshold));
+ ASSERT_NE(0u, outputBlobStreams.size());
- outputVideoStreams.clear();
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
- outputVideoStreams, &videoThreshold));
- ASSERT_NE(0u, outputVideoStreams.size());
+ outputVideoStreams.clear();
+ ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta,
+ outputVideoStreams, &videoThreshold));
+ ASSERT_NE(0u, outputVideoStreams.size());
- int32_t streamId = 0;
- for (auto &blobIter : outputBlobStreams) {
- for (auto &videoIter : outputVideoStreams) {
- Stream videoStream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (videoIter.width),
- static_cast<uint32_t> (videoIter.height),
- static_cast<PixelFormat> (videoIter.format), 0, 0,
- StreamRotation::ROTATION_0};
- Stream blobStream = {streamId++, StreamType::OUTPUT,
- static_cast<uint32_t> (blobIter.width),
- static_cast<uint32_t> (blobIter.height),
- static_cast<PixelFormat> (blobIter.format),
- GRALLOC_USAGE_HW_VIDEO_ENCODER, 0,
- StreamRotation::ROTATION_0};
- ::android::hardware::hidl_vec<Stream> streams = {
- videoStream, blobStream};
- StreamConfiguration config = {streams,
- StreamConfigurationMode::NORMAL_MODE};
- ret = session->configureStreams(config,
- [](Status s, HalStreamConfiguration halConfig) {
- ASSERT_EQ(Status::OK, s);
- ASSERT_EQ(2u, halConfig.streams.size());
- });
- ASSERT_TRUE(ret.isOk());
+ int32_t streamId = 0;
+ for (auto &blobIter : outputBlobStreams) {
+ for (auto &videoIter : outputVideoStreams) {
+ Stream videoStream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (videoIter.width),
+ static_cast<uint32_t> (videoIter.height),
+ static_cast<PixelFormat> (videoIter.format),
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER, 0,
+ StreamRotation::ROTATION_0};
+ Stream blobStream = {streamId++, StreamType::OUTPUT,
+ static_cast<uint32_t> (blobIter.width),
+ static_cast<uint32_t> (blobIter.height),
+ static_cast<PixelFormat> (blobIter.format),
+ GRALLOC1_CONSUMER_USAGE_CPU_READ, 0,
+ StreamRotation::ROTATION_0};
+ ::android::hardware::hidl_vec<Stream> streams = {
+ videoStream, blobStream};
+ StreamConfiguration config = {streams,
+ StreamConfigurationMode::NORMAL_MODE};
+ ret = session->configureStreams(config, [] (
+ Status s, HalStreamConfiguration halConfig) {
+ ASSERT_EQ(Status::OK, s);
+ ASSERT_EQ(2u, halConfig.streams.size());
+ });
+ ASSERT_TRUE(ret.isOk());
+ }
}
- }
- free_camera_metadata(staticMeta);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
+ free_camera_metadata(staticMeta);
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
// Generate and verify a camera capture request
TEST_F(CameraHidlTest, processCaptureRequestPreview) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
- uint64_t bufferId = 1;
- uint32_t frameNumber = 1;
- ::android::hardware::hidl_vec<uint8_t> settings;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+ uint64_t bufferId = 1;
+ uint32_t frameNumber = 1;
+ ::android::hardware::hidl_vec<uint8_t> settings;
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- Stream previewStream;
- HalStreamConfiguration halStreamConfig;
- sp<ICameraDeviceSession> session;
- configurePreviewStream(name, env, &previewThreshold,
- &session /*out*/, &previewStream /*out*/,
- &halStreamConfig /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ Stream previewStream;
+ HalStreamConfiguration halStreamConfig;
+ sp<ICameraDeviceSession> session;
+ bool supportsPartialResults = false;
+ uint32_t partialResultCount = 0;
+ configurePreviewStream(name, provider.second, &previewThreshold,
+ &session /*out*/, &previewStream /*out*/,
+ &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
+ &partialResultCount/*out*/);
- RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
- Return<void> ret;
- ret = session->constructDefaultRequestSettings(reqTemplate,
- [&](auto status, const auto& req) {
- ASSERT_EQ(Status::OK, status);
- settings = req; });
- ASSERT_TRUE(ret.isOk());
-
- sp<GraphicBuffer> gb = new GraphicBuffer(
- previewStream.width, previewStream.height,
- static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
- 1, android_convertGralloc1To0Usage(
- halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage));
- ASSERT_NE(nullptr, gb.get());
- StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
- bufferId, hidl_handle(gb->getNativeBuffer()->handle),
- BufferStatus::OK, nullptr, nullptr};
- ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {
- outputBuffer};
- StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
- BufferStatus::ERROR, nullptr, nullptr};
- CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
- emptyInputBuffer, outputBuffers};
-
- {
- std::unique_lock<std::mutex> l(mLock);
- mResultBuffers.clear();
- mResultFrameNumber = frameNumber;
- }
-
- Status status = Status::INTERNAL_ERROR;
- uint32_t numRequestProcessed = 0;
- hidl_vec<BufferCache> cachesToRemove;
- Return<void> returnStatus = session->processCaptureRequest(
- {request},
- cachesToRemove,
- [&status, &numRequestProcessed] (auto s, uint32_t n) {
- status = s;
- numRequestProcessed = n;
+ std::shared_ptr<ResultMetadataQueue> resultQueue;
+ auto resultQueueRet = session->getCaptureResultMetadataQueue(
+ [&resultQueue](const auto& descriptor) {
+ resultQueue = std::make_shared<ResultMetadataQueue>(
+ descriptor);
+ if (!resultQueue->isValid() ||
+ resultQueue->availableToWrite() <= 0) {
+ ALOGE("%s: HAL returns empty result metadata fmq,"
+ " not use it", __func__);
+ resultQueue = nullptr;
+ // Don't use the queue onwards.
+ }
});
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, status);
- ASSERT_EQ(numRequestProcessed, 1u);
+ ASSERT_TRUE(resultQueueRet.isOk());
- {
- std::unique_lock<std::mutex> l(mLock);
- while (0 == mResultBuffers.size()) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kStreamBufferTimeoutSec);
- ASSERT_NE(std::cv_status::timeout,
- mResultCondition.wait_until(l, timeout));
+ InFlightRequest inflightReq = {1, false, supportsPartialResults,
+ partialResultCount, resultQueue};
+
+ RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
+ Return<void> ret;
+ ret = session->constructDefaultRequestSettings(reqTemplate,
+ [&](auto status, const auto& req) {
+ ASSERT_EQ(Status::OK, status);
+ settings = req; });
+ ASSERT_TRUE(ret.isOk());
+
+ sp<GraphicBuffer> gb = new GraphicBuffer(
+ previewStream.width, previewStream.height,
+ static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
+ 1, android_convertGralloc1To0Usage(
+ halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage));
+ ASSERT_NE(nullptr, gb.get());
+ StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
+ bufferId, hidl_handle(gb->getNativeBuffer()->handle),
+ BufferStatus::OK, nullptr, nullptr};
+ ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {
+ outputBuffer};
+ StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
+ BufferStatus::ERROR, nullptr, nullptr};
+ CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */,
+ settings, emptyInputBuffer, outputBuffers};
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ mInflightMap.clear();
+ mInflightMap.add(frameNumber, &inflightReq);
}
- ASSERT_EQ(BufferStatus::OK, mResultBuffers[0].status);
- ASSERT_EQ(previewStream.id, mResultBuffers[0].streamId);
+ Status status = Status::INTERNAL_ERROR;
+ uint32_t numRequestProcessed = 0;
+ hidl_vec<BufferCache> cachesToRemove;
+ Return<void> returnStatus = session->processCaptureRequest(
+ {request},
+ cachesToRemove,
+ [&status, &numRequestProcessed] (auto s, uint32_t n) {
+ status = s;
+ numRequestProcessed = n;
+ });
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_EQ(numRequestProcessed, 1u);
- request.frameNumber++;
- //Empty settings should be supported after the first call
- //for repeating requests.
- request.settings.setToExternal(nullptr, 0, true);
- mResultBuffers.clear();
- mResultFrameNumber++;
- }
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ while (!inflightReq.errorCodeValid &&
+ ((0 < inflightReq.numBuffersLeft) ||
+ (!inflightReq.haveResultMetadata))) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kStreamBufferTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout,
+ mResultCondition.wait_until(l, timeout));
+ }
- returnStatus = session->processCaptureRequest(
- {request},
- cachesToRemove,
- [&status, &numRequestProcessed] (auto s, uint32_t n) {
- status = s;
- numRequestProcessed = n;
- });
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, status);
- ASSERT_EQ(numRequestProcessed, 1u);
+ ASSERT_FALSE(inflightReq.errorCodeValid);
+ ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+ ASSERT_EQ(previewStream.id,
+ inflightReq.resultOutputBuffers[0].streamId);
- {
- std::unique_lock<std::mutex> l(mLock);
- while (0 == mResultBuffers.size()) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kStreamBufferTimeoutSec);
- ASSERT_NE(std::cv_status::timeout,
- mResultCondition.wait_until(l, timeout));
+ request.frameNumber++;
+ //Empty settings should be supported after the first call
+ //for repeating requests.
+ request.settings.setToExternal(nullptr, 0, true);
+ // The buffer has been registered to HAL by bufferId, so per
+ // API contract we should send a null handle for this buffer
+ request.outputBuffers[0].buffer = nullptr;
+ mInflightMap.clear();
+ inflightReq = {1, false, supportsPartialResults,
+ partialResultCount, resultQueue};
+ mInflightMap.add(request.frameNumber, &inflightReq);
}
- ASSERT_EQ(BufferStatus::OK, mResultBuffers[0].status);
- ASSERT_EQ(previewStream.id, mResultBuffers[0].streamId);
- }
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
+ returnStatus = session->processCaptureRequest(
+ {request},
+ cachesToRemove,
+ [&status, &numRequestProcessed] (auto s, uint32_t n) {
+ status = s;
+ numRequestProcessed = n;
+ });
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_EQ(numRequestProcessed, 1u);
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ while (!inflightReq.errorCodeValid &&
+ ((0 < inflightReq.numBuffersLeft) ||
+ (!inflightReq.haveResultMetadata))) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kStreamBufferTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout,
+ mResultCondition.wait_until(l, timeout));
+ }
+
+ ASSERT_FALSE(inflightReq.errorCodeValid);
+ ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+ ASSERT_EQ(previewStream.id,
+ inflightReq.resultOutputBuffers[0].streamId);
+ }
+
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
@@ -2569,58 +3055,67 @@
// Test whether an incorrect capture request with missing settings will
// be reported correctly.
TEST_F(CameraHidlTest, processCaptureRequestInvalidSinglePreview) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<AvailableStream> outputPreviewStreams;
- AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
- uint64_t bufferId = 1;
- uint32_t frameNumber = 1;
- ::android::hardware::hidl_vec<uint8_t> settings;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<AvailableStream> outputPreviewStreams;
+ AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+ uint64_t bufferId = 1;
+ uint32_t frameNumber = 1;
+ ::android::hardware::hidl_vec<uint8_t> settings;
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- Stream previewStream;
- HalStreamConfiguration halStreamConfig;
- sp<ICameraDeviceSession> session;
- configurePreviewStream(name, env, &previewThreshold,
- &session /*out*/, &previewStream /*out*/,
- &halStreamConfig /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ Stream previewStream;
+ HalStreamConfiguration halStreamConfig;
+ sp<ICameraDeviceSession> session;
+ bool supportsPartialResults = false;
+ uint32_t partialResultCount = 0;
+ configurePreviewStream(name, provider.second, &previewThreshold,
+ &session /*out*/, &previewStream /*out*/,
+ &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
+ &partialResultCount /*out*/);
- sp<GraphicBuffer> gb = new GraphicBuffer(
- previewStream.width, previewStream.height,
- static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
- 1, android_convertGralloc1To0Usage(
- halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage));
+ sp<GraphicBuffer> gb = new GraphicBuffer(
+ previewStream.width, previewStream.height,
+ static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
+ 1, android_convertGralloc1To0Usage(
+ halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage));
- StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
- bufferId, hidl_handle(gb->getNativeBuffer()->handle),
- BufferStatus::OK, nullptr, nullptr};
- ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {
- outputBuffer};
- StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
- BufferStatus::ERROR, nullptr, nullptr};
- CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
- emptyInputBuffer, outputBuffers};
+ StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
+ bufferId, hidl_handle(gb->getNativeBuffer()->handle),
+ BufferStatus::OK, nullptr, nullptr};
+ ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {
+ outputBuffer};
+ StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
+ BufferStatus::ERROR, nullptr, nullptr};
+ CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
+ emptyInputBuffer, outputBuffers};
- //Settings were not correctly initialized, we should fail here
- Status status = Status::OK;
- uint32_t numRequestProcessed = 0;
- hidl_vec<BufferCache> cachesToRemove;
- Return<void> ret = session->processCaptureRequest(
- {request},
- cachesToRemove,
- [&status, &numRequestProcessed] (auto s, uint32_t n) {
- status = s;
- numRequestProcessed = n;
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Status::INTERNAL_ERROR, status);
- ASSERT_EQ(numRequestProcessed, 0u);
+ //Settings were not correctly initialized, we should fail here
+ Status status = Status::OK;
+ uint32_t numRequestProcessed = 0;
+ hidl_vec<BufferCache> cachesToRemove;
+ Return<void> ret = session->processCaptureRequest(
+ {request},
+ cachesToRemove,
+ [&status, &numRequestProcessed] (auto s, uint32_t n) {
+ status = s;
+ numRequestProcessed = n;
+ });
+ ASSERT_TRUE(ret.isOk());
+ // b/64041692: Temporariy accept ILLEGAL_ARGUMENT or INTERNAL_ERROR
+ // It will be changed to only accept ILLEGAL_ARGUMENT in next release
+ ASSERT_TRUE(status == Status::ILLEGAL_ARGUMENT ||
+ status == Status::INTERNAL_ERROR);
+ ASSERT_EQ(numRequestProcessed, 0u);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
@@ -2628,207 +3123,233 @@
// Check whether an invalid capture request with missing output buffers
// will be reported correctly.
TEST_F(CameraHidlTest, processCaptureRequestInvalidBuffer) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<AvailableStream> outputBlobStreams;
- AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
- uint32_t frameNumber = 1;
- ::android::hardware::hidl_vec<uint8_t> settings;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<AvailableStream> outputBlobStreams;
+ AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+ uint32_t frameNumber = 1;
+ ::android::hardware::hidl_vec<uint8_t> settings;
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- Stream previewStream;
- HalStreamConfiguration halStreamConfig;
- sp<ICameraDeviceSession> session;
- configurePreviewStream(name, env, &previewThreshold,
- &session /*out*/, &previewStream /*out*/,
- &halStreamConfig /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ Stream previewStream;
+ HalStreamConfiguration halStreamConfig;
+ sp<ICameraDeviceSession> session;
+ bool supportsPartialResults = false;
+ uint32_t partialResultCount = 0;
+ configurePreviewStream(name, provider.second, &previewThreshold,
+ &session /*out*/, &previewStream /*out*/,
+ &halStreamConfig /*out*/, &supportsPartialResults/*out*/,
+ &partialResultCount /*out*/);
- RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
- Return<void> ret;
- ret = session->constructDefaultRequestSettings(reqTemplate,
- [&](auto status, const auto& req) {
- ASSERT_EQ(Status::OK, status);
- settings = req; });
- ASSERT_TRUE(ret.isOk());
+ RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
+ Return<void> ret;
+ ret = session->constructDefaultRequestSettings(reqTemplate,
+ [&](auto status, const auto& req) {
+ ASSERT_EQ(Status::OK, status);
+ settings = req; });
+ ASSERT_TRUE(ret.isOk());
- ::android::hardware::hidl_vec<StreamBuffer> emptyOutputBuffers;
- StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
- BufferStatus::ERROR, nullptr, nullptr};
- CaptureRequest request = {frameNumber, 0/* fmqSettingsSize */, settings,
- emptyInputBuffer, emptyOutputBuffers};
+ ::android::hardware::hidl_vec<StreamBuffer> emptyOutputBuffers;
+ StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
+ BufferStatus::ERROR, nullptr, nullptr};
+ CaptureRequest request = {frameNumber, 0/* fmqSettingsSize */,
+ settings, emptyInputBuffer, emptyOutputBuffers};
- //Output buffers are missing, we should fail here
- Status status = Status::OK;
- uint32_t numRequestProcessed = 0;
- hidl_vec<BufferCache> cachesToRemove;
- ret = session->processCaptureRequest(
- {request},
- cachesToRemove,
- [&status, &numRequestProcessed] (auto s, uint32_t n) {
- status = s;
- numRequestProcessed = n;
- });
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Status::INTERNAL_ERROR, status);
- ASSERT_EQ(numRequestProcessed, 0u);
+ //Output buffers are missing, we should fail here
+ Status status = Status::OK;
+ uint32_t numRequestProcessed = 0;
+ hidl_vec<BufferCache> cachesToRemove;
+ ret = session->processCaptureRequest(
+ {request},
+ cachesToRemove,
+ [&status, &numRequestProcessed] (auto s, uint32_t n) {
+ status = s;
+ numRequestProcessed = n;
+ });
+ ASSERT_TRUE(ret.isOk());
+ // b/64041692: Temporariy accept ILLEGAL_ARGUMENT or INTERNAL_ERROR
+ // It will be changed to only accept ILLEGAL_ARGUMENT in next release
+ ASSERT_TRUE(status == Status::ILLEGAL_ARGUMENT ||
+ status == Status::INTERNAL_ERROR);
+ ASSERT_EQ(numRequestProcessed, 0u);
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
+ }
}
}
}
// Generate, trigger and flush a preview request
TEST_F(CameraHidlTest, flushPreviewRequest) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<AvailableStream> outputPreviewStreams;
- AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
- uint64_t bufferId = 1;
- uint32_t frameNumber = 1;
- ::android::hardware::hidl_vec<uint8_t> settings;
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<AvailableStream> outputPreviewStreams;
+ AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+ uint64_t bufferId = 1;
+ uint32_t frameNumber = 1;
+ ::android::hardware::hidl_vec<uint8_t> settings;
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- Stream previewStream;
- HalStreamConfiguration halStreamConfig;
- sp<ICameraDeviceSession> session;
- configurePreviewStream(name, env, &previewThreshold,
- &session /*out*/, &previewStream /*out*/,
- &halStreamConfig /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ Stream previewStream;
+ HalStreamConfiguration halStreamConfig;
+ sp<ICameraDeviceSession> session;
+ bool supportsPartialResults = false;
+ uint32_t partialResultCount = 0;
+ configurePreviewStream(name, provider.second, &previewThreshold,
+ &session /*out*/, &previewStream /*out*/,
+ &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
+ &partialResultCount /*out*/);
- RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
- Return<void> ret;
- ret = session->constructDefaultRequestSettings(reqTemplate,
- [&](auto status, const auto& req) {
- ASSERT_EQ(Status::OK, status);
- settings = req; });
- ASSERT_TRUE(ret.isOk());
-
- sp<GraphicBuffer> gb = new GraphicBuffer(
- previewStream.width, previewStream.height,
- static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
- 1, android_convertGralloc1To0Usage(
- halStreamConfig.streams[0].producerUsage,
- halStreamConfig.streams[0].consumerUsage));
- ASSERT_NE(nullptr, gb.get());
- StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
- bufferId, hidl_handle(gb->getNativeBuffer()->handle),
- BufferStatus::OK, nullptr, nullptr};
- ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {
- outputBuffer};
- const StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
- BufferStatus::ERROR, nullptr, nullptr};
- CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */, settings,
- emptyInputBuffer, outputBuffers};
-
- {
- std::unique_lock<std::mutex> l(mLock);
- mResultBuffers.clear();
- mErrors.clear();
- mResultFrameNumber = frameNumber;
- }
-
- Status status = Status::INTERNAL_ERROR;
- uint32_t numRequestProcessed = 0;
- hidl_vec<BufferCache> cachesToRemove;
- ret = session->processCaptureRequest(
- {request},
- cachesToRemove,
- [&status, &numRequestProcessed] (auto s, uint32_t n) {
- status = s;
- numRequestProcessed = n;
+ std::shared_ptr<ResultMetadataQueue> resultQueue;
+ auto resultQueueRet = session->getCaptureResultMetadataQueue(
+ [&resultQueue](const auto& descriptor) {
+ resultQueue = std::make_shared<ResultMetadataQueue>(
+ descriptor);
+ if (!resultQueue->isValid() ||
+ resultQueue->availableToWrite() <= 0) {
+ ALOGE("%s: HAL returns empty result metadata fmq,"
+ " not use it", __func__);
+ resultQueue = nullptr;
+ // Don't use the queue onwards.
+ }
});
+ ASSERT_TRUE(resultQueueRet.isOk());
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(Status::OK, status);
- ASSERT_EQ(numRequestProcessed, 1u);
- //Flush before waiting for request to complete.
- Return<Status> returnStatus = session->flush();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
+ InFlightRequest inflightReq = {1, false, supportsPartialResults,
+ partialResultCount, resultQueue};
+ RequestTemplate reqTemplate = RequestTemplate::PREVIEW;
+ Return<void> ret;
+ ret = session->constructDefaultRequestSettings(reqTemplate,
+ [&](auto status, const auto& req) {
+ ASSERT_EQ(Status::OK, status);
+ settings = req; });
+ ASSERT_TRUE(ret.isOk());
- {
- std::unique_lock<std::mutex> l(mLock);
- while ((0 == mResultBuffers.size()) && (0 == mErrors.size())) {
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::seconds(kStreamBufferTimeoutSec);
- ASSERT_NE(std::cv_status::timeout,
- mResultCondition.wait_until(l, timeout));
+ sp<GraphicBuffer> gb = new GraphicBuffer(
+ previewStream.width, previewStream.height,
+ static_cast<int32_t>(halStreamConfig.streams[0].overrideFormat),
+ 1, android_convertGralloc1To0Usage(
+ halStreamConfig.streams[0].producerUsage,
+ halStreamConfig.streams[0].consumerUsage));
+ ASSERT_NE(nullptr, gb.get());
+ StreamBuffer outputBuffer = {halStreamConfig.streams[0].id,
+ bufferId, hidl_handle(gb->getNativeBuffer()->handle),
+ BufferStatus::OK, nullptr, nullptr};
+ ::android::hardware::hidl_vec<StreamBuffer> outputBuffers = {
+ outputBuffer};
+ const StreamBuffer emptyInputBuffer = {-1, 0, nullptr,
+ BufferStatus::ERROR, nullptr, nullptr};
+ CaptureRequest request = {frameNumber, 0 /* fmqSettingsSize */,
+ settings, emptyInputBuffer, outputBuffers};
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ mInflightMap.clear();
+ mInflightMap.add(frameNumber, &inflightReq);
}
- if (mErrors.empty()) {
- ASSERT_EQ(BufferStatus::OK, mResultBuffers[0].status);
- ASSERT_EQ(previewStream.id, mResultBuffers[0].streamId);
- } else {
- for (auto &error : mErrors) {
- switch (error.errorCode) {
+ Status status = Status::INTERNAL_ERROR;
+ uint32_t numRequestProcessed = 0;
+ hidl_vec<BufferCache> cachesToRemove;
+ ret = session->processCaptureRequest(
+ {request},
+ cachesToRemove,
+ [&status, &numRequestProcessed] (auto s, uint32_t n) {
+ status = s;
+ numRequestProcessed = n;
+ });
+
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_EQ(Status::OK, status);
+ ASSERT_EQ(numRequestProcessed, 1u);
+ //Flush before waiting for request to complete.
+ Return<Status> returnStatus = session->flush();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ while (!inflightReq.errorCodeValid &&
+ ((0 < inflightReq.numBuffersLeft) ||
+ (!inflightReq.haveResultMetadata))) {
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::seconds(kStreamBufferTimeoutSec);
+ ASSERT_NE(std::cv_status::timeout,
+ mResultCondition.wait_until(l, timeout));
+ }
+
+ if (!inflightReq.errorCodeValid) {
+ ASSERT_NE(inflightReq.resultOutputBuffers.size(), 0u);
+ ASSERT_EQ(previewStream.id,
+ inflightReq.resultOutputBuffers[0].streamId);
+ } else {
+ switch (inflightReq.errorCode) {
case ErrorCode::ERROR_REQUEST:
case ErrorCode::ERROR_RESULT:
- //Expected
- break;
case ErrorCode::ERROR_BUFFER:
- //Expected as well
- ASSERT_EQ(frameNumber, error.frameNumber);
- ASSERT_EQ(previewStream.id, error.errorStreamId);
+ //Expected
break;
case ErrorCode::ERROR_DEVICE:
default:
- FAIL() <<"Unexpected error:" << static_cast<uint32_t> (error.errorCode);
+ FAIL() << "Unexpected error:" << static_cast<uint32_t> (
+ inflightReq.errorCode);
}
}
+
+ ret = session->close();
+ ASSERT_TRUE(ret.isOk());
}
}
-
- ret = session->close();
- ASSERT_TRUE(ret.isOk());
}
}
}
// Verify that camera flushes correctly without any pending requests.
TEST_F(CameraHidlTest, flushEmpty) {
- CameraHidlEnvironment* env = CameraHidlEnvironment::Instance();
- hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames();
- std::vector<AvailableStream> outputPreviewStreams;
- AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
- static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
+ for (auto provider : CameraHidlEnvironment::Instance()->mProviders) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(
+ provider.second);
+ std::vector<AvailableStream> outputPreviewStreams;
+ AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight,
+ static_cast<int32_t>(PixelFormat::IMPLEMENTATION_DEFINED)};
- for (const auto& name : cameraDeviceNames) {
- if (getCameraDeviceVersion(name) == CAMERA_DEVICE_API_VERSION_3_2) {
- Stream previewStream;
- HalStreamConfiguration halStreamConfig;
- sp<ICameraDeviceSession> session;
- configurePreviewStream(name, env, &previewThreshold,
- &session /*out*/, &previewStream /*out*/,
- &halStreamConfig /*out*/);
+ for (const auto& name : cameraDeviceNames) {
+ if (getCameraDeviceVersion(name, provider.first) ==
+ CAMERA_DEVICE_API_VERSION_3_2) {
+ Stream previewStream;
+ HalStreamConfiguration halStreamConfig;
+ sp<ICameraDeviceSession> session;
+ bool supportsPartialResults = false;
+ uint32_t partialResultCount = 0;
+ configurePreviewStream(name, provider.second, &previewThreshold,
+ &session /*out*/, &previewStream /*out*/,
+ &halStreamConfig /*out*/, &supportsPartialResults /*out*/,
+ &partialResultCount /*out*/);
- {
- std::unique_lock<std::mutex> l(mLock);
- mResultBuffers.clear();
- mErrors.clear();
- mResultFrameNumber = 0;
+ Return<Status> returnStatus = session->flush();
+ ASSERT_TRUE(returnStatus.isOk());
+ ASSERT_EQ(Status::OK, returnStatus);
+
+ {
+ std::unique_lock<std::mutex> l(mLock);
+ auto timeout = std::chrono::system_clock::now() +
+ std::chrono::milliseconds(kEmptyFlushTimeoutMSec);
+ ASSERT_EQ(std::cv_status::timeout,
+ mResultCondition.wait_until(l, timeout));
+ }
+
+ Return<void> ret = session->close();
+ ASSERT_TRUE(ret.isOk());
}
-
- Return<Status> returnStatus = session->flush();
- ASSERT_TRUE(returnStatus.isOk());
- ASSERT_EQ(Status::OK, returnStatus);
-
- {
- std::unique_lock<std::mutex> l(mLock);
- auto timeout = std::chrono::system_clock::now() +
- std::chrono::milliseconds(kEmptyFlushTimeoutMSec);
- ASSERT_EQ(std::cv_status::timeout,
- mResultCondition.wait_until(l, timeout));
- ASSERT_TRUE(mErrors.empty());
- ASSERT_TRUE(mResultBuffers.empty());
- }
-
- Return<void> ret = session->close();
- ASSERT_TRUE(ret.isOk());
}
}
}
@@ -3018,21 +3539,24 @@
// Open a device session and configure a preview stream.
void CameraHidlTest::configurePreviewStream(const std::string &name,
- const CameraHidlEnvironment* env,
+ sp<ICameraProvider> provider,
const AvailableStream *previewThreshold,
sp<ICameraDeviceSession> *session /*out*/,
Stream *previewStream /*out*/,
- HalStreamConfiguration *halStreamConfig /*out*/) {
- ASSERT_NE(nullptr, env);
+ HalStreamConfiguration *halStreamConfig /*out*/,
+ bool *supportsPartialResults /*out*/,
+ uint32_t *partialResultCount /*out*/) {
ASSERT_NE(nullptr, session);
ASSERT_NE(nullptr, previewStream);
ASSERT_NE(nullptr, halStreamConfig);
+ ASSERT_NE(nullptr, supportsPartialResults);
+ ASSERT_NE(nullptr, partialResultCount);
std::vector<AvailableStream> outputPreviewStreams;
::android::sp<ICameraDevice> device3_2;
ALOGI("configureStreams: Testing camera device %s", name.c_str());
Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V3_x(
+ ret = provider->getCameraDeviceInterface_V3_x(
name,
[&](auto status, const auto& device) {
ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
@@ -3064,6 +3588,14 @@
});
ASSERT_TRUE(ret.isOk());
+ camera_metadata_ro_entry entry;
+ auto status = find_camera_metadata_ro_entry(staticMeta,
+ ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &entry);
+ if ((0 == status) && (entry.count > 0)) {
+ *partialResultCount = entry.data.i32[0];
+ *supportsPartialResults = (*partialResultCount > 1);
+ }
+
outputPreviewStreams.clear();
auto rc = getAvailableOutputStreams(staticMeta,
outputPreviewStreams, previewThreshold);
@@ -3075,7 +3607,7 @@
static_cast<uint32_t> (outputPreviewStreams[0].width),
static_cast<uint32_t> (outputPreviewStreams[0].height),
static_cast<PixelFormat> (outputPreviewStreams[0].format),
- 0, 0, StreamRotation::ROTATION_0};
+ GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0, StreamRotation::ROTATION_0};
::android::hardware::hidl_vec<Stream> streams = {*previewStream};
StreamConfiguration config = {streams,
StreamConfigurationMode::NORMAL_MODE};
@@ -3090,17 +3622,16 @@
// Open a device session with empty callbacks and return static metadata.
void CameraHidlTest::openEmptyDeviceSession(const std::string &name,
- const CameraHidlEnvironment* env,
+ sp<ICameraProvider> provider,
sp<ICameraDeviceSession> *session /*out*/,
camera_metadata_t **staticMeta /*out*/) {
- ASSERT_NE(nullptr, env);
ASSERT_NE(nullptr, session);
ASSERT_NE(nullptr, staticMeta);
::android::sp<ICameraDevice> device3_2;
ALOGI("configureStreams: Testing camera device %s", name.c_str());
Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V3_x(
+ ret = provider->getCameraDeviceInterface_V3_x(
name,
[&](auto status, const auto& device) {
ALOGI("getCameraDeviceInterface_V3_x returns status:%d",
@@ -3132,13 +3663,12 @@
// Open a particular camera device.
void CameraHidlTest::openCameraDevice(const std::string &name,
- const CameraHidlEnvironment* env,
+ sp<ICameraProvider> provider,
sp<::android::hardware::camera::device::V1_0::ICameraDevice> *device1 /*out*/) {
- ASSERT_TRUE(nullptr != env);
ASSERT_TRUE(nullptr != device1);
Return<void> ret;
- ret = env->mProvider->getCameraDeviceInterface_V1_x(
+ ret = provider->getCameraDeviceInterface_V1_x(
name,
[&](auto status, const auto& device) {
ALOGI("getCameraDeviceInterface_V1_x returns status:%d",
diff --git a/current.txt b/current.txt
index a476f51..e714b62 100644
--- a/current.txt
+++ b/current.txt
@@ -186,3 +186,7 @@
b12ef0bdd8a4d247a8a6e960b227ed32383f2b0241f55d67fcea6eff6a6737fa android.hardware.wifi.supplicant@1.0::ISupplicantStaNetwork
d8f0877ae1d321c1d884c7631dfe36cab0ec8a4b2863d4b687f85d3549a63bcc android.hardware.wifi.supplicant@1.0::ISupplicantStaNetworkCallback
fe3c3c2f572b72f15f8594c538b0577bd5c28722c31879cfe6231330cddb6747 android.hardware.wifi.supplicant@1.0::types
+
+# ABI preserving changes to HALs released in Android O
+
+78589343d8ee2e1b155acad3fbdc7fcbb6af94491aee968b2383c21627264f8b android.hardware.radio@1.0::IRadioResponse
diff --git a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
index 33fb6fb..5d4e7d0 100644
--- a/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
+++ b/drm/1.0/vts/functional/drm_hal_vendor_test.cpp
@@ -129,7 +129,7 @@
// Do the same for the crypto factory
cryptoFactory = VtsTestBase::getService<ICryptoFactory>(name);
if (cryptoFactory == nullptr) {
- VtsTestBase::getService<ICryptoFactory>();
+ cryptoFactory = VtsTestBase::getService<ICryptoFactory>();
}
ASSERT_NE(cryptoFactory, nullptr);
diff --git a/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
index 3dad3c1..a017404 100644
--- a/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
+++ b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
@@ -59,7 +59,7 @@
uint32_t len = 16;
hidl_vec<int32_t> vec;
vec.resize(len);
- std::fill(vec.begin(), vec.end(), 1);
+ std::fill(vec.begin(), vec.end(), 1000);
for (auto range = ranges.begin(); range != ranges.end(); range++) {
EXPECT_TRUE(ir->transmit(range->min, vec));
EXPECT_TRUE(ir->transmit(range->max, vec));
@@ -74,7 +74,6 @@
vec.resize(len);
std::fill(vec.begin(), vec.end(), 1);
EXPECT_FALSE(ir->transmit(-1, vec));
- EXPECT_FALSE(ir->transmit(0, vec));
}
int main(int argc, char **argv) {
diff --git a/radio/1.0/IRadioResponse.hal b/radio/1.0/IRadioResponse.hal
index 35ab899..8697e57 100644
--- a/radio/1.0/IRadioResponse.hal
+++ b/radio/1.0/IRadioResponse.hal
@@ -28,6 +28,12 @@
*
* Valid errors returned:
* RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getIccCardStatusResponse(RadioResponseInfo info, CardStatus cardStatus);
@@ -39,6 +45,13 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE (radio resetting)
* RadioError:PASSWORD_INCORRECT
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:INVALID_SIM_STATE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway supplyIccPinForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
@@ -50,6 +63,13 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE (radio resetting)
* RadioError:PASSWORD_INCORRECT (PUK is invalid)
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:INVALID_SIM_STATE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway supplyIccPukForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
@@ -61,6 +81,13 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE (radio resetting)
* RadioError:PASSWORD_INCORRECT
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:INVALID_SIM_STATE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway supplyIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
@@ -71,6 +98,13 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE (radio resetting)
* RadioError:PASSWORD_INCORRECT (PUK is invalid)
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:INVALID_SIM_STATE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway supplyIccPuk2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
@@ -82,6 +116,13 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE (radio resetting)
* RadioError:PASSWORD_INCORRECT
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:INVALID_SIM_STATE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway changeIccPinForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
@@ -93,6 +134,13 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE (radio resetting)
* RadioError:PASSWORD_INCORRECT (old PIN2 is invalid)
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:INVALID_SIM_STATE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway changeIccPin2ForAppResponse(RadioResponseInfo info, int32_t remainingRetries);
@@ -102,6 +150,7 @@
*
* Valid errors returned:
* RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
* RadioError:PASSWORD_INCORRECT (code is invalid)
* RadioError:NO_MEMORY
* RadioError:INVALID_SIM_STATE
@@ -109,6 +158,9 @@
* RadioError:SYSTEM_ERR
* RadioError:MODEM_ERR
* RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway supplyNetworkDepersonalizationResponse(RadioResponseInfo info, int32_t remainingRetries);
@@ -124,6 +176,8 @@
* RadioError:SYSTEM_ERR
* RadioError:INVALID_ARGUMENTS
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getCurrentCallsResponse(RadioResponseInfo info, vec<Call> calls);
@@ -152,6 +206,7 @@
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:CANCELLED
*/
oneway dialResponse(RadioResponseInfo info);
@@ -162,6 +217,13 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE (radio resetting)
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_SIM_STATE
+ * RadioError:SIM_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getIMSIForAppResponse(RadioResponseInfo info, string imsi);
@@ -177,6 +239,9 @@
* RadioError:MODEM_ERR
* RadioError:INTERNAL_ERR
* RadioError:INVALID_CALL_ID
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway hangupConnectionResponse(RadioResponseInfo info);
@@ -196,6 +261,7 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:CANCELLED
*/
oneway hangupWaitingOrBackgroundResponse(RadioResponseInfo info);
@@ -215,6 +281,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway hangupForegroundResumeBackgroundResponse(RadioResponseInfo info);
@@ -235,6 +303,8 @@
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway switchWaitingOrHoldingAndActiveResponse(RadioResponseInfo info);
@@ -254,6 +324,8 @@
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway conferenceResponse(RadioResponseInfo info);
@@ -274,6 +346,8 @@
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway rejectCallResponse(RadioResponseInfo info);
@@ -322,6 +396,9 @@
* RadioError:INTERNAL_ERR
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getLastCallFailCauseResponse(RadioResponseInfo info,
LastCallFailCauseInfo failCauseinfo);
@@ -339,6 +416,8 @@
* RadioError:MODEM_ERR
* RadioError:NOT_PROVISIONED
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getSignalStrengthResponse(RadioResponseInfo info, SignalStrength sigStrength);
@@ -350,6 +429,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getVoiceRegistrationStateResponse(RadioResponseInfo info,
VoiceRegStateResult voiceRegResponse);
@@ -368,6 +452,8 @@
* RadioError:MODEM_ERR
* RadioError:NOT_PROVISIONED
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getDataRegistrationStateResponse(RadioResponseInfo info,
DataRegStateResult dataRegResponse);
@@ -385,6 +471,8 @@
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getOperatorResponse(RadioResponseInfo info, string longName, string shortName,
string numeric);
@@ -406,6 +494,8 @@
* RadioError:OPERATION_NOT_ALLOWED
* RadioError:INVALID_MODEM_STATE
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setRadioPowerResponse(RadioResponseInfo info);
@@ -423,6 +513,7 @@
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:CANCELLED
* RadioError:INVALID_MODEM_STATE
*/
oneway sendDtmfResponse(RadioResponseInfo info);
@@ -452,6 +543,8 @@
* RadioError:INVALID_MODEM_STATE
* RadioError:NETWORK_NOT_READY
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway sendSmsResponse(RadioResponseInfo info, SendSmsResult sms);
@@ -481,6 +574,8 @@
* RadioError:INVALID_MODEM_STATE
* RadioError:NETWORK_NOT_READY
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway sendSMSExpectMoreResponse(RadioResponseInfo info, SendSmsResult sms);
@@ -497,7 +592,10 @@
* RadioError:OP_NOT_ALLOWED_DURING_VOICE_CALL
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_ARGUMENTS
- * RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setupDataCallResponse(RadioResponseInfo info, SetupDataCallResult dcResponse);
@@ -510,6 +608,13 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:SIM_PIN2
* RadioError:SIM_PUK2
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_SIM_STATE
+ * RadioError:SIM_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway iccIOForAppResponse(RadioResponseInfo info, IccIoResult iccIo);
@@ -534,6 +639,8 @@
* RadioError:INVALID_STATE
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway sendUssdResponse(RadioResponseInfo info);
@@ -553,6 +660,8 @@
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway cancelPendingUssdResponse(RadioResponseInfo info);
@@ -574,6 +683,8 @@
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getClirResponse(RadioResponseInfo info, int32_t n, int32_t m);
@@ -591,6 +702,8 @@
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setClirResponse(RadioResponseInfo info);
@@ -620,6 +733,8 @@
* RadioError:FDN_CHECK_FAILURE
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:SYSTEM_ERR
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getCallForwardStatusResponse(RadioResponseInfo info,
vec<CallForwardInfo> callForwardInfos);
@@ -642,6 +757,8 @@
* RadioError:FDN_CHECK_FAILURE
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setCallForwardResponse(RadioResponseInfo info);
@@ -669,6 +786,8 @@
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getCallWaitingResponse(RadioResponseInfo info, bool enable, int32_t serviceClass);
@@ -690,6 +809,8 @@
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setCallWaitingResponse(RadioResponseInfo info);
@@ -699,6 +820,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway acknowledgeLastIncomingGsmSmsResponse(RadioResponseInfo info);
@@ -717,6 +843,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway acceptCallResponse(RadioResponseInfo info);
@@ -730,6 +858,10 @@
* RadioError:INVALID_STATE
* RadioError:INVALID_ARGUMENTS
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway deactivateDataCallResponse(RadioResponseInfo info);
@@ -752,6 +884,8 @@
* RadioError:SYSTEM_ERR
* RadioError:FDN_CHECK_FAILURE
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getFacilityLockForAppResponse(RadioResponseInfo info, int32_t response);
@@ -774,6 +908,8 @@
* RadioError:FDN_CHECK_FAILURE
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setFacilityLockForAppResponse(RadioResponseInfo info, int32_t retry);
@@ -793,6 +929,8 @@
* RadioError:SYSTEM_ERR
* RadioError:FDN_CHECK_FAILURE
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setBarringPasswordResponse(RadioResponseInfo info);
@@ -809,6 +947,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getNetworkSelectionModeResponse(RadioResponseInfo info, bool manual);
@@ -826,6 +966,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*
* Returns RadioError:ILLEGAL_SIM_OR_ME when the failure is permanent and
* no retries needed, such as illegal SIM or ME.
@@ -847,6 +989,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*
* Returns RadioError:ILLEGAL_SIM_OR_ME when the failure is permanent and
* no retries needed, such as illegal SIM or ME.
@@ -869,6 +1013,8 @@
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:CANCELLED
+ * RadioError:NO_RESOURCES
+ * RadioError:INTERNAL_ERR
*/
oneway getAvailableNetworksResponse(RadioResponseInfo info,
vec<OperatorInfo> networkInfos);
@@ -888,6 +1034,7 @@
* RadioError:INVALID_CALL_ID
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:CANCELLED
* RadioError:INVALID_MODEM_STATE
*/
oneway startDtmfResponse(RadioResponseInfo info);
@@ -907,6 +1054,7 @@
* RadioError:INTERNAL_ERR
* RadioError:INVALID_CALL_ID
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:CANCELLED
* RadioError:INVALID_MODEM_STATE
*/
oneway stopDtmfResponse(RadioResponseInfo info);
@@ -925,6 +1073,8 @@
* RadioError:MODEM_ERR
* RadioError:NOT_PROVISIONED
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getBasebandVersionResponse(RadioResponseInfo info, string version);
@@ -945,6 +1095,7 @@
* RadioError:OPERATION_NOT_ALLOWED
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:CANCELLED
*/
oneway separateConnectionResponse(RadioResponseInfo info);
@@ -960,6 +1111,8 @@
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setMuteResponse(RadioResponseInfo info);
@@ -979,6 +1132,8 @@
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getMuteResponse(RadioResponseInfo info, bool enable);
@@ -996,6 +1151,8 @@
* RadioError:INTERNAL_ERR
* RadioError:FDN_CHECK_FAILURE
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getClipResponse(RadioResponseInfo info, ClipStatus status);
@@ -1006,6 +1163,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getDataCallListResponse(RadioResponseInfo info, vec<SetupDataCallResult> dcResponse);
@@ -1022,6 +1184,8 @@
* RadioError:MODEM_ERR
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setSuppServiceNotificationsResponse(RadioResponseInfo info);
@@ -1031,6 +1195,7 @@
*
* Valid errors returned:
* RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
* RadioError:SIM_FULL
* RadioError:INVALID_ARGUMENTS
* RadioError:INVALID_SMS_FORMAT
@@ -1045,6 +1210,8 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
*/
oneway writeSmsToSimResponse(RadioResponseInfo info, int32_t index);
@@ -1053,6 +1220,8 @@
*
* Valid errors returned:
* RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:SIM_FULL
* RadioError:INVALID_ARGUMENTS
* RadioError:NO_MEMORY
* RadioError:SYSTEM_ERR
@@ -1061,6 +1230,8 @@
* RadioError:INTERNAL_ERR
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
* RadioError:INVALID_MODEM_STATE
*/
oneway deleteSmsOnSimResponse(RadioResponseInfo info);
@@ -1078,6 +1249,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setBandModeResponse(RadioResponseInfo info);
@@ -1094,6 +1267,8 @@
* RadioError:SYSTEM_ERR
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getAvailableBandModesResponse(RadioResponseInfo info, vec<RadioBandMode> bandModes);
@@ -1107,6 +1282,13 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:SIM_BUSY
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:MODEM_ERR
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway sendEnvelopeResponse(RadioResponseInfo info, string commandResponse);
@@ -1118,6 +1300,12 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:INVALID_ARGUMENTS
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway sendTerminalResponseToSimResponse(RadioResponseInfo info);
@@ -1126,11 +1314,15 @@
*
* Valid errors returned:
* RadioError:NONE
+ * RadioError:RADIO_NOT_AVAILABLE
* RadioError:NO_MEMORY
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:MODEM_ERR
* RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway handleStkCallSetupRequestFromSimResponse(RadioResponseInfo info);
@@ -1151,6 +1343,8 @@
* RadioError:OPERATION_NOT_ALLOWED
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway explicitCallTransferResponse(RadioResponseInfo info);
@@ -1168,6 +1362,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setPreferredNetworkTypeResponse(RadioResponseInfo info);
@@ -1184,6 +1380,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getPreferredNetworkTypeResponse(RadioResponseInfo info,
PreferredNetworkType nwType);
@@ -1202,6 +1400,8 @@
* RadioError:MODEM_ERR
* RadioError:NO_NETWORK_FOUND
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getNeighboringCidsResponse(RadioResponseInfo info, vec<NeighboringCell> cells);
@@ -1217,6 +1417,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setLocationUpdatesResponse(RadioResponseInfo info);
@@ -1228,6 +1430,11 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:SIM_ABSENT
* RadioError:SUBSCRIPTION_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway setCdmaSubscriptionSourceResponse(RadioResponseInfo info);
@@ -1244,6 +1451,8 @@
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setCdmaRoamingPreferenceResponse(RadioResponseInfo info);
@@ -1260,6 +1469,8 @@
* RadioError:SYSTEM_ERR
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getCdmaRoamingPreferenceResponse(RadioResponseInfo info, CdmaRoamingType type);
@@ -1275,6 +1486,8 @@
* RadioError:NO_MEMORY
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setTTYModeResponse(RadioResponseInfo info);
@@ -1291,6 +1504,8 @@
* RadioError:NO_MEMORY
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getTTYModeResponse(RadioResponseInfo info, TtyMode mode);
@@ -1307,6 +1522,8 @@
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_CALL_ID
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setPreferredVoicePrivacyResponse(RadioResponseInfo info);
@@ -1324,6 +1541,8 @@
* RadioError:NO_MEMORY
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getPreferredVoicePrivacyResponse(RadioResponseInfo info, bool enable);
@@ -1344,6 +1563,8 @@
* RadioError:INVALID_STATE
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway sendCDMAFeatureCodeResponse(RadioResponseInfo info);
@@ -1361,6 +1582,9 @@
* RadioError:INVALID_CALL_ID
* RadioError:INVALID_STATE
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
* RadioError:MODE_NOT_SUPPORTED
*/
oneway sendBurstDtmfResponse(RadioResponseInfo info);
@@ -1391,6 +1615,8 @@
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:OPERATION_NOT_ALLOWED
* RadioError:ENCODING_ERR
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway sendCdmaSmsResponse(RadioResponseInfo info, SendSmsResult sms);
@@ -1413,6 +1639,8 @@
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway acknowledgeLastIncomingCdmaSmsResponse(RadioResponseInfo info);
@@ -1432,6 +1660,9 @@
* RadioError:NO_RESOURCES
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
*/
oneway getGsmBroadcastConfigResponse(RadioResponseInfo info,
vec<GsmBroadcastSmsConfigInfo> configs);
@@ -1450,6 +1681,9 @@
* RadioError:MODEM_ERR
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
*/
oneway setGsmBroadcastConfigResponse(RadioResponseInfo info);
@@ -1468,6 +1702,9 @@
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
*/
oneway setGsmBroadcastActivationResponse(RadioResponseInfo info);
@@ -1487,6 +1724,9 @@
* RadioError:NO_RESOURCES
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
*/
oneway getCdmaBroadcastConfigResponse(RadioResponseInfo info,
vec<CdmaBroadcastSmsConfigInfo> configs);
@@ -1505,6 +1745,9 @@
* RadioError:MODEM_ERR
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
*/
oneway setCdmaBroadcastConfigResponse(RadioResponseInfo info);
@@ -1523,6 +1766,9 @@
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
*/
oneway setCdmaBroadcastActivationResponse(RadioResponseInfo info);
@@ -1547,6 +1793,8 @@
* RadioError:MODEM_ERR
* RadioError:NOT_PROVISIONED
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getCDMASubscriptionResponse(RadioResponseInfo info, string mdn, string hSid,
string hNid, string min, string prl);
@@ -1572,6 +1820,9 @@
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
*/
oneway writeSmsToRuimResponse(RadioResponseInfo info, uint32_t index);
@@ -1588,6 +1839,9 @@
* RadioError:NO_SUCH_ENTRY
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
* RadioError:INVALID_MODEM_STATE
*/
oneway deleteSmsOnRuimResponse(RadioResponseInfo info);
@@ -1608,6 +1862,9 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:NOT_PROVISIONED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*
* If a empty string value is returned for any of the device id, it means that there was error
* accessing the device.
@@ -1629,6 +1886,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:MODEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway exitEmergencyCallbackModeResponse(RadioResponseInfo info);
@@ -1649,6 +1908,8 @@
* RadioError:NOT_PROVISIONED
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getSmscAddressResponse(RadioResponseInfo info, string smsc);
@@ -1668,6 +1929,8 @@
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setSmscAddressResponse(RadioResponseInfo info);
@@ -1685,6 +1948,8 @@
* RadioError:INVALID_STATE
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway reportSmsMemoryStatusResponse(RadioResponseInfo info);
@@ -1694,6 +1959,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway reportStkServiceIsRunningResponse(RadioResponseInfo info);
@@ -1705,6 +1975,11 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:SUBSCRIPTION_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getCdmaSubscriptionSourceResponse(RadioResponseInfo info, CdmaSubscriptionSource source);
@@ -1715,6 +1990,13 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway requestIsimAuthenticationResponse(RadioResponseInfo info, string response);
@@ -1724,6 +2006,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway acknowledgeIncomingGsmSmsWithPduResponse(RadioResponseInfo info);
@@ -1736,6 +2023,11 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:SIM_BUSY
* RadioError:OPERATION_NOT_ALLOWED
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway sendEnvelopeWithStatusResponse(RadioResponseInfo info, IccIoResult iccIo);
@@ -1746,6 +2038,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getVoiceRadioTechnologyResponse(RadioResponseInfo info, RadioTechnology rat);
@@ -1762,6 +2059,8 @@
* RadioError:MODEM_ERR
* RadioError:NO_NETWORK_FOUND
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getCellInfoListResponse(RadioResponseInfo info, vec<CellInfo> cellInfo);
@@ -1775,6 +2074,9 @@
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:INVALID_ARGUMENTS
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway setCellInfoListRateResponse(RadioResponseInfo info);
@@ -1792,6 +2094,8 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:NOT_PROVISIONED
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setInitialAttachApnResponse(RadioResponseInfo info);
@@ -1804,12 +2108,12 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
- * RadioError:NO_MEMORY
* RadioError:INTERNAL_ERR
- * RadioError:SYSTEM_ERR
- * RadioError:REQUEST_NOT_SUPPORTED
- * RadioError:MODEM_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
* RadioError:INVALID_MODEM_STATE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getImsRegistrationStateResponse(RadioResponseInfo info, bool isRegistered,
RadioTechnologyFamily ratFamily);
@@ -1837,6 +2141,8 @@
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:NETWORK_NOT_READY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway sendImsSmsResponse(RadioResponseInfo info, SendSmsResult sms);
@@ -1847,6 +2153,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway iccTransmitApduBasicChannelResponse(RadioResponseInfo info, IccIoResult result);
@@ -1861,6 +2172,14 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:MISSING_RESOURCE
* RadioError:NO_SUCH_ELEMENT
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:SIM_ERR
+ * RadioError:INVALID_SIM_STATE
+ * RadioError:MISSING_RESOURCE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway iccOpenLogicalChannelResponse(RadioResponseInfo info, int32_t channelId,
vec<int8_t> selectResponse);
@@ -1871,6 +2190,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway iccCloseLogicalChannelResponse(RadioResponseInfo info);
@@ -1881,6 +2205,11 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway iccTransmitApduLogicalChannelResponse(RadioResponseInfo info, IccIoResult result);
@@ -1891,6 +2220,7 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway nvReadItemResponse(RadioResponseInfo info, string result);
@@ -1900,6 +2230,7 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway nvWriteItemResponse(RadioResponseInfo info);
@@ -1909,6 +2240,7 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway nvWriteCdmaPrlResponse(RadioResponseInfo info);
@@ -1918,6 +2250,7 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway nvResetConfigResponse(RadioResponseInfo info);
@@ -1934,6 +2267,8 @@
* RadioError:MODEM_ERR
* RadioError:INVALID_ARGUMENTS
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setUiccSubscriptionResponse(RadioResponseInfo info);
@@ -1950,6 +2285,9 @@
* RadioError:INVALID_ARGUMENTS
* RadioError:DEVICE_IN_USE
* RadioError:INVALID_MODEM_STATE
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway setDataAllowedResponse(RadioResponseInfo info);
@@ -1960,6 +2298,7 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getHardwareConfigResponse(RadioResponseInfo info, vec<HardwareConfig> config);
@@ -1970,6 +2309,14 @@
* Valid errors returned:
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:INVALID_MODEM_STATE
+ * RadioError:SIM_ERR
+ * RadioError:INVALID_ARGUMENTS
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway requestIccSimAuthenticationResponse(RadioResponseInfo info, IccIoResult result);
@@ -1980,6 +2327,11 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:SUBSCRIPTION_NOT_AVAILABLE
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway setDataProfileResponse(RadioResponseInfo info);
@@ -1994,6 +2346,8 @@
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway requestShutdownResponse(RadioResponseInfo info);
@@ -2007,6 +2361,10 @@
* RadioError:OPERATION_NOT_ALLOWED
* RadioError:INVALID_STATE
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway getRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc);
@@ -2026,6 +2384,8 @@
* RadioError:MODEM_ERR
* RadioError:INVALID_STATE
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setRadioCapabilityResponse(RadioResponseInfo info, RadioCapability rc);
@@ -2039,6 +2399,9 @@
* RadioError:LCE_NOT_SUPPORTED
* RadioError:INTERNAL_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway startLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo);
@@ -2050,6 +2413,11 @@
* RadioError:NONE
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:LCE_NOT_SUPPORTED
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway stopLceServiceResponse(RadioResponseInfo info, LceStatusInfo statusInfo);
@@ -2062,6 +2430,10 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:LCE_NOT_SUPPORTED
* RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway pullLceDataResponse(RadioResponseInfo info, LceDataInfo lceInfo);
@@ -2077,6 +2449,9 @@
* RadioError:SYSTEM_ERR
* RadioError:MODEM_ERR
* RadioError:NOT_PROVISIONED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
+ * RadioError:REQUEST_NOT_SUPPORTED
*/
oneway getModemActivityInfoResponse(RadioResponseInfo info, ActivityStatsInfo activityInfo);
@@ -2122,6 +2497,8 @@
* RadioError:SYSTEM_ERR
* RadioError:INVALID_ARGUMENTS
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway sendDeviceStateResponse(RadioResponseInfo info);
@@ -2136,6 +2513,8 @@
* RadioError:INTERNAL_ERR
* RadioError:SYSTEM_ERR
* RadioError:REQUEST_NOT_SUPPORTED
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setIndicationFilterResponse(RadioResponseInfo info);
@@ -2147,6 +2526,10 @@
* RadioError:RADIO_NOT_AVAILABLE
* RadioError:REQUEST_NOT_SUPPORTED
* RadioError:INVALID_ARGUMENTS
+ * RadioError:INTERNAL_ERR
+ * RadioError:NO_MEMORY
+ * RadioError:NO_RESOURCES
+ * RadioError:CANCELLED
*/
oneway setSimCardPowerResponse(RadioResponseInfo info);
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
index 747b2f4..31ba342 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_cell_broadcast.cpp
@@ -122,7 +122,8 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(CheckGeneralError() ||
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
}
}
@@ -140,7 +141,8 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(CheckGeneralError());
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ CheckGeneralError());
}
}
@@ -158,7 +160,8 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(CheckGeneralError() ||
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
index 35d97ee..1f2a50e 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
@@ -76,9 +76,13 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
- radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
- radioRsp->rspInfo.error == RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW ||
- radioRsp->rspInfo.error == RadioError::OP_NOT_ALLOWED_DURING_VOICE_CALL ||
+ radioRsp->rspInfo.error ==
+ RadioError::RADIO_NOT_AVAILABLE ||
+ radioRsp->rspInfo.error ==
+ RadioError::OP_NOT_ALLOWED_BEFORE_REG_TO_NW ||
+ radioRsp->rspInfo.error ==
+ RadioError::OP_NOT_ALLOWED_DURING_VOICE_CALL ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT ||
CheckOEMError());
}
}
@@ -98,7 +102,10 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- EXPECT_EQ(RadioError::INVALID_CALL_ID, radioRsp->rspInfo.error);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::INVALID_CALL_ID ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT || CheckOEMError() ||
+ radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
}
}
@@ -116,7 +123,9 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
- radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE);
+ radioRsp->rspInfo.error ==
+ RadioError::RADIO_NOT_AVAILABLE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -220,6 +229,9 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- // TODO(shuoq): Will add error check when we know the expected error from QC
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT ||
+ radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
index 8f01d8d..eb5d337 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_icc.cpp
@@ -317,6 +317,7 @@
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_SIM_STATE ||
radioRsp->rspInfo.error == RadioError::PASSWORD_INCORRECT ||
- radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ radioRsp->rspInfo.error == RadioError::INTERNAL_ERR ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index e791ede..71e0b4f 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -397,7 +397,8 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::EMPTY_RECORD);
}
}
@@ -677,9 +678,11 @@
if (cardStatus.cardState == CardState::ABSENT) {
std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
+ ASSERT_TRUE(radioRsp->rspInfo.error ==
+ RadioError::RADIO_NOT_AVAILABLE ||
radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED ||
- radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ radioRsp->rspInfo.error == RadioError::INTERNAL_ERR ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -697,7 +700,9 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED ||
- radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
+ radioRsp->rspInfo.error ==
+ RadioError::REQUEST_NOT_SUPPORTED ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -713,8 +718,11 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE || CheckOEMError() ||
- radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ ASSERT_TRUE(radioRsp->rspInfo.error ==
+ RadioError::RADIO_NOT_AVAILABLE ||
+ CheckOEMError() ||
+ radioRsp->rspInfo.error == RadioError::INTERNAL_ERR ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -755,7 +763,8 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- EXPECT_EQ(radioRsp->rspInfo.error, RadioError::NONE);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}
/* Reset back to no carrier restriction */
@@ -769,7 +778,8 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- EXPECT_EQ(radioRsp->rspInfo.error, RadioError::NONE);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
+ radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
index 271a23a..8b3faef 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_sms.cpp
@@ -36,7 +36,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+ radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
EXPECT_EQ(0, radioRsp->sendSmsResult.errorCode);
}
}
@@ -62,7 +63,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+ radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -145,7 +147,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::INVALID_STATE);
+ radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -236,8 +239,11 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(CheckGeneralError() || radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
- radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
+ ASSERT_TRUE(CheckGeneralError() ||
+ radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
+ radioRsp->rspInfo.error ==
+ RadioError::INVALID_MODEM_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -257,7 +263,8 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT);
+ radioRsp->rspInfo.error == RadioError::INVALID_SMS_FORMAT ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -285,7 +292,9 @@
radioRsp->rspInfo.error == RadioError::ENCODING_ERR ||
radioRsp->rspInfo.error == RadioError::NO_RESOURCES ||
radioRsp->rspInfo.error == RadioError::NETWORK_NOT_READY ||
- radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS);
+ radioRsp->rspInfo.error ==
+ RadioError::INVALID_SMSC_ADDRESS ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -308,7 +317,9 @@
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY ||
- radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
+ radioRsp->rspInfo.error ==
+ RadioError::INVALID_MODEM_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -361,7 +372,9 @@
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY ||
- radioRsp->rspInfo.error == RadioError::INVALID_SMSC_ADDRESS);
+ radioRsp->rspInfo.error ==
+ RadioError::INVALID_SMSC_ADDRESS ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -413,7 +426,9 @@
radioRsp->rspInfo.error == RadioError::NONE ||
radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
radioRsp->rspInfo.error == RadioError::NO_SUCH_ENTRY ||
- radioRsp->rspInfo.error == RadioError::INVALID_MODEM_STATE);
+ radioRsp->rspInfo.error ==
+ RadioError::INVALID_MODEM_STATE ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
@@ -434,6 +449,7 @@
ASSERT_TRUE(CheckGeneralError() ||
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::INVALID_STATE ||
- radioRsp->rspInfo.error == RadioError::MODEM_ERR);
+ radioRsp->rspInfo.error == RadioError::MODEM_ERR ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
index 4c76559..670bafd 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_stk.cpp
@@ -39,23 +39,6 @@
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE);
}
-
- // Test with sending random string
- serial = GetRandomSerialNumber();
- content = "0";
-
- radio->sendEnvelope(serial, content);
-
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
- EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-
- if (cardStatus.cardState == CardState::ABSENT) {
- std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
- ASSERT_TRUE(CheckGeneralError() ||
- radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
- radioRsp->rspInfo.error == RadioError::NONE);
- }
}
/*
@@ -79,23 +62,6 @@
radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
radioRsp->rspInfo.error == RadioError::NONE);
}
-
- serial = GetRandomSerialNumber();
-
- // Test with sending random string
- commandResponse = "0";
-
- radio->sendTerminalResponseToSim(serial, commandResponse);
-
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
- EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-
- if (cardStatus.cardState == CardState::ABSENT) {
- std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
- ASSERT_TRUE(CheckGeneralError() ||
- radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
- }
}
/*
@@ -155,21 +121,7 @@
if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(CheckGeneralError() ||
- radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
- }
-
- // Test with sending random string
- serial = GetRandomSerialNumber();
- contents = "0";
-
- radio->sendEnvelopeWithStatus(serial, contents);
-
- EXPECT_EQ(std::cv_status::no_timeout, wait());
- EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
- EXPECT_EQ(serial, radioRsp->rspInfo.serial);
-
- if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(CheckGeneralError() ||
- radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
+ radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
+ radioRsp->rspInfo.error == RadioError::SIM_ABSENT);
}
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
index 5f28155..ed2c6bb 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
@@ -37,6 +37,10 @@
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
EXPECT_EQ(RadioError::NONE, radioRsp->rspInfo.error);
+
+ /* Vts Testing with Sim Absent only. This needs to be removed later in P when sim present
+ * scenarios will be tested. */
+ EXPECT_EQ(CardState::ABSENT, cardStatus.cardState);
}
void RadioHidlTest::TearDown() {}
diff --git a/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp b/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
index a69d14d..33f3049 100644
--- a/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
+++ b/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
@@ -23,12 +23,9 @@
class SupplicantHidlEnvironment : public ::testing::Environment {
public:
virtual void SetUp() override {
- stopWifiFramework();
stopSupplicant();
}
virtual void TearDown() override {
- startWifiFramework();
- // Framework will start wpa_supplicant.
}
};
diff --git a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
index df4bfa9..79be2b0 100644
--- a/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
+++ b/wifi/supplicant/1.0/vts/functional/supplicant_hidl_test_utils.cpp
@@ -135,19 +135,6 @@
std::condition_variable condition_;
};
-void stopWifiFramework() {
- ASSERT_EQ(std::system("stop"), 0);
- // TODO: Use some other mechanism to wait for the framework to
- // finish disabling.
- sleep(5);
-}
-
-void startWifiFramework() {
- ASSERT_EQ(std::system("start"), 0);
- // These tests don't care whether the framework
- // finished enabling or not.
-}
-
void stopSupplicant() {
DriverTool driver_tool;
SupplicantManager supplicant_manager;