From 769ab6f949369468ee6355d00e490ad14a2f3721 Mon Sep 17 00:00:00 2001 From: Kevin DuBois Date: Wed, 19 Jun 2019 08:13:28 -0700 Subject: SF: do not extend DisplayDevice lifetime DisplayDevice lifetime was extended, resulting in stack corruption due to lifetime issue Fixes: 135211720 Test: 1h45m continual rotation with PIP video playing without crashing Test: Functional testing to make sure b/132394665 is still fixed. Change-Id: I1c4b3946a6da7994ff442a2345c1c878aa899ee4 --- services/surfaceflinger/RegionSamplingThread.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'services/surfaceflinger/RegionSamplingThread.cpp') diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 8b85d4cdbf..72bbf5dc26 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -342,9 +342,19 @@ void RegionSamplingThread::captureSample() { } const auto device = mFlinger.getDefaultDisplayDevice(); - const auto display = device->getCompositionDisplay(); - const auto state = display->getState(); - const auto orientation = static_cast(state.orientation); + const auto orientation = [](uint32_t orientation) { + switch (orientation) { + default: + case DisplayState::eOrientationDefault: + return ui::Transform::ROT_0; + case DisplayState::eOrientation90: + return ui::Transform::ROT_90; + case DisplayState::eOrientation180: + return ui::Transform::ROT_180; + case DisplayState::eOrientation270: + return ui::Transform::ROT_270; + } + }(device->getOrientation()); std::vector descriptors; Region sampleRegion; -- cgit v1.2.3-59-g8ed1b