From 9a14392256354538f1f43a5e80fe46c2c2b965cb Mon Sep 17 00:00:00 2001 From: Jesse Hall Date: Thu, 4 Oct 2012 16:29:19 -0700 Subject: [PATCH] Ignore display state changes for disconnected displays When a display is disconnected, removing it from SurfaceFlinger's display list is non-atomic with removing it from the Display Manager and any in-flight transactions. So SurfaceFlinger might get a display state change transaction for a display it has already forgotten about. Just ignore these. Bug: 7288082 Change-Id: Ic27e55377f3db40fb34e3b1cd67e43297df117a2 --- services/surfaceflinger/SurfaceFlinger.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 8160a7aba..11031759e 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1707,8 +1707,12 @@ void SurfaceFlinger::setTransactionState( uint32_t SurfaceFlinger::setDisplayStateLocked(const DisplayState& s) { + ssize_t dpyIdx = mCurrentState.displays.indexOfKey(s.token); + if (dpyIdx < 0) + return 0; + uint32_t flags = 0; - DisplayDeviceState& disp(mCurrentState.displays.editValueFor(s.token)); + DisplayDeviceState& disp(mCurrentState.displays.editValueAt(dpyIdx)); if (disp.isValid()) { const uint32_t what = s.what; if (what & DisplayState::eSurfaceChanged) {