Loading core/java/android/view/TextureView.java +2 −2 Original line number Diff line number Diff line Loading @@ -297,7 +297,7 @@ public class TextureView extends View { @Override public void setForeground(Drawable foreground) { if (foreground != null) { if (foreground != null && !sTextureViewIgnoresDrawableSetters) { throw new UnsupportedOperationException( "TextureView doesn't support displaying a foreground drawable"); } Loading @@ -305,7 +305,7 @@ public class TextureView extends View { @Override public void setBackgroundDrawable(Drawable background) { if (background != null) { if (background != null && !sTextureViewIgnoresDrawableSetters) { throw new UnsupportedOperationException( "TextureView doesn't support displaying a background drawable"); } Loading core/java/android/view/View.java +10 −0 Original line number Diff line number Diff line Loading @@ -811,6 +811,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ private static boolean sLayoutParamsAlwaysChanged = false; /** * Allow setForeground/setBackground to be called (and ignored) on a textureview, * without throwing */ static boolean sTextureViewIgnoresDrawableSetters = false; /** * This view does not want keystrokes. Use with TAKES_FOCUS_MASK when * calling setFlags. Loading Loading @@ -3984,6 +3990,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // work. Partial layout breaks this assumption. sLayoutParamsAlwaysChanged = targetSdkVersion <= M; // Prior to N, TextureView would silently ignore calls to setBackground/setForeground. // On N+, we throw, but that breaks compatibility with apps that use these methods. sTextureViewIgnoresDrawableSetters = targetSdkVersion <= M; sCompatibilityDone = true; } } Loading Loading
core/java/android/view/TextureView.java +2 −2 Original line number Diff line number Diff line Loading @@ -297,7 +297,7 @@ public class TextureView extends View { @Override public void setForeground(Drawable foreground) { if (foreground != null) { if (foreground != null && !sTextureViewIgnoresDrawableSetters) { throw new UnsupportedOperationException( "TextureView doesn't support displaying a foreground drawable"); } Loading @@ -305,7 +305,7 @@ public class TextureView extends View { @Override public void setBackgroundDrawable(Drawable background) { if (background != null) { if (background != null && !sTextureViewIgnoresDrawableSetters) { throw new UnsupportedOperationException( "TextureView doesn't support displaying a background drawable"); } Loading
core/java/android/view/View.java +10 −0 Original line number Diff line number Diff line Loading @@ -811,6 +811,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ private static boolean sLayoutParamsAlwaysChanged = false; /** * Allow setForeground/setBackground to be called (and ignored) on a textureview, * without throwing */ static boolean sTextureViewIgnoresDrawableSetters = false; /** * This view does not want keystrokes. Use with TAKES_FOCUS_MASK when * calling setFlags. Loading Loading @@ -3984,6 +3990,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // work. Partial layout breaks this assumption. sLayoutParamsAlwaysChanged = targetSdkVersion <= M; // Prior to N, TextureView would silently ignore calls to setBackground/setForeground. // On N+, we throw, but that breaks compatibility with apps that use these methods. sTextureViewIgnoresDrawableSetters = targetSdkVersion <= M; sCompatibilityDone = true; } } Loading