remove support for PUSH_BUFFER surfaces and overlays

the same functionality is now supported through
the h/w composer HAL, and YUV support in the GPU.

Change-Id: I8146605449954b8e8fd7f78810b7d873c2d8f5bf
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index e967522..86cd3b0 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -84,7 +84,10 @@
      * of the surface must be pushed by an external entity. This is type
      * of surface can be used for efficient camera preview or movie
      * play back.
+     *
+     * @deprecated not support by the system anymore
      */
+    @Deprecated
     public static final int PUSH_BUFFERS        = 0x00000200;
     /**
      * Indicates that the surface must be considered opaque, even if its
diff --git a/core/java/android/view/SurfaceHolder.java b/core/java/android/view/SurfaceHolder.java
index 0d38f7b..1b242b3 100644
--- a/core/java/android/view/SurfaceHolder.java
+++ b/core/java/android/view/SurfaceHolder.java
@@ -18,10 +18,6 @@
 
 import android.graphics.Canvas;
 import android.graphics.Rect;
-import static android.view.WindowManager.LayoutParams.MEMORY_TYPE_NORMAL;
-import static android.view.WindowManager.LayoutParams.MEMORY_TYPE_HARDWARE;
-import static android.view.WindowManager.LayoutParams.MEMORY_TYPE_GPU;
-import static android.view.WindowManager.LayoutParams.MEMORY_TYPE_PUSH_BUFFERS;
 
 /**
  * Abstract interface to someone holding a display surface.  Allows you to
@@ -34,30 +30,19 @@
  * {@link #lockCanvas} and {@link Callback#surfaceCreated Callback.surfaceCreated}.
  */
 public interface SurfaceHolder {
-    /**
-     * Surface type.
-     * 
-     * @see #SURFACE_TYPE_NORMAL
-     * @see #SURFACE_TYPE_PUSH_BUFFERS
-     */
-    
-    /** Surface type: creates a regular surface, usually in main, non
-     * contiguous, cached/buffered RAM. */
-    public static final int SURFACE_TYPE_NORMAL = MEMORY_TYPE_NORMAL;
-    /** Surface type: creates a suited to be used with DMA engines and
-     * hardware accelerators. 
-     * @deprecated this is ignored, this value is set automatically when needed.
-     */
+
+    /** @deprecated this is ignored, this value is set automatically when needed. */
     @Deprecated
-    public static final int SURFACE_TYPE_HARDWARE = MEMORY_TYPE_HARDWARE;
-    /** Surface type: creates a surface suited to be used with the GPU 
-     * @deprecated this is ignored, this value is set automatically when needed.
-     */
+    public static final int SURFACE_TYPE_NORMAL = 0;
+    /** @deprecated this is ignored, this value is set automatically when needed. */
     @Deprecated
-    public static final int SURFACE_TYPE_GPU = MEMORY_TYPE_GPU;
-    /** Surface type: creates a "push" surface, that is a surface that 
-     * doesn't owns its buffers. With such a surface lockCanvas will fail. */
-    public static final int SURFACE_TYPE_PUSH_BUFFERS = MEMORY_TYPE_PUSH_BUFFERS;
+    public static final int SURFACE_TYPE_HARDWARE = 1;
+    /** @deprecated this is ignored, this value is set automatically when needed. */
+    @Deprecated
+    public static final int SURFACE_TYPE_GPU = 2;
+    /** @deprecated this is ignored, this value is set automatically when needed. */
+    @Deprecated
+    public static final int SURFACE_TYPE_PUSH_BUFFERS = 3;
 
     /**
      * Exception that is thrown from {@link #lockCanvas} when called on a Surface
@@ -160,10 +145,11 @@
     public boolean isCreating();
     
     /**
-     * Sets the surface's type. 
-     * 
-     * @param type The surface's memory type.
+     * Sets the surface's type.
+     *  
+     * @deprecated this is ignored, this value is set automatically when needed.
      */
+    @Deprecated
     public void setType(int type);
 
     /**
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index b9a9674..7021604 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -145,7 +145,6 @@
      * compatibility with applications assuming this format.
      */
     int mRequestedFormat = PixelFormat.RGB_565;
-    int mRequestedType = -1;
 
     boolean mHaveFrame = false;
     boolean mDestroyReportNeeded = false;
@@ -158,7 +157,6 @@
     int mWidth = -1;
     int mHeight = -1;
     int mFormat = -1;
-    int mType = -1;
     final Rect mSurfaceFrame = new Rect();
     int mLastSurfaceWidth = -1, mLastSurfaceHeight = -1;
     boolean mUpdateWindowNeeded;
@@ -428,9 +426,9 @@
         final boolean sizeChanged = mWidth != myWidth || mHeight != myHeight;
         final boolean visibleChanged = mVisible != mRequestedVisible
                 || mNewSurfaceNeeded;
-        final boolean typeChanged = mType != mRequestedType;
+
         if (force || creating || formatChanged || sizeChanged || visibleChanged
-            || typeChanged || mLeft != mLocation[0] || mTop != mLocation[1]
+            || mLeft != mLocation[0] || mTop != mLocation[1]
             || mUpdateWindowNeeded || mReportDrawNeeded || redrawNeeded) {
 
             if (localLOGV) Log.i(TAG, "Changes: creating=" + creating
@@ -446,7 +444,6 @@
                 mWidth = myWidth;
                 mHeight = myHeight;
                 mFormat = mRequestedFormat;
-                mType = mRequestedType;
 
                 // Scaling/Translate window's layout here because mLayout is not used elsewhere.
                 
@@ -471,8 +468,6 @@
                     mLayout.flags |= WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW;
                 }
 
-                mLayout.memoryType = mRequestedType;
-
                 if (mWindow == null) {
                     mWindow = new MyWindow(this);
                     mLayout.type = mWindowType;
@@ -716,24 +711,11 @@
             }
         }
 
-        public void setType(int type) {
-            switch (type) {
-            case SURFACE_TYPE_HARDWARE:
-            case SURFACE_TYPE_GPU:
-                // these are deprecated, treat as "NORMAL"
-                type = SURFACE_TYPE_NORMAL;
-                break;
-            }
-            switch (type) {
-            case SURFACE_TYPE_NORMAL:
-            case SURFACE_TYPE_PUSH_BUFFERS:
-                mRequestedType = type;
-                if (mWindow != null) {
-                    updateWindow(false, false);
-                }
-                break;
-            }
-        }
+        /**
+         * @deprecated setType is now ignored.
+         */
+        @Deprecated
+        public void setType(int type) { }
 
         public void setKeepScreenOn(boolean screenOn) {
             Message msg = mHandler.obtainMessage(KEEP_SCREEN_ON_MSG);
@@ -750,10 +732,6 @@
         }
 
         private final Canvas internalLockCanvas(Rect dirty) {
-            if (mType == SURFACE_TYPE_PUSH_BUFFERS) {
-                throw new BadSurfaceTypeException(
-                        "Surface type is SURFACE_TYPE_PUSH_BUFFERS");
-            }
             mSurfaceLock.lock();
 
             if (localLOGV) Log.i(TAG, "Locking canvas... stopped="
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 51016f5..e8792ff 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -388,31 +388,22 @@
         public static final int LAST_SYSTEM_WINDOW      = 2999;
         
         /**
-         * Specifies what type of memory buffers should be used by this window.
-         * Default is normal.
-         * 
-         * @see #MEMORY_TYPE_NORMAL
-         * @see #MEMORY_TYPE_PUSH_BUFFERS
+         * @deprecated this is ignored
          */
+        @Deprecated
         public int memoryType;
 
-        /** Memory type: The window's surface is allocated in main memory. */
+        /** @deprecated this is ignored, this value is set automatically when needed. */
+        @Deprecated
         public static final int MEMORY_TYPE_NORMAL = 0;
-        /** Memory type: The window's surface is configured to be accessible
-         * by DMA engines and hardware accelerators.
-         * @deprecated this is ignored, this value is set automatically when needed.
-         */
+        /** @deprecated this is ignored, this value is set automatically when needed. */
         @Deprecated
         public static final int MEMORY_TYPE_HARDWARE = 1;
-        /** Memory type: The window's surface is configured to be accessible
-         * by graphics accelerators. 
-         * @deprecated this is ignored, this value is set automatically when needed.
-         */
+        /** @deprecated this is ignored, this value is set automatically when needed. */
         @Deprecated
         public static final int MEMORY_TYPE_GPU = 2;
-        /** Memory type: The window's surface doesn't own its buffers and
-         * therefore cannot be locked. Instead the buffers are pushed to
-         * it through native binder calls. */
+        /** @deprecated this is ignored, this value is set automatically when needed. */
+        @Deprecated
         public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
 
         /**
@@ -994,7 +985,6 @@
             out.writeInt(x);
             out.writeInt(y);
             out.writeInt(type);
-            out.writeInt(memoryType);
             out.writeInt(flags);
             out.writeInt(softInputMode);
             out.writeInt(gravity);
@@ -1030,7 +1020,6 @@
             x = in.readInt();
             y = in.readInt();
             type = in.readInt();
-            memoryType = in.readInt();
             flags = in.readInt();
             softInputMode = in.readInt();
             gravity = in.readInt();
@@ -1106,10 +1095,6 @@
                 type = o.type;
                 changes |= TYPE_CHANGED;
             }
-            if (memoryType != o.memoryType) {
-                memoryType = o.memoryType;
-                changes |= MEMORY_TYPE_CHANGED;
-            }
             if (flags != o.flags) {
                 flags = o.flags;
                 changes |= FLAGS_CHANGED;