From 526f0a0e158cf46c244edc57624c15ebce26c71f Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 18 Oct 2011 20:19:59 -0700 Subject: Fix a hang in SF caused by invalid transform matrix from the WM WindowManager could create by transforms because of divide by zero. Bug: 5422468 Change-Id: I782f87ebb78b5ff23750e22837f36ca6cfed1f2f --- services/java/com/android/server/wm/WindowState.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/java/com/android/server/wm/WindowState.java b/services/java/com/android/server/wm/WindowState.java index e921818..eeffb02 100644 --- a/services/java/com/android/server/wm/WindowState.java +++ b/services/java/com/android/server/wm/WindowState.java @@ -1120,7 +1120,11 @@ final class WindowState implements WindowManagerPolicy.WindowState { // window's center). final float w = frame.width(); final float h = frame.height(); - tmpMatrix.setScale(1 + 2/w, 1 + 2/h, w/2, h/2); + if (w>=1 && h>=1) { + tmpMatrix.setScale(1 + 2/w, 1 + 2/h, w/2, h/2); + } else { + tmpMatrix.reset(); + } } else { tmpMatrix.reset(); } -- cgit v1.1