summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Konstantin Lopyrev <klopyrev@google.com> 2010-08-25 17:37:45 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2010-08-25 17:37:45 -0700
commit5a54e98022d640900f94102c077d8dff447f3c76 (patch)
tree9f67389d43875744005b2a9d8d83fb647a368a53
parentd72c1172f669d0a50a5164672c354ec7fb4ac9aa (diff)
parent6947cc594276df899a0c4662224455f40846bd0a (diff)
am 6947cc59: Merge "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." into gingerbread
Merge commit '6947cc594276df899a0c4662224455f40846bd0a' into gingerbread-plus-aosp * commit '6947cc594276df899a0c4662224455f40846bd0a': 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.
-rw-r--r--core/java/android/view/ViewDebug.java32
-rw-r--r--services/java/com/android/server/WindowManagerService.java15
2 files changed, 32 insertions, 15 deletions
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 402443cbdafb..7b6991fed051 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();
}
}
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 421d1c4d982c..9b9d95086aaf 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -4808,6 +4808,8 @@ public class WindowManagerService extends IWindowManager.Stub
Parcel data = null;
Parcel reply = null;
+ BufferedWriter out = null;
+
// Any uncaught exception will crash the system process
try {
// Find the hashcode of the window
@@ -4845,6 +4847,12 @@ public class WindowManagerService extends IWindowManager.Stub
reply.readException();
+ if (!client.isOutputShutdown()) {
+ out = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
+ out.write("DONE\n");
+ out.flush();
+ }
+
} catch (Exception e) {
Slog.w(TAG, "Could not send command " + command + " with parameters " + parameters, e);
success = false;
@@ -4855,6 +4863,13 @@ public class WindowManagerService extends IWindowManager.Stub
if (reply != null) {
reply.recycle();
}
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+
+ }
+ }
}
return success;