Rename HardwareLayer -> TextureLayer
Update name to reflect meaning/usage
Change-Id: Iddb3621cbca147f96faa83380867baa49c382aab
Fixes: 20461288
Test: builds & boots
diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt
index f3997a4..534adcd 100644
--- a/config/hiddenapi-light-greylist.txt
+++ b/config/hiddenapi-light-greylist.txt
@@ -1822,7 +1822,7 @@
Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextSelection;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;
Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionStarted(I)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;
Landroid/view/textservice/TextServicesManager;->isSpellCheckerEnabled()Z
-Landroid/view/TextureView;->mLayer:Landroid/view/HardwareLayer;
+Landroid/view/TextureView;->mLayer:Landroid/view/TextureLayer;
Landroid/view/TextureView;->mNativeWindow:J
Landroid/view/TextureView;->mSurface:Landroid/graphics/SurfaceTexture;
Landroid/view/TextureView;->mUpdateListener:Landroid/graphics/SurfaceTexture$OnFrameAvailableListener;
diff --git a/config/preloaded-classes b/config/preloaded-classes
index 784c3f8..95c2b2c 100644
--- a/config/preloaded-classes
+++ b/config/preloaded-classes
@@ -2289,7 +2289,7 @@
android.view.Gravity
android.view.HandlerActionQueue
android.view.HandlerActionQueue$HandlerAction
-android.view.HardwareLayer
+android.view.TextureLayer
android.view.IGraphicsStats
android.view.IGraphicsStats$Stub
android.view.IGraphicsStats$Stub$Proxy
diff --git a/core/java/android/view/DisplayListCanvas.java b/core/java/android/view/DisplayListCanvas.java
index 8f9ae0e..671532c 100644
--- a/core/java/android/view/DisplayListCanvas.java
+++ b/core/java/android/view/DisplayListCanvas.java
@@ -198,8 +198,8 @@
*
* @param layer The layer to composite on this canvas
*/
- void drawHardwareLayer(HardwareLayer layer) {
- nDrawLayer(mNativeCanvasWrapper, layer.getLayerHandle());
+ void drawTextureLayer(TextureLayer layer) {
+ nDrawTextureLayer(mNativeCanvasWrapper, layer.getLayerHandle());
}
///////////////////////////////////////////////////////////////////////////
@@ -257,7 +257,7 @@
@CriticalNative
private static native void nDrawRenderNode(long renderer, long renderNode);
@CriticalNative
- private static native void nDrawLayer(long renderer, long layer);
+ private static native void nDrawTextureLayer(long renderer, long layer);
@CriticalNative
private static native void nDrawCircle(long renderer, long propCx,
long propCy, long propRadius, long propPaint);
diff --git a/core/java/android/view/HardwareLayer.java b/core/java/android/view/TextureLayer.java
similarity index 88%
rename from core/java/android/view/HardwareLayer.java
rename to core/java/android/view/TextureLayer.java
index 7af1020..35a886f 100644
--- a/core/java/android/view/HardwareLayer.java
+++ b/core/java/android/view/TextureLayer.java
@@ -25,19 +25,17 @@
import com.android.internal.util.VirtualRefBasePtr;
/**
- * A hardware layer can be used to render graphics operations into a hardware
- * friendly buffer. For instance, with an OpenGL backend a hardware layer
- * would use a Frame Buffer Object (FBO.) The hardware layer can be used as
- * a drawing cache when a complex set of graphics operations needs to be
- * drawn several times.
+ * TextureLayer represents a SurfaceTexture that will be composited by RenderThread into the
+ * frame when drawn in a HW accelerated Canvas. This is backed by a DeferredLayerUpdater on
+ * the native side.
*
* @hide
*/
-final class HardwareLayer {
+final class TextureLayer {
private ThreadedRenderer mRenderer;
private VirtualRefBasePtr mFinalizer;
- private HardwareLayer(ThreadedRenderer renderer, long deferredUpdater) {
+ private TextureLayer(ThreadedRenderer renderer, long deferredUpdater) {
if (renderer == null || deferredUpdater == 0) {
throw new IllegalArgumentException("Either hardware renderer: " + renderer
+ " or deferredUpdater: " + deferredUpdater + " is invalid");
@@ -141,11 +139,12 @@
mRenderer.pushLayerUpdate(this);
}
- static HardwareLayer adoptTextureLayer(ThreadedRenderer renderer, long layer) {
- return new HardwareLayer(renderer, layer);
+ static TextureLayer adoptTextureLayer(ThreadedRenderer renderer, long layer) {
+ return new TextureLayer(renderer, layer);
}
- private static native boolean nPrepare(long layerUpdater, int width, int height, boolean isOpaque);
+ private static native boolean nPrepare(long layerUpdater, int width, int height,
+ boolean isOpaque);
private static native void nSetLayerPaint(long layerUpdater, long paint);
private static native void nSetTransform(long layerUpdater, long matrix);
private static native void nSetSurfaceTexture(long layerUpdater, SurfaceTexture surface);
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java
index 25dce99..371794045 100644
--- a/core/java/android/view/TextureView.java
+++ b/core/java/android/view/TextureView.java
@@ -106,7 +106,7 @@
public class TextureView extends View {
private static final String LOG_TAG = "TextureView";
- private HardwareLayer mLayer;
+ private TextureLayer mLayer;
private SurfaceTexture mSurface;
private SurfaceTextureListener mListener;
private boolean mHadSurface;
@@ -336,13 +336,13 @@
if (canvas.isHardwareAccelerated()) {
DisplayListCanvas displayListCanvas = (DisplayListCanvas) canvas;
- HardwareLayer layer = getHardwareLayer();
+ TextureLayer layer = getTextureLayer();
if (layer != null) {
applyUpdate();
applyTransformMatrix();
mLayer.setLayerPaint(mLayerPaint); // ensure layer paint is up to date
- displayListCanvas.drawHardwareLayer(layer);
+ displayListCanvas.drawTextureLayer(layer);
}
}
}
@@ -369,7 +369,7 @@
}
}
- HardwareLayer getHardwareLayer() {
+ TextureLayer getTextureLayer() {
if (mLayer == null) {
if (mAttachInfo == null || mAttachInfo.mThreadedRenderer == null) {
return null;
@@ -602,7 +602,7 @@
// the layer here thanks to the validate() call at the beginning of
// this method
if (mLayer == null && mUpdateSurface) {
- getHardwareLayer();
+ getTextureLayer();
}
if (mLayer != null) {
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index e50d40e..59472d9 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -833,9 +833,9 @@
*
* @return A hardware layer
*/
- HardwareLayer createTextureLayer() {
+ TextureLayer createTextureLayer() {
long layer = nCreateTextureLayer(mNativeProxy);
- return HardwareLayer.adoptTextureLayer(this, layer);
+ return TextureLayer.adoptTextureLayer(this, layer);
}
@@ -844,7 +844,7 @@
}
- boolean copyLayerInto(final HardwareLayer layer, final Bitmap bitmap) {
+ boolean copyLayerInto(final TextureLayer layer, final Bitmap bitmap) {
return nCopyLayerInto(mNativeProxy,
layer.getDeferredLayerUpdater(), bitmap);
}
@@ -855,7 +855,7 @@
*
* @param layer The hardware layer that needs an update
*/
- void pushLayerUpdate(HardwareLayer layer) {
+ void pushLayerUpdate(TextureLayer layer) {
nPushLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater());
}
@@ -863,7 +863,7 @@
* Tells the HardwareRenderer that the layer is destroyed. The renderer
* should remove the layer from any update queues.
*/
- void onLayerDestroyed(HardwareLayer layer) {
+ void onLayerDestroyed(TextureLayer layer) {
nCancelLayerUpdate(mNativeProxy, layer.getDeferredLayerUpdater());
}
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 33f80ce..b048977 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -64,7 +64,7 @@
"android_graphics_drawable_VectorDrawable.cpp",
"android_view_DisplayEventReceiver.cpp",
"android_view_DisplayListCanvas.cpp",
- "android_view_HardwareLayer.cpp",
+ "android_view_TextureLayer.cpp",
"android_view_InputChannel.cpp",
"android_view_InputDevice.cpp",
"android_view_InputEventReceiver.cpp",
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index d202173..f280c7a 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -142,7 +142,7 @@
extern int register_android_graphics_pdf_PdfRenderer(JNIEnv* env);
extern int register_android_view_DisplayEventReceiver(JNIEnv* env);
extern int register_android_view_DisplayListCanvas(JNIEnv* env);
-extern int register_android_view_HardwareLayer(JNIEnv* env);
+extern int register_android_view_TextureLayer(JNIEnv* env);
extern int register_android_view_RenderNode(JNIEnv* env);
extern int register_android_view_RenderNodeAnimator(JNIEnv* env);
extern int register_android_view_Surface(JNIEnv* env);
@@ -1370,7 +1370,7 @@
REG_JNI(register_android_view_RenderNode),
REG_JNI(register_android_view_RenderNodeAnimator),
REG_JNI(register_android_view_DisplayListCanvas),
- REG_JNI(register_android_view_HardwareLayer),
+ REG_JNI(register_android_view_TextureLayer),
REG_JNI(register_android_view_ThreadedRenderer),
REG_JNI(register_android_view_Surface),
REG_JNI(register_android_view_SurfaceControl),
diff --git a/core/jni/android_view_DisplayListCanvas.cpp b/core/jni/android_view_DisplayListCanvas.cpp
index 98f4733..7956bf4 100644
--- a/core/jni/android_view_DisplayListCanvas.cpp
+++ b/core/jni/android_view_DisplayListCanvas.cpp
@@ -159,7 +159,7 @@
canvas->drawRenderNode(renderNode);
}
-static void android_view_DisplayListCanvas_drawLayer(jlong canvasPtr, jlong layerPtr) {
+static void android_view_DisplayListCanvas_drawTextureLayer(jlong canvasPtr, jlong layerPtr) {
Canvas* canvas = reinterpret_cast<Canvas*>(canvasPtr);
DeferredLayerUpdater* layer = reinterpret_cast<DeferredLayerUpdater*>(layerPtr);
canvas->drawLayer(layer);
@@ -210,7 +210,7 @@
{ "nInsertReorderBarrier", "(JZ)V", (void*) android_view_DisplayListCanvas_insertReorderBarrier },
{ "nFinishRecording", "(J)J", (void*) android_view_DisplayListCanvas_finishRecording },
{ "nDrawRenderNode", "(JJ)V", (void*) android_view_DisplayListCanvas_drawRenderNode },
- { "nDrawLayer", "(JJ)V", (void*) android_view_DisplayListCanvas_drawLayer },
+ { "nDrawTextureLayer", "(JJ)V", (void*) android_view_DisplayListCanvas_drawTextureLayer },
{ "nDrawCircle", "(JJJJJ)V", (void*) android_view_DisplayListCanvas_drawCircleProps },
{ "nDrawRoundRect", "(JJJJJJJJ)V",(void*) android_view_DisplayListCanvas_drawRoundRectProps },
};
diff --git a/core/jni/android_view_HardwareLayer.cpp b/core/jni/android_view_TextureLayer.cpp
similarity index 73%
rename from core/jni/android_view_HardwareLayer.cpp
rename to core/jni/android_view_TextureLayer.cpp
index d934870..e14c46f 100644
--- a/core/jni/android_view_HardwareLayer.cpp
+++ b/core/jni/android_view_TextureLayer.cpp
@@ -40,7 +40,7 @@
using namespace uirenderer;
-static jboolean android_view_HardwareLayer_prepare(JNIEnv* env, jobject clazz,
+static jboolean TextureLayer_prepare(JNIEnv* env, jobject clazz,
jlong layerUpdaterPtr, jint width, jint height, jboolean isOpaque) {
DeferredLayerUpdater* layer = reinterpret_cast<DeferredLayerUpdater*>(layerUpdaterPtr);
bool changed = false;
@@ -49,7 +49,7 @@
return changed;
}
-static void android_view_HardwareLayer_setLayerPaint(JNIEnv* env, jobject clazz,
+static void TextureLayer_setLayerPaint(JNIEnv* env, jobject clazz,
jlong layerUpdaterPtr, jlong paintPtr) {
DeferredLayerUpdater* layer = reinterpret_cast<DeferredLayerUpdater*>(layerUpdaterPtr);
if (layer) {
@@ -58,21 +58,21 @@
}
}
-static void android_view_HardwareLayer_setTransform(JNIEnv* env, jobject clazz,
+static void TextureLayer_setTransform(JNIEnv* env, jobject clazz,
jlong layerUpdaterPtr, jlong matrixPtr) {
DeferredLayerUpdater* layer = reinterpret_cast<DeferredLayerUpdater*>(layerUpdaterPtr);
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
layer->setTransform(matrix);
}
-static void android_view_HardwareLayer_setSurfaceTexture(JNIEnv* env, jobject clazz,
+static void TextureLayer_setSurfaceTexture(JNIEnv* env, jobject clazz,
jlong layerUpdaterPtr, jobject surface) {
DeferredLayerUpdater* layer = reinterpret_cast<DeferredLayerUpdater*>(layerUpdaterPtr);
sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface));
layer->setSurfaceTexture(surfaceTexture);
}
-static void android_view_HardwareLayer_updateSurfaceTexture(JNIEnv* env, jobject clazz,
+static void TextureLayer_updateSurfaceTexture(JNIEnv* env, jobject clazz,
jlong layerUpdaterPtr) {
DeferredLayerUpdater* layer = reinterpret_cast<DeferredLayerUpdater*>(layerUpdaterPtr);
layer->updateTexImage();
@@ -82,18 +82,18 @@
// JNI Glue
// ----------------------------------------------------------------------------
-const char* const kClassPathName = "android/view/HardwareLayer";
+const char* const kClassPathName = "android/view/TextureLayer";
static const JNINativeMethod gMethods[] = {
- { "nPrepare", "(JIIZ)Z", (void*) android_view_HardwareLayer_prepare },
- { "nSetLayerPaint", "(JJ)V", (void*) android_view_HardwareLayer_setLayerPaint },
- { "nSetTransform", "(JJ)V", (void*) android_view_HardwareLayer_setTransform },
+ { "nPrepare", "(JIIZ)Z", (void*) TextureLayer_prepare },
+ { "nSetLayerPaint", "(JJ)V", (void*) TextureLayer_setLayerPaint },
+ { "nSetTransform", "(JJ)V", (void*) TextureLayer_setTransform },
{ "nSetSurfaceTexture", "(JLandroid/graphics/SurfaceTexture;)V",
- (void*) android_view_HardwareLayer_setSurfaceTexture },
- { "nUpdateSurfaceTexture", "(J)V", (void*) android_view_HardwareLayer_updateSurfaceTexture },
+ (void*) TextureLayer_setSurfaceTexture },
+ { "nUpdateSurfaceTexture", "(J)V", (void*) TextureLayer_updateSurfaceTexture },
};
-int register_android_view_HardwareLayer(JNIEnv* env) {
+int register_android_view_TextureLayer(JNIEnv* env) {
return RegisterMethodsOrDie(env, kClassPathName, gMethods, NELEM(gMethods));
}