Add new SF backdoor option: hdr/sdr ratio overlay
- follow how RefreshRateOverlay did in general.
- 1043 as new opcode to enable hdr/sdr ratio overlay.
- decouple SevenSegmentDrawer and SurfaceControlHandle helper classes
from RefreshRateOverlay.
- add corresponding SF backdoor test for validation.
- for non-HDR-supported device, we don't reject them to use SF backdoor
but 1.00 will be always shown on the screen if enabling.
Test: adb shell call service call SurfaceFlinger 1043 1; atest
SurfaceFlinger_test
Bug: 277957056
Change-Id: Ifce2d435f127b53ab9d01aba4e24ffd4fdb010a7
diff --git a/services/surfaceflinger/RefreshRateOverlay.h b/services/surfaceflinger/RefreshRateOverlay.h
index 0b89b8e..65c61cb 100644
--- a/services/surfaceflinger/RefreshRateOverlay.h
+++ b/services/surfaceflinger/RefreshRateOverlay.h
@@ -16,12 +16,12 @@
#pragma once
-#include <SkColor.h>
+#include "Utils/OverlayUtils.h"
+
#include <vector>
#include <ftl/flags.h>
#include <ftl/small_map.h>
-#include <gui/SurfaceComposerClient.h>
#include <ui/LayerStack.h>
#include <ui/Size.h>
#include <ui/Transform.h>
@@ -34,22 +34,8 @@
namespace android {
class GraphicBuffer;
-class SurfaceControl;
class SurfaceFlinger;
-// Helper class to delete the SurfaceControl on a helper thread as
-// SurfaceControl assumes its destruction happens without SurfaceFlinger::mStateLock held.
-class SurfaceControlHolder {
-public:
- explicit SurfaceControlHolder(sp<SurfaceControl> sc) : mSurfaceControl(std::move(sc)){};
- ~SurfaceControlHolder();
-
- const sp<SurfaceControl>& get() const { return mSurfaceControl; }
-
-private:
- sp<SurfaceControl> mSurfaceControl;
-};
-
class RefreshRateOverlay {
public:
enum class Features {
@@ -70,18 +56,9 @@
private:
using Buffers = std::vector<sp<GraphicBuffer>>;
- class SevenSegmentDrawer {
- public:
- static Buffers draw(int displayFps, int renderFps, SkColor, ui::Transform::RotationFlags,
- ftl::Flags<Features>);
-
- private:
- enum class Segment { Upper, UpperLeft, UpperRight, Middle, LowerLeft, LowerRight, Bottom };
-
- static void drawSegment(Segment, int left, SkColor, SkCanvas&);
- static void drawDigit(int digit, int left, SkColor, SkCanvas&);
- static void drawNumber(int number, int left, SkColor, SkCanvas&);
- };
+ static Buffers draw(int displayFps, int renderFps, SkColor, ui::Transform::RotationFlags,
+ ftl::Flags<Features>);
+ static void drawNumber(int number, int left, SkColor, SkCanvas&);
const Buffers& getOrCreateBuffers(Fps, Fps);