OSDN Git Service

Fix boot loop issue on Android Wear.
authorSeigo Nonaka <nona@google.com>
Fri, 14 Apr 2017 00:30:38 +0000 (17:30 -0700)
committerSeigo Nonaka <nona@google.com>
Fri, 14 Apr 2017 01:58:36 +0000 (18:58 -0700)
commitbf629ed08077e59877158a30cc04711319bce977
treea597387848cdf34d9bed6616ce66aed15dde5f29
parent92fc8bdd518cccf1c4fe2c9ad2460178cf61e3b4
Fix boot loop issue on Android Wear.

The boot loop was seen after I65e220aca823fd815a52437b11c8e6dc952de8e2
but only on Android Wear. On Android Wear, some font files are missing
but are listed in fonts.xml. Before that patch, we created a Typeface
object with an empty FontFamily even if there was no valid font entry
in font-family tag. However, after that patch, FontFamily stopped
creating native objects and holds a null pointer instead. As the
result, SIGSEGV happens.

The right fix is skipping Typeface creation if native code failed to
create the font family object.

Since Typeface.init cannot be called twice, this is hard to test
automatically.

Bug: 37328609
Bug: 37326002
Test: Boot succeeded even after removing CutiveMono.ttf from system.

Change-Id: I125de07343252784986d728c3bbaa46b24ace601
graphics/java/android/graphics/Typeface.java