Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68f90d0e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Suppress IllegalArgumentException on API 28 or before"

parents 70cf6e8b 2a424a7b
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ 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;
@@ -651,7 +652,16 @@ 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 (IOException e) {
                continue;