Merge changes I96775dd4,I6e163c46,Id3065a85 into main
* changes:
Rename api name and parameter type base on HAL feedback
Return status for the setters API
Remove send parameter API from IMediaQuality
diff --git a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/AmbientBacklightSettings.aidl b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/AmbientBacklightSettings.aidl
index ffbae26..7770e18 100644
--- a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/AmbientBacklightSettings.aidl
+++ b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/AmbientBacklightSettings.aidl
@@ -34,12 +34,12 @@
package android.hardware.tv.mediaquality;
@VintfStability
parcelable AmbientBacklightSettings {
- String packageName;
+ int uid;
android.hardware.tv.mediaquality.AmbientBacklightSource source;
int maxFramerate;
android.hardware.graphics.common.PixelFormat colorFormat;
int hZonesNumber;
int vZonesNumber;
boolean hasLetterbox;
- int threshold;
+ int colorThreshold;
}
diff --git a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IMediaQuality.aidl b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IMediaQuality.aidl
index e329f8e..26df461 100644
--- a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IMediaQuality.aidl
+++ b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IMediaQuality.aidl
@@ -55,6 +55,4 @@
void sendDefaultSoundParameters(in android.hardware.tv.mediaquality.SoundParameters soundParameters);
void getParamCaps(in android.hardware.tv.mediaquality.ParameterName[] paramNames, out android.hardware.tv.mediaquality.ParamCapability[] caps);
void getVendorParamCaps(in android.hardware.tv.mediaquality.VendorParameterIdentifier[] names, out android.hardware.tv.mediaquality.VendorParamCapability[] caps);
- void sendPictureParameters(in android.hardware.tv.mediaquality.PictureParameters pictureParameters);
- void sendSoundParameters(in android.hardware.tv.mediaquality.SoundParameters soundParameters);
}
diff --git a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
index e1a882e..9b413d4 100644
--- a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
+++ b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
@@ -37,5 +37,5 @@
oneway void onPictureProfileAdjusted(in android.hardware.tv.mediaquality.PictureProfile pictureProfile);
oneway void onParamCapabilityChanged(long pictureProfileId, in android.hardware.tv.mediaquality.ParamCapability[] caps);
oneway void onVendorParamCapabilityChanged(long pictureProfileId, in android.hardware.tv.mediaquality.VendorParamCapability[] caps);
- oneway void onRequestPictureParameters(long pictureProfileId);
+ oneway void requestPictureParameters(long pictureProfileId);
}
diff --git a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
index e162601..d976cf7 100644
--- a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
+++ b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
@@ -37,5 +37,5 @@
oneway void onSoundProfileAdjusted(in android.hardware.tv.mediaquality.SoundProfile soundProfile);
oneway void onParamCapabilityChanged(long soundProfileId, in android.hardware.tv.mediaquality.ParamCapability[] caps);
oneway void onVendorParamCapabilityChanged(long soundProfileId, in android.hardware.tv.mediaquality.VendorParamCapability[] caps);
- oneway void onRequestSoundParameters(long SoundProfileId);
+ oneway void requestSoundParameters(long SoundProfileId);
}
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/AmbientBacklightSettings.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/AmbientBacklightSettings.aidl
index b6a26ee..fd19f7c 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/AmbientBacklightSettings.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/AmbientBacklightSettings.aidl
@@ -24,7 +24,7 @@
/**
* The package name of the ambient backlight control application.
*/
- String packageName;
+ int uid;
/**
* The source of the ambient backlight.
@@ -66,5 +66,5 @@
* the colorFormat. For example, RGB888, where the values of R/G/B range from 0 to 255,
* and the threshold is a positive number within the same range.
*/
- int threshold;
+ int colorThreshold;
}
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IMediaQuality.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IMediaQuality.aidl
index a1fd415..3da1495 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IMediaQuality.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IMediaQuality.aidl
@@ -55,6 +55,9 @@
* device as configured before.
*
* @param enabled True to enable the ambient backlight detection, false to disable.
+ *
+ * @return Status::ok on success
+ * UNSUPPORTED_OPERATION if this functionality is unsupported.
*/
void setAmbientBacklightDetectionEnabled(in boolean enabled);
@@ -88,6 +91,9 @@
* parameters depends on the current content playing.
*
* @param enable True to enable, false to disable.
+ *
+ * @return Status::ok on success
+ * UNSUPPORTED_OPERATION if this functionality is unsupported.
*/
void setAutoPqEnabled(boolean enable);
@@ -112,6 +118,9 @@
* lower resolution image and invent the missing pixel to make the image looks sharper.
*
* @param enable True to enable, false to disable.
+ *
+ * @return Status::ok on success
+ * UNSUPPORTED_OPERATION if this functionality is unsupported.
*/
void setAutoSrEnabled(boolean enable);
@@ -136,6 +145,9 @@
* adjust the sound parameters depends on the current content playing.
*
* @param enable True to enable, false to disable.
+ *
+ * @return Status::ok on success
+ * UNSUPPORTED_OPERATION if this functionality is unsupported.
*/
void setAutoAqEnabled(boolean enable);
@@ -207,20 +219,4 @@
* Gets vendor capability information of the given parameters.
*/
void getVendorParamCaps(in VendorParameterIdentifier[] names, out VendorParamCapability[] caps);
-
- /**
- * When HAL request picture parameters by picture profile id, the framework will use this to
- * send the picture parameters associate with the profile id.
- *
- * @param pictureParameters pictureParameters that associate with the profile id HAL provided.
- */
- void sendPictureParameters(in PictureParameters pictureParameters);
-
- /**
- * When HAL request sound parameters by sound profile id, the framework will use this to
- * send the sound parameters associate with the profile id.
- *
- * @param soundParameters soundParameters that associate with the profile id HAL provided.
- */
- void sendSoundParameters(in SoundParameters soundParameters);
}
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
index 06651e4..c8c7e68 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
@@ -59,5 +59,5 @@
*
* @param pictureProfileId The PictureProfile id that associate with the PictureProfile.
*/
- void onRequestPictureParameters(long pictureProfileId);
+ void requestPictureParameters(long pictureProfileId);
}
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
index 2ab9c6c..3f96762 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
@@ -59,5 +59,5 @@
*
* @param SoundProfileId The SoundProfile id that associate with the SoundProfile.
*/
- void onRequestSoundParameters(long SoundProfileId);
+ void requestSoundParameters(long SoundProfileId);
}
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 f449d34..087730f 100644
--- a/tv/mediaquality/aidl/default/hal/media_quality_hal_impl.rs
+++ b/tv/mediaquality/aidl/default/hal/media_quality_hal_impl.rs
@@ -32,12 +32,14 @@
VendorParameterIdentifier::VendorParameterIdentifier,
};
use binder::{Interface, Strong};
+use binder::ExceptionCode;
use std::sync::{Arc, Mutex};
use std::thread;
/// Defined so we can implement the IMediaQuality AIDL interface.
pub struct MediaQualityService {
callback: Arc<Mutex<Option<Strong<dyn IMediaQualityCallback>>>>,
+ ambient_backlight_supported: Arc<Mutex<bool>>,
ambient_backlight_enabled: Arc<Mutex<bool>>,
ambient_backlight_detector_settings: Arc<Mutex<AmbientBacklightSettings>>,
auto_pq_supported: Arc<Mutex<bool>>,
@@ -60,6 +62,7 @@
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_detector_settings:
Arc::new(Mutex::new(AmbientBacklightSettings::default())),
@@ -97,45 +100,51 @@
) -> binder::Result<()> {
println!("Received settings: {:?}", settings);
let mut ambient_backlight_detector_settings = self.ambient_backlight_detector_settings.lock().unwrap();
- ambient_backlight_detector_settings.packageName = settings.packageName.clone();
+ ambient_backlight_detector_settings.uid = settings.uid.clone();
ambient_backlight_detector_settings.source = settings.source;
ambient_backlight_detector_settings.maxFramerate = settings.maxFramerate;
ambient_backlight_detector_settings.colorFormat = settings.colorFormat;
ambient_backlight_detector_settings.hZonesNumber = settings.hZonesNumber;
ambient_backlight_detector_settings.vZonesNumber = settings.vZonesNumber;
ambient_backlight_detector_settings.hasLetterbox = settings.hasLetterbox;
- ambient_backlight_detector_settings.threshold = settings.threshold;
+ ambient_backlight_detector_settings.colorThreshold = settings.colorThreshold;
Ok(())
}
fn setAmbientBacklightDetectionEnabled(&self, enabled: bool) -> binder::Result<()> {
println!("Received enabled: {}", enabled);
let mut ambient_backlight_enabled = self.ambient_backlight_enabled.lock().unwrap();
+ let ambient_backlight_supported = self.ambient_backlight_supported.lock().unwrap();
*ambient_backlight_enabled = enabled;
- if enabled {
- println!("Enable Ambient Backlight detection");
- thread::scope(|s| {
- s.spawn(|| {
- let cb = self.callback.lock().unwrap();
- if let Some(cb) = &*cb {
- let enabled_event = AmbientBacklightEvent::Enabled(true);
- cb.notifyAmbientBacklightEvent(&enabled_event).unwrap();
- }
+
+ if *ambient_backlight_supported {
+ if enabled {
+ println!("Enable Ambient Backlight detection");
+ thread::scope(|s| {
+ s.spawn(|| {
+ let cb = self.callback.lock().unwrap();
+ if let Some(cb) = &*cb {
+ let enabled_event = AmbientBacklightEvent::Enabled(true);
+ cb.notifyAmbientBacklightEvent(&enabled_event).unwrap();
+ }
+ });
});
- });
+ } else {
+ println!("Disable Ambient Backlight detection");
+ thread::scope(|s| {
+ s.spawn(|| {
+ let cb = self.callback.lock().unwrap();
+ if let Some(cb) = &*cb {
+ let disabled_event = AmbientBacklightEvent::Enabled(false);
+ cb.notifyAmbientBacklightEvent(&disabled_event).unwrap();
+ }
+ });
+ });
+ }
+ return Ok(());
} else {
- println!("Disable Ambient Backlight detection");
- thread::scope(|s| {
- s.spawn(|| {
- let cb = self.callback.lock().unwrap();
- if let Some(cb) = &*cb {
- let disabled_event = AmbientBacklightEvent::Enabled(false);
- cb.notifyAmbientBacklightEvent(&disabled_event).unwrap();
- }
- });
- });
+ return Err(ExceptionCode::UNSUPPORTED_OPERATION.into());
}
- Ok(())
}
fn getAmbientBacklightDetectionEnabled(&self) -> binder::Result<bool> {
@@ -155,13 +164,19 @@
fn setAutoPqEnabled(&self, enabled: bool) -> binder::Result<()> {
let mut auto_pq_enabled = self.auto_pq_enabled.lock().unwrap();
+ let auto_pq_supported = self.auto_pq_supported.lock().unwrap();
*auto_pq_enabled = enabled;
- if enabled {
- println!("Enable auto picture quality");
+
+ if *auto_pq_supported {
+ if enabled {
+ println!("Enable auto picture quality");
+ } else {
+ println!("Disable auto picture quality");
+ }
+ return Ok(());
} else {
- println!("Disable auto picture quality");
+ return Err(ExceptionCode::UNSUPPORTED_OPERATION.into());
}
- Ok(())
}
fn isAutoSrSupported(&self) -> binder::Result<bool> {
@@ -176,13 +191,19 @@
fn setAutoSrEnabled(&self, enabled: bool) -> binder::Result<()> {
let mut auto_sr_enabled = self.auto_sr_enabled.lock().unwrap();
+ let auto_sr_supported = self.auto_sr_supported.lock().unwrap();
*auto_sr_enabled = enabled;
- if enabled {
- println!("Enable auto super resolution");
+
+ if *auto_sr_supported {
+ if enabled {
+ println!("Enable auto super resolution");
+ } else {
+ println!("Disable auto super resolution");
+ }
+ return Ok(());
} else {
- println!("Disable auto super resolution");
+ return Err(ExceptionCode::UNSUPPORTED_OPERATION.into());
}
- Ok(())
}
fn isAutoAqSupported(&self) -> binder::Result<bool> {
@@ -197,13 +218,19 @@
fn setAutoAqEnabled(&self, enabled: bool) -> binder::Result<()> {
let mut auto_aq_enabled = self.auto_aq_enabled.lock().unwrap();
+ let auto_aq_supported = self.auto_aq_supported.lock().unwrap();
*auto_aq_enabled = enabled;
- if enabled {
- println!("Enable auto audio quality");
+
+ if *auto_aq_supported {
+ if enabled {
+ println!("Enable auto audio quality");
+ } else {
+ println!("Disable auto audio quality");
+ }
+ return Ok(());
} else {
- println!("Disable auto audio quality");
+ return Err(ExceptionCode::UNSUPPORTED_OPERATION.into());
}
- Ok(())
}
fn getPictureProfileListener(&self) -> binder::Result<binder::Strong<dyn IPictureProfileChangedListener>> {
@@ -265,14 +292,4 @@
println!("getVendorParamCaps. len= {}", param_names.len());
Ok(())
}
-
- fn sendPictureParameters(&self, _picture_parameters: &PictureParameters) -> binder::Result<()>{
- println!("Received picture parameters");
- Ok(())
- }
-
- fn sendSoundParameters(&self, _sound_parameters: &SoundParameters) -> binder::Result<()>{
- println!("Received sound parameters");
- Ok(())
- }
}
diff --git a/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp b/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
index a5ea5ac..3be471b 100644
--- a/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
+++ b/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
@@ -95,7 +95,7 @@
return ScopedAStatus::ok();
}
- ScopedAStatus onRequestPictureParameters(int64_t) { return ScopedAStatus::ok(); }
+ ScopedAStatus requestPictureParameters(int64_t) { return ScopedAStatus::ok(); }
private:
std::function<void(const PictureProfile& pictureProfile)> on_hal_picture_profile_adjust_;
@@ -121,7 +121,7 @@
return ScopedAStatus::ok();
}
- ScopedAStatus onRequestSoundParameters(int64_t) { return ScopedAStatus::ok(); }
+ ScopedAStatus requestSoundParameters(int64_t) { return ScopedAStatus::ok(); }
private:
std::function<void(const SoundProfile& soundProfile)> on_hal_sound_profile_adjust_;
@@ -212,13 +212,13 @@
TEST_P(MediaQualityAidl, TestSetAmbientBacklightDetector) {
AmbientBacklightSettings in_settings = {
- .packageName = "com.android.mediaquality",
+ .uid = 1,
.source = AmbientBacklightSource::VIDEO,
.colorFormat = PixelFormat::RGB_888,
.hZonesNumber = 32,
.vZonesNumber = 20,
.hasLetterbox = true,
- .threshold = 0,
+ .colorThreshold = 0,
};
ASSERT_OK(mediaquality->setAmbientBacklightDetector(in_settings));
}