OSDN Git Service

add TYPE_PRIVATE_PRESENTATION window type
authorkeunyoung <keunyoung@google.com>
Sat, 22 Jun 2013 02:07:57 +0000 (19:07 -0700)
committerkeunyoung <keunyoung@google.com>
Fri, 12 Jul 2013 21:41:10 +0000 (14:41 -0700)
- This window type can be used for Presentation created on top of virtual
  private display.
- There can be PRIVATE_PRESENTATION specific policy / behavior, but for now,
  there is nothing special.

Change-Id: I9fde0f0376e57fcc60000d3a3f8657a21ef58993

api/current.txt
core/java/android/view/WindowManager.java
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
services/java/com/android/server/wm/DisplayContent.java
services/java/com/android/server/wm/WindowManagerService.java

index a5f05fa..aa70fe0 100644 (file)
@@ -27836,6 +27836,7 @@ package android.view {
     field public static final int TYPE_KEYGUARD_DIALOG = 2009; // 0x7d9
     field public static final int TYPE_PHONE = 2002; // 0x7d2
     field public static final int TYPE_PRIORITY_PHONE = 2007; // 0x7d7
+    field public static final int TYPE_PRIVATE_PRESENTATION = 2030; // 0x7ee
     field public static final int TYPE_SEARCH_BAR = 2001; // 0x7d1
     field public static final int TYPE_STATUS_BAR = 2000; // 0x7d0
     field public static final int TYPE_STATUS_BAR_PANEL = 2014; // 0x7de
index 5144889..e1b3179 100644 (file)
@@ -219,7 +219,8 @@ public interface WindowManager extends ViewManager {
             @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
             @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
             @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
-            @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY")
+            @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"),
+            @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"),
         })
         public int type;
     
@@ -536,6 +537,12 @@ public interface WindowManager extends ViewManager {
         public static final int TYPE_KEYGUARD_SCRIM           = FIRST_SYSTEM_WINDOW+29;
 
         /**
+         * Window type: Window for Presentation on top of private
+         * virtual display.
+         */
+        public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
+
+        /**
          * End of types of system windows.
          */
         public static final int LAST_SYSTEM_WINDOW      = 2999;
index 262b7ee..cd53800 100644 (file)
@@ -1232,6 +1232,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
             case TYPE_DREAM:
             case TYPE_INPUT_METHOD:
             case TYPE_WALLPAPER:
+            case TYPE_PRIVATE_PRESENTATION:
                 // The window manager will check these.
                 break;
             case TYPE_PHONE:
@@ -1294,6 +1295,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
             case TYPE_SYSTEM_DIALOG:
             case TYPE_UNIVERSE_BACKGROUND:
             case TYPE_VOLUME_OVERLAY:
+            case TYPE_PRIVATE_PRESENTATION:
                 break;
         }
 
@@ -1366,6 +1368,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         switch (type) {
         case TYPE_UNIVERSE_BACKGROUND:
             return 1;
+        case TYPE_PRIVATE_PRESENTATION:
+            return 2;
         case TYPE_WALLPAPER:
             // wallpaper is at the bottom, though the window manager may move it.
             return 2;
index feac370..088061c 100644 (file)
@@ -156,6 +156,10 @@ class DisplayContent {
         mStackHistory.add(toTop ? mStackHistory.size() : 0, stack);
     }
 
+    public boolean isPrivate() {
+        return (mDisplay.getFlags() & Display.FLAG_PRIVATE) != 0;
+    }
+
     /**
      * Retrieve the tasks on this display in stack order from the bottommost TaskStack up.
      * @return All the Tasks, in order, on this display.
index 50d267f..06cd34e 100644 (file)
@@ -2137,6 +2137,11 @@ public class WindowManagerService extends IWindowManager.Stub
                 }
             }
 
+            if (type == TYPE_PRIVATE_PRESENTATION && !displayContent.isPrivate()) {
+                Slog.w(TAG, "Attempted to add private presentation window to a non-private display.  Aborting.");
+                return WindowManagerGlobal.ADD_PERMISSION_DENIED;
+            }
+
             boolean addToken = false;
             WindowToken token = mTokenMap.get(attrs.token);
             if (token == null) {