Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6487432 authored by Anna Bauza's avatar Anna Bauza Committed by Android Build Cherrypicker Worker
Browse files

Integrating new Avatar Picker App in Settings

Bug: 309426522
Test: manual
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9d5f70c8d3ca45447c3019bd934e338c05cef193)
Merged-In: I8905841cc46ba62099f44dbecf01c06869677bf5
Change-Id: I8905841cc46ba62099f44dbecf01c06869677bf5
parent 7e3b5f57
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -56,3 +56,11 @@ flag {
    description: "Add support to lock private space automatically after a time period"
    bug: "303201022"
}

flag {
    name: "avatar_sync"
    namespace: "multiuser"
    description: "Implement new Avatar Picker outside of SetttingsLib with ability to select avatars from Google Account and synchronise to any changes."
    bug: "296829976"
    is_fixed_read_only: true
}
+11 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.multiuser.Flags;
import android.net.Uri;
import android.util.Log;
import android.widget.ImageView;
@@ -59,6 +60,9 @@ public class EditUserPhotoController {
    private static final String IMAGES_DIR = "multi_user";
    private static final String NEW_USER_PHOTO_FILE_NAME = "NewUserPhoto.png";

    private static final String AVATAR_PICKER_ACTION = "com.android.avatarpicker"
            + ".FULL_SCREEN_ACTIVITY";

    private final Activity mActivity;
    private final ActivityStarter mActivityStarter;
    private final ImageView mImageView;
@@ -105,7 +109,6 @@ public class EditUserPhotoController {
                onPhotoCropped(data.getData());
                return true;
            }

        }
        return false;
    }
@@ -115,7 +118,13 @@ public class EditUserPhotoController {
    }

    private void showAvatarPicker() {
        Intent intent = new Intent(mImageView.getContext(), AvatarPickerActivity.class);
        Intent intent;
        if (Flags.avatarSync()) {
            intent = new Intent(AVATAR_PICKER_ACTION);
            intent.addCategory(Intent.CATEGORY_DEFAULT);
        } else {
            intent = new Intent(mImageView.getContext(), AvatarPickerActivity.class);
        }
        intent.putExtra(AvatarPickerActivity.EXTRA_FILE_AUTHORITY, mFileAuthority);
        mActivityStarter.startActivityForResult(intent, REQUEST_CODE_PICK_AVATAR);
    }