Defensively load untrusted icons from account authenticator

Catch Resources.NotFoundException which should cover all parsing
errors from loadDrawables(); also substitute a default icon if
parsing returns null.

Bug: 17760671
Change-Id: Ia0ec25e34974ed85b6ffe6882d5bce003d64e9d6
This commit is contained in:
Rubin Xu
2015-06-08 17:21:19 +01:00
parent b777c6e205
commit d1ce82ae8b
3 changed files with 16 additions and 9 deletions

View File

@@ -96,7 +96,8 @@ final public class AuthenticatorHelper extends BroadcastReceiver {
/**
* Gets an icon associated with a particular account type. If none found, return null.
* @param accountType the type of account
* @return a drawable for the icon or null if one cannot be found.
* @return a drawable for the icon or a default icon returned by
* {@link PackageManager#getDefaultActivityIcon} if one cannot be found.
*/
public Drawable getDrawableForType(Context context, final String accountType) {
Drawable icon = null;