summaryrefslogtreecommitdiff
path: root/graphics/java/android/view
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2018-02-21 11:02:20 -0800
committerJohn Reck <jreck@google.com>2018-02-21 11:02:20 -0800
commit9bdd2e6151aa7a70bb4a12e91e7f68959b6334cb (patch)
tree45d1f1c29c520c0b701f883f9b8ebe8f3f0e43b8 /graphics/java/android/view
parent2ebb02123122d6ef3b0cf5c115c2ea4e19319496 (diff)
Handle window surface insets
Bug: 69413152 Test: PixelCopy CTS tests Change-Id: Ie26c38e462fbc6c19669d33efaec5251f40f75bd
Diffstat (limited to 'graphics/java/android/view')
-rw-r--r--graphics/java/android/view/PixelCopy.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/graphics/java/android/view/PixelCopy.java b/graphics/java/android/view/PixelCopy.java
index a14609f3e924..2797a4daa925 100644
--- a/graphics/java/android/view/PixelCopy.java
+++ b/graphics/java/android/view/PixelCopy.java
@@ -263,8 +263,16 @@ public final class PixelCopy {
"Only able to copy windows with decor views");
}
Surface surface = null;
- if (source.peekDecorView().getViewRootImpl() != null) {
- surface = source.peekDecorView().getViewRootImpl().mSurface;
+ final ViewRootImpl root = source.peekDecorView().getViewRootImpl();
+ if (root != null) {
+ surface = root.mSurface;
+ final Rect surfaceInsets = root.mWindowAttributes.surfaceInsets;
+ if (srcRect == null) {
+ srcRect = new Rect(surfaceInsets.left, surfaceInsets.top,
+ root.mWidth + surfaceInsets.left, root.mHeight + surfaceInsets.top);
+ } else {
+ srcRect.offset(surfaceInsets.left, surfaceInsets.top);
+ }
}
if (surface == null || !surface.isValid()) {
throw new IllegalArgumentException(