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
diff --git a/core/java/android/content/pm/multiuser.aconfig b/core/java/android/content/pm/multiuser.aconfig
index 57025c2..9a1796f 100644
--- a/core/java/android/content/pm/multiuser.aconfig
+++ b/core/java/android/content/pm/multiuser.aconfig
@@ -56,3 +56,11 @@
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
+}
diff --git a/packages/SettingsLib/src/com/android/settingslib/users/EditUserPhotoController.java b/packages/SettingsLib/src/com/android/settingslib/users/EditUserPhotoController.java
index 9084aa2..e83b9bc 100644
--- a/packages/SettingsLib/src/com/android/settingslib/users/EditUserPhotoController.java
+++ b/packages/SettingsLib/src/com/android/settingslib/users/EditUserPhotoController.java
@@ -22,6 +22,7 @@
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 @@
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 @@
onPhotoCropped(data.getData());
return true;
}
-
}
return false;
}
@@ -115,7 +118,13 @@
}
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);
}