Use inner frame of letterbox as touchable region for letterboxed app

Since commit 192fe76a, the letterbox is touchable. In order for the
touch event to be able to slip into the activity, the touchable region
of activity must not cover the letterbox.

Also toggle the token of window handle with surface show/hide to reduce
the inactive window records in InputDispatcher.

Bug: 110257889
Test: manual - Enable display cutout, open DocumentUI in landscape and
      drag from the black region in the cutout side to DocumentUI, the
      list view should scroll or the drawer slides out.

Change-Id: I4a0bffebfe7a3efcac842c0abbae60ea2a3487bd
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 220370c..2367ccc 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -3132,8 +3132,17 @@
         }
     }
 
+    /** Gets the inner bounds of letterbox. The bounds will be empty if there is no letterbox. */
+    void getLetterboxInnerBounds(Rect outBounds) {
+        if (mLetterbox != null) {
+            outBounds.set(mLetterbox.getInnerFrame());
+        } else {
+            outBounds.setEmpty();
+        }
+    }
+
     /**
-     * @eturn true if there is a letterbox and any part of that letterbox overlaps with
+     * @return {@code true} if there is a letterbox and any part of that letterbox overlaps with
      * the given {@code rect}.
      */
     boolean isLetterboxOverlappingWith(Rect rect) {