From ae16b80b779db790e100ebe6e9d292b96dc04c9c Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Wed, 12 Jan 2022 11:42:05 -0500 Subject: RegionSamplingListener: Treat empty Rect as BAD_VALUE The Rect will eventually be merged with other listeners to create an area of the screen to capture. If the area is empty, this will result in trying to create an empty texture, which will fail and hit a LOG_ALWAYS_FATAL. This means that mDescriptors will only contain non-empty Rects; if mDescriptors is empty, the RegionSamplingThread will not attempt to do a capture. Bug: 206415266 Test: make Change-Id: Ib395a7627feba73bb9e4ca5f38aebd675515e506 --- services/surfaceflinger/SurfaceFlinger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'services/surfaceflinger/SurfaceFlinger.cpp') diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 8db974ed0e..4252fdf61b 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1609,7 +1609,7 @@ status_t SurfaceFlinger::getCompositionPreference( status_t SurfaceFlinger::addRegionSamplingListener(const Rect& samplingArea, const sp& stopLayerHandle, const sp& listener) { - if (!listener || samplingArea == Rect::INVALID_RECT) { + if (!listener || samplingArea == Rect::INVALID_RECT || samplingArea.isEmpty()) { return BAD_VALUE; } -- cgit v1.2.3-59-g8ed1b