RESTRICT AUTOMERGE

This reverts commit 0bb93d4b1c05d717ed4cbf5772a6a766b5281f1e.

Reason for revert: Breaks apps using Presentation in combination with private virtual displays

Bug: 141745510
Change-Id: I6673946137d6b12fa725e6df1c936068dedc3787
diff --git a/core/java/android/app/Presentation.java b/core/java/android/app/Presentation.java
index bc2b250..af55788 100644
--- a/core/java/android/app/Presentation.java
+++ b/core/java/android/app/Presentation.java
@@ -25,18 +25,18 @@
 import android.hardware.display.DisplayManager;
 import android.hardware.display.DisplayManager.DisplayListener;
 import android.os.Binder;
-import android.os.Handler;
 import android.os.IBinder;
-import android.os.Message;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.util.TypedValue;
 import android.view.ContextThemeWrapper;
 import android.view.Display;
 import android.view.Gravity;
 import android.view.Window;
 import android.view.WindowManager;
 import android.view.WindowManagerImpl;
+import android.os.Handler;
+import android.os.Message;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.util.TypedValue;
 
 /**
  * Base class for presentations.
@@ -115,9 +115,7 @@
  * The display manager keeps track of all displays in the system.  However, not all
  * displays are appropriate for showing presentations.  For example, if an activity
  * attempted to show a presentation on the main display it might obscure its own content
- * (it's like opening a dialog on top of your activity).  Creating a presentation on the main
- * display will result in {@link android.view.WindowManager.InvalidDisplayException} being thrown
- * when invoking {@link #show()}.
+ * (it's like opening a dialog on top of your activity).
  * </p><p>
  * Here's how to identify suitable displays for showing presentations using
  * {@link DisplayManager#getDisplays(String)} and the
@@ -244,7 +242,7 @@
     /**
      * Inherited from {@link Dialog#show}. Will throw
      * {@link android.view.WindowManager.InvalidDisplayException} if the specified secondary
-     * {@link Display} can't be found or if it does not have {@link Display#FLAG_PRESENTATION} set.
+     * {@link Display} can't be found.
      */
     @Override
     public void show() {
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 361c116..8439669 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -56,7 +56,6 @@
 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_PRESENTATION;
 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;
@@ -1228,13 +1227,6 @@
                 return WindowManagerGlobal.ADD_PERMISSION_DENIED;
             }
 
-            if (type == TYPE_PRESENTATION && !displayContent.getDisplay().isPublicPresentation()) {
-                Slog.w(TAG_WM,
-                        "Attempted to add presentation window to a non-suitable display.  "
-                                + "Aborting.");
-                return WindowManagerGlobal.ADD_INVALID_DISPLAY;
-            }
-
             AppWindowToken atoken = null;
             final boolean hasParent = parentWindow != null;
             // Use existing parent window token for child windows since they go in the same token