Merge "SF: aidl-composer removed getDisplayBrightnessSupport and getDozeSupport."
diff --git a/libs/battery/MultiStateCounter.h b/libs/battery/MultiStateCounter.h
index a2b59a8..0caf005 100644
--- a/libs/battery/MultiStateCounter.h
+++ b/libs/battery/MultiStateCounter.h
@@ -63,12 +63,24 @@
void setValue(state_t state, const T& value);
/**
- * Updates the value for the current state and returns the delta from the previously
- * set value.
+ * Updates the value by distributing the delta from the previously set value
+ * among states according to their respective time-in-state.
+ * Returns the delta from the previously set value.
*/
const T& updateValue(const T& value, time_t timestamp);
- void addValue(const T& value);
+ /**
+ * Updates the value by distributing the specified increment among states according
+ * to their respective time-in-state.
+ */
+ void incrementValue(const T& increment, time_t timestamp);
+
+ /**
+ * Adds the specified increment to the value for the current state, without affecting
+ * the last updated value or timestamp. Ignores partial time-in-state: the entirety of
+ * the increment is given to the current state.
+ */
+ void addValue(const T& increment);
void reset();
@@ -216,11 +228,17 @@
}
template <class T>
+void MultiStateCounter<T>::incrementValue(const T& increment, time_t timestamp) {
+ T newValue = lastValue;
+ add(&newValue, increment, 1 /* numerator */, 1 /* denominator */);
+ updateValue(newValue, timestamp);
+}
+
+template <class T>
void MultiStateCounter<T>::addValue(const T& value) {
if (!isEnabled) {
return;
}
-
add(&states[currentState].counter, value, 1 /* numerator */, 1 /* denominator */);
}
diff --git a/libs/battery/MultiStateCounterTest.cpp b/libs/battery/MultiStateCounterTest.cpp
index 876bf74..cb11a54 100644
--- a/libs/battery/MultiStateCounterTest.cpp
+++ b/libs/battery/MultiStateCounterTest.cpp
@@ -210,6 +210,26 @@
EXPECT_DOUBLE_EQ(3.0, delta);
}
+TEST_F(MultiStateCounterTest, incrementValue) {
+ DoubleMultiStateCounter testCounter(2, 0);
+ testCounter.updateValue(0, 0);
+ testCounter.setState(0, 0);
+ testCounter.updateValue(6.0, 2000);
+
+ testCounter.setState(1, 3000);
+
+ testCounter.incrementValue(8.0, 6000);
+
+ // The total accumulated count is:
+ // 6.0 // For the period 0-2000
+ // +(8.0 * 0.25) // For the period 3000-4000
+ EXPECT_DOUBLE_EQ(8.0, testCounter.getCount(0));
+
+ // 0 // For the period 0-3000
+ // +(8.0 * 0.75) // For the period 3000-4000
+ EXPECT_DOUBLE_EQ(6.0, testCounter.getCount(1));
+}
+
TEST_F(MultiStateCounterTest, addValue) {
DoubleMultiStateCounter testCounter(1, 0);
testCounter.updateValue(0, 0);
diff --git a/libs/binder/ndk/Android.bp b/libs/binder/ndk/Android.bp
index ee46fcb..4289574 100644
--- a/libs/binder/ndk/Android.bp
+++ b/libs/binder/ndk/Android.bp
@@ -38,7 +38,7 @@
host: {
cflags: [
"-D__INTRODUCED_IN(n)=",
- "-D__assert(a,b,c)=",
+ "-D__assert(a,b,c)=do { syslog(LOG_ERR, a \": \" c); abort(); } while(false)",
// We want all the APIs to be available on the host.
"-D__ANDROID_API__=10000",
],
diff --git a/libs/binder/ndk/include_cpp/android/binder_parcel_utils.h b/libs/binder/ndk/include_cpp/android/binder_parcel_utils.h
index 67623a6..e5560f8 100644
--- a/libs/binder/ndk/include_cpp/android/binder_parcel_utils.h
+++ b/libs/binder/ndk/include_cpp/android/binder_parcel_utils.h
@@ -482,9 +482,7 @@
template <typename P>
static inline binder_status_t AParcel_writeParcelable(AParcel* parcel, const P& p) {
if constexpr (is_interface_v<P>) {
- if (!p) {
- return STATUS_UNEXPECTED_NULL;
- }
+ // Legacy behavior: allow null
return first_template_type_t<P>::writeToParcel(parcel, p);
} else {
static_assert(is_parcelable_v<P>);
@@ -502,13 +500,8 @@
template <typename P>
static inline binder_status_t AParcel_readParcelable(const AParcel* parcel, P* p) {
if constexpr (is_interface_v<P>) {
- binder_status_t status = first_template_type_t<P>::readFromParcel(parcel, p);
- if (status == STATUS_OK) {
- if (!*p) {
- return STATUS_UNEXPECTED_NULL;
- }
- }
- return status;
+ // Legacy behavior: allow null
+ return first_template_type_t<P>::readFromParcel(parcel, p);
} else {
static_assert(is_parcelable_v<P>);
int32_t null;
@@ -560,7 +553,7 @@
*p = std::nullopt;
return STATUS_OK;
}
- *p = std::optional<first_template_type_t<P>>(first_template_type_t<P>{});
+ p->emplace(first_template_type_t<P>());
return (*p)->readFromParcel(parcel);
} else {
static_assert(is_specialization_v<P, std::unique_ptr>);
diff --git a/libs/binder/rust/src/binder.rs b/libs/binder/rust/src/binder.rs
index 3d2eddf..4d6b294 100644
--- a/libs/binder/rust/src/binder.rs
+++ b/libs/binder/rust/src/binder.rs
@@ -66,6 +66,35 @@
}
}
+/// Implemented by sync interfaces to specify what the associated async interface is.
+/// Generic to handle the fact that async interfaces are generic over a thread pool.
+///
+/// The binder in any object implementing this trait should be compatible with the
+/// `Target` associated type, and using `FromIBinder` to convert it to the target
+/// should not fail.
+pub trait ToAsyncInterface<P>
+where
+ Self: Interface,
+ Self::Target: FromIBinder,
+{
+ /// The async interface associated with this sync interface.
+ type Target: ?Sized;
+}
+
+/// Implemented by async interfaces to specify what the associated sync interface is.
+///
+/// The binder in any object implementing this trait should be compatible with the
+/// `Target` associated type, and using `FromIBinder` to convert it to the target
+/// should not fail.
+pub trait ToSyncInterface
+where
+ Self: Interface,
+ Self::Target: FromIBinder,
+{
+ /// The sync interface associated with this async interface.
+ type Target: ?Sized;
+}
+
/// Interface stability promise
///
/// An interface can promise to be a stable vendor interface ([`Vintf`]), or
@@ -337,6 +366,26 @@
pub fn downgrade(this: &Strong<I>) -> Weak<I> {
Weak::new(this)
}
+
+ /// Convert this synchronous binder handle into an asynchronous one.
+ pub fn into_async<P>(self) -> Strong<<I as ToAsyncInterface<P>>::Target>
+ where
+ I: ToAsyncInterface<P>,
+ {
+ // By implementing the ToAsyncInterface trait, it is guaranteed that the binder
+ // object is also valid for the target type.
+ FromIBinder::try_from(self.0.as_binder()).unwrap()
+ }
+
+ /// Convert this asynchronous binder handle into a synchronous one.
+ pub fn into_sync(self) -> Strong<<I as ToSyncInterface>::Target>
+ where
+ I: ToSyncInterface,
+ {
+ // By implementing the ToSyncInterface trait, it is guaranteed that the binder
+ // object is also valid for the target type.
+ FromIBinder::try_from(self.0.as_binder()).unwrap()
+ }
}
impl<I: FromIBinder + ?Sized> Clone for Strong<I> {
@@ -1017,6 +1066,14 @@
.expect(concat!("Error cloning interface ", stringify!($async_interface)))
}
}
+
+ impl<P: $crate::BinderAsyncPool> $crate::ToAsyncInterface<P> for dyn $interface {
+ type Target = dyn $async_interface<P>;
+ }
+
+ impl<P: $crate::BinderAsyncPool> $crate::ToSyncInterface for dyn $async_interface<P> {
+ type Target = dyn $interface;
+ }
)?
};
}
diff --git a/libs/binder/rust/src/lib.rs b/libs/binder/rust/src/lib.rs
index b94dfa1..7c04a72 100644
--- a/libs/binder/rust/src/lib.rs
+++ b/libs/binder/rust/src/lib.rs
@@ -109,8 +109,8 @@
pub use crate::binder::{
BinderFeatures, FromIBinder, IBinder, IBinderInternal, Interface, InterfaceClass, Remotable,
- Stability, Strong, TransactionCode, TransactionFlags, Weak, FIRST_CALL_TRANSACTION,
- FLAG_CLEAR_BUF, FLAG_ONEWAY, FLAG_PRIVATE_LOCAL, LAST_CALL_TRANSACTION,
+ Stability, Strong, ToAsyncInterface, ToSyncInterface, TransactionCode, TransactionFlags, Weak,
+ FIRST_CALL_TRANSACTION, FLAG_CLEAR_BUF, FLAG_ONEWAY, FLAG_PRIVATE_LOCAL, LAST_CALL_TRANSACTION,
};
pub use crate::binder_async::{BoxFuture, BinderAsyncPool};
pub use error::{status_t, ExceptionCode, Result, Status, StatusCode};
diff --git a/libs/binder/rust/tests/integration.rs b/libs/binder/rust/tests/integration.rs
index 40359b4..80dc476 100644
--- a/libs/binder/rust/tests/integration.rs
+++ b/libs/binder/rust/tests/integration.rs
@@ -100,6 +100,7 @@
Test = FIRST_CALL_TRANSACTION,
GetDumpArgs,
GetSelinuxContext,
+ GetIsHandlingTransaction,
}
impl TryFrom<u32> for TestTransactionCode {
@@ -112,6 +113,7 @@
_ if c == TestTransactionCode::GetSelinuxContext as u32 => {
Ok(TestTransactionCode::GetSelinuxContext)
}
+ _ if c == TestTransactionCode::GetIsHandlingTransaction as u32 => Ok(TestTransactionCode::GetIsHandlingTransaction),
_ => Err(StatusCode::UNKNOWN_TRANSACTION),
}
}
@@ -140,6 +142,10 @@
ThreadState::with_calling_sid(|sid| sid.map(|s| s.to_string_lossy().into_owned()));
sid.ok_or(StatusCode::UNEXPECTED_NULL)
}
+
+ fn get_is_handling_transaction(&self) -> binder::Result<bool> {
+ Ok(binder::is_handling_transaction())
+ }
}
/// Trivial testing binder interface
@@ -152,6 +158,9 @@
/// Returns the caller's SELinux context
fn get_selinux_context(&self) -> binder::Result<String>;
+
+ /// Returns the value of calling `is_handling_transaction`.
+ fn get_is_handling_transaction(&self) -> binder::Result<bool>;
}
/// Async trivial testing binder interface
@@ -164,6 +173,9 @@
/// Returns the caller's SELinux context
fn get_selinux_context(&self) -> binder::BoxFuture<'static, binder::Result<String>>;
+
+ /// Returns the value of calling `is_handling_transaction`.
+ fn get_is_handling_transaction(&self) -> binder::BoxFuture<'static, binder::Result<bool>>;
}
declare_binder_interface! {
@@ -186,6 +198,7 @@
TestTransactionCode::Test => reply.write(&service.test()?),
TestTransactionCode::GetDumpArgs => reply.write(&service.get_dump_args()?),
TestTransactionCode::GetSelinuxContext => reply.write(&service.get_selinux_context()?),
+ TestTransactionCode::GetIsHandlingTransaction => reply.write(&service.get_is_handling_transaction()?),
}
}
@@ -212,6 +225,15 @@
)?;
reply.read()
}
+
+ fn get_is_handling_transaction(&self) -> binder::Result<bool> {
+ let reply = self.binder.transact(
+ TestTransactionCode::GetIsHandlingTransaction as TransactionCode,
+ 0,
+ |_| Ok(()),
+ )?;
+ reply.read()
+ }
}
impl<P: binder::BinderAsyncPool> IATest<P> for BpTest {
@@ -238,6 +260,14 @@
|reply| async move { reply?.read() }
)
}
+
+ fn get_is_handling_transaction(&self) -> binder::BoxFuture<'static, binder::Result<bool>> {
+ let binder = self.binder.clone();
+ P::spawn(
+ move || binder.transact(TestTransactionCode::GetIsHandlingTransaction as TransactionCode, 0, |_| Ok(())),
+ |reply| async move { reply?.read() }
+ )
+ }
}
impl ITest for Binder<BnTest> {
@@ -252,6 +282,10 @@
fn get_selinux_context(&self) -> binder::Result<String> {
self.0.get_selinux_context()
}
+
+ fn get_is_handling_transaction(&self) -> binder::Result<bool> {
+ self.0.get_is_handling_transaction()
+ }
}
impl<P: binder::BinderAsyncPool> IATest<P> for Binder<BnTest> {
@@ -269,6 +303,11 @@
let res = self.0.get_selinux_context();
Box::pin(async move { res })
}
+
+ fn get_is_handling_transaction(&self) -> binder::BoxFuture<'static, binder::Result<bool>> {
+ let res = self.0.get_is_handling_transaction();
+ Box::pin(async move { res })
+ }
}
/// Trivial testing binder interface
@@ -500,7 +539,7 @@
#[tokio::test]
async fn get_selinux_context_async() {
- let service_name = "get_selinux_context";
+ let service_name = "get_selinux_context_async";
let _process = ScopedServiceProcess::new(service_name);
let test_client: Strong<dyn IATest<Tokio>> =
binder_tokio::get_interface(service_name).await.expect("Did not get manager binder service");
@@ -510,6 +549,32 @@
);
}
+ #[tokio::test]
+ async fn get_selinux_context_sync_to_async() {
+ let service_name = "get_selinux_context";
+ let _process = ScopedServiceProcess::new(service_name);
+ let test_client: Strong<dyn ITest> =
+ binder::get_interface(service_name).expect("Did not get manager binder service");
+ let test_client = test_client.into_async::<Tokio>();
+ assert_eq!(
+ test_client.get_selinux_context().await.unwrap(),
+ get_expected_selinux_context()
+ );
+ }
+
+ #[tokio::test]
+ async fn get_selinux_context_async_to_sync() {
+ let service_name = "get_selinux_context";
+ let _process = ScopedServiceProcess::new(service_name);
+ let test_client: Strong<dyn IATest<Tokio>> =
+ binder_tokio::get_interface(service_name).await.expect("Did not get manager binder service");
+ let test_client = test_client.into_sync();
+ assert_eq!(
+ test_client.get_selinux_context().unwrap(),
+ get_expected_selinux_context()
+ );
+ }
+
struct Bools {
binder_died: Arc<AtomicBool>,
binder_dealloc: Arc<AtomicBool>,
@@ -867,4 +932,45 @@
Err(err) => assert_eq!(err, binder::StatusCode::BAD_VALUE),
}
}
+
+ #[test]
+ fn get_is_handling_transaction() {
+ let service_name = "get_is_handling_transaction";
+ let _process = ScopedServiceProcess::new(service_name);
+ let test_client: Strong<dyn ITest> =
+ binder::get_interface(service_name).expect("Did not get manager binder service");
+ // Should be true externally.
+ assert!(test_client.get_is_handling_transaction().unwrap());
+
+ // Should be false locally.
+ assert!(!binder::is_handling_transaction());
+
+ // Should also be false in spawned thread.
+ std::thread::spawn(|| {
+ assert!(!binder::is_handling_transaction());
+ }).join().unwrap();
+ }
+
+ #[tokio::test]
+ async fn get_is_handling_transaction_async() {
+ let service_name = "get_is_handling_transaction_async";
+ let _process = ScopedServiceProcess::new(service_name);
+ let test_client: Strong<dyn IATest<Tokio>> =
+ binder_tokio::get_interface(service_name).await.expect("Did not get manager binder service");
+ // Should be true externally.
+ assert!(test_client.get_is_handling_transaction().await.unwrap());
+
+ // Should be false locally.
+ assert!(!binder::is_handling_transaction());
+
+ // Should also be false in spawned task.
+ tokio::spawn(async {
+ assert!(!binder::is_handling_transaction());
+ }).await.unwrap();
+
+ // And in spawn_blocking task.
+ tokio::task::spawn_blocking(|| {
+ assert!(!binder::is_handling_transaction());
+ }).await.unwrap();
+ }
}
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index 64ddd68..e26c763 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -292,14 +292,15 @@
// Sideband layers
auto* compositionState = editCompositionState();
if (compositionState->sidebandStream.get() && !compositionState->sidebandStreamHasFrame) {
- compositionState->compositionType = Hwc2::IComposerClient::Composition::SIDEBAND;
+ compositionState->compositionType =
+ aidl::android::hardware::graphics::composer3::Composition::SIDEBAND;
return;
} else {
// Normal buffer layers
compositionState->hdrMetadata = mBufferInfo.mHdrMetadata;
compositionState->compositionType = mPotentialCursor
- ? Hwc2::IComposerClient::Composition::CURSOR
- : Hwc2::IComposerClient::Composition::DEVICE;
+ ? aidl::android::hardware::graphics::composer3::Composition::CURSOR
+ : aidl::android::hardware::graphics::composer3::Composition::DEVICE;
}
compositionState->buffer = mBufferInfo.mBuffer->getBuffer();
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h
index 7e605f9..8bf7f8f 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h
@@ -39,6 +39,8 @@
#include "DisplayHardware/Hal.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
@@ -156,7 +158,8 @@
*/
// The type of composition for this layer
- hal::Composition compositionType{hal::Composition::INVALID};
+ aidl::android::hardware::graphics::composer3::Composition compositionType{
+ aidl::android::hardware::graphics::composer3::Composition::INVALID};
// The buffer and related state
sp<GraphicBuffer> buffer;
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/OutputLayer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/OutputLayer.h
index ead941d..a2824f5 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/OutputLayer.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/OutputLayer.h
@@ -33,6 +33,8 @@
#include "LayerFE.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
@@ -112,7 +114,8 @@
virtual bool isHardwareCursor() const = 0;
// Applies a HWC device requested composition type change
- virtual void applyDeviceCompositionTypeChange(Hwc2::IComposerClient::Composition) = 0;
+ virtual void applyDeviceCompositionTypeChange(
+ aidl::android::hardware::graphics::composer3::Composition) = 0;
// Prepares to apply any HWC device layer requests
virtual void prepareForDeviceLayerRequests() = 0;
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h
index c15249d..0082dac 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayer.h
@@ -27,6 +27,8 @@
#include "DisplayHardware/DisplayIdentification.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
namespace android::compositionengine {
struct LayerFECompositionState;
@@ -50,7 +52,8 @@
HWC2::Layer* getHwcLayer() const override;
bool requiresClientComposition() const override;
bool isHardwareCursor() const override;
- void applyDeviceCompositionTypeChange(Hwc2::IComposerClient::Composition) override;
+ void applyDeviceCompositionTypeChange(
+ aidl::android::hardware::graphics::composer3::Composition) override;
void prepareForDeviceLayerRequests() override;
void applyDeviceLayerRequest(Hwc2::IComposerClient::LayerRequest request) override;
bool needsFiltering() const override;
@@ -68,21 +71,24 @@
private:
Rect calculateInitialCrop() const;
- void writeOutputDependentGeometryStateToHWC(HWC2::Layer*, Hwc2::IComposerClient::Composition,
- uint32_t z);
+ void writeOutputDependentGeometryStateToHWC(
+ HWC2::Layer*, aidl::android::hardware::graphics::composer3::Composition, uint32_t z);
void writeOutputIndependentGeometryStateToHWC(HWC2::Layer*, const LayerFECompositionState&,
bool skipLayer);
void writeOutputDependentPerFrameStateToHWC(HWC2::Layer*);
void writeOutputIndependentPerFrameStateToHWC(
HWC2::Layer*, const LayerFECompositionState&,
- Hwc2::IComposerClient::Composition compositionType, bool skipLayer);
+ aidl::android::hardware::graphics::composer3::Composition compositionType,
+ bool skipLayer);
void writeSolidColorStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
void writeSidebandStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
void writeBufferStateToHWC(HWC2::Layer*, const LayerFECompositionState&, bool skipLayer);
- void writeCompositionTypeToHWC(HWC2::Layer*, Hwc2::IComposerClient::Composition,
+ void writeCompositionTypeToHWC(HWC2::Layer*,
+ aidl::android::hardware::graphics::composer3::Composition,
bool isPeekingThrough, bool skipLayer);
- void detectDisallowedCompositionTypeChange(Hwc2::IComposerClient::Composition from,
- Hwc2::IComposerClient::Composition to) const;
+ void detectDisallowedCompositionTypeChange(
+ aidl::android::hardware::graphics::composer3::Composition from,
+ aidl::android::hardware::graphics::composer3::Composition to) const;
bool isClientCompositionForced(bool isPeekingThrough) const;
};
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayerCompositionState.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayerCompositionState.h
index 627b80b..49cb912 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayerCompositionState.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayerCompositionState.h
@@ -35,6 +35,8 @@
#include "DisplayHardware/ComposerHal.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
@@ -123,8 +125,8 @@
std::shared_ptr<HWC2::Layer> hwcLayer;
// The most recently set HWC composition type for this layer
- Hwc2::IComposerClient::Composition hwcCompositionType{
- Hwc2::IComposerClient::Composition::INVALID};
+ aidl::android::hardware::graphics::composer3::Composition hwcCompositionType{
+ aidl::android::hardware::graphics::composer3::Composition::INVALID};
// The buffer cache for this layer. This is used to lower the
// cost of sending reused buffers to the HWC.
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h
index 7397c19..14324de 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/LayerState.h
@@ -28,6 +28,8 @@
#include "DisplayHardware/Hal.h"
#include "math/HashCombine.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
namespace std {
template <typename T>
struct hash<android::sp<T>> {
@@ -232,7 +234,7 @@
return mBackgroundBlurRadius.get() > 0 || !mBlurRegions.get().empty();
}
int32_t getBackgroundBlurRadius() const { return mBackgroundBlurRadius.get(); }
- hardware::graphics::composer::hal::Composition getCompositionType() const {
+ aidl::android::hardware::graphics::composer3::Composition getCompositionType() const {
return mCompositionType.get();
}
@@ -370,17 +372,18 @@
OutputLayerState<mat4, LayerStateField::ColorTransform> mColorTransform;
- using CompositionTypeState = OutputLayerState<hardware::graphics::composer::hal::Composition,
- LayerStateField::CompositionType>;
- CompositionTypeState
- mCompositionType{[](auto layer) {
- return layer->getState().forceClientComposition
- ? hardware::graphics::composer::hal::Composition::CLIENT
- : layer->getLayerFE()
- .getCompositionState()
- ->compositionType;
- },
- CompositionTypeState::getHalToStrings()};
+ using CompositionTypeState =
+ OutputLayerState<aidl::android::hardware::graphics::composer3::Composition,
+ LayerStateField::CompositionType>;
+ CompositionTypeState mCompositionType{[](auto layer) {
+ return layer->getState().forceClientComposition
+ ? aidl::android::hardware::graphics::
+ composer3::Composition::CLIENT
+ : layer->getLayerFE()
+ .getCompositionState()
+ ->compositionType;
+ },
+ CompositionTypeState::getHalToStrings()};
OutputLayerState<void*, LayerStateField::SidebandStream>
mSidebandStream{[](auto layer) {
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Predictor.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Predictor.h
index fe486d3..ef1560e 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Predictor.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/Predictor.h
@@ -109,7 +109,7 @@
static std::optional<Plan> fromString(const std::string&);
void reset() { mLayerTypes.clear(); }
- void addLayerType(hardware::graphics::composer::hal::Composition type) {
+ void addLayerType(aidl::android::hardware::graphics::composer3::Composition type) {
mLayerTypes.emplace_back(type);
}
@@ -125,7 +125,7 @@
}
private:
- std::vector<hardware::graphics::composer::hal::Composition> mLayerTypes;
+ std::vector<aidl::android::hardware::graphics::composer3::Composition> mLayerTypes;
};
} // namespace android::compositionengine::impl::planner
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/OutputLayer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/OutputLayer.h
index 358ed5a..a6cb811 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/OutputLayer.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/OutputLayer.h
@@ -46,7 +46,8 @@
MOCK_CONST_METHOD0(getHwcLayer, HWC2::Layer*());
MOCK_CONST_METHOD0(requiresClientComposition, bool());
MOCK_CONST_METHOD0(isHardwareCursor, bool());
- MOCK_METHOD1(applyDeviceCompositionTypeChange, void(Hwc2::IComposerClient::Composition));
+ MOCK_METHOD1(applyDeviceCompositionTypeChange,
+ void(aidl::android::hardware::graphics::composer3::Composition));
MOCK_METHOD0(prepareForDeviceLayerRequests, void());
MOCK_METHOD1(applyDeviceLayerRequest, void(Hwc2::IComposerClient::LayerRequest request));
MOCK_CONST_METHOD0(needsFiltering, bool());
diff --git a/services/surfaceflinger/CompositionEngine/src/Display.cpp b/services/surfaceflinger/CompositionEngine/src/Display.cpp
index 4603e6b..3571319 100644
--- a/services/surfaceflinger/CompositionEngine/src/Display.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Display.cpp
@@ -282,7 +282,8 @@
if (auto it = changedTypes.find(hwcLayer); it != changedTypes.end()) {
layer->applyDeviceCompositionTypeChange(
- static_cast<Hwc2::IComposerClient::Composition>(it->second));
+ static_cast<aidl::android::hardware::graphics::composer3::Composition>(
+ it->second));
}
}
}
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index b010d9f..e6bcec8 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -37,6 +37,8 @@
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion"
+using aidl::android::hardware::graphics::composer3::Composition;
+
namespace android::compositionengine {
OutputLayer::~OutputLayer() = default;
@@ -358,8 +360,8 @@
auto requestedCompositionType = outputIndependentState->compositionType;
- if (requestedCompositionType == hal::Composition::SOLID_COLOR && state.overrideInfo.buffer) {
- requestedCompositionType = hal::Composition::DEVICE;
+ if (requestedCompositionType == Composition::SOLID_COLOR && state.overrideInfo.buffer) {
+ requestedCompositionType = Composition::DEVICE;
}
// TODO(b/181172795): We now update geometry for all flattened layers. We should update it
@@ -380,7 +382,7 @@
writeCompositionTypeToHWC(hwcLayer.get(), requestedCompositionType, isPeekingThrough,
skipLayer);
- if (requestedCompositionType == hal::Composition::SOLID_COLOR) {
+ if (requestedCompositionType == Composition::SOLID_COLOR) {
writeSolidColorStateToHWC(hwcLayer.get(), *outputIndependentState);
}
@@ -389,7 +391,7 @@
}
void OutputLayer::writeOutputDependentGeometryStateToHWC(HWC2::Layer* hwcLayer,
- hal::Composition requestedCompositionType,
+ Composition requestedCompositionType,
uint32_t z) {
const auto& outputDependentState = getState();
@@ -423,7 +425,7 @@
}
// Solid-color layers and overridden buffers should always use an identity transform.
- const auto bufferTransform = (requestedCompositionType != hal::Composition::SOLID_COLOR &&
+ const auto bufferTransform = (requestedCompositionType != Composition::SOLID_COLOR &&
getState().overrideInfo.buffer == nullptr)
? outputDependentState.bufferTransform
: static_cast<hal::Transform>(0);
@@ -504,7 +506,7 @@
void OutputLayer::writeOutputIndependentPerFrameStateToHWC(
HWC2::Layer* hwcLayer, const LayerFECompositionState& outputIndependentState,
- hal::Composition compositionType, bool skipLayer) {
+ Composition compositionType, bool skipLayer) {
switch (auto error = hwcLayer->setColorTransform(outputIndependentState.colorTransform)) {
case hal::Error::NONE:
break;
@@ -529,18 +531,18 @@
// Content-specific per-frame state
switch (compositionType) {
- case hal::Composition::SOLID_COLOR:
+ case Composition::SOLID_COLOR:
// For compatibility, should be written AFTER the composition type.
break;
- case hal::Composition::SIDEBAND:
+ case Composition::SIDEBAND:
writeSidebandStateToHWC(hwcLayer, outputIndependentState);
break;
- case hal::Composition::CURSOR:
- case hal::Composition::DEVICE:
+ case Composition::CURSOR:
+ case Composition::DEVICE:
writeBufferStateToHWC(hwcLayer, outputIndependentState, skipLayer);
break;
- case hal::Composition::INVALID:
- case hal::Composition::CLIENT:
+ case Composition::INVALID:
+ case Composition::CLIENT:
// Ignored
break;
}
@@ -606,13 +608,13 @@
}
void OutputLayer::writeCompositionTypeToHWC(HWC2::Layer* hwcLayer,
- hal::Composition requestedCompositionType,
+ Composition requestedCompositionType,
bool isPeekingThrough, bool skipLayer) {
auto& outputDependentState = editState();
if (isClientCompositionForced(isPeekingThrough)) {
// If we are forcing client composition, we need to tell the HWC
- requestedCompositionType = hal::Composition::CLIENT;
+ requestedCompositionType = Composition::CLIENT;
}
// Set the requested composition type with the HWC whenever it changes
@@ -625,7 +627,7 @@
if (auto error = hwcLayer->setCompositionType(requestedCompositionType);
error != hal::Error::NONE) {
ALOGE("[%s] Failed to set composition type %s: %s (%d)", getLayerFE().getDebugName(),
- toString(requestedCompositionType).c_str(), to_string(error).c_str(),
+ to_string(requestedCompositionType).c_str(), to_string(error).c_str(),
static_cast<int32_t>(error));
}
}
@@ -664,38 +666,37 @@
bool OutputLayer::requiresClientComposition() const {
const auto& state = getState();
- return !state.hwc || state.hwc->hwcCompositionType == hal::Composition::CLIENT;
+ return !state.hwc || state.hwc->hwcCompositionType == Composition::CLIENT;
}
bool OutputLayer::isHardwareCursor() const {
const auto& state = getState();
- return state.hwc && state.hwc->hwcCompositionType == hal::Composition::CURSOR;
+ return state.hwc && state.hwc->hwcCompositionType == Composition::CURSOR;
}
-void OutputLayer::detectDisallowedCompositionTypeChange(hal::Composition from,
- hal::Composition to) const {
+void OutputLayer::detectDisallowedCompositionTypeChange(Composition from, Composition to) const {
bool result = false;
switch (from) {
- case hal::Composition::INVALID:
- case hal::Composition::CLIENT:
+ case Composition::INVALID:
+ case Composition::CLIENT:
result = false;
break;
- case hal::Composition::DEVICE:
- case hal::Composition::SOLID_COLOR:
- result = (to == hal::Composition::CLIENT);
+ case Composition::DEVICE:
+ case Composition::SOLID_COLOR:
+ result = (to == Composition::CLIENT);
break;
- case hal::Composition::CURSOR:
- case hal::Composition::SIDEBAND:
- result = (to == hal::Composition::CLIENT || to == hal::Composition::DEVICE);
+ case Composition::CURSOR:
+ case Composition::SIDEBAND:
+ result = (to == Composition::CLIENT || to == Composition::DEVICE);
break;
}
if (!result) {
ALOGE("[%s] Invalid device requested composition type change: %s (%d) --> %s (%d)",
- getLayerFE().getDebugName(), toString(from).c_str(), static_cast<int>(from),
- toString(to).c_str(), static_cast<int>(to));
+ getLayerFE().getDebugName(), to_string(from).c_str(), static_cast<int>(from),
+ to_string(to).c_str(), static_cast<int>(to));
}
}
@@ -704,7 +705,7 @@
(!isPeekingThrough && getLayerFE().hasRoundedCorners());
}
-void OutputLayer::applyDeviceCompositionTypeChange(hal::Composition compositionType) {
+void OutputLayer::applyDeviceCompositionTypeChange(Composition compositionType) {
auto& state = editState();
LOG_FATAL_IF(!state.hwc);
auto& hwcState = *state.hwc;
diff --git a/services/surfaceflinger/CompositionEngine/src/planner/Flattener.cpp b/services/surfaceflinger/CompositionEngine/src/planner/Flattener.cpp
index c14effc..0918510 100644
--- a/services/surfaceflinger/CompositionEngine/src/planner/Flattener.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/planner/Flattener.cpp
@@ -211,7 +211,8 @@
displayCost += static_cast<size_t>(layer->getDisplayFrame().width() *
layer->getDisplayFrame().height());
- hasClientComposition |= layer->getCompositionType() == hal::Composition::CLIENT;
+ hasClientComposition |= layer->getCompositionType() ==
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT;
}
if (hasClientComposition) {
diff --git a/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp b/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp
index 2532e3d..c79ca0d 100644
--- a/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp
@@ -160,7 +160,8 @@
lhs.mColorTransform == rhs.mColorTransform &&
lhs.mCompositionType == rhs.mCompositionType &&
lhs.mSidebandStream == rhs.mSidebandStream && lhs.mBuffer == rhs.mBuffer &&
- (lhs.mCompositionType.get() != hal::Composition::SOLID_COLOR ||
+ (lhs.mCompositionType.get() !=
+ aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR ||
lhs.mSolidColor == rhs.mSolidColor);
}
diff --git a/services/surfaceflinger/CompositionEngine/src/planner/Planner.cpp b/services/surfaceflinger/CompositionEngine/src/planner/Planner.cpp
index f5b1cee..74d2701 100644
--- a/services/surfaceflinger/CompositionEngine/src/planner/Planner.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/planner/Planner.cpp
@@ -193,7 +193,7 @@
finalPlan.addLayerType(
forcedOrRequestedClient
- ? hardware::graphics::composer::hal::Composition::CLIENT
+ ? aidl::android::hardware::graphics::composer3::Composition::CLIENT
: layer->getLayerFE().getCompositionState()->compositionType);
}
diff --git a/services/surfaceflinger/CompositionEngine/src/planner/Predictor.cpp b/services/surfaceflinger/CompositionEngine/src/planner/Predictor.cpp
index 8226ef7..074673e 100644
--- a/services/surfaceflinger/CompositionEngine/src/planner/Predictor.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/planner/Predictor.cpp
@@ -39,8 +39,10 @@
// Skip layers where both are client-composited, since that doesn't change the
// composition plan
- if (mLayers[i].getCompositionType() == hal::Composition::CLIENT &&
- other[i]->getCompositionType() == hal::Composition::CLIENT) {
+ if (mLayers[i].getCompositionType() ==
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT &&
+ other[i]->getCompositionType() ==
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT) {
continue;
}
@@ -89,22 +91,28 @@
for (char c : string) {
switch (c) {
case 'C':
- plan.addLayerType(hal::Composition::CLIENT);
+ plan.addLayerType(
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT);
continue;
case 'U':
- plan.addLayerType(hal::Composition::CURSOR);
+ plan.addLayerType(
+ aidl::android::hardware::graphics::composer3::Composition::CURSOR);
continue;
case 'D':
- plan.addLayerType(hal::Composition::DEVICE);
+ plan.addLayerType(
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE);
continue;
case 'I':
- plan.addLayerType(hal::Composition::INVALID);
+ plan.addLayerType(
+ aidl::android::hardware::graphics::composer3::Composition::INVALID);
continue;
case 'B':
- plan.addLayerType(hal::Composition::SIDEBAND);
+ plan.addLayerType(
+ aidl::android::hardware::graphics::composer3::Composition::SIDEBAND);
continue;
case 'S':
- plan.addLayerType(hal::Composition::SOLID_COLOR);
+ plan.addLayerType(
+ aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR);
continue;
default:
return std::nullopt;
@@ -117,22 +125,22 @@
std::string result;
for (auto type : plan.mLayerTypes) {
switch (type) {
- case hal::Composition::CLIENT:
+ case aidl::android::hardware::graphics::composer3::Composition::CLIENT:
result.append("C");
break;
- case hal::Composition::CURSOR:
+ case aidl::android::hardware::graphics::composer3::Composition::CURSOR:
result.append("U");
break;
- case hal::Composition::DEVICE:
+ case aidl::android::hardware::graphics::composer3::Composition::DEVICE:
result.append("D");
break;
- case hal::Composition::INVALID:
+ case aidl::android::hardware::graphics::composer3::Composition::INVALID:
result.append("I");
break;
- case hal::Composition::SIDEBAND:
+ case aidl::android::hardware::graphics::composer3::Composition::SIDEBAND:
result.append("B");
break;
- case hal::Composition::SOLID_COLOR:
+ case aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR:
result.append("S");
break;
}
diff --git a/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp b/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp
index 568efce..3bdb2c0 100644
--- a/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp
@@ -38,6 +38,10 @@
#include "MockHWComposer.h"
#include "MockPowerAdvisor.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
+using aidl::android::hardware::graphics::composer3::Composition;
+
namespace android::compositionengine {
namespace {
@@ -592,7 +596,7 @@
TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithChanges) {
android::HWComposer::DeviceRequestedChanges changes{
- {{nullptr, hal::Composition::CLIENT}},
+ {{nullptr, Composition::CLIENT}},
hal::DisplayRequest::FLIP_CLIENT_TARGET,
{{nullptr, hal::LayerRequest::CLEAR_CLIENT_TARGET}},
{hal::PixelFormat::RGBA_8888, hal::Dataspace::UNKNOWN},
@@ -700,17 +704,15 @@
}
TEST_F(DisplayApplyChangedTypesToLayersTest, appliesChanges) {
- EXPECT_CALL(*mLayer1.outputLayer,
- applyDeviceCompositionTypeChange(Hwc2::IComposerClient::Composition::CLIENT))
+ EXPECT_CALL(*mLayer1.outputLayer, applyDeviceCompositionTypeChange(Composition::CLIENT))
.Times(1);
- EXPECT_CALL(*mLayer2.outputLayer,
- applyDeviceCompositionTypeChange(Hwc2::IComposerClient::Composition::DEVICE))
+ EXPECT_CALL(*mLayer2.outputLayer, applyDeviceCompositionTypeChange(Composition::DEVICE))
.Times(1);
mDisplay->applyChangedTypesToLayers(impl::Display::ChangedTypes{
- {&mLayer1.hwc2Layer, hal::Composition::CLIENT},
- {&mLayer2.hwc2Layer, hal::Composition::DEVICE},
- {&hwc2LayerUnknown, hal::Composition::SOLID_COLOR},
+ {&mLayer1.hwc2Layer, Composition::CLIENT},
+ {&mLayer2.hwc2Layer, Composition::DEVICE},
+ {&hwc2LayerUnknown, Composition::SOLID_COLOR},
});
}
diff --git a/services/surfaceflinger/CompositionEngine/tests/MockHWC2.h b/services/surfaceflinger/CompositionEngine/tests/MockHWC2.h
index 9e08f9e..ff68053 100644
--- a/services/surfaceflinger/CompositionEngine/tests/MockHWC2.h
+++ b/services/surfaceflinger/CompositionEngine/tests/MockHWC2.h
@@ -32,6 +32,8 @@
#include <ui/GraphicTypes.h>
#include "DisplayHardware/HWC2.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
@@ -57,7 +59,8 @@
MOCK_METHOD1(setSurfaceDamage, Error(const android::Region&));
MOCK_METHOD1(setBlendMode, Error(hal::BlendMode));
MOCK_METHOD1(setColor, Error(hal::Color));
- MOCK_METHOD1(setCompositionType, Error(hal::Composition));
+ MOCK_METHOD1(setCompositionType,
+ Error(aidl::android::hardware::graphics::composer3::Composition));
MOCK_METHOD1(setDataspace, Error(android::ui::Dataspace));
MOCK_METHOD2(setPerFrameMetadata, Error(const int32_t, const android::HdrMetadata&));
MOCK_METHOD1(setDisplayFrame, Error(const android::Rect&));
diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
index 207c31e..ad7976f 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
@@ -30,6 +30,10 @@
#include "MockHWComposer.h"
#include "RegionMatcher.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
+using aidl::android::hardware::graphics::composer3::Composition;
+
namespace android::compositionengine {
namespace {
@@ -851,7 +855,7 @@
EXPECT_CALL(*mHwcLayer, setSurfaceDamage(RegionEq(surfaceDamage))).WillOnce(Return(kError));
}
- void expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition compositionType) {
+ void expectSetCompositionTypeCall(Composition compositionType) {
EXPECT_CALL(*mHwcLayer, setCompositionType(compositionType)).WillOnce(Return(kError));
}
@@ -975,7 +979,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForSolidColor) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Composition::SOLID_COLOR;
expectPerFrameCommonCalls();
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillOnce(Return(false));
@@ -984,7 +988,7 @@
// check this in this test only by setting up an testing::InSeqeuence
// instance before setting up the two expectations.
InSequence s;
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::SOLID_COLOR);
+ expectSetCompositionTypeCall(Composition::SOLID_COLOR);
expectSetColorCall();
mOutputLayer.writeStateToHWC(/*includeGeometry*/ false, /*skipLayer*/ false, 0,
@@ -992,11 +996,11 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForSideband) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SIDEBAND;
+ mLayerFEState.compositionType = Composition::SIDEBAND;
expectPerFrameCommonCalls();
expectSetSidebandHandleCall();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::SIDEBAND);
+ expectSetCompositionTypeCall(Composition::SIDEBAND);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillOnce(Return(false));
@@ -1005,11 +1009,11 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForCursor) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::CURSOR;
+ mLayerFEState.compositionType = Composition::CURSOR;
expectPerFrameCommonCalls();
expectSetHdrMetadataAndBufferCalls();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::CURSOR);
+ expectSetCompositionTypeCall(Composition::CURSOR);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillOnce(Return(false));
@@ -1018,11 +1022,11 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForDevice) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Composition::DEVICE;
expectPerFrameCommonCalls();
expectSetHdrMetadataAndBufferCalls();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillOnce(Return(false));
@@ -1031,10 +1035,9 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, compositionTypeIsNotSetIfUnchanged) {
- (*mOutputLayer.editState().hwc).hwcCompositionType =
- Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ (*mOutputLayer.editState().hwc).hwcCompositionType = Composition::SOLID_COLOR;
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Composition::SOLID_COLOR;
expectPerFrameCommonCalls();
expectSetColorCall();
@@ -1047,11 +1050,11 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, compositionTypeIsSetToClientIfColorTransformNotSupported) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Composition::SOLID_COLOR;
expectPerFrameCommonCalls(SimulateUnsupported::ColorTransform);
expectSetColorCall();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::CLIENT);
+ expectSetCompositionTypeCall(Composition::CLIENT);
mOutputLayer.writeStateToHWC(/*includeGeometry*/ false, /*skipLayer*/ false, 0,
/*zIsOverridden*/ false, /*isPeekingThrough*/ false);
@@ -1060,25 +1063,25 @@
TEST_F(OutputLayerWriteStateToHWCTest, compositionTypeIsSetToClientIfClientCompositionForced) {
mOutputLayer.editState().forceClientComposition = true;
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Composition::SOLID_COLOR;
expectPerFrameCommonCalls();
expectSetColorCall();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::CLIENT);
+ expectSetCompositionTypeCall(Composition::CLIENT);
mOutputLayer.writeStateToHWC(/*includeGeometry*/ false, /*skipLayer*/ false, 0,
/*zIsOverridden*/ false, /*isPeekingThrough*/ false);
}
TEST_F(OutputLayerWriteStateToHWCTest, allStateIncludesMetadataIfPresent) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Composition::DEVICE;
includeGenericLayerMetadataInState();
expectGeometryCommonCalls();
expectPerFrameCommonCalls();
expectSetHdrMetadataAndBufferCalls();
expectGenericLayerMetadataCalls();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillOnce(Return(false));
@@ -1087,12 +1090,12 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, perFrameStateDoesNotIncludeMetadataIfPresent) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Composition::DEVICE;
includeGenericLayerMetadataInState();
expectPerFrameCommonCalls();
expectSetHdrMetadataAndBufferCalls();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillOnce(Return(false));
@@ -1101,7 +1104,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, overriddenSkipLayerDoesNotSendBuffer) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Composition::DEVICE;
includeOverrideInfo();
expectGeometryCommonCalls(kOverrideDisplayFrame, kOverrideSourceCrop, kOverrideBufferTransform,
@@ -1109,7 +1112,7 @@
expectPerFrameCommonCalls(SimulateUnsupported::None, kOverrideDataspace, kOverrideVisibleRegion,
kOverrideSurfaceDamage, kDisplayBrightnessNits);
expectSetHdrMetadataAndBufferCalls();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillRepeatedly(Return(false));
mOutputLayer.writeStateToHWC(/*includeGeometry*/ true, /*skipLayer*/ true, 0,
@@ -1117,7 +1120,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, overriddenSkipLayerForSolidColorDoesNotSendBuffer) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Composition::SOLID_COLOR;
includeOverrideInfo();
expectGeometryCommonCalls(kOverrideDisplayFrame, kOverrideSourceCrop, kOverrideBufferTransform,
@@ -1125,7 +1128,7 @@
expectPerFrameCommonCalls(SimulateUnsupported::None, kOverrideDataspace, kOverrideVisibleRegion,
kOverrideSurfaceDamage, kDisplayBrightnessNits);
expectSetHdrMetadataAndBufferCalls();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillRepeatedly(Return(false));
mOutputLayer.writeStateToHWC(/*includeGeometry*/ true, /*skipLayer*/ true, 0,
@@ -1133,7 +1136,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, includesOverrideInfoIfPresent) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Composition::DEVICE;
includeOverrideInfo();
expectGeometryCommonCalls(kOverrideDisplayFrame, kOverrideSourceCrop, kOverrideBufferTransform,
@@ -1141,7 +1144,7 @@
expectPerFrameCommonCalls(SimulateUnsupported::None, kOverrideDataspace, kOverrideVisibleRegion,
kOverrideSurfaceDamage, kDisplayBrightnessNits);
expectSetHdrMetadataAndBufferCalls(kOverrideHwcSlot, kOverrideBuffer, kOverrideFence);
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillRepeatedly(Return(false));
mOutputLayer.writeStateToHWC(/*includeGeometry*/ true, /*skipLayer*/ false, 0,
@@ -1149,7 +1152,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, includesOverrideInfoForSolidColorIfPresent) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Composition::SOLID_COLOR;
includeOverrideInfo();
expectGeometryCommonCalls(kOverrideDisplayFrame, kOverrideSourceCrop, kOverrideBufferTransform,
@@ -1157,7 +1160,7 @@
expectPerFrameCommonCalls(SimulateUnsupported::None, kOverrideDataspace, kOverrideVisibleRegion,
kOverrideSurfaceDamage, kDisplayBrightnessNits);
expectSetHdrMetadataAndBufferCalls(kOverrideHwcSlot, kOverrideBuffer, kOverrideFence);
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillRepeatedly(Return(false));
mOutputLayer.writeStateToHWC(/*includeGeometry*/ true, /*skipLayer*/ false, 0,
@@ -1165,14 +1168,14 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, previousOverriddenLayerSendsSurfaceDamage) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Composition::DEVICE;
mOutputLayer.editState().hwc->stateOverridden = true;
expectGeometryCommonCalls();
expectPerFrameCommonCalls(SimulateUnsupported::None, kDataspace, kOutputSpaceVisibleRegion,
Region::INVALID_REGION);
expectSetHdrMetadataAndBufferCalls();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillRepeatedly(Return(false));
mOutputLayer.writeStateToHWC(/*includeGeometry*/ true, /*skipLayer*/ false, 0,
@@ -1180,16 +1183,16 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, previousSkipLayerSendsUpdatedDeviceCompositionInfo) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Composition::DEVICE;
mOutputLayer.editState().hwc->stateOverridden = true;
mOutputLayer.editState().hwc->layerSkipped = true;
- mOutputLayer.editState().hwc->hwcCompositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mOutputLayer.editState().hwc->hwcCompositionType = Composition::DEVICE;
expectGeometryCommonCalls();
expectPerFrameCommonCalls(SimulateUnsupported::None, kDataspace, kOutputSpaceVisibleRegion,
Region::INVALID_REGION);
expectSetHdrMetadataAndBufferCalls();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillOnce(Return(false));
mOutputLayer.writeStateToHWC(/*includeGeometry*/ true, /*skipLayer*/ false, 0,
@@ -1197,17 +1200,17 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, previousSkipLayerSendsUpdatedClientCompositionInfo) {
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Composition::DEVICE;
mOutputLayer.editState().forceClientComposition = true;
mOutputLayer.editState().hwc->stateOverridden = true;
mOutputLayer.editState().hwc->layerSkipped = true;
- mOutputLayer.editState().hwc->hwcCompositionType = Hwc2::IComposerClient::Composition::CLIENT;
+ mOutputLayer.editState().hwc->hwcCompositionType = Composition::CLIENT;
expectGeometryCommonCalls();
expectPerFrameCommonCalls(SimulateUnsupported::None, kDataspace, kOutputSpaceVisibleRegion,
Region::INVALID_REGION);
expectSetHdrMetadataAndBufferCalls();
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::CLIENT);
+ expectSetCompositionTypeCall(Composition::CLIENT);
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillRepeatedly(Return(false));
mOutputLayer.writeStateToHWC(/*includeGeometry*/ true, /*skipLayer*/ false, 0,
@@ -1253,7 +1256,7 @@
expectGeometryCommonCalls();
expectPerFrameCommonCalls();
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillOnce(Return(true));
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::CLIENT);
+ expectSetCompositionTypeCall(Composition::CLIENT);
mOutputLayer.writeStateToHWC(/*includeGeometry*/ true, /*skipLayer*/ false, 0,
/*zIsOverridden*/ false, /*isPeekingThrough*/
@@ -1265,14 +1268,13 @@
expectPerFrameCommonCalls();
expectSetHdrMetadataAndBufferCalls();
EXPECT_CALL(*mLayerFE, hasRoundedCorners()).WillRepeatedly(Return(true));
- expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::DEVICE);
+ expectSetCompositionTypeCall(Composition::DEVICE);
- mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Composition::DEVICE;
mOutputLayer.writeStateToHWC(/*includeGeometry*/ true, /*skipLayer*/ false, 0,
/*zIsOverridden*/ false, /*isPeekingThrough*/
true);
- EXPECT_EQ(Hwc2::IComposerClient::Composition::DEVICE,
- mOutputLayer.getState().hwc->hwcCompositionType);
+ EXPECT_EQ(Composition::DEVICE, mOutputLayer.getState().hwc->hwcCompositionType);
}
/*
@@ -1371,14 +1373,14 @@
TEST_F(OutputLayerTest, requiresClientCompositionReturnsTrueIfSetToClientComposition) {
mOutputLayer.editState().hwc = impl::OutputLayerCompositionState::Hwc{nullptr};
- mOutputLayer.editState().hwc->hwcCompositionType = Hwc2::IComposerClient::Composition::CLIENT;
+ mOutputLayer.editState().hwc->hwcCompositionType = Composition::CLIENT;
EXPECT_TRUE(mOutputLayer.requiresClientComposition());
}
TEST_F(OutputLayerTest, requiresClientCompositionReturnsFalseIfSetToDeviceComposition) {
mOutputLayer.editState().hwc = impl::OutputLayerCompositionState::Hwc{nullptr};
- mOutputLayer.editState().hwc->hwcCompositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mOutputLayer.editState().hwc->hwcCompositionType = Composition::DEVICE;
EXPECT_FALSE(mOutputLayer.requiresClientComposition());
}
@@ -1395,14 +1397,14 @@
TEST_F(OutputLayerTest, isHardwareCursorReturnsTrueIfSetToCursorComposition) {
mOutputLayer.editState().hwc = impl::OutputLayerCompositionState::Hwc{nullptr};
- mOutputLayer.editState().hwc->hwcCompositionType = Hwc2::IComposerClient::Composition::CURSOR;
+ mOutputLayer.editState().hwc->hwcCompositionType = Composition::CURSOR;
EXPECT_TRUE(mOutputLayer.isHardwareCursor());
}
TEST_F(OutputLayerTest, isHardwareCursorReturnsFalseIfSetToDeviceComposition) {
mOutputLayer.editState().hwc = impl::OutputLayerCompositionState::Hwc{nullptr};
- mOutputLayer.editState().hwc->hwcCompositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mOutputLayer.editState().hwc->hwcCompositionType = Composition::DEVICE;
EXPECT_FALSE(mOutputLayer.isHardwareCursor());
}
@@ -1413,13 +1415,12 @@
TEST_F(OutputLayerTest, applyDeviceCompositionTypeChangeSetsNewType) {
mOutputLayer.editState().hwc = impl::OutputLayerCompositionState::Hwc{nullptr};
- mOutputLayer.editState().hwc->hwcCompositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mOutputLayer.editState().hwc->hwcCompositionType = Composition::DEVICE;
- mOutputLayer.applyDeviceCompositionTypeChange(Hwc2::IComposerClient::Composition::CLIENT);
+ mOutputLayer.applyDeviceCompositionTypeChange(Composition::CLIENT);
ASSERT_TRUE(mOutputLayer.getState().hwc);
- EXPECT_EQ(Hwc2::IComposerClient::Composition::CLIENT,
- mOutputLayer.getState().hwc->hwcCompositionType);
+ EXPECT_EQ(Composition::CLIENT, mOutputLayer.getState().hwc->hwcCompositionType);
}
/*
diff --git a/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp b/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp
index 9ad3ab4..84b3fc5 100644
--- a/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp
@@ -27,6 +27,10 @@
#include "android/hardware_buffer.h"
#include "compositionengine/LayerFECompositionState.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
+using aidl::android::hardware::graphics::composer3::Composition;
+
namespace android::compositionengine::impl::planner {
namespace {
@@ -277,33 +281,28 @@
TEST_F(LayerStateTest, getCompositionType) {
OutputLayerCompositionState outputLayerCompositionState;
LayerFECompositionState layerFECompositionState;
- layerFECompositionState.compositionType =
- hardware::graphics::composer::hal::Composition::DEVICE;
+ layerFECompositionState.compositionType = Composition::DEVICE;
setupMocksForLayer(mOutputLayer, mLayerFE, outputLayerCompositionState,
layerFECompositionState);
mLayerState = std::make_unique<LayerState>(&mOutputLayer);
- EXPECT_EQ(hardware::graphics::composer::hal::Composition::DEVICE,
- mLayerState->getCompositionType());
+ EXPECT_EQ(Composition::DEVICE, mLayerState->getCompositionType());
}
TEST_F(LayerStateTest, getCompositionType_forcedClient) {
OutputLayerCompositionState outputLayerCompositionState;
outputLayerCompositionState.forceClientComposition = true;
LayerFECompositionState layerFECompositionState;
- layerFECompositionState.compositionType =
- hardware::graphics::composer::hal::Composition::DEVICE;
+ layerFECompositionState.compositionType = Composition::DEVICE;
setupMocksForLayer(mOutputLayer, mLayerFE, outputLayerCompositionState,
layerFECompositionState);
mLayerState = std::make_unique<LayerState>(&mOutputLayer);
- EXPECT_EQ(hardware::graphics::composer::hal::Composition::CLIENT,
- mLayerState->getCompositionType());
+ EXPECT_EQ(Composition::CLIENT, mLayerState->getCompositionType());
}
TEST_F(LayerStateTest, updateCompositionType) {
OutputLayerCompositionState outputLayerCompositionState;
LayerFECompositionState layerFECompositionState;
- layerFECompositionState.compositionType =
- hardware::graphics::composer::hal::Composition::DEVICE;
+ layerFECompositionState.compositionType = Composition::DEVICE;
setupMocksForLayer(mOutputLayer, mLayerFE, outputLayerCompositionState,
layerFECompositionState);
mLayerState = std::make_unique<LayerState>(&mOutputLayer);
@@ -311,29 +310,25 @@
mock::OutputLayer newOutputLayer;
mock::LayerFE newLayerFE;
LayerFECompositionState layerFECompositionStateTwo;
- layerFECompositionStateTwo.compositionType =
- hardware::graphics::composer::hal::Composition::SOLID_COLOR;
+ layerFECompositionStateTwo.compositionType = Composition::SOLID_COLOR;
setupMocksForLayer(newOutputLayer, newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
- EXPECT_EQ(hardware::graphics::composer::hal::Composition::SOLID_COLOR,
- mLayerState->getCompositionType());
+ EXPECT_EQ(Composition::SOLID_COLOR, mLayerState->getCompositionType());
EXPECT_EQ(Flags<LayerStateField>(LayerStateField::CompositionType), updates);
}
TEST_F(LayerStateTest, compareCompositionType) {
OutputLayerCompositionState outputLayerCompositionState;
LayerFECompositionState layerFECompositionState;
- layerFECompositionState.compositionType =
- hardware::graphics::composer::hal::Composition::DEVICE;
+ layerFECompositionState.compositionType = Composition::DEVICE;
setupMocksForLayer(mOutputLayer, mLayerFE, outputLayerCompositionState,
layerFECompositionState);
mLayerState = std::make_unique<LayerState>(&mOutputLayer);
mock::OutputLayer newOutputLayer;
mock::LayerFE newLayerFE;
LayerFECompositionState layerFECompositionStateTwo;
- layerFECompositionStateTwo.compositionType =
- hardware::graphics::composer::hal::Composition::SOLID_COLOR;
+ layerFECompositionStateTwo.compositionType = Composition::SOLID_COLOR;
setupMocksForLayer(newOutputLayer, newLayerFE, outputLayerCompositionState,
layerFECompositionStateTwo);
auto otherLayerState = std::make_unique<LayerState>(&newOutputLayer);
diff --git a/services/surfaceflinger/CompositionEngine/tests/planner/PredictorTest.cpp b/services/surfaceflinger/CompositionEngine/tests/planner/PredictorTest.cpp
index 1492707..6038268 100644
--- a/services/surfaceflinger/CompositionEngine/tests/planner/PredictorTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/planner/PredictorTest.cpp
@@ -24,6 +24,10 @@
#include <gtest/gtest.h>
#include <log/log.h>
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
+using aidl::android::hardware::graphics::composer3::Composition;
+
namespace android::compositionengine::impl::planner {
namespace {
@@ -103,7 +107,7 @@
mock::LayerFE layerFEOne;
OutputLayerCompositionState outputLayerCompositionStateOne;
LayerFECompositionState layerFECompositionStateOne;
- layerFECompositionStateOne.compositionType = hal::Composition::DEVICE;
+ layerFECompositionStateOne.compositionType = Composition::DEVICE;
setupMocksForLayer(outputLayerOne, layerFEOne, outputLayerCompositionStateOne,
layerFECompositionStateOne);
LayerState layerStateOne(&outputLayerOne);
@@ -112,7 +116,7 @@
mock::LayerFE layerFETwo;
OutputLayerCompositionState outputLayerCompositionStateTwo;
LayerFECompositionState layerFECompositionStateTwo;
- layerFECompositionStateTwo.compositionType = hal::Composition::SOLID_COLOR;
+ layerFECompositionStateTwo.compositionType = Composition::SOLID_COLOR;
setupMocksForLayer(outputLayerTwo, layerFETwo, outputLayerCompositionStateTwo,
layerFECompositionStateTwo);
LayerState layerStateTwo(&outputLayerTwo);
@@ -370,7 +374,7 @@
TEST_F(PredictionTest, constructPrediction) {
Plan plan;
- plan.addLayerType(hal::Composition::DEVICE);
+ plan.addLayerType(Composition::DEVICE);
Prediction prediction({}, plan);
@@ -442,13 +446,13 @@
mock::LayerFE layerFEOne;
OutputLayerCompositionState outputLayerCompositionStateOne;
LayerFECompositionState layerFECompositionStateOne;
- layerFECompositionStateOne.compositionType = hal::Composition::DEVICE;
+ layerFECompositionStateOne.compositionType = Composition::DEVICE;
setupMocksForLayer(outputLayerOne, layerFEOne, outputLayerCompositionStateOne,
layerFECompositionStateOne);
LayerState layerStateOne(&outputLayerOne);
Plan plan;
- plan.addLayerType(hal::Composition::DEVICE);
+ plan.addLayerType(Composition::DEVICE);
Predictor predictor;
@@ -484,7 +488,7 @@
LayerState layerStateTwo(&outputLayerTwo);
Plan plan;
- plan.addLayerType(hal::Composition::DEVICE);
+ plan.addLayerType(Composition::DEVICE);
Predictor predictor;
@@ -521,7 +525,7 @@
LayerState layerStateTwo(&outputLayerTwo);
Plan plan;
- plan.addLayerType(hal::Composition::DEVICE);
+ plan.addLayerType(Composition::DEVICE);
Predictor predictor;
@@ -535,7 +539,7 @@
EXPECT_EQ(Prediction::Type::Approximate, predictedPlan->type);
Plan planTwo;
- planTwo.addLayerType(hal::Composition::CLIENT);
+ planTwo.addLayerType(Composition::CLIENT);
predictor.recordResult(predictedPlan, hashTwo, {&layerStateTwo}, false, planTwo);
// Now trying to retrieve the predicted plan again returns a nullopt instead.
// TODO(b/158790260): Even though this is enforced in this test, we might want to reassess this.
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
index 1225d7c..c9b6144 100644
--- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp
@@ -375,13 +375,11 @@
Error AidlComposer::getChangedCompositionTypes(
Display display, std::vector<Layer>* outLayers,
- std::vector<IComposerClient::Composition>* outTypes) {
+ std::vector<aidl::android::hardware::graphics::composer3::Composition>* outTypes) {
std::vector<int64_t> layers;
- std::vector<Composition> types;
- mReader.takeChangedCompositionTypes(translate<int64_t>(display), &layers, &types);
+ mReader.takeChangedCompositionTypes(translate<int64_t>(display), &layers, outTypes);
*outLayers = translate<Layer>(layers);
- *outTypes = translate<IComposerClient::Composition>(types);
return Error::NONE;
}
@@ -652,10 +650,10 @@
return Error::NONE;
}
-Error AidlComposer::setLayerCompositionType(Display display, Layer layer,
- IComposerClient::Composition type) {
- mWriter.setLayerCompositionType(translate<int64_t>(display), translate<int64_t>(layer),
- translate<Composition>(type));
+Error AidlComposer::setLayerCompositionType(
+ Display display, Layer layer,
+ aidl::android::hardware::graphics::composer3::Composition type) {
+ mWriter.setLayerCompositionType(translate<int64_t>(display), translate<int64_t>(layer), type);
return Error::NONE;
}
diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h
index 2f67cb7..057ba89 100644
--- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.h
+++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.h
@@ -36,6 +36,8 @@
#include <aidl/android/hardware/graphics/composer3/IComposerClient.h>
#include <android/hardware/graphics/composer3/command-buffer.h>
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
@@ -77,8 +79,10 @@
Error destroyLayer(Display display, Layer layer) override;
Error getActiveConfig(Display display, Config* outConfig) override;
- Error getChangedCompositionTypes(Display display, std::vector<Layer>* outLayers,
- std::vector<IComposerClient::Composition>* outTypes) override;
+ Error getChangedCompositionTypes(
+ Display display, std::vector<Layer>* outLayers,
+ std::vector<aidl::android::hardware::graphics::composer3::Composition>* outTypes)
+ override;
Error getColorModes(Display display, std::vector<ColorMode>* outModes) override;
Error getDisplayAttribute(Display display, Config config, IComposerClient::Attribute attribute,
int32_t* outValue) override;
@@ -131,8 +135,9 @@
const std::vector<IComposerClient::Rect>& damage) override;
Error setLayerBlendMode(Display display, Layer layer, IComposerClient::BlendMode mode) override;
Error setLayerColor(Display display, Layer layer, const IComposerClient::Color& color) override;
- Error setLayerCompositionType(Display display, Layer layer,
- IComposerClient::Composition type) override;
+ Error setLayerCompositionType(
+ Display display, Layer layer,
+ aidl::android::hardware::graphics::composer3::Composition type) override;
Error setLayerDataspace(Display display, Layer layer, Dataspace dataspace) override;
Error setLayerDisplayFrame(Display display, Layer layer,
const IComposerClient::Rect& frame) override;
diff --git a/services/surfaceflinger/DisplayHardware/ComposerHal.h b/services/surfaceflinger/DisplayHardware/ComposerHal.h
index 3cc5e5e..b4ba8ab 100644
--- a/services/surfaceflinger/DisplayHardware/ComposerHal.h
+++ b/services/surfaceflinger/DisplayHardware/ComposerHal.h
@@ -31,6 +31,8 @@
#include <ui/GraphicBuffer.h>
#include <utils/StrongPointer.h>
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
@@ -98,7 +100,7 @@
virtual Error getActiveConfig(Display display, Config* outConfig) = 0;
virtual Error getChangedCompositionTypes(
Display display, std::vector<Layer>* outLayers,
- std::vector<IComposerClient::Composition>* outTypes) = 0;
+ std::vector<aidl::android::hardware::graphics::composer3::Composition>* outTypes) = 0;
virtual Error getColorModes(Display display, std::vector<ColorMode>* outModes) = 0;
virtual Error getDisplayAttribute(Display display, Config config,
IComposerClient::Attribute attribute, int32_t* outValue) = 0;
@@ -155,8 +157,9 @@
IComposerClient::BlendMode mode) = 0;
virtual Error setLayerColor(Display display, Layer layer,
const IComposerClient::Color& color) = 0;
- virtual Error setLayerCompositionType(Display display, Layer layer,
- IComposerClient::Composition type) = 0;
+ virtual Error setLayerCompositionType(
+ Display display, Layer layer,
+ aidl::android::hardware::graphics::composer3::Composition type) = 0;
virtual Error setLayerDataspace(Display display, Layer layer, Dataspace dataspace) = 0;
virtual Error setLayerDisplayFrame(Display display, Layer layer,
const IComposerClient::Rect& frame) = 0;
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.cpp b/services/surfaceflinger/DisplayHardware/HWC2.cpp
index 596666c..82f463e 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWC2.cpp
@@ -39,6 +39,8 @@
#include "ComposerHal.h"
+using aidl::android::hardware::graphics::composer3::Composition;
+
namespace android {
using android::Fence;
@@ -147,7 +149,7 @@
Error Display::getChangedCompositionTypes(std::unordered_map<HWC2::Layer*, Composition>* outTypes) {
std::vector<Hwc2::Layer> layerIds;
- std::vector<Hwc2::IComposerClient::Composition> types;
+ std::vector<Composition> types;
auto intError = mComposer.getChangedCompositionTypes(
mId, &layerIds, &types);
uint32_t numElements = layerIds.size();
diff --git a/services/surfaceflinger/DisplayHardware/HWC2.h b/services/surfaceflinger/DisplayHardware/HWC2.h
index 5e0ba06..1425c61 100644
--- a/services/surfaceflinger/DisplayHardware/HWC2.h
+++ b/services/surfaceflinger/DisplayHardware/HWC2.h
@@ -36,6 +36,8 @@
#include "Hal.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
namespace android {
class Fence;
@@ -88,7 +90,8 @@
[[clang::warn_unused_result]] virtual base::expected<std::shared_ptr<HWC2::Layer>, hal::Error>
createLayer() = 0;
[[clang::warn_unused_result]] virtual hal::Error getChangedCompositionTypes(
- std::unordered_map<Layer*, hal::Composition>* outTypes) = 0;
+ std::unordered_map<Layer*, aidl::android::hardware::graphics::composer3::Composition>*
+ outTypes) = 0;
[[clang::warn_unused_result]] virtual hal::Error getColorModes(
std::vector<hal::ColorMode>* outModes) const = 0;
// Returns a bitmask which contains HdrMetadata::Type::*.
@@ -163,7 +166,9 @@
hal::Error acceptChanges() override;
base::expected<std::shared_ptr<HWC2::Layer>, hal::Error> createLayer() override;
hal::Error getChangedCompositionTypes(
- std::unordered_map<HWC2::Layer*, hal::Composition>* outTypes) override;
+ std::unordered_map<HWC2::Layer*,
+ aidl::android::hardware::graphics::composer3::Composition>* outTypes)
+ override;
hal::Error getColorModes(std::vector<hal::ColorMode>* outModes) const override;
// Returns a bitmask which contains HdrMetadata::Type::*.
int32_t getSupportedPerFrameMetadata() const override;
@@ -266,7 +271,8 @@
[[clang::warn_unused_result]] virtual hal::Error setBlendMode(hal::BlendMode mode) = 0;
[[clang::warn_unused_result]] virtual hal::Error setColor(hal::Color color) = 0;
- [[clang::warn_unused_result]] virtual hal::Error setCompositionType(hal::Composition type) = 0;
+ [[clang::warn_unused_result]] virtual hal::Error setCompositionType(
+ aidl::android::hardware::graphics::composer3::Composition type) = 0;
[[clang::warn_unused_result]] virtual hal::Error setDataspace(hal::Dataspace dataspace) = 0;
[[clang::warn_unused_result]] virtual hal::Error setPerFrameMetadata(
const int32_t supportedPerFrameMetadata, const android::HdrMetadata& metadata) = 0;
@@ -316,7 +322,8 @@
hal::Error setBlendMode(hal::BlendMode mode) override;
hal::Error setColor(hal::Color color) override;
- hal::Error setCompositionType(hal::Composition type) override;
+ hal::Error setCompositionType(
+ aidl::android::hardware::graphics::composer3::Composition type) override;
hal::Error setDataspace(hal::Dataspace dataspace) override;
hal::Error setPerFrameMetadata(const int32_t supportedPerFrameMetadata,
const android::HdrMetadata& metadata) override;
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h
index bd79977..aa4abdf 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.h
@@ -43,6 +43,8 @@
#include "HWC2.h"
#include "Hal.h"
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
namespace android {
namespace hal = hardware::graphics::composer::hal;
@@ -70,7 +72,9 @@
class HWComposer {
public:
struct DeviceRequestedChanges {
- using ChangedTypes = std::unordered_map<HWC2::Layer*, hal::Composition>;
+ using ChangedTypes =
+ std::unordered_map<HWC2::Layer*,
+ aidl::android::hardware::graphics::composer3::Composition>;
using ClientTargetProperty = hal::ClientTargetProperty;
using DisplayRequests = hal::DisplayRequest;
using LayerRequests = std::unordered_map<HWC2::Layer*, hal::LayerRequest>;
diff --git a/services/surfaceflinger/DisplayHardware/Hal.h b/services/surfaceflinger/DisplayHardware/Hal.h
index 02d0658..77e704f 100644
--- a/services/surfaceflinger/DisplayHardware/Hal.h
+++ b/services/surfaceflinger/DisplayHardware/Hal.h
@@ -20,6 +20,8 @@
#include <android/hardware/graphics/composer/2.4/IComposer.h>
#include <android/hardware/graphics/composer/2.4/IComposerClient.h>
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
#define ERROR_HAS_CHANGES 5
namespace android {
@@ -49,7 +51,6 @@
using Attribute = IComposerClient::Attribute;
using BlendMode = IComposerClient::BlendMode;
using Color = IComposerClient::Color;
-using Composition = IComposerClient::Composition;
using Connection = IComposerCallback::Connection;
using ContentType = IComposerClient::ContentType;
using Capability = IComposer::Capability;
@@ -95,19 +96,20 @@
}
}
-inline std::string to_string(hardware::graphics::composer::hal::Composition composition) {
+inline std::string to_string(
+ aidl::android::hardware::graphics::composer3::Composition composition) {
switch (composition) {
- case hardware::graphics::composer::hal::Composition::INVALID:
+ case aidl::android::hardware::graphics::composer3::Composition::INVALID:
return "Invalid";
- case hardware::graphics::composer::hal::Composition::CLIENT:
+ case aidl::android::hardware::graphics::composer3::Composition::CLIENT:
return "Client";
- case hardware::graphics::composer::hal::Composition::DEVICE:
+ case aidl::android::hardware::graphics::composer3::Composition::DEVICE:
return "Device";
- case hardware::graphics::composer::hal::Composition::SOLID_COLOR:
+ case aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR:
return "SolidColor";
- case hardware::graphics::composer::hal::Composition::CURSOR:
+ case aidl::android::hardware::graphics::composer3::Composition::CURSOR:
return "Cursor";
- case hardware::graphics::composer::hal::Composition::SIDEBAND:
+ case aidl::android::hardware::graphics::composer3::Composition::SIDEBAND:
return "Sideband";
default:
return "Unknown";
diff --git a/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp
index 11d41c0..18f24c1 100644
--- a/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp
+++ b/services/surfaceflinger/DisplayHardware/HidlComposerHal.cpp
@@ -278,7 +278,7 @@
Error HidlComposer::getChangedCompositionTypes(
Display display, std::vector<Layer>* outLayers,
- std::vector<IComposerClient::Composition>* outTypes) {
+ std::vector<aidl::android::hardware::graphics::composer3::Composition>* outTypes) {
mReader.takeChangedCompositionTypes(display, outLayers, outTypes);
return Error::NONE;
}
@@ -618,11 +618,17 @@
return Error::NONE;
}
-Error HidlComposer::setLayerCompositionType(Display display, Layer layer,
- IComposerClient::Composition type) {
+static IComposerClient::Composition to_hidl_type(
+ aidl::android::hardware::graphics::composer3::Composition type) {
+ return static_cast<IComposerClient::Composition>(type);
+}
+
+Error HidlComposer::setLayerCompositionType(
+ Display display, Layer layer,
+ aidl::android::hardware::graphics::composer3::Composition type) {
mWriter.selectDisplay(display);
mWriter.selectLayer(layer);
- mWriter.setLayerCompositionType(type);
+ mWriter.setLayerCompositionType(to_hidl_type(type));
return Error::NONE;
}
@@ -1266,7 +1272,8 @@
mCurrentReturnData->compositionTypes.reserve(count);
while (count > 0) {
auto layer = read64();
- auto type = static_cast<IComposerClient::Composition>(readSigned());
+ auto type = static_cast<aidl::android::hardware::graphics::composer3::Composition>(
+ readSigned());
mCurrentReturnData->changedLayers.push_back(layer);
mCurrentReturnData->compositionTypes.push_back(type);
@@ -1394,7 +1401,7 @@
void CommandReader::takeChangedCompositionTypes(
Display display, std::vector<Layer>* outLayers,
- std::vector<IComposerClient::Composition>* outTypes) {
+ std::vector<aidl::android::hardware::graphics::composer3::Composition>* outTypes) {
auto found = mReturnData.find(display);
if (found == mReturnData.end()) {
outLayers->clear();
diff --git a/services/surfaceflinger/DisplayHardware/HidlComposerHal.h b/services/surfaceflinger/DisplayHardware/HidlComposerHal.h
index 18c0635..5b2219e 100644
--- a/services/surfaceflinger/DisplayHardware/HidlComposerHal.h
+++ b/services/surfaceflinger/DisplayHardware/HidlComposerHal.h
@@ -37,6 +37,8 @@
#include <ui/GraphicBuffer.h>
#include <utils/StrongPointer.h>
+#include <aidl/android/hardware/graphics/composer3/Composition.h>
+
// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion -Wextra"
@@ -92,8 +94,9 @@
uint32_t* outNumLayerRequestMasks) const;
// Get and clear saved changed composition types.
- void takeChangedCompositionTypes(Display display, std::vector<Layer>* outLayers,
- std::vector<IComposerClient::Composition>* outTypes);
+ void takeChangedCompositionTypes(
+ Display display, std::vector<Layer>* outLayers,
+ std::vector<aidl::android::hardware::graphics::composer3::Composition>* outTypes);
// Get and clear saved display requests.
void takeDisplayRequests(Display display, uint32_t* outDisplayRequestMask,
@@ -130,7 +133,7 @@
uint32_t displayRequests = 0;
std::vector<Layer> changedLayers;
- std::vector<IComposerClient::Composition> compositionTypes;
+ std::vector<aidl::android::hardware::graphics::composer3::Composition> compositionTypes;
std::vector<Layer> requestedLayers;
std::vector<uint32_t> requestMasks;
@@ -188,8 +191,10 @@
Error destroyLayer(Display display, Layer layer) override;
Error getActiveConfig(Display display, Config* outConfig) override;
- Error getChangedCompositionTypes(Display display, std::vector<Layer>* outLayers,
- std::vector<IComposerClient::Composition>* outTypes) override;
+ Error getChangedCompositionTypes(
+ Display display, std::vector<Layer>* outLayers,
+ std::vector<aidl::android::hardware::graphics::composer3::Composition>* outTypes)
+ override;
Error getColorModes(Display display, std::vector<ColorMode>* outModes) override;
Error getDisplayAttribute(Display display, Config config, IComposerClient::Attribute attribute,
int32_t* outValue) override;
@@ -242,8 +247,9 @@
const std::vector<IComposerClient::Rect>& damage) override;
Error setLayerBlendMode(Display display, Layer layer, IComposerClient::BlendMode mode) override;
Error setLayerColor(Display display, Layer layer, const IComposerClient::Color& color) override;
- Error setLayerCompositionType(Display display, Layer layer,
- IComposerClient::Composition type) override;
+ Error setLayerCompositionType(
+ Display display, Layer layer,
+ aidl::android::hardware::graphics::composer3::Composition type) override;
Error setLayerDataspace(Display display, Layer layer, Dataspace dataspace) override;
Error setLayerDisplayFrame(Display display, Layer layer,
const IComposerClient::Rect& frame) override;
diff --git a/services/surfaceflinger/EffectLayer.cpp b/services/surfaceflinger/EffectLayer.cpp
index 845176c..cc85352 100644
--- a/services/surfaceflinger/EffectLayer.cpp
+++ b/services/surfaceflinger/EffectLayer.cpp
@@ -109,7 +109,8 @@
auto* compositionState = editCompositionState();
compositionState->color = getColor();
- compositionState->compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ compositionState->compositionType =
+ aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR;
}
sp<compositionengine::LayerFE> EffectLayer::getCompositionEngineLayerFE() const {
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index b395159..6e9138c 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -650,15 +650,16 @@
return {*layerSettings};
}
-Hwc2::IComposerClient::Composition Layer::getCompositionType(const DisplayDevice& display) const {
+aidl::android::hardware::graphics::composer3::Composition Layer::getCompositionType(
+ const DisplayDevice& display) const {
const auto outputLayer = findOutputLayerForDisplay(&display);
if (outputLayer == nullptr) {
- return Hwc2::IComposerClient::Composition::INVALID;
+ return aidl::android::hardware::graphics::composer3::Composition::INVALID;
}
if (outputLayer->getState().hwc) {
return (*outputLayer->getState().hwc).hwcCompositionType;
} else {
- return Hwc2::IComposerClient::Composition::CLIENT;
+ return aidl::android::hardware::graphics::composer3::Composition::CLIENT;
}
}
@@ -2004,7 +2005,7 @@
if (traceFlags & LayerTracing::TRACE_COMPOSITION) {
// Only populate for the primary display.
if (display) {
- const Hwc2::IComposerClient::Composition compositionType = getCompositionType(*display);
+ const auto compositionType = getCompositionType(*display);
layerProto->set_hwc_composition_type(static_cast<HwcCompositionType>(compositionType));
}
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 3f4d48b..31cdf0b 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -1037,7 +1037,8 @@
// Returns true if the layer can draw shadows on its border.
virtual bool canDrawShadows() const { return true; }
- Hwc2::IComposerClient::Composition getCompositionType(const DisplayDevice&) const;
+ aidl::android::hardware::graphics::composer3::Composition getCompositionType(
+ const DisplayDevice&) const;
/**
* Returns an unsorted vector of all layers that are part of this tree.
diff --git a/services/surfaceflinger/Tracing/RingBuffer.h b/services/surfaceflinger/Tracing/RingBuffer.h
index 281cd19..3b2626d 100644
--- a/services/surfaceflinger/Tracing/RingBuffer.h
+++ b/services/surfaceflinger/Tracing/RingBuffer.h
@@ -37,22 +37,21 @@
size_t used() const { return mUsedInBytes; }
size_t frameCount() const { return mStorage.size(); }
void setSize(size_t newSize) { mSizeInBytes = newSize; }
- EntryProto& front() { return mStorage.front(); }
- const EntryProto& front() const { return mStorage.front(); }
- const EntryProto& back() const { return mStorage.back(); }
+ const std::string& front() const { return mStorage.front(); }
+ const std::string& back() const { return mStorage.back(); }
void reset() {
// use the swap trick to make sure memory is released
- std::deque<EntryProto>().swap(mStorage);
+ std::deque<std::string>().swap(mStorage);
mUsedInBytes = 0U;
}
void writeToProto(FileProto& fileProto) {
fileProto.mutable_entry()->Reserve(static_cast<int>(mStorage.size()) +
fileProto.entry().size());
- for (const EntryProto& entry : mStorage) {
+ for (const std::string& entry : mStorage) {
EntryProto* entryProto = fileProto.add_entry();
- *entryProto = entry;
+ entryProto->ParseFromString(entry);
}
}
@@ -74,28 +73,35 @@
return NO_ERROR;
}
- std::vector<EntryProto> emplace(EntryProto&& proto) {
- std::vector<EntryProto> replacedEntries;
- size_t protoSize = static_cast<size_t>(proto.ByteSize());
+ std::vector<std::string> emplace(std::string&& serializedProto) {
+ std::vector<std::string> replacedEntries;
+ size_t protoSize = static_cast<size_t>(serializedProto.size());
while (mUsedInBytes + protoSize > mSizeInBytes) {
if (mStorage.empty()) {
return {};
}
- mUsedInBytes -= static_cast<size_t>(mStorage.front().ByteSize());
+ mUsedInBytes -= static_cast<size_t>(mStorage.front().size());
replacedEntries.emplace_back(mStorage.front());
mStorage.pop_front();
}
mUsedInBytes += protoSize;
- mStorage.emplace_back();
- mStorage.back().Swap(&proto);
+ mStorage.emplace_back(serializedProto);
return replacedEntries;
}
+ std::vector<std::string> emplace(EntryProto&& proto) {
+ std::string serializedProto;
+ proto.SerializeToString(&serializedProto);
+ return emplace(std::move(serializedProto));
+ }
+
void dump(std::string& result) const {
std::chrono::milliseconds duration(0);
if (frameCount() > 0) {
+ EntryProto entry;
+ entry.ParseFromString(mStorage.front());
duration = std::chrono::duration_cast<std::chrono::milliseconds>(
- std::chrono::nanoseconds(systemTime() - front().elapsed_realtime_nanos()));
+ std::chrono::nanoseconds(systemTime() - entry.elapsed_realtime_nanos()));
}
const int64_t durationCount = duration.count();
base::StringAppendF(&result,
@@ -107,7 +113,7 @@
private:
size_t mUsedInBytes = 0U;
size_t mSizeInBytes = 0U;
- std::deque<EntryProto> mStorage;
+ std::deque<std::string> mStorage;
};
} // namespace android
diff --git a/services/surfaceflinger/Tracing/TransactionTracing.cpp b/services/surfaceflinger/Tracing/TransactionTracing.cpp
index c1b3d2e..b5966d5 100644
--- a/services/surfaceflinger/Tracing/TransactionTracing.cpp
+++ b/services/surfaceflinger/Tracing/TransactionTracing.cpp
@@ -177,9 +177,9 @@
const std::vector<int32_t>& removedLayers) {
ATRACE_CALL();
std::scoped_lock lock(mTraceLock);
- std::vector<proto::TransactionTraceEntry> removedEntries;
+ std::vector<std::string> removedEntries;
+ proto::TransactionTraceEntry entryProto;
for (const CommittedTransactions& entry : committedTransactions) {
- proto::TransactionTraceEntry entryProto;
entryProto.set_elapsed_realtime_nanos(entry.timestamp);
entryProto.set_vsync_id(entry.vsyncId);
entryProto.mutable_added_layers()->Reserve(static_cast<int32_t>(mCreatedLayers.size()));
@@ -202,13 +202,21 @@
ALOGW("Could not find transaction id %" PRIu64, id);
}
}
- std::vector<proto::TransactionTraceEntry> entries = mBuffer->emplace(std::move(entryProto));
+
+ std::string serializedProto;
+ entryProto.SerializeToString(&serializedProto);
+ entryProto.Clear();
+ std::vector<std::string> entries = mBuffer->emplace(std::move(serializedProto));
+ removedEntries.reserve(removedEntries.size() + entries.size());
removedEntries.insert(removedEntries.end(), std::make_move_iterator(entries.begin()),
std::make_move_iterator(entries.end()));
}
- for (const proto::TransactionTraceEntry& removedEntry : removedEntries) {
- updateStartingStateLocked(removedEntry);
+ proto::TransactionTraceEntry removedEntryProto;
+ for (const std::string& removedEntry : removedEntries) {
+ removedEntryProto.ParseFromString(removedEntry);
+ updateStartingStateLocked(removedEntryProto);
+ removedEntryProto.Clear();
}
mTransactionsAddedToBufferCv.notify_one();
}
@@ -220,7 +228,11 @@
std::unique_lock<std::mutex> lock(mTraceLock);
base::ScopedLockAssertion assumeLocked(mTraceLock);
mTransactionsAddedToBufferCv.wait(lock, [&]() REQUIRES(mTraceLock) {
- return mBuffer->used() > 0 && mBuffer->back().vsync_id() >= vsyncId;
+ proto::TransactionTraceEntry entry;
+ if (mBuffer->used() > 0) {
+ entry.ParseFromString(mBuffer->back());
+ }
+ return mBuffer->used() > 0 && entry.vsync_id() >= vsyncId;
});
}
diff --git a/services/surfaceflinger/tests/unittests/CompositionTest.cpp b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
index f1e6e48..554e454 100644
--- a/services/surfaceflinger/tests/unittests/CompositionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/CompositionTest.cpp
@@ -1029,9 +1029,10 @@
}
};
-template <IComposerClient::Composition CompositionType>
+template <aidl::android::hardware::graphics::composer3::Composition CompositionType>
struct KeepCompositionTypeVariant {
- static constexpr hal::Composition TYPE = CompositionType;
+ static constexpr aidl::android::hardware::graphics::composer3::Composition TYPE =
+ CompositionType;
static void setupHwcSetCallExpectations(CompositionTest* test) {
if (!test->mDisplayOff) {
@@ -1046,10 +1047,11 @@
}
};
-template <IComposerClient::Composition InitialCompositionType,
- IComposerClient::Composition FinalCompositionType>
+template <aidl::android::hardware::graphics::composer3::Composition InitialCompositionType,
+ aidl::android::hardware::graphics::composer3::Composition FinalCompositionType>
struct ChangeCompositionTypeVariant {
- static constexpr hal::Composition TYPE = FinalCompositionType;
+ static constexpr aidl::android::hardware::graphics::composer3::Composition TYPE =
+ FinalCompositionType;
static void setupHwcSetCallExpectations(CompositionTest* test) {
if (!test->mDisplayOff) {
@@ -1063,8 +1065,9 @@
EXPECT_CALL(*test->mComposer, getChangedCompositionTypes(HWC_DISPLAY, _, _))
.WillOnce(DoAll(SetArgPointee<1>(std::vector<Hwc2::Layer>{
static_cast<Hwc2::Layer>(HWC_LAYER)}),
- SetArgPointee<2>(std::vector<IComposerClient::Composition>{
- FinalCompositionType}),
+ SetArgPointee<2>(
+ std::vector<aidl::android::hardware::graphics::composer3::
+ Composition>{FinalCompositionType}),
Return(Error::NONE)));
}
};
@@ -1258,25 +1261,28 @@
*/
TEST_F(CompositionTest, HWCComposedNormalBufferLayerWithDirtyGeometry) {
- displayRefreshCompositionDirtyGeometry<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::DEVICE>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyGeometry<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, HWCComposedNormalBufferLayerWithDirtyFrame) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::DEVICE>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, REComposedNormalBufferLayer) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
- ChangeCompositionTypeVariant<IComposerClient::Composition::DEVICE,
- IComposerClient::Composition::CLIENT>,
- RECompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
+ ChangeCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE,
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ RECompositionResultVariant>>();
}
TEST_F(CompositionTest, captureScreenNormalBufferLayer) {
@@ -1290,25 +1296,28 @@
*/
TEST_F(CompositionTest, HWCComposedEffectLayerWithDirtyGeometry) {
- displayRefreshCompositionDirtyGeometry<
- CompositionCase<DefaultDisplaySetupVariant, EffectLayerVariant<EffectLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::SOLID_COLOR>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyGeometry<CompositionCase<
+ DefaultDisplaySetupVariant, EffectLayerVariant<EffectLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, HWCComposedEffectLayerWithDirtyFrame) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, EffectLayerVariant<EffectLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::SOLID_COLOR>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, EffectLayerVariant<EffectLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, REComposedEffectLayer) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, EffectLayerVariant<EffectLayerProperties>,
- ChangeCompositionTypeVariant<IComposerClient::Composition::SOLID_COLOR,
- IComposerClient::Composition::CLIENT>,
- RECompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, EffectLayerVariant<EffectLayerProperties>,
+ ChangeCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR,
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ RECompositionResultVariant>>();
}
TEST_F(CompositionTest, captureScreenEffectLayer) {
@@ -1322,25 +1331,28 @@
*/
TEST_F(CompositionTest, HWCComposedSidebandBufferLayerWithDirtyGeometry) {
- displayRefreshCompositionDirtyGeometry<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<SidebandLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::SIDEBAND>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyGeometry<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<SidebandLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::SIDEBAND>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, HWCComposedSidebandBufferLayerWithDirtyFrame) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<SidebandLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::SIDEBAND>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<SidebandLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::SIDEBAND>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, REComposedSidebandBufferLayer) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<SidebandLayerProperties>,
- ChangeCompositionTypeVariant<IComposerClient::Composition::SIDEBAND,
- IComposerClient::Composition::CLIENT>,
- RECompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<SidebandLayerProperties>,
+ ChangeCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::SIDEBAND,
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ RECompositionResultVariant>>();
}
TEST_F(CompositionTest, captureScreenSidebandBufferLayer) {
@@ -1354,25 +1366,28 @@
*/
TEST_F(CompositionTest, HWCComposedSecureBufferLayerWithDirtyGeometry) {
- displayRefreshCompositionDirtyGeometry<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::DEVICE>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyGeometry<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, HWCComposedSecureBufferLayerWithDirtyFrame) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::DEVICE>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, REComposedSecureBufferLayer) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
- ChangeCompositionTypeVariant<IComposerClient::Composition::DEVICE,
- IComposerClient::Composition::CLIENT>,
- RECompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
+ ChangeCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE,
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ RECompositionResultVariant>>();
}
TEST_F(CompositionTest, captureScreenSecureBufferLayerOnSecureDisplay) {
@@ -1386,17 +1401,19 @@
*/
TEST_F(CompositionTest, HWCComposedSecureBufferLayerOnInsecureDisplayWithDirtyGeometry) {
- displayRefreshCompositionDirtyGeometry<
- CompositionCase<InsecureDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::CLIENT>,
- ForcedClientCompositionResultVariant>>();
+ displayRefreshCompositionDirtyGeometry<CompositionCase<
+ InsecureDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ ForcedClientCompositionResultVariant>>();
}
TEST_F(CompositionTest, HWCComposedSecureBufferLayerOnInsecureDisplayWithDirtyFrame) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<InsecureDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::CLIENT>,
- ForcedClientCompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ InsecureDisplaySetupVariant, BufferLayerVariant<SecureLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ ForcedClientCompositionResultVariant>>();
}
TEST_F(CompositionTest, captureScreenSecureBufferLayerOnInsecureDisplay) {
@@ -1411,22 +1428,24 @@
TEST_F(CompositionTest,
HWCComposedBufferLayerWithSecureParentLayerOnInsecureDisplayWithDirtyGeometry) {
- displayRefreshCompositionDirtyGeometry<
- CompositionCase<InsecureDisplaySetupVariant,
- ChildLayerVariant<BufferLayerVariant<ParentSecureLayerProperties>,
- ContainerLayerVariant<SecureLayerProperties>>,
- KeepCompositionTypeVariant<IComposerClient::Composition::CLIENT>,
- ForcedClientCompositionResultVariant>>();
+ displayRefreshCompositionDirtyGeometry<CompositionCase<
+ InsecureDisplaySetupVariant,
+ ChildLayerVariant<BufferLayerVariant<ParentSecureLayerProperties>,
+ ContainerLayerVariant<SecureLayerProperties>>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ ForcedClientCompositionResultVariant>>();
}
TEST_F(CompositionTest,
HWCComposedBufferLayerWithSecureParentLayerOnInsecureDisplayWithDirtyFrame) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<InsecureDisplaySetupVariant,
- ChildLayerVariant<BufferLayerVariant<ParentSecureLayerProperties>,
- ContainerLayerVariant<SecureLayerProperties>>,
- KeepCompositionTypeVariant<IComposerClient::Composition::CLIENT>,
- ForcedClientCompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ InsecureDisplaySetupVariant,
+ ChildLayerVariant<BufferLayerVariant<ParentSecureLayerProperties>,
+ ContainerLayerVariant<SecureLayerProperties>>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ ForcedClientCompositionResultVariant>>();
}
TEST_F(CompositionTest, captureScreenBufferLayerWithSecureParentLayerOnInsecureDisplay) {
@@ -1442,25 +1461,28 @@
*/
TEST_F(CompositionTest, HWCComposedCursorLayerWithDirtyGeometry) {
- displayRefreshCompositionDirtyGeometry<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<CursorLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::CURSOR>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyGeometry<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<CursorLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::CURSOR>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, HWCComposedCursorLayerWithDirtyFrame) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<CursorLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::CURSOR>,
- HwcCompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<CursorLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::CURSOR>,
+ HwcCompositionResultVariant>>();
}
TEST_F(CompositionTest, REComposedCursorLayer) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<CursorLayerProperties>,
- ChangeCompositionTypeVariant<IComposerClient::Composition::CURSOR,
- IComposerClient::Composition::CLIENT>,
- RECompositionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<CursorLayerProperties>,
+ ChangeCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::CURSOR,
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ RECompositionResultVariant>>();
}
TEST_F(CompositionTest, captureScreenCursorLayer) {
@@ -1477,7 +1499,8 @@
mDisplayOff = true;
displayRefreshCompositionDirtyGeometry<CompositionCase<
PoweredOffDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::DEVICE>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE>,
HwcCompositionResultVariant>>();
}
@@ -1485,7 +1508,8 @@
mDisplayOff = true;
displayRefreshCompositionDirtyFrame<CompositionCase<
PoweredOffDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::DEVICE>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE>,
HwcCompositionResultVariant>>();
}
@@ -1493,8 +1517,9 @@
mDisplayOff = true;
displayRefreshCompositionDirtyFrame<CompositionCase<
PoweredOffDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
- ChangeCompositionTypeVariant<IComposerClient::Composition::DEVICE,
- IComposerClient::Composition::CLIENT>,
+ ChangeCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::DEVICE,
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
RECompositionResultVariant>>();
}
@@ -1509,17 +1534,19 @@
*/
TEST_F(CompositionTest, DebugOptionForcingClientCompositionOfBufferLayerWithDirtyGeometry) {
- displayRefreshCompositionDirtyGeometry<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::CLIENT>,
- ForcedClientCompositionViaDebugOptionResultVariant>>();
+ displayRefreshCompositionDirtyGeometry<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ ForcedClientCompositionViaDebugOptionResultVariant>>();
}
TEST_F(CompositionTest, DebugOptionForcingClientCompositionOfBufferLayerWithDirtyFrame) {
- displayRefreshCompositionDirtyFrame<
- CompositionCase<DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
- KeepCompositionTypeVariant<IComposerClient::Composition::CLIENT>,
- ForcedClientCompositionViaDebugOptionResultVariant>>();
+ displayRefreshCompositionDirtyFrame<CompositionCase<
+ DefaultDisplaySetupVariant, BufferLayerVariant<DefaultLayerProperties>,
+ KeepCompositionTypeVariant<
+ aidl::android::hardware::graphics::composer3::Composition::CLIENT>,
+ ForcedClientCompositionViaDebugOptionResultVariant>>();
}
} // namespace
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index 100a78d..0067997 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -270,7 +270,8 @@
layer->editCompositionState()->sidebandStream = sidebandStream;
}
- void setLayerCompositionType(const sp<Layer>& layer, hal::Composition type) {
+ void setLayerCompositionType(const sp<Layer>& layer,
+ aidl::android::hardware::graphics::composer3::Composition type) {
auto outputLayer = findOutputLayerForDisplay(layer, mFlinger->getDefaultDisplayDevice());
LOG_ALWAYS_FATAL_IF(!outputLayer);
auto& state = outputLayer->editState();
diff --git a/services/surfaceflinger/tests/unittests/TransactionTracingTest.cpp b/services/surfaceflinger/tests/unittests/TransactionTracingTest.cpp
index 71c7bd9..43b09fd 100644
--- a/services/surfaceflinger/tests/unittests/TransactionTracingTest.cpp
+++ b/services/surfaceflinger/tests/unittests/TransactionTracingTest.cpp
@@ -56,7 +56,9 @@
auto bufferFront() {
std::scoped_lock<std::mutex> lock(mTracing->mTraceLock);
- return mTracing->mBuffer->front();
+ proto::TransactionTraceEntry entry;
+ entry.ParseFromString(mTracing->mBuffer->front());
+ return entry;
}
bool threadIsJoinable() {
diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h
index 1debd65..c3250d5 100644
--- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h
+++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockComposer.h
@@ -61,7 +61,8 @@
MOCK_METHOD2(destroyLayer, Error(Display, Layer));
MOCK_METHOD2(getActiveConfig, Error(Display, Config*));
MOCK_METHOD3(getChangedCompositionTypes,
- Error(Display, std::vector<Layer>*, std::vector<IComposerClient::Composition>*));
+ Error(Display, std::vector<Layer>*,
+ std::vector<aidl::android::hardware::graphics::composer3::Composition>*));
MOCK_METHOD2(getColorModes, Error(Display, std::vector<ColorMode>*));
MOCK_METHOD4(getDisplayAttribute,
Error(Display, Config config, IComposerClient::Attribute, int32_t*));
@@ -95,7 +96,8 @@
Error(Display, Layer, const std::vector<IComposerClient::Rect>&));
MOCK_METHOD3(setLayerBlendMode, Error(Display, Layer, IComposerClient::BlendMode));
MOCK_METHOD3(setLayerColor, Error(Display, Layer, const IComposerClient::Color&));
- MOCK_METHOD3(setLayerCompositionType, Error(Display, Layer, IComposerClient::Composition));
+ MOCK_METHOD3(setLayerCompositionType,
+ Error(Display, Layer, aidl::android::hardware::graphics::composer3::Composition));
MOCK_METHOD3(setLayerDataspace, Error(Display, Layer, Dataspace));
MOCK_METHOD3(setLayerPerFrameMetadata,
Error(Display, Layer, const std::vector<IComposerClient::PerFrameMetadata>&));
diff --git a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h
index 83a0996..d4fefee 100644
--- a/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h
+++ b/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockHWC2.h
@@ -38,7 +38,9 @@
MOCK_METHOD((base::expected<std::shared_ptr<HWC2::Layer>, hal::Error>), createLayer, (),
(override));
MOCK_METHOD(hal::Error, getChangedCompositionTypes,
- ((std::unordered_map<Layer *, hal::Composition> *)), (override));
+ ((std::unordered_map<Layer *,
+ aidl::android::hardware::graphics::composer3::Composition> *)),
+ (override));
MOCK_METHOD(hal::Error, getColorModes, (std::vector<hal::ColorMode> *), (const, override));
MOCK_METHOD(int32_t, getSupportedPerFrameMetadata, (), (const, override));
MOCK_METHOD(hal::Error, getRenderIntents, (hal::ColorMode, std::vector<hal::RenderIntent> *),
@@ -103,7 +105,8 @@
MOCK_METHOD(hal::Error, setSurfaceDamage, (const android::Region &), (override));
MOCK_METHOD(hal::Error, setBlendMode, (hal::BlendMode), (override));
MOCK_METHOD(hal::Error, setColor, (hal::Color), (override));
- MOCK_METHOD(hal::Error, setCompositionType, (hal::Composition), (override));
+ MOCK_METHOD(hal::Error, setCompositionType,
+ (aidl::android::hardware::graphics::composer3::Composition), (override));
MOCK_METHOD(hal::Error, setDataspace, (android::ui::Dataspace), (override));
MOCK_METHOD(hal::Error, setPerFrameMetadata, (const int32_t, const android::HdrMetadata &),
(override));