Surface::GPU and Surface::HARDWARE are now deprecated; they will be set automatically if needed.
this also ripples into the window manager API by making some constant there deprecated as well.
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index c4bf642..9ec1013 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -34,12 +34,18 @@
/** Surface is created hidden */
public static final int HIDDEN = 0x00000004;
- /** The surface is to be used by hardware accelerators or DMA engines */
+ /** The surface is to be used by hardware accelerators or DMA engines
+ * @deprecated this is ignored, this value is set automatically when needed.
+ */
+ @Deprecated
public static final int HARDWARE = 0x00000010;
/** Implies "HARDWARE", the surface is to be used by the GPU
* additionally the backbuffer is never preserved for these
- * surfaces. */
+ * surfaces.
+ * @deprecated this is ignored, this value is set automatically when needed.
+ */
+ @Deprecated
public static final int GPU = 0x00000028;
/** The surface contains secure content, special measures will
diff --git a/core/java/android/view/SurfaceHolder.java b/core/java/android/view/SurfaceHolder.java
index 3d0dda3..64a10d1 100644
--- a/core/java/android/view/SurfaceHolder.java
+++ b/core/java/android/view/SurfaceHolder.java
@@ -38,8 +38,6 @@
* Surface type.
*
* @see #SURFACE_TYPE_NORMAL
- * @see #SURFACE_TYPE_HARDWARE
- * @see #SURFACE_TYPE_GPU
* @see #SURFACE_TYPE_PUSH_BUFFERS
*/
@@ -47,9 +45,15 @@
* 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. */
+ * hardware accelerators.
+ * @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 */
+ /** Surface type: creates a surface suited to be used with the GPU
+ * @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. */
@@ -139,11 +143,7 @@
public boolean isCreating();
/**
- * Sets the surface's type. Surfaces intended to be used with OpenGL ES
- * should be of SURFACE_TYPE_GPU, surfaces accessed by DMA engines and
- * hardware accelerators should be of type SURFACE_TYPE_HARDWARE.
- * Failing to set the surface's type appropriately could result in
- * degraded performance or failure.
+ * Sets the surface's type.
*
* @param type The surface's memory type.
*/
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 4840f27..3b64945 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -573,9 +573,14 @@
public void setType(int type) {
switch (type) {
- case SURFACE_TYPE_NORMAL:
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) {
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 35d7cc9..8c12656 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -329,8 +329,6 @@
* Default is normal.
*
* @see #MEMORY_TYPE_NORMAL
- * @see #MEMORY_TYPE_HARDWARE
- * @see #MEMORY_TYPE_GPU
* @see #MEMORY_TYPE_PUSH_BUFFERS
*/
public int memoryType;
@@ -338,10 +336,16 @@
/** Memory type: The window's surface is allocated in main memory. */
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. */
+ * by DMA engines and hardware accelerators.
+ * @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. */
+ * by graphics accelerators.
+ * @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
diff --git a/core/java/com/android/internal/view/BaseSurfaceHolder.java b/core/java/com/android/internal/view/BaseSurfaceHolder.java
index 2364ae4..2823689 100644
--- a/core/java/com/android/internal/view/BaseSurfaceHolder.java
+++ b/core/java/com/android/internal/view/BaseSurfaceHolder.java
@@ -91,9 +91,14 @@
public void setType(int type) {
switch (type) {
- case SURFACE_TYPE_NORMAL:
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:
if (mRequestedType != type) {
mRequestedType = type;