diff options
author | Konstantin Lopyrev <klopyrev@google.com> | 2010-08-24 22:00:12 -0700 |
---|---|---|
committer | Konstantin Lopyrev <klopyrev@google.com> | 2010-08-25 13:38:27 -0700 |
commit | 43b9b48f792e0b1b166af7f7fb6a32172e7f11c2 (patch) | |
tree | a2b672ac91132c4e950df1a831d58b1905befca3 /core | |
parent | b8814dce287552c1bdf13fa999296ebc7387776d (diff) | |
download | frameworks_base-43b9b48f792e0b1b166af7f7fb6a32172e7f11c2.zip frameworks_base-43b9b48f792e0b1b166af7f7fb6a32172e7f11c2.tar.gz frameworks_base-43b9b48f792e0b1b166af7f7fb6a32172e7f11c2.tar.bz2 |
Preventing the hierarchy viewer from getting stuck, once when trying to load the window data for SurfaceView and the Wallpaper, and in the case the captured node has disappeared.
Change-Id: Iaff6bd501a2bb3faa7a394fff740479f6a95e899
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/view/ViewDebug.java | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java index 402443c..7b6991f 100644 --- a/core/java/android/view/ViewDebug.java +++ b/core/java/android/view/ViewDebug.java @@ -1138,22 +1138,24 @@ public class ViewDebug { final View captureView = findView(root, parameter); Bitmap b = performViewCapture(captureView, false); - - if (b != null) { - BufferedOutputStream out = null; - try { - out = new BufferedOutputStream(clientStream, 32 * 1024); - b.compress(Bitmap.CompressFormat.PNG, 100, out); - out.flush(); - } finally { - if (out != null) { - out.close(); - } - b.recycle(); - } - } else { + + if (b == null) { Log.w("View", "Failed to create capture bitmap!"); - clientStream.close(); + // Send an empty one so that it doesn't get stuck waiting for + // something. + b = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888); + } + + BufferedOutputStream out = null; + try { + out = new BufferedOutputStream(clientStream, 32 * 1024); + b.compress(Bitmap.CompressFormat.PNG, 100, out); + out.flush(); + } finally { + if (out != null) { + out.close(); + } + b.recycle(); } } |