summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/RegionSamplingThread.cpp
diff options
context:
space:
mode:
author Kevin DuBois <kevindubois@google.com> 2019-06-19 08:13:28 -0700
committer Kevin DuBois <kevindubois@google.com> 2019-06-20 16:49:44 -0700
commit769ab6f949369468ee6355d00e490ad14a2f3721 (patch)
tree41d2ea9abe259f249173aa10a46bfa5ffff97735 /services/surfaceflinger/RegionSamplingThread.cpp
parent5d4931816c8bd0eeb8829dbe201fe97d4a979add (diff)
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
Diffstat (limited to 'services/surfaceflinger/RegionSamplingThread.cpp')
-rw-r--r--services/surfaceflinger/RegionSamplingThread.cpp16
1 files changed, 13 insertions, 3 deletions
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<ui::Transform::orientation_flags>(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<RegionSamplingThread::Descriptor> descriptors;
Region sampleRegion;