Camera VTS: Fix incorrect return value check
The AIDL interface specificies that ICameraProvider::setCallback should return Status::ILLEGAL_ARGUMENT if the provided callback is null. The setCallback test incorrectly checked for the return value to be OK instead. This CL fixes the test to check for ILLEGAL_ARGUMENT and removes setting callback to null from setTorchMode test. In addition it fixes `setCallback` test to use Bn* variant of ICameraProviderCallback to ensure that the object makes it through the binder. Bug: 233221359 Test: atest VtsAidlHalCameraProvider_TargetTest Change-Id: Ia33226b15efd9628bf8e1b53ec2a3012b08eaaac
This commit is contained in:
parent
412f907bd3
commit
4bf91c7e38
1 changed files with 4 additions and 7 deletions
|
@ -39,7 +39,7 @@ using ::aidl::android::hardware::camera::device::ICameraDevice;
|
|||
using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap;
|
||||
using ::aidl::android::hardware::camera::metadata::SensorPixelMode;
|
||||
using ::aidl::android::hardware::camera::provider::CameraIdAndStreamCombination;
|
||||
using ::aidl::android::hardware::camera::provider::ICameraProviderCallbackDefault;
|
||||
using ::aidl::android::hardware::camera::provider::BnCameraProviderCallback;
|
||||
|
||||
using ::ndk::ScopedAStatus;
|
||||
|
||||
|
@ -86,7 +86,7 @@ TEST_P(CameraAidlTest, getVendorTags) {
|
|||
|
||||
// Test if ICameraProvider::setCallback returns Status::OK
|
||||
TEST_P(CameraAidlTest, setCallback) {
|
||||
struct ProviderCb : public ICameraProviderCallbackDefault {
|
||||
struct ProviderCb : public BnCameraProviderCallback {
|
||||
ScopedAStatus cameraDeviceStatusChange(const std::string& cameraDeviceName,
|
||||
CameraDeviceStatus newStatus) override {
|
||||
ALOGI("camera device status callback name %s, status %d", cameraDeviceName.c_str(),
|
||||
|
@ -109,11 +109,11 @@ TEST_P(CameraAidlTest, setCallback) {
|
|||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<ProviderCb> cb = ProviderCb::make<ProviderCb>();
|
||||
std::shared_ptr<ProviderCb> cb = ndk::SharedRefBase::make<ProviderCb>();
|
||||
ScopedAStatus ret = mProvider->setCallback(cb);
|
||||
ASSERT_TRUE(ret.isOk());
|
||||
ret = mProvider->setCallback(nullptr);
|
||||
ASSERT_TRUE(ret.isOk());
|
||||
ASSERT_EQ(static_cast<int32_t>(Status::ILLEGAL_ARGUMENT), ret.getServiceSpecificError());
|
||||
}
|
||||
|
||||
// Test if ICameraProvider::getCameraDeviceInterface returns Status::OK and non-null device
|
||||
|
@ -399,9 +399,6 @@ TEST_P(CameraAidlTest, setTorchMode) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = mProvider->setCallback(nullptr);
|
||||
ASSERT_TRUE(ret.isOk());
|
||||
}
|
||||
|
||||
// Check dump functionality.
|
||||
|
|
Loading…
Reference in a new issue