Merge "Fix 4 broken work profile tests"

This commit is contained in:
Robin Lee
2017-02-01 14:31:07 +00:00
committed by Android (Google) Code Review
3 changed files with 13 additions and 20 deletions

View File

@@ -42,6 +42,10 @@ public class AudioHelper {
return Utils.getManagedProfileId(um, UserHandle.myUserId());
}
public boolean isUserUnlocked(UserManager um, @UserIdInt int userId) {
return um.isUserUnlocked(userId);
}
public Context createPackageContextAsUser(@UserIdInt int profileId) {
return Utils.createPackageContextAsUser(mContext, profileId);
}

View File

@@ -160,8 +160,8 @@ public class WorkSoundPreferenceController extends PreferenceController implemen
}
private CharSequence updateRingtoneName(Context context, int type) {
if (context == null || !UserManager.get(context).isUserUnlocked(context.getUserId())) {
return context.getString(R.string.managed_profile_not_available_label);
if (context == null || !mHelper.isUserUnlocked(mUserManager, context.getUserId())) {
return mContext.getString(R.string.managed_profile_not_available_label);
}
Uri ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context, type);
return Ringtone.getTitle(context, ringtoneUri, false /* followSettingsUri */,