Move getParameters API in adjustment listener
HAL can get the picture/sound parameters asynchronously by providing the
profile id from the framework.
Test: mmm .
Bug: 375472716
Flag: android.media.tv.flags.media_quality_fw
Change-Id: I1e10e7b2a54f17774078766358d8982457fd5da6
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 115ada7..cfaca7a 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 setPictureParametersCallback(android.hardware.tv.mediaquality.IPictureParametersCallback callback);
- void setSoundParametersCallback(android.hardware.tv.mediaquality.ISoundParametersCallback callback);
}
diff --git a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IPictureParametersCallback.aidl b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IPictureParametersCallback.aidl
deleted file mode 100644
index ccb31c4..0000000
--- a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/IPictureParametersCallback.aidl
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.tv.mediaquality;
-@VintfStability
-interface IPictureParametersCallback {
- android.hardware.tv.mediaquality.PictureParameters getPictureParameters(long pictureProfileId);
-}
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 6339377..e1a882e 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,4 +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);
}
diff --git a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/ISoundParametersCallback.aidl b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/ISoundParametersCallback.aidl
deleted file mode 100644
index 9509006..0000000
--- a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/ISoundParametersCallback.aidl
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.tv.mediaquality;
-@VintfStability
-interface ISoundParametersCallback {
- android.hardware.tv.mediaquality.SoundParameters getSoundParameters(long SoundProfileId);
-}
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 1006349..e162601 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,4 +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);
}
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IMediaQuality.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IMediaQuality.aidl
index e12ded0..f78f3de 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IMediaQuality.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IMediaQuality.aidl
@@ -18,10 +18,8 @@
import android.hardware.tv.mediaquality.AmbientBacklightSettings;
import android.hardware.tv.mediaquality.IMediaQualityCallback;
-import android.hardware.tv.mediaquality.IPictureParametersCallback;
import android.hardware.tv.mediaquality.IPictureProfileAdjustmentListener;
import android.hardware.tv.mediaquality.IPictureProfileChangedListener;
-import android.hardware.tv.mediaquality.ISoundParametersCallback;
import android.hardware.tv.mediaquality.ISoundProfileAdjustmentListener;
import android.hardware.tv.mediaquality.ISoundProfileChangedListener;
import android.hardware.tv.mediaquality.ParamCapability;
@@ -151,7 +149,14 @@
/**
* Sets the listener for picture adjustment from the HAL.
*
- * @param IPictureProfileAdjustmentListener listener object to pass picture profile.
+ * When the same client registers this listener multiple times, only the most recent
+ * registration will be active. The previous listener will be overwritten.
+ *
+ * When different client registers this listener, it will overwrite the previous registered
+ * client. Only one listener can be active.
+ *
+ * @param IPictureProfileAdjustmentListener listener object to pass picture profile, profile
+ * id and hardware capability.
*/
void setPictureProfileAdjustmentListener(IPictureProfileAdjustmentListener listener);
@@ -174,7 +179,14 @@
/**
* Sets the listener for sound adjustment from the HAL.
*
- * @param ISoundProfileAdjustmentListener listener object to pass sound profile.
+ * When the same client registers this listener multiple times, only the most recent
+ * registration will be active. The previous listener will be overwritten.
+ *
+ * When different client registers this listener, it will overwrite the previous registered
+ * client. Only one listener can be active.
+ *
+ * @param ISoundProfileAdjustmentListener listener object to pass sound profile, profile id
+ * and hardware capability.
*/
void setSoundProfileAdjustmentListener(ISoundProfileAdjustmentListener listener);
@@ -195,30 +207,4 @@
* Gets vendor capability information of the given parameters.
*/
void getVendorParamCaps(in VendorParameterIdentifier[] names, out VendorParamCapability[] caps);
-
- /**
- * Sets picture parameters callback to get the picture parameters send by the client.
- *
- * When the same client registers this callback multiple times, only the most recent
- * registration will be active. The previous callback will be overwritten.
- *
- * When different client registers this callback, it will overwrite the previous registered
- * client. Only one callback can be active.
- *
- * @param callback Callback object to pass PictureParameters.
- */
- void setPictureParametersCallback(IPictureParametersCallback callback);
-
- /**
- * Sets sound parameters callback to get the sound parameters send by the client.
- *
- * When the same client registers this callback multiple times, only the most recent
- * registration will be active. The previous callback will be overwritten.
- *
- * When different client registers this callback, it will overwrite the previous registered
- * client. Only one callback can be active.
- *
- * @param callback Callback object to pass SoundParameters.
- */
- void setSoundParametersCallback(ISoundParametersCallback callback);
}
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureParametersCallback.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureParametersCallback.aidl
deleted file mode 100644
index b92c775..0000000
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureParametersCallback.aidl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.tv.mediaquality;
-
-import android.hardware.tv.mediaquality.PictureParameters;
-
-@VintfStability
-interface IPictureParametersCallback {
- /**
- * Get the picture parameters by PictureProfile id. Check PictureParameters for its' detail.
- * This is called from the HAL to media quality framework.
- *
- * @param pictureProfileId The PictureProfile id that associate with the PictureProfile.
- * @return PictureParameters with all the pre-defined parameters and vendor defined parameters.
- */
- PictureParameters getPictureParameters(long pictureProfileId);
-}
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
index 806d90d..8a19544 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
@@ -46,4 +46,15 @@
* @param caps the updated vendor capabilities.
*/
void onVendorParamCapabilityChanged(long pictureProfileId, in VendorParamCapability[] caps);
+
+ /**
+ * Request the picture parameters by picture profile id. Check PictureParameters for its detail.
+ * This is called from the HAL to media quality framework.
+ *
+ * The requested picture parameters will get from IMediaQuality::sendPictureParameters called
+ * by the framework.
+ *
+ * @param pictureProfileId The PictureProfile id that associate with the PictureProfile.
+ */
+ void onRequestPictureParameters(long pictureProfileId);
}
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundParametersCallback.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundParametersCallback.aidl
deleted file mode 100644
index 856ceb4..0000000
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundParametersCallback.aidl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.hardware.tv.mediaquality;
-
-import android.hardware.tv.mediaquality.SoundParameters;
-
-@VintfStability
-interface ISoundParametersCallback {
- /**
- * Get the Sound parameters by SoundProfile id. Check SoundParameters for its' detail.
- * This is called from the HAL to media quality framework.
- *
- * @param SoundProfileId The SoundProfile id that associate with the SoundProfile.
- * @return SoundParameters with all the pre-defined parameters and vendor defined parameters.
- */
- SoundParameters getSoundParameters(long SoundProfileId);
-}
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
index 5ee9d86..373cfc1 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
@@ -46,4 +46,15 @@
* @param caps the updated vendor capabilities.
*/
void onVendorParamCapabilityChanged(long soundProfileId, in VendorParamCapability[] caps);
+
+ /**
+ * Request the sound parameters by sound profile id. Check SoundParameters for its detail.
+ * This is called from the HAL to media quality framework.
+ *
+ * The requested sound parameters will get from IMediaQuality::sendSoundParameters called
+ * by the framework.
+ *
+ * @param SoundProfileId The SoundProfile id that associate with the SoundProfile.
+ */
+ void onRequestSoundParameters(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 190e6a7..d598ce8 100644
--- a/tv/mediaquality/aidl/default/hal/media_quality_hal_impl.rs
+++ b/tv/mediaquality/aidl/default/hal/media_quality_hal_impl.rs
@@ -30,8 +30,6 @@
SoundParameters::SoundParameters,
VendorParamCapability::VendorParamCapability,
VendorParameterIdentifier::VendorParameterIdentifier,
- IPictureParametersCallback::IPictureParametersCallback,
- ISoundParametersCallback::ISoundParametersCallback,
};
use binder::{Interface, Strong};
use std::sync::{Arc, Mutex};
@@ -54,8 +52,6 @@
Arc<Mutex<Option<Strong<dyn ISoundProfileAdjustmentListener>>>>,
picture_profile_changed_listener: Arc<Mutex<Option<Strong<dyn IPictureProfileChangedListener>>>>,
sound_profile_changed_listener: Arc<Mutex<Option<Strong<dyn ISoundProfileChangedListener>>>>,
- picture_parameters_callback: Arc<Mutex<Option<Strong<dyn IPictureParametersCallback>>>>,
- sound_parameters_callback: Arc<Mutex<Option<Strong<dyn ISoundParametersCallback>>>>,
}
impl MediaQualityService {
@@ -77,8 +73,6 @@
sound_profile_adjustment_listener: Arc::new(Mutex::new(None)),
picture_profile_changed_listener: Arc::new(Mutex::new(None)),
sound_profile_changed_listener: Arc::new(Mutex::new(None)),
- picture_parameters_callback: Arc::new(Mutex::new(None)),
- sound_parameters_callback: Arc::new(Mutex::new(None)),
}
}
}
@@ -271,22 +265,4 @@
println!("getVendorParamCaps. len= {}", param_names.len());
Ok(())
}
-
- fn setPictureParametersCallback(
- &self,
- callback: &Strong<dyn IPictureParametersCallback>
- ) -> binder::Result<()> {
- let mut cb = self.picture_parameters_callback.lock().unwrap();
- *cb = Some(callback.clone());
- Ok(())
- }
-
- fn setSoundParametersCallback(
- &self,
- callback: &Strong<dyn ISoundParametersCallback>
- ) -> binder::Result<()> {
- let mut cb = self.sound_parameters_callback.lock().unwrap();
- *cb = Some(callback.clone());
- Ok(())
- }
}
diff --git a/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp b/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
index c3e25a4..09deee6 100644
--- a/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
+++ b/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
@@ -94,6 +94,8 @@
return ScopedAStatus::ok();
}
+ ScopedAStatus onRequestPictureParameters(int64_t) { return ScopedAStatus::ok(); }
+
private:
std::function<void(const PictureProfile& pictureProfile)> on_hal_picture_profile_adjust_;
};
@@ -118,6 +120,8 @@
return ScopedAStatus::ok();
}
+ ScopedAStatus onRequestSoundParameters(int64_t) { return ScopedAStatus::ok(); }
+
private:
std::function<void(const SoundProfile& soundProfile)> on_hal_sound_profile_adjust_;
};