Launcher change corresponding to platform change.

Here is platform change : ag/540450

Added try catch block so the APK works on older builds as well.

Bug: 17390424
Change-Id: Id5731c65f036e35b71aa74ce6d8ae031107ed60b
This commit is contained in:
Dharmesh Mokani
2014-09-05 15:59:00 -07:00
parent a38dc90188
commit f9847b9bd3
3 changed files with 30 additions and 13 deletions

View File

@@ -121,12 +121,15 @@ class AppWidgetManagerCompatVL extends AppWidgetManagerCompat {
} else {
badgeLocation.offset(bitmap.getWidth() - badgeSize - badgeMargin, top);
}
UserManager userManager = (UserManager) mContext.getSystemService(
Context.USER_SERVICE);
Drawable drawable = userManager.getBadgedDrawableForUser(new BitmapDrawable(res, bitmap),
info.getProfile(), badgeLocation, 0);
Drawable drawable = null;
// STOPSHIP(mokani): Remove catch block once dogfood build is bigger than LRW70.
// This hack is just to prevent crash in older builds.
try {
drawable = mPm.getUserBadgedDrawableForDensity(new BitmapDrawable(res, bitmap),
info.getProfile(), badgeLocation, 0);
} catch (Exception e) {
return bitmap;
}
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();