@Override
 protected Bitmap doInBackground(Void... voids) {
   if (avatarUri != null) {
     try {
       avatarBmp =
           BitmapUtil.createScaledBitmap(
               GroupCreateActivity.this, masterSecret, avatarUri, AVATAR_SIZE, AVATAR_SIZE);
     } catch (IOException | BitmapDecodingException e) {
       Log.w(TAG, e);
       return null;
     }
   }
   return avatarBmp;
 }
  public static Drawable getContactPhoto(Context context, Uri uri, String name) {
    final InputStream inputStream = getContactPhotoStream(context, uri);
    final int targetSize =
        context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size);

    if (inputStream != null) {
      try {
        return RoundedDrawable.fromBitmap(
                BitmapUtil.createScaledBitmap(
                    inputStream, getContactPhotoStream(context, uri), targetSize, targetSize))
            .setScaleType(ImageView.ScaleType.CENTER_CROP)
            .setOval(true);
      } catch (BitmapDecodingException bde) {
        Log.w(TAG, bde);
      }
    }

    return getDefaultContactPhoto(context, name);
  }