Handle potential IllegalArgumentException in Telecom
The Icon API can potentially throw an IllegalArgumentException in some cases.
Adding catch blocks to ensure they don't crash Telecom.
Test: Manual
Fixes: 151575635
Signed-off-by: Junyeong Bak <junyeong.bak@samsung.com>
Change-Id: Ia41032df7a013eb5ea7de4aa0a8cfe9031143365
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index d0b7a0b..60e91d4 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -1599,10 +1599,16 @@
return BitmapFactory.decodeByteArray(imageByteArray, 0, imageByteArray.length);
}
+ @Nullable
protected Icon readIcon(XmlPullParser parser) throws IOException {
- byte[] iconByteArray = Base64.decode(parser.getText(), 0);
- ByteArrayInputStream stream = new ByteArrayInputStream(iconByteArray);
- return Icon.createFromStream(stream);
+ try {
+ byte[] iconByteArray = Base64.decode(parser.getText(), 0);
+ ByteArrayInputStream stream = new ByteArrayInputStream(iconByteArray);
+ return Icon.createFromStream(stream);
+ } catch (IllegalArgumentException e) {
+ Log.e(this, e, "Bitmap must not be null.");
+ return null;
+ }
}
}