diff options
| -rw-r--r-- | services/java/com/android/server/WindowManagerService.java | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index 7011f9a13091..7b7a891e5525 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -9216,27 +9216,32 @@ public class WindowManagerService extends IWindowManager.Stub return; } + mInLayout = true; boolean recoveringMemory = false; - if (mForceRemoves != null) { - recoveringMemory = true; - // Wait a little it for things to settle down, and off we go. - for (int i=0; i<mForceRemoves.size(); i++) { - WindowState ws = mForceRemoves.get(i); - Slog.i(TAG, "Force removing: " + ws); - removeWindowInnerLocked(ws.mSession, ws); - } - mForceRemoves = null; - Slog.w(TAG, "Due to memory failure, waiting a bit for next layout"); - Object tmp = new Object(); - synchronized (tmp) { - try { - tmp.wait(250); - } catch (InterruptedException e) { + + try { + if (mForceRemoves != null) { + recoveringMemory = true; + // Wait a little it for things to settle down, and off we go. + for (int i=0; i<mForceRemoves.size(); i++) { + WindowState ws = mForceRemoves.get(i); + Slog.i(TAG, "Force removing: " + ws); + removeWindowInnerLocked(ws.mSession, ws); + } + mForceRemoves = null; + Slog.w(TAG, "Due to memory failure, waiting a bit for next layout"); + Object tmp = new Object(); + synchronized (tmp) { + try { + tmp.wait(250); + } catch (InterruptedException e) { + } } } + } catch (RuntimeException e) { + Slog.e(TAG, "Unhandled exception while force removing for memory", e); } - - mInLayout = true; + try { performLayoutAndPlaceSurfacesLockedInner(recoveringMemory); |