From 2e931eae355c27df4df82a7345e1f06d0d188201 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Wed, 19 Aug 2015 16:13:04 -0700 Subject: [PATCH] Throw exception when setting a fg/bg on TextureView Change-Id: Iead53e0947d941ebc1331f77fc478c475e24c812 --- core/java/android/view/TextureView.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index cdc196e1c371c..197ea09e2d607 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -23,6 +23,7 @@ import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.SurfaceTexture; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.Log; @@ -294,6 +295,22 @@ public class TextureView extends View { public void buildLayer() { } + @Override + public void setForeground(Drawable foreground) { + if (foreground != null) { + throw new UnsupportedOperationException( + "TextureView doesn't support displaying a foreground drawable"); + } + } + + @Override + public void setBackgroundDrawable(Drawable background) { + if (background != null) { + throw new UnsupportedOperationException( + "TextureView doesn't support displaying a background drawable"); + } + } + /** * Subclasses of TextureView cannot do their own rendering * with the {@link Canvas} object.