Merge "Exclude status and nav bar from focus monitor."
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 9b64481..5942198 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -110,6 +110,8 @@
 
     final DimLayerController mDimLayerController;
 
+    final ArrayList<WindowState> mTapExcludedWindows = new ArrayList<>();
+
     /**
      * @param display May not be null.
      * @param service You know.
@@ -412,6 +414,11 @@
             inputMethod.getTouchableRegion(mTmpRegion);
             mTouchExcludeRegion.op(mTmpRegion, Region.Op.UNION);
         }
+        for (int i = mTapExcludedWindows.size() - 1; i >= 0; i--) {
+            WindowState win = mTapExcludedWindows.get(i);
+            win.getTouchableRegion(mTmpRegion);
+            mTouchExcludeRegion.op(mTmpRegion, Region.Op.UNION);
+        }
         if (mTapDetector != null) {
             mTapDetector.setTouchExcludeRegion(mTouchExcludeRegion, mNonResizeableRegion);
         }
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 0c606fe..816cab7 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -42,6 +42,7 @@
 import static android.view.WindowManager.LayoutParams.TYPE_DREAM;
 import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
 import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
+import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
 import static android.view.WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION;
 import static android.view.WindowManager.LayoutParams.TYPE_QS_DIALOG;
 import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
@@ -1966,6 +1967,10 @@
 
             res = WindowManagerGlobal.ADD_OKAY;
 
+            if (type == TYPE_STATUS_BAR || type == TYPE_NAVIGATION_BAR) {
+                displayContent.mTapExcludedWindows.add(win);
+            }
+
             origId = Binder.clearCallingIdentity();
 
             if (addToken) {
@@ -2309,6 +2314,11 @@
             Slog.w(TAG_WM, "Removing window " + win, e);
         }
 
+        final int type = win.mAttrs.type;
+        if (type == TYPE_STATUS_BAR || type == TYPE_NAVIGATION_BAR) {
+            final DisplayContent displaycontent = win.getDisplayContent();
+            displaycontent.mTapExcludedWindows.remove(win);
+        }
         mPolicy.removeWindowLw(win);
         win.removeLocked();
 
@@ -2364,7 +2374,7 @@
             }
         }
 
-        if (win.mAttrs.type == TYPE_WALLPAPER) {
+        if (type == TYPE_WALLPAPER) {
             mWallpaperControllerLocked.clearLastWallpaperTimeoutTime();
             getDefaultDisplayContentLocked().pendingLayoutChanges |=
                     WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;