summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Juho Ha <juhoha@google.com> 2017-06-12 20:15:31 +0900
committer Jorim Jaggi <jjaggi@google.com> 2017-08-21 12:32:00 +0000
commitd864b442951f043bf1bd3392929ebff3bafbc3ae (patch)
tree449d11805c305a81755f2668e5b82edda11b8240
parent1ec1ab6803ef11ce95975b19801e576379a807e5 (diff)
Disable task snapshot when image size is invalid
Since devices such as IoT can have no screen, the size of graphic buffer can be 1x1. In this case the WindowManager crashes while making bitmap with reduced size. To prevent the crash, disabled snapshotting on this screen. This may also happen on phones sporadically. Bug: 62401135 Fixes: 64733031 Test: Device without the display does not crash when app dies. Change-Id: I367008405e6238baf3e56974f7d363ea81dfa916 (cherry picked from commit 9035d72c61868193b5630db16a71a0d208bc4666)
-rw-r--r--services/core/java/com/android/server/wm/TaskSnapshotController.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/TaskSnapshotController.java b/services/core/java/com/android/server/wm/TaskSnapshotController.java
index 4e4d42dea0a6..bc7f33021c77 100644
--- a/services/core/java/com/android/server/wm/TaskSnapshotController.java
+++ b/services/core/java/com/android/server/wm/TaskSnapshotController.java
@@ -211,7 +211,7 @@ class TaskSnapshotController {
}
final GraphicBuffer buffer = top.mDisplayContent.screenshotApplicationsToBuffer(top.token,
-1, -1, false, 1.0f, false, true);
- if (buffer == null) {
+ if (buffer == null || buffer.getWidth() <= 1 || buffer.getHeight() <= 1) {
return null;
}
return new TaskSnapshot(buffer, top.getConfiguration().orientation,