summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/widget/TextView.java33
1 files changed, 20 insertions, 13 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index eee70e047dfd..629216e32fa9 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -912,10 +912,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
break;
case com.android.internal.R.styleable.TextAppearance_fontFamily:
- try {
- fontTypeface = appearance.getFont(attr);
- } catch (UnsupportedOperationException | Resources.NotFoundException e) {
- // Expected if it is not a font resource.
+ if (!context.isRestricted()) {
+ try {
+ fontTypeface = appearance.getFont(attr);
+ } catch (UnsupportedOperationException
+ | Resources.NotFoundException e) {
+ // Expected if it is not a font resource.
+ }
}
if (fontTypeface == null) {
fontFamily = appearance.getString(attr);
@@ -1229,11 +1232,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
break;
case com.android.internal.R.styleable.TextView_fontFamily:
- try {
- fontTypeface = a.getFont(attr);
- } catch (UnsupportedOperationException | Resources.NotFoundException e) {
- // Expected if it is not a resource reference or if it is a reference to
- // another resource type.
+ if (!context.isRestricted()) {
+ try {
+ fontTypeface = a.getFont(attr);
+ } catch (UnsupportedOperationException | Resources.NotFoundException e) {
+ // Expected if it is not a resource reference or if it is a reference to
+ // another resource type.
+ }
}
if (fontTypeface == null) {
fontFamily = a.getString(attr);
@@ -3380,10 +3385,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
Typeface fontTypeface = null;
String fontFamily = null;
- try {
- fontTypeface = ta.getFont(R.styleable.TextAppearance_fontFamily);
- } catch (UnsupportedOperationException | Resources.NotFoundException e) {
- // Expected if it is not a font resource.
+ if (!context.isRestricted()) {
+ try {
+ fontTypeface = ta.getFont(R.styleable.TextAppearance_fontFamily);
+ } catch (UnsupportedOperationException | Resources.NotFoundException e) {
+ // Expected if it is not a font resource.
+ }
}
if (fontTypeface == null) {
fontFamily = ta.getString(R.styleable.TextAppearance_fontFamily);