HDR ratio indicator needs to vote for NO_VOTE as setFrameRate
Bug: 353532673
Flag: EXEMPT bugfix
Test: play with indicator
Change-Id: Ifb365d66bc24ebfa275acffd1beb2729c839d475
diff --git a/services/surfaceflinger/HdrSdrRatioOverlay.cpp b/services/surfaceflinger/HdrSdrRatioOverlay.cpp
index dfb1c1e..2088635 100644
--- a/services/surfaceflinger/HdrSdrRatioOverlay.cpp
+++ b/services/surfaceflinger/HdrSdrRatioOverlay.cpp
@@ -114,7 +114,7 @@
ALOGE("%s: Failed to create buffer state layer", __func__);
return;
}
- SurfaceComposerClient::Transaction()
+ createTransaction()
.setLayer(mSurfaceControl->get(), INT32_MAX - 2)
.setTrustedOverlay(mSurfaceControl->get(), true)
.apply();
@@ -130,7 +130,7 @@
}
void HdrSdrRatioOverlay::setLayerStack(ui::LayerStack stack) {
- SurfaceComposerClient::Transaction().setLayerStack(mSurfaceControl->get(), stack).apply();
+ createTransaction().setLayerStack(mSurfaceControl->get(), stack).apply();
}
void HdrSdrRatioOverlay::setViewport(ui::Size viewport) {
@@ -141,7 +141,7 @@
// set the ratio frame to the top right of the screen
frame.offsetBy(viewport.width - frame.width(), height >> 4);
- SurfaceComposerClient::Transaction()
+ createTransaction()
.setMatrix(mSurfaceControl->get(), frame.getWidth() / static_cast<float>(kBufferWidth),
0, 0, frame.getHeight() / static_cast<float>(kBufferHeight))
.setPosition(mSurfaceControl->get(), frame.left, frame.top)
@@ -167,7 +167,7 @@
}
}();
- SurfaceComposerClient::Transaction().setTransform(mSurfaceControl->get(), transform).apply();
+ createTransaction().setTransform(mSurfaceControl->get(), transform).apply();
constexpr SkColor kMinRatioColor = SK_ColorBLUE;
constexpr SkColor kMaxRatioColor = SK_ColorGREEN;
@@ -194,9 +194,21 @@
void HdrSdrRatioOverlay::animate() {
if (!std::isfinite(mCurrentHdrSdrRatio) || mCurrentHdrSdrRatio < 1.0f) return;
- SurfaceComposerClient::Transaction()
+ createTransaction()
.setBuffer(mSurfaceControl->get(), getOrCreateBuffers(mCurrentHdrSdrRatio))
.apply();
}
+SurfaceComposerClient::Transaction HdrSdrRatioOverlay::createTransaction() const {
+ constexpr float kFrameRate = 0.f;
+ constexpr int8_t kCompatibility = ANATIVEWINDOW_FRAME_RATE_NO_VOTE;
+ constexpr int8_t kSeamlessness = ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS;
+
+ const sp<SurfaceControl>& surface = mSurfaceControl->get();
+
+ SurfaceComposerClient::Transaction transaction;
+ transaction.setFrameRate(surface, kFrameRate, kCompatibility, kSeamlessness);
+ return transaction;
+}
+
} // namespace android
\ No newline at end of file
diff --git a/services/surfaceflinger/HdrSdrRatioOverlay.h b/services/surfaceflinger/HdrSdrRatioOverlay.h
index 72d401d..ba88252 100644
--- a/services/surfaceflinger/HdrSdrRatioOverlay.h
+++ b/services/surfaceflinger/HdrSdrRatioOverlay.h
@@ -53,5 +53,7 @@
size_t mIndex = 0;
std::array<sp<GraphicBuffer>, 2> mRingBuffer;
+
+ SurfaceComposerClient::Transaction createTransaction() const;
};
} // namespace android