summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/surfaceflinger/Tracing/TransactionProtoParser.cpp2
-rw-r--r--services/surfaceflinger/Tracing/TransactionProtoParser.h2
-rw-r--r--services/surfaceflinger/Tracing/TransactionTracing.h3
-rw-r--r--services/surfaceflinger/tests/unittests/TransactionTracingTest.cpp11
4 files changed, 11 insertions, 7 deletions
diff --git a/services/surfaceflinger/Tracing/TransactionProtoParser.cpp b/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
index 7e12313af1..783b36e66c 100644
--- a/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
+++ b/services/surfaceflinger/Tracing/TransactionProtoParser.cpp
@@ -43,7 +43,7 @@ proto::TransactionState TransactionProtoParser::toProto(const TransactionState&
}
proto::TransactionState TransactionProtoParser::toProto(
- const std::unordered_map<int32_t /* layerId */, TracingLayerState> states) {
+ const std::map<int32_t /* layerId */, TracingLayerState> states) {
proto::TransactionState proto;
for (auto& [layerId, state] : states) {
proto::LayerState layerProto = toProto(state, nullptr);
diff --git a/services/surfaceflinger/Tracing/TransactionProtoParser.h b/services/surfaceflinger/Tracing/TransactionProtoParser.h
index 619ee058bb..16e9b5e729 100644
--- a/services/surfaceflinger/Tracing/TransactionProtoParser.h
+++ b/services/surfaceflinger/Tracing/TransactionProtoParser.h
@@ -51,7 +51,7 @@ public:
static proto::TransactionState toProto(const TransactionState&, LayerHandleToIdFn getLayerIdFn,
DisplayHandleToIdFn getDisplayIdFn);
static proto::TransactionState toProto(
- const std::unordered_map<int32_t /* layerId */, TracingLayerState>);
+ const std::map<int32_t /* layerId */, TracingLayerState>);
static proto::LayerCreationArgs toProto(const TracingLayerCreationArgs& args);
diff --git a/services/surfaceflinger/Tracing/TransactionTracing.h b/services/surfaceflinger/Tracing/TransactionTracing.h
index 0aa22ede26..546ac7afb0 100644
--- a/services/surfaceflinger/Tracing/TransactionTracing.h
+++ b/services/surfaceflinger/Tracing/TransactionTracing.h
@@ -85,8 +85,7 @@ private:
std::vector<proto::LayerCreationArgs> mCreatedLayers GUARDED_BY(mTraceLock);
std::unordered_map<BBinder* /* layerHandle */, int32_t /* layerId */> mLayerHandles
GUARDED_BY(mTraceLock);
- std::unordered_map<int32_t /* layerId */, TracingLayerState> mStartingStates
- GUARDED_BY(mTraceLock);
+ std::map<int32_t /* layerId */, TracingLayerState> mStartingStates GUARDED_BY(mTraceLock);
// We do not want main thread to block so main thread will try to acquire mMainThreadLock,
// otherwise will push data to temporary container.
diff --git a/services/surfaceflinger/tests/unittests/TransactionTracingTest.cpp b/services/surfaceflinger/tests/unittests/TransactionTracingTest.cpp
index ffe5671935..4e49c18059 100644
--- a/services/surfaceflinger/tests/unittests/TransactionTracingTest.cpp
+++ b/services/surfaceflinger/tests/unittests/TransactionTracingTest.cpp
@@ -165,7 +165,7 @@ protected:
mTracing->onLayerAdded(fakeLayerHandle->localBinder(), mParentLayerId, "parent",
123 /* flags */, -1 /* parentId */);
const sp<IBinder> fakeChildLayerHandle = new BBinder();
- mTracing->onLayerAdded(fakeChildLayerHandle->localBinder(), 2 /* layerId */, "child",
+ mTracing->onLayerAdded(fakeChildLayerHandle->localBinder(), mChildLayerId, "child",
456 /* flags */, mParentLayerId);
// add some layer transaction
@@ -179,7 +179,8 @@ protected:
transaction.states.add(layerState);
ComposerState childState;
childState.state.surface = fakeChildLayerHandle;
- layerState.state.z = 43;
+ childState.state.what = layer_state_t::eLayerChanged;
+ childState.state.z = 43;
transaction.states.add(childState);
mTracing->addQueuedTransaction(transaction);
@@ -227,6 +228,7 @@ protected:
}
int mParentLayerId = 1;
+ int mChildLayerId = 2;
int64_t mVsyncId = 0;
int64_t VSYNC_ID_FIRST_LAYER_CHANGE;
int64_t VSYNC_ID_SECOND_LAYER_CHANGE;
@@ -244,8 +246,11 @@ TEST_F(TransactionTracingLayerHandlingTest, addStartingState) {
EXPECT_GT(proto.entry().size(), 0);
EXPECT_GT(proto.entry(0).transactions().size(), 0);
EXPECT_GT(proto.entry(0).added_layers().size(), 0);
- EXPECT_GT(proto.entry(0).transactions(0).layer_changes().size(), 0);
+ EXPECT_EQ(proto.entry(0).transactions(0).layer_changes().size(), 2);
+ EXPECT_EQ(proto.entry(0).transactions(0).layer_changes(0).layer_id(), mParentLayerId);
EXPECT_EQ(proto.entry(0).transactions(0).layer_changes(0).z(), 42);
+ EXPECT_EQ(proto.entry(0).transactions(0).layer_changes(1).layer_id(), mChildLayerId);
+ EXPECT_EQ(proto.entry(0).transactions(0).layer_changes(1).z(), 43);
}
TEST_F(TransactionTracingLayerHandlingTest, updateStartingState) {