Crop avatar to circle when syncing from Contacts.
This ensures that photos synced to the Android user icon from the Me Contact, by the ProfileUpdateReceiver, are cropped to a circle. This matches the behaviour when images are selected using the avatar picker. Bug: 256827004 Test: Manual, build & flash, sync photo, observe in lockscreen. Change-Id: If1abf110b74a3892a5cfb76ee344be79c867feed
This commit is contained in:
@@ -1681,7 +1681,10 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||||
Bitmap icon = BitmapFactory.decodeStream(avatarDataStream);
|
Bitmap decodedIcon = BitmapFactory.decodeStream(avatarDataStream);
|
||||||
|
CircleFramedDrawable drawable = CircleFramedDrawable.getInstance(context, decodedIcon);
|
||||||
|
Bitmap icon = UserIcons.convertToBitmapAtUserIconSize(context.getResources(), drawable);
|
||||||
|
|
||||||
um.setUserIcon(userId, icon);
|
um.setUserIcon(userId, icon);
|
||||||
try {
|
try {
|
||||||
avatarDataStream.close();
|
avatarDataStream.close();
|
||||||
|
Reference in New Issue
Block a user