Retrieve resources from the corresponding profile

This handles the case where the authenticator does not exist in the primary profile.

Bug: 15466880
Change-Id: I9f6311397456b8bf210f50df82b6be605c1140f0
This commit is contained in:
Alexandra Gherghina
2014-06-30 18:07:52 +01:00
parent 1eb3f316bd
commit ce0b22cf90

View File

@@ -102,7 +102,8 @@ final public class AuthenticatorHelper extends BroadcastReceiver {
if (mTypeToAuthDescription.containsKey(accountType)) {
try {
AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType);
Context authContext = context.createPackageContext(desc.packageName, 0);
Context authContext = context.createPackageContextAsUser(desc.packageName, 0,
mUserHandle);
icon = mUm.getBadgedDrawableForUser(
authContext.getResources().getDrawable(desc.iconId), mUserHandle);
synchronized (mAccTypeIconCache) {
@@ -128,7 +129,8 @@ final public class AuthenticatorHelper extends BroadcastReceiver {
if (mTypeToAuthDescription.containsKey(accountType)) {
try {
AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType);
Context authContext = context.createPackageContext(desc.packageName, 0);
Context authContext = context.createPackageContextAsUser(desc.packageName, 0,
mUserHandle);
label = authContext.getResources().getText(desc.labelId);
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "No label name for account type " + accountType);