Fix default implementation and VTS error
The isSupported flags in default implementation is false, so when
calling the api in VTS will get unsupported exception. Changed the
supported to true.
Added VTS for get picture/audio profile changed litener.
Bug: 391695285
Test: atest VtsHalMediaQualityTargetTest
Flag: EXEMPT bugfix
Change-Id: Id139d9d608a991b3ff72fc2a99246c3e4d05c5c2
diff --git a/tv/mediaquality/aidl/default/hal/media_quality_hal_impl.rs b/tv/mediaquality/aidl/default/hal/media_quality_hal_impl.rs
index 087730f..37f333a 100644
--- a/tv/mediaquality/aidl/default/hal/media_quality_hal_impl.rs
+++ b/tv/mediaquality/aidl/default/hal/media_quality_hal_impl.rs
@@ -62,15 +62,15 @@
pub fn new() -> Self {
Self {
callback: Arc::new(Mutex::new(None)),
- ambient_backlight_supported: Arc::new(Mutex::new(false)),
- ambient_backlight_enabled: Arc::new(Mutex::new(true)),
+ ambient_backlight_supported: Arc::new(Mutex::new(true)),
+ ambient_backlight_enabled: Arc::new(Mutex::new(false)),
ambient_backlight_detector_settings:
Arc::new(Mutex::new(AmbientBacklightSettings::default())),
- auto_pq_supported: Arc::new(Mutex::new(false)),
+ auto_pq_supported: Arc::new(Mutex::new(true)),
auto_pq_enabled: Arc::new(Mutex::new(false)),
- auto_sr_supported: Arc::new(Mutex::new(false)),
+ auto_sr_supported: Arc::new(Mutex::new(true)),
auto_sr_enabled: Arc::new(Mutex::new(false)),
- auto_aq_supported: Arc::new(Mutex::new(false)),
+ auto_aq_supported: Arc::new(Mutex::new(true)),
auto_aq_enabled: Arc::new(Mutex::new(false)),
picture_profile_adjustment_listener: Arc::new(Mutex::new(None)),
sound_profile_adjustment_listener: Arc::new(Mutex::new(None)),
@@ -236,7 +236,7 @@
fn getPictureProfileListener(&self) -> binder::Result<binder::Strong<dyn IPictureProfileChangedListener>> {
println!("getPictureProfileListener");
let listener = self.picture_profile_changed_listener.lock().unwrap();
- listener.clone().ok_or(binder::StatusCode::UNKNOWN_ERROR.into())
+ Ok(listener.clone().expect("NONE"))
}
fn setPictureProfileAdjustmentListener(
diff --git a/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp b/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
index a01d4b0..5d320d3 100644
--- a/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
+++ b/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
@@ -578,6 +578,18 @@
ASSERT_OK(mediaquality->setAmbientBacklightCallback(callback));
}
+TEST_P(MediaQualityAidl, TestGetPictureProfileChangedListener) {
+ std::shared_ptr<::aidl::android::hardware::tv::mediaquality::IPictureProfileChangedListener>
+ aidlListener;
+ mediaquality->getPictureProfileListener(&aidlListener);
+}
+
+TEST_P(MediaQualityAidl, TestGetSoundProfileChangedListener) {
+ std::shared_ptr<::aidl::android::hardware::tv::mediaquality::ISoundProfileChangedListener>
+ aidlListener;
+ mediaquality->getSoundProfileListener(&aidlListener);
+}
+
TEST_P(MediaQualityAidl, TestSetPictureProfileAdjustmentListener) {
std::shared_ptr<PictureProfileAdjustmentListener> listener =
ndk::SharedRefBase::make<PictureProfileAdjustmentListener>(