Loading core/java/android/provider/FontsContract.java +5 −11 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.graphics.fonts.FontFamily; import android.graphics.fonts.FontStyle; import android.graphics.fonts.FontVariationAxis; import android.net.Uri; import android.os.Build.VERSION_CODES; import android.os.CancellationSignal; import android.os.Handler; import android.os.HandlerThread; Loading Loading @@ -652,17 +651,12 @@ public class FontsContract { if (familyBuilder == null) { familyBuilder = new FontFamily.Builder(font); } else { try { familyBuilder.addFont(font); } catch (IllegalArgumentException e) { if (context.getApplicationInfo().targetSdkVersion <= VERSION_CODES.P) { // Surpress the IllegalArgumentException for keeping the backward // compatibility. continue; } throw e; } } } catch (IllegalArgumentException e) { // To be a compatible behavior with API28 or before, catch IllegalArgumentExcetpion // thrown by native code and returns null. return null; } catch (IOException e) { continue; } Loading graphics/java/android/graphics/Typeface.java +5 −12 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.graphics.fonts.FontStyle; import android.graphics.fonts.FontVariationAxis; import android.graphics.fonts.SystemFonts; import android.os.Build; import android.os.Build.VERSION_CODES; import android.os.ParcelFileDescriptor; import android.provider.FontRequest; import android.provider.FontsContract; Loading @@ -48,7 +47,6 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.Preconditions; import dalvik.annotation.optimization.CriticalNative; import dalvik.system.VMRuntime; import libcore.util.NativeAllocationRegistry; Loading Loading @@ -266,16 +264,7 @@ public class Typeface { if (familyBuilder == null) { familyBuilder = new FontFamily.Builder(fontBuilder.build()); } else { try { familyBuilder.addFont(fontBuilder.build()); } catch (IllegalArgumentException e) { if (VMRuntime.getRuntime().getTargetSdkVersion() <= VERSION_CODES.P) { // Surpress the IllegalArgumentException for keeping the backward // compatibility. continue; } throw e; } } } if (familyBuilder == null) { Loading @@ -297,6 +286,10 @@ public class Typeface { typeface = new Typeface.CustomFallbackBuilder(family) .setStyle(bestFont.getStyle()) .build(); } catch (IllegalArgumentException e) { // To be a compatible behavior with API28 or before, catch IllegalArgumentExcetpion // thrown by native code and returns null. return null; } catch (IOException e) { typeface = Typeface.DEFAULT; } Loading Loading
core/java/android/provider/FontsContract.java +5 −11 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.graphics.fonts.FontFamily; import android.graphics.fonts.FontStyle; import android.graphics.fonts.FontVariationAxis; import android.net.Uri; import android.os.Build.VERSION_CODES; import android.os.CancellationSignal; import android.os.Handler; import android.os.HandlerThread; Loading Loading @@ -652,17 +651,12 @@ public class FontsContract { if (familyBuilder == null) { familyBuilder = new FontFamily.Builder(font); } else { try { familyBuilder.addFont(font); } catch (IllegalArgumentException e) { if (context.getApplicationInfo().targetSdkVersion <= VERSION_CODES.P) { // Surpress the IllegalArgumentException for keeping the backward // compatibility. continue; } throw e; } } } catch (IllegalArgumentException e) { // To be a compatible behavior with API28 or before, catch IllegalArgumentExcetpion // thrown by native code and returns null. return null; } catch (IOException e) { continue; } Loading
graphics/java/android/graphics/Typeface.java +5 −12 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import android.graphics.fonts.FontStyle; import android.graphics.fonts.FontVariationAxis; import android.graphics.fonts.SystemFonts; import android.os.Build; import android.os.Build.VERSION_CODES; import android.os.ParcelFileDescriptor; import android.provider.FontRequest; import android.provider.FontsContract; Loading @@ -48,7 +47,6 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.Preconditions; import dalvik.annotation.optimization.CriticalNative; import dalvik.system.VMRuntime; import libcore.util.NativeAllocationRegistry; Loading Loading @@ -266,16 +264,7 @@ public class Typeface { if (familyBuilder == null) { familyBuilder = new FontFamily.Builder(fontBuilder.build()); } else { try { familyBuilder.addFont(fontBuilder.build()); } catch (IllegalArgumentException e) { if (VMRuntime.getRuntime().getTargetSdkVersion() <= VERSION_CODES.P) { // Surpress the IllegalArgumentException for keeping the backward // compatibility. continue; } throw e; } } } if (familyBuilder == null) { Loading @@ -297,6 +286,10 @@ public class Typeface { typeface = new Typeface.CustomFallbackBuilder(family) .setStyle(bestFont.getStyle()) .build(); } catch (IllegalArgumentException e) { // To be a compatible behavior with API28 or before, catch IllegalArgumentExcetpion // thrown by native code and returns null. return null; } catch (IOException e) { typeface = Typeface.DEFAULT; } Loading