FramebufferSurface: fix for limitFramebufferSize
This CL fixes limitFramebufferSize and adds a test for the
broken use case. Also limitFramebufferSize is renamed to
limitSize because "Framebuffer" is implied by the class
name. The implementation is moved to a static
limitSizeInternal which can be tested more easily.
Bug: 180908183
Test: atest FramebufferSurfaceTest
Change-Id: Ic094b36fef6f9a17c87ec95a6c3f5f0a09c99d2f
diff --git a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
index 5d1e131..3123351 100644
--- a/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
+++ b/services/surfaceflinger/DisplayHardware/FramebufferSurface.h
@@ -55,15 +55,20 @@
virtual const sp<Fence>& getClientTargetAcquireFence() const override;
private:
+ friend class FramebufferSurfaceTest;
+
+ // Limits the width and height by the maximum width specified.
+ ui::Size limitSize(const ui::Size&);
+
+ // Used for testing purposes.
+ static ui::Size limitSizeInternal(const ui::Size&, const ui::Size& maxSize);
+
virtual ~FramebufferSurface() { }; // this class cannot be overloaded
virtual void freeBufferLocked(int slotIndex);
virtual void dumpLocked(String8& result, const char* prefix) const;
- // Limits the width and height by the maximum width specified in the constructor.
- ui::Size limitFramebufferSize(const ui::Size&);
-
// nextBuffer waits for and then latches the next buffer from the
// BufferQueue and releases the previously latched buffer to the
// BufferQueue. The new buffer is returned in the 'buffer' argument.