PointerLocation should not show if display is in mirror mode.

If a virtual display is created without flag FLAG_OWN_CONTENT_ONLY,
and no window initialized, it will automatically enter the mirror mode.

So we need to exclude the pointer location window when checking the
display has content, to make sure it won't leave the mirror mode if there
is no other window exist.

Test: manual
Bug: 138487611
Change-Id: I60d70ea578df4b18b1666d439a2c925f3310351f
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 4135ef3..e851a06 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -796,10 +796,14 @@
                 mTmpApplySurfaceChangesTransactionState.obscured = true;
             }
 
-            mTmpApplySurfaceChangesTransactionState.displayHasContent |=
-                    root.handleNotObscuredLocked(w,
-                            mTmpApplySurfaceChangesTransactionState.obscured,
-                            mTmpApplySurfaceChangesTransactionState.syswin);
+            final boolean displayHasContent = root.handleNotObscuredLocked(w,
+                    mTmpApplySurfaceChangesTransactionState.obscured,
+                    mTmpApplySurfaceChangesTransactionState.syswin);
+
+            if (!mTmpApplySurfaceChangesTransactionState.displayHasContent
+                    && !getDisplayPolicy().isWindowExcludedFromContent(w)) {
+                mTmpApplySurfaceChangesTransactionState.displayHasContent |= displayHasContent;
+            }
 
             if (w.mHasSurface && isDisplayed) {
                 final int type = w.mAttrs.type;
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index e35ef25..e5962ae 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -3790,6 +3790,20 @@
         mPointerLocationView = null;
     }
 
+    /**
+     * Check if the window could be excluded from checking if the display has content.
+     *
+     * @param w WindowState to check if should be excluded.
+     * @return True if the window type is PointerLocation which is excluded.
+     */
+    boolean isWindowExcludedFromContent(WindowState w) {
+        if (w != null && mPointerLocationView != null) {
+            return w.mClient == mPointerLocationView.getWindowToken();
+        }
+
+        return false;
+    }
+
     @VisibleForTesting
     static boolean isOverlappingWithNavBar(WindowState targetWindow, WindowState navBarWindow) {
         if (navBarWindow == null || !navBarWindow.isVisibleLw()