Merge "Correct cropping of windows above decor layer." into pi-dev
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 6c2821d..674414f 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -4270,6 +4270,24 @@
}
}
+ private boolean skipDecorCrop() {
+ // The decor frame is used to specify the region not covered by the system
+ // decorations (nav bar, status bar). In case this is empty, for example with
+ // FLAG_TRANSLUCENT_NAVIGATION, we don't need to do any cropping.
+ if (mDecorFrame.isEmpty()) {
+ return true;
+ }
+
+ // But if we have a frame, and are an application window, then we must be cropped.
+ if (mAppToken != null) {
+ return false;
+ }
+
+ // For non application windows, we may be allowed to extend over the decor bars
+ // depending on our type and permissions assosciated with our token.
+ return mToken.canLayerAboveSystemBars();
+ }
+
/**
* Calculate the window crop according to system decor policy. In general this is
* the system decor rect (see #calculateSystemDecorRect), but we also have some
@@ -4287,7 +4305,7 @@
policyCrop.intersect(-mCompatFrame.left, -mCompatFrame.top,
displayInfo.logicalWidth - mCompatFrame.left,
displayInfo.logicalHeight - mCompatFrame.top);
- } else if (mDecorFrame.isEmpty()) {
+ } else if (skipDecorCrop()) {
// Windows without policy decor aren't cropped.
policyCrop.set(0, 0, mCompatFrame.width(), mCompatFrame.height());
} else {
diff --git a/services/core/java/com/android/server/wm/WindowToken.java b/services/core/java/com/android/server/wm/WindowToken.java
index 14680d9..b97460a 100644
--- a/services/core/java/com/android/server/wm/WindowToken.java
+++ b/services/core/java/com/android/server/wm/WindowToken.java
@@ -17,7 +17,7 @@
package com.android.server.wm;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
-
+import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WINDOW_MOVEMENT;
@@ -336,4 +336,16 @@
boolean okToAnimate() {
return mDisplayContent != null && mDisplayContent.okToAnimate();
}
+
+ /**
+ * Return whether windows from this token can layer above the
+ * system bars, or in other words extend outside of the "Decor Frame"
+ */
+ boolean canLayerAboveSystemBars() {
+ int layer = mService.mPolicy.getWindowLayerFromTypeLw(windowType,
+ mOwnerCanManageAppTokens);
+ int navLayer = mService.mPolicy.getWindowLayerFromTypeLw(TYPE_NAVIGATION_BAR,
+ mOwnerCanManageAppTokens);
+ return mOwnerCanManageAppTokens && (layer > navLayer);
+ }
}