Skip to content
Snippets Groups Projects
Commit a81b4a0d authored by Mady Mellor's avatar Mady Mellor
Browse files

Catch an exception when loading a bubble icon

If an app gives us a shortcut whose icon can't be looked up, an
exception is thrown. This CL modifies the code to catch an
exception and default to the app icon instead of the shortcut
icon.

Test: manual - modify icon loading code to throw an exception
             - create a bubble
	     => observe there is no crash and the bubble uses
	        the app icon instead
Bug: 300073572

Change-Id: Iedc9825c42ec2f50bb9939e34acd9f1960dd229e
(cherry picked from commit bf533694)
parent 6f4c93a5
No related branches found
No related tags found
No related merge requests found
......@@ -257,8 +257,16 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
return false;
}
// Badged bubble image
Drawable bubbleDrawable = iconFactory.getBubbleDrawable(c, info.shortcutInfo, b.getIcon());
Drawable bubbleDrawable = null;
try {
// Badged bubble image
bubbleDrawable = iconFactory.getBubbleDrawable(c, info.shortcutInfo,
b.getIcon());
} catch (Exception e) {
// If we can't create the icon we'll default to the app icon
Log.w(TAG, "Exception creating icon for the bubble: " + b.getKey());
}
if (bubbleDrawable == null) {
// Default to app icon
bubbleDrawable = appIcon;
......@@ -268,7 +276,7 @@ public class BubbleViewInfoTask extends AsyncTask<Void, Void, BubbleViewInfoTask
b.isImportantConversation());
info.badgeBitmap = badgeBitmapInfo.icon;
// Raw badge bitmap never includes the important conversation ring
info.rawBadgeBitmap = b.isImportantConversation() // is this needed for bar?
info.rawBadgeBitmap = b.isImportantConversation()
? iconFactory.getBadgeBitmap(badgedIcon, false).icon
: badgeBitmapInfo.icon;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment