summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anna Bauza <annabauza@google.com> 2024-03-21 20:54:39 +0000
committer Anna Bauza <annabauza@google.com> 2024-03-29 14:43:29 +0000
commite95044ad377f37f7f973ab8f74527307dc3544fb (patch)
tree624f5e7bb25f73e4135a258a176901c4bc7db13d
parentc79b5379f875aa28573018038e66150e4eab5aaa (diff)
Refactor SettingsLib to remove redundant resources conditionally
Bug: 320878675 Test: manual Change-Id: I77b3eb4cc2edbbfa6788e53004e370d49da0c0c0
-rw-r--r--packages/SettingsLib/Android.bp30
-rw-r--r--packages/SettingsLib/AndroidManifest.xml3
-rw-r--r--packages/SettingsLib/AvatarPicker/Android.bp31
-rw-r--r--packages/SettingsLib/AvatarPicker/AndroidManifest.xml32
-rw-r--r--packages/SettingsLib/AvatarPicker/res/drawable/avatar_choose_photo_circled.xml30
-rw-r--r--packages/SettingsLib/AvatarPicker/res/drawable/avatar_selector.xml (renamed from packages/SettingsLib/res/drawable/avatar_selector.xml)9
-rw-r--r--packages/SettingsLib/AvatarPicker/res/drawable/avatar_take_photo_circled.xml30
-rw-r--r--packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle.xml24
-rw-r--r--packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle_filled.xml27
-rw-r--r--packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle_outline.xml25
-rw-r--r--packages/SettingsLib/AvatarPicker/res/layout/avatar_item.xml (renamed from packages/SettingsLib/res/layout/avatar_item.xml)11
-rw-r--r--packages/SettingsLib/AvatarPicker/res/layout/avatar_picker.xml (renamed from packages/SettingsLib/res/layout/avatar_picker.xml)21
-rw-r--r--packages/SettingsLib/AvatarPicker/res/values/arrays.xml27
-rw-r--r--packages/SettingsLib/AvatarPicker/res/values/dimens.xml22
-rw-r--r--packages/SettingsLib/AvatarPicker/res/values/strings.xml32
-rw-r--r--packages/SettingsLib/AvatarPicker/src/AvatarPhotoController.java (renamed from packages/SettingsLib/src/com/android/settingslib/users/AvatarPhotoController.java)9
-rw-r--r--packages/SettingsLib/AvatarPicker/src/AvatarPickerActivity.java (renamed from packages/SettingsLib/src/com/android/settingslib/users/AvatarPickerActivity.java)3
-rw-r--r--packages/SettingsLib/AvatarPicker/src/PhotoCapabilityUtils.java (renamed from packages/SettingsLib/src/com/android/settingslib/users/PhotoCapabilityUtils.java)2
-rw-r--r--packages/SettingsLib/AvatarPicker/src/ThreadUtils.java115
-rw-r--r--packages/SettingsLib/res/drawable/avatar_choose_photo_circled.xml30
-rw-r--r--packages/SettingsLib/res/drawable/avatar_take_photo_circled.xml30
-rw-r--r--packages/SettingsLib/res/values/arrays.xml9
-rw-r--r--packages/SettingsLib/res/values/dimens.xml7
-rw-r--r--packages/SettingsLib/res/values/strings.xml10
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/users/EditUserPhotoController.java23
-rw-r--r--packages/SettingsLib/tests/integ/Android.bp1
-rw-r--r--packages/SettingsLib/tests/integ/src/com/android/settingslib/users/AvatarPhotoControllerTest.java8
27 files changed, 469 insertions, 132 deletions
diff --git a/packages/SettingsLib/Android.bp b/packages/SettingsLib/Android.bp
index bd56aae1cb17..66fad3689eac 100644
--- a/packages/SettingsLib/Android.bp
+++ b/packages/SettingsLib/Android.bp
@@ -11,6 +11,7 @@ android_library {
name: "SettingsLib",
defaults: [
"SettingsLintDefaults",
+ "SettingsLibAvatarPickerDefaults",
],
static_libs: [
@@ -109,3 +110,32 @@ java_aconfig_library {
name: "settingslib_flags_lib",
aconfig_declarations: "settingslib_flags",
}
+
+soong_config_module_type {
+ name: "avatar_picker_java_defaults",
+ module_type: "java_defaults",
+ config_namespace: "SettingsLib",
+ bool_variables: [
+ "legacy_avatar_picker_app_enabled",
+ ],
+ properties: [
+ "static_libs",
+ "manifest",
+ ],
+}
+
+soong_config_bool_variable {
+ name: "legacy_avatar_picker_app_enabled",
+}
+
+avatar_picker_java_defaults {
+ name: "SettingsLibAvatarPickerDefaults",
+ soong_config_variables: {
+ // If flag is enabled, add the library
+ legacy_avatar_picker_app_enabled: {
+ static_libs: [
+ "SettingsLibAvatarPicker",
+ ],
+ },
+ },
+}
diff --git a/packages/SettingsLib/AndroidManifest.xml b/packages/SettingsLib/AndroidManifest.xml
index 322d6cfc2da7..412ff29aec32 100644
--- a/packages/SettingsLib/AndroidManifest.xml
+++ b/packages/SettingsLib/AndroidManifest.xml
@@ -21,9 +21,6 @@
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
<application>
- <activity
- android:name="com.android.settingslib.users.AvatarPickerActivity"
- android:theme="@style/SudThemeGlifV2.DayNight"/>
</application>
</manifest>
diff --git a/packages/SettingsLib/AvatarPicker/Android.bp b/packages/SettingsLib/AvatarPicker/Android.bp
new file mode 100644
index 000000000000..1d42cd4a0436
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/Android.bp
@@ -0,0 +1,31 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "frameworks_base_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["frameworks_base_license"],
+}
+
+android_library {
+ name: "SettingsLibAvatarPicker",
+ manifest: "AndroidManifest.xml",
+ use_resource_processor: true,
+ platform_apis: true,
+
+ defaults: [
+ "SettingsLintDefaults",
+ ],
+
+ static_libs: [
+ "SettingsLibSettingsTheme",
+ "setupdesign",
+ "guava",
+ ],
+
+ resource_dirs: ["res"],
+ srcs: [
+ "src/**/*.java",
+ "src/**/*.kt",
+ ],
+}
diff --git a/packages/SettingsLib/AvatarPicker/AndroidManifest.xml b/packages/SettingsLib/AvatarPicker/AndroidManifest.xml
new file mode 100644
index 000000000000..73dd35b0a310
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.settingslib.avatarpicker">
+
+ <uses-sdk android:minSdkVersion="23" />
+ <application>
+ <activity
+ android:name=".AvatarPickerActivity"
+ android:theme="@style/SudThemeGlifV2.DayNight"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="com.android.avatarpicker.FULL_SCREEN_ACTIVITY" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/packages/SettingsLib/AvatarPicker/res/drawable/avatar_choose_photo_circled.xml b/packages/SettingsLib/AvatarPicker/res/drawable/avatar_choose_photo_circled.xml
new file mode 100644
index 000000000000..27bb87fc9687
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/res/drawable/avatar_choose_photo_circled.xml
@@ -0,0 +1,30 @@
+<!--
+ Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <shape android:shape="oval">
+ <stroke
+ android:width="2dp"
+ android:color="?android:attr/colorPrimary" />
+ </shape>
+ </item>
+ <item
+ android:bottom="@dimen/avatar_picker_icon_inset"
+ android:drawable="@drawable/ic_avatar_choose_photo"
+ android:left="@dimen/avatar_picker_icon_inset"
+ android:right="@dimen/avatar_picker_icon_inset"
+ android:top="@dimen/avatar_picker_icon_inset" />
+</layer-list>
diff --git a/packages/SettingsLib/res/drawable/avatar_selector.xml b/packages/SettingsLib/AvatarPicker/res/drawable/avatar_selector.xml
index ccde59763a4a..1fb521a80cd3 100644
--- a/packages/SettingsLib/res/drawable/avatar_selector.xml
+++ b/packages/SettingsLib/AvatarPicker/res/drawable/avatar_selector.xml
@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2022 The Android Open Source Project
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright (C) 2024 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -17,9 +16,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape android:shape="oval">
- <stroke
- android:color="?android:attr/colorPrimary"
- android:width="@dimen/avatar_picker_padding"/>
+ <stroke android:width="@dimen/avatar_picker_padding" android:color="?android:attr/colorPrimary" />
</shape>
</item>
</selector> \ No newline at end of file
diff --git a/packages/SettingsLib/AvatarPicker/res/drawable/avatar_take_photo_circled.xml b/packages/SettingsLib/AvatarPicker/res/drawable/avatar_take_photo_circled.xml
new file mode 100644
index 000000000000..d678e9b9aeb0
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/res/drawable/avatar_take_photo_circled.xml
@@ -0,0 +1,30 @@
+<!--
+ Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item>
+ <shape android:shape="oval">
+ <stroke
+ android:width="2dp"
+ android:color="?android:attr/colorPrimary" />
+ </shape>
+ </item>
+ <item
+ android:bottom="@dimen/avatar_picker_icon_inset"
+ android:drawable="@drawable/ic_avatar_take_photo"
+ android:left="@dimen/avatar_picker_icon_inset"
+ android:right="@dimen/avatar_picker_icon_inset"
+ android:top="@dimen/avatar_picker_icon_inset" />
+</layer-list>
diff --git a/packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle.xml b/packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle.xml
new file mode 100644
index 000000000000..6421f9117029
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle.xml
@@ -0,0 +1,24 @@
+<!--
+ Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24"
+ android:viewportWidth="24">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M5.85,17.1Q7.125,16.125 8.7,15.562Q10.275,15 12,15Q13.725,15 15.3,15.562Q16.875,16.125 18.15,17.1Q19.025,16.075 19.513,14.775Q20,13.475 20,12Q20,8.675 17.663,6.337Q15.325,4 12,4Q8.675,4 6.338,6.337Q4,8.675 4,12Q4,13.475 4.488,14.775Q4.975,16.075 5.85,17.1ZM12,13Q10.525,13 9.512,11.988Q8.5,10.975 8.5,9.5Q8.5,8.025 9.512,7.012Q10.525,6 12,6Q13.475,6 14.488,7.012Q15.5,8.025 15.5,9.5Q15.5,10.975 14.488,11.988Q13.475,13 12,13ZM12,22Q9.925,22 8.1,21.212Q6.275,20.425 4.925,19.075Q3.575,17.725 2.788,15.9Q2,14.075 2,12Q2,9.925 2.788,8.1Q3.575,6.275 4.925,4.925Q6.275,3.575 8.1,2.787Q9.925,2 12,2Q14.075,2 15.9,2.787Q17.725,3.575 19.075,4.925Q20.425,6.275 21.212,8.1Q22,9.925 22,12Q22,14.075 21.212,15.9Q20.425,17.725 19.075,19.075Q17.725,20.425 15.9,21.212Q14.075,22 12,22ZM12,20Q13.325,20 14.5,19.613Q15.675,19.225 16.65,18.5Q15.675,17.775 14.5,17.387Q13.325,17 12,17Q10.675,17 9.5,17.387Q8.325,17.775 7.35,18.5Q8.325,19.225 9.5,19.613Q10.675,20 12,20ZM12,11Q12.65,11 13.075,10.575Q13.5,10.15 13.5,9.5Q13.5,8.85 13.075,8.425Q12.65,8 12,8Q11.35,8 10.925,8.425Q10.5,8.85 10.5,9.5Q10.5,10.15 10.925,10.575Q11.35,11 12,11ZM12,9.5Q12,9.5 12,9.5Q12,9.5 12,9.5Q12,9.5 12,9.5Q12,9.5 12,9.5Q12,9.5 12,9.5Q12,9.5 12,9.5Q12,9.5 12,9.5Q12,9.5 12,9.5ZM12,18.5Q12,18.5 12,18.5Q12,18.5 12,18.5Q12,18.5 12,18.5Q12,18.5 12,18.5Q12,18.5 12,18.5Q12,18.5 12,18.5Q12,18.5 12,18.5Q12,18.5 12,18.5Z" />
+</vector>
diff --git a/packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle_filled.xml b/packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle_filled.xml
new file mode 100644
index 000000000000..645fdf7a8861
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle_filled.xml
@@ -0,0 +1,27 @@
+<!--
+ Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24"
+ android:viewportWidth="24">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM18.36,16.83c-1.43,-1.74 -4.9,-2.33 -6.36,-2.33s-4.93,0.59 -6.36,2.33A7.95,7.95 0,0 1,4 12c0,-4.41 3.59,-8 8,-8s8,3.59 8,8c0,1.82 -0.62,3.49 -1.64,4.83z" />
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M12,6c-1.94,0 -3.5,1.56 -3.5,3.5S10.06,13 12,13s3.5,-1.56 3.5,-3.5S13.94,6 12,6z" />
+</vector>
diff --git a/packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle_outline.xml b/packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle_outline.xml
new file mode 100644
index 000000000000..a5c103874538
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/res/drawable/ic_account_circle_outline.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportHeight="24"
+ android:viewportWidth="24">
+ <path
+ android:fillColor="?android:attr/colorPrimary"
+ android:pathData="M5.85,17.1q1.275,-0.975 2.85,-1.538Q10.275,15 12,15q1.725,0 3.3,0.563 1.575,0.562 2.85,1.537 0.875,-1.025 1.363,-2.325Q20,13.475 20,12q0,-3.325 -2.337,-5.662Q15.325,4 12,4T6.338,6.338Q4,8.675 4,12q0,1.475 0.487,2.775 0.488,1.3 1.363,2.325zM12,13q-1.475,0 -2.488,-1.012Q8.5,10.975 8.5,9.5t1.012,-2.487Q10.525,6 12,6t2.488,1.013Q15.5,8.024 15.5,9.5t-1.012,2.488Q13.475,13 12,13zM12,22q-2.075,0 -3.9,-0.788 -1.825,-0.787 -3.175,-2.137 -1.35,-1.35 -2.137,-3.175Q2,14.075 2,12t0.788,-3.9q0.787,-1.825 2.137,-3.175 1.35,-1.35 3.175,-2.137Q9.925,2 12,2t3.9,0.788q1.825,0.787 3.175,2.137 1.35,1.35 2.137,3.175Q22,9.925 22,12t-0.788,3.9q-0.787,1.825 -2.137,3.175 -1.35,1.35 -3.175,2.137Q14.075,22 12,22zM12,20q1.325,0 2.5,-0.387 1.175,-0.388 2.15,-1.113 -0.975,-0.725 -2.15,-1.113Q13.325,17 12,17t-2.5,0.387q-1.175,0.388 -2.15,1.113 0.975,0.725 2.15,1.113Q10.675,20 12,20zM12,11q0.65,0 1.075,-0.425 0.425,-0.425 0.425,-1.075 0,-0.65 -0.425,-1.075Q12.65,8 12,8q-0.65,0 -1.075,0.425Q10.5,8.85 10.5,9.5q0,0.65 0.425,1.075Q11.35,11 12,11zM12,9.5zM12,18.5z" />
+</vector>
+
diff --git a/packages/SettingsLib/res/layout/avatar_item.xml b/packages/SettingsLib/AvatarPicker/res/layout/avatar_item.xml
index c52f6648cb7e..cc4e8a78357a 100644
--- a/packages/SettingsLib/res/layout/avatar_item.xml
+++ b/packages/SettingsLib/AvatarPicker/res/layout/avatar_item.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,9 +15,9 @@
-->
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/avatar_image"
- android:layout_height="@dimen/avatar_size_in_picker"
android:layout_width="@dimen/avatar_size_in_picker"
- android:layout_margin="@dimen/avatar_picker_margin"
+ android:layout_height="@dimen/avatar_size_in_picker"
android:layout_gravity="center"
- android:padding="@dimen/avatar_picker_padding"
- android:background="@drawable/avatar_selector"/>
+ android:layout_margin="@dimen/avatar_picker_margin"
+ android:background="@drawable/avatar_selector"
+ android:padding="@dimen/avatar_picker_padding" />
diff --git a/packages/SettingsLib/res/layout/avatar_picker.xml b/packages/SettingsLib/AvatarPicker/res/layout/avatar_picker.xml
index 2d40bd0de7ea..e9d375e3313c 100644
--- a/packages/SettingsLib/res/layout/avatar_picker.xml
+++ b/packages/SettingsLib/AvatarPicker/res/layout/avatar_picker.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
Copyright (C) 2022 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,25 +13,25 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<com.google.android.setupdesign.GlifLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<com.google.android.setupdesign.GlifLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/glif_layout"
- android:layout_height="match_parent"
android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:icon="@drawable/ic_account_circle_outline"
- app:sucUsePartnerResource="true"
- app:sucHeaderText="@string/avatar_picker_title">
+ app:sucHeaderText="@string/avatar_picker_title"
+ app:sucUsePartnerResource="true">
<LinearLayout
- android:layout_height="match_parent"
+ style="@style/SudContentFrame"
android:layout_width="match_parent"
- android:gravity="center_horizontal"
- style="@style/SudContentFrame">
+ android:layout_height="match_parent"
+ android:gravity="center_horizontal">
+
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/avatar_grid"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ android:layout_height="wrap_content" />
</LinearLayout>
</com.google.android.setupdesign.GlifLayout> \ No newline at end of file
diff --git a/packages/SettingsLib/AvatarPicker/res/values/arrays.xml b/packages/SettingsLib/AvatarPicker/res/values/arrays.xml
new file mode 100644
index 000000000000..042bc4144c9f
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/res/values/arrays.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- Images offered as options in the avatar picker. If populated, the avatar_image_descriptions
+ array must also be populated with a content description for each image. -->
+ <array name="avatar_images" />
+
+ <!-- Content descriptions for each of the images in the avatar_images array. When overlaid
+ these values should be translated, but this empty array must not be translated or it may
+ replace the real descriptions with an empty array. -->
+ <string-array name="avatar_image_descriptions" translatable="false" />
+</resources> \ No newline at end of file
diff --git a/packages/SettingsLib/AvatarPicker/res/values/dimens.xml b/packages/SettingsLib/AvatarPicker/res/values/dimens.xml
new file mode 100644
index 000000000000..df54dc2cd195
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/res/values/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License
+ -->
+<resources>
+ <dimen name="avatar_size_in_picker">96dp</dimen>
+ <dimen name="avatar_picker_padding">6dp</dimen>
+ <dimen name="avatar_picker_margin">2dp</dimen>
+ <dimen name="avatar_picker_icon_inset">25dp</dimen>
+ <integer name="avatar_picker_columns">3</integer>
+</resources> \ No newline at end of file
diff --git a/packages/SettingsLib/AvatarPicker/res/values/strings.xml b/packages/SettingsLib/AvatarPicker/res/values/strings.xml
new file mode 100644
index 000000000000..1ead1289b696
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/res/values/strings.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright (C) 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License
+ -->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+
+ <!-- An option in a photo selection dialog to choose a pre-existing image [CHAR LIMIT=50] -->
+ <string name="user_image_choose_photo">Choose an image</string>
+
+ <!-- An option in a photo selection dialog to take a new photo [CHAR LIMIT=50] -->
+ <string name="user_image_take_photo">Take a photo</string>
+
+ <!-- Title for a screen allowing the user to choose a profile picture. [CHAR LIMIT=NONE] -->
+ <string name="avatar_picker_title">Choose a profile picture</string>
+
+ <!-- Content description for a default user icon. [CHAR LIMIT=NONE] -->
+ <string name="default_user_icon_description">Default user icon</string>
+
+ <!-- Button label for generic Done action, to be pressed when an action has been completed [CHAR LIMIT=20] -->
+ <string name="done">Done</string>
+</resources> \ No newline at end of file
diff --git a/packages/SettingsLib/src/com/android/settingslib/users/AvatarPhotoController.java b/packages/SettingsLib/AvatarPicker/src/AvatarPhotoController.java
index f165c9f7cf03..c20392a300e7 100644
--- a/packages/SettingsLib/src/com/android/settingslib/users/AvatarPhotoController.java
+++ b/packages/SettingsLib/AvatarPicker/src/AvatarPhotoController.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.settingslib.users;
+package com.android.settingslib.avatarpicker;
import android.app.Activity;
import android.content.ClipData;
@@ -39,8 +39,6 @@ import android.util.Log;
import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
-import com.android.settingslib.utils.ThreadUtils;
-
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
@@ -170,8 +168,9 @@ class AvatarPhotoController {
private void copyAndCropPhoto(final Uri pictureUri, boolean delayBeforeCrop) {
ListenableFuture<Uri> future = ThreadUtils.getBackgroundExecutor().submit(() -> {
final ContentResolver cr = mContextInjector.getContentResolver();
- try (InputStream in = cr.openInputStream(pictureUri);
- OutputStream out = cr.openOutputStream(mPreCropPictureUri)) {
+ try {
+ InputStream in = cr.openInputStream(pictureUri);
+ OutputStream out = cr.openOutputStream(mPreCropPictureUri);
Streams.copy(in, out);
return mPreCropPictureUri;
} catch (IOException e) {
diff --git a/packages/SettingsLib/src/com/android/settingslib/users/AvatarPickerActivity.java b/packages/SettingsLib/AvatarPicker/src/AvatarPickerActivity.java
index 61c8ee786dbe..de101b1fb2e8 100644
--- a/packages/SettingsLib/src/com/android/settingslib/users/AvatarPickerActivity.java
+++ b/packages/SettingsLib/AvatarPicker/src/AvatarPickerActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.settingslib.users;
+package com.android.settingslib.avatarpicker;
import android.app.Activity;
import android.content.ContentResolver;
@@ -38,7 +38,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.util.UserIcons;
-import com.android.settingslib.R;
import com.google.android.setupcompat.template.FooterBarMixin;
import com.google.android.setupcompat.template.FooterButton;
diff --git a/packages/SettingsLib/src/com/android/settingslib/users/PhotoCapabilityUtils.java b/packages/SettingsLib/AvatarPicker/src/PhotoCapabilityUtils.java
index b8615a7e5aa9..43cb0f5d10bf 100644
--- a/packages/SettingsLib/src/com/android/settingslib/users/PhotoCapabilityUtils.java
+++ b/packages/SettingsLib/AvatarPicker/src/PhotoCapabilityUtils.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.settingslib.users;
+package com.android.settingslib.avatarpicker;
import android.app.KeyguardManager;
import android.content.Context;
diff --git a/packages/SettingsLib/AvatarPicker/src/ThreadUtils.java b/packages/SettingsLib/AvatarPicker/src/ThreadUtils.java
new file mode 100644
index 000000000000..dc19e666b8e3
--- /dev/null
+++ b/packages/SettingsLib/AvatarPicker/src/ThreadUtils.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.avatarpicker;
+
+import android.os.Handler;
+import android.os.Looper;
+
+import androidx.annotation.NonNull;
+
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
+
+import java.util.concurrent.Callable;
+import java.util.concurrent.Executors;
+
+// copied from SettinsLib/utils
+public class ThreadUtils {
+
+ private static volatile Thread sMainThread;
+ private static volatile Handler sMainThreadHandler;
+ private static volatile ListeningExecutorService sListeningService;
+
+ /**
+ * Returns true if the current thread is the UI thread.
+ */
+ public static boolean isMainThread() {
+ if (sMainThread == null) {
+ sMainThread = Looper.getMainLooper().getThread();
+ }
+ return Thread.currentThread() == sMainThread;
+ }
+
+ /**
+ * Returns a shared UI thread handler.
+ */
+ @NonNull
+ public static Handler getUiThreadHandler() {
+ if (sMainThreadHandler == null) {
+ sMainThreadHandler = new Handler(Looper.getMainLooper());
+ }
+
+ return sMainThreadHandler;
+ }
+
+ /**
+ * Checks that the current thread is the UI thread. Otherwise throws an exception.
+ */
+ public static void ensureMainThread() {
+ if (!isMainThread()) {
+ throw new RuntimeException("Must be called on the UI thread");
+ }
+ }
+
+ /**
+ * Posts runnable in background using shared background thread pool.
+ *
+ * @return A future of the task that can be monitored for updates or cancelled.
+ */
+ @SuppressWarnings("rawtypes")
+ @NonNull
+ public static ListenableFuture postOnBackgroundThread(@NonNull Runnable runnable) {
+ return getBackgroundExecutor().submit(runnable);
+ }
+
+ /**
+ * Posts callable in background using shared background thread pool.
+ *
+ * @return A future of the task that can be monitored for updates or cancelled.
+ */
+ @NonNull
+ public static <T> ListenableFuture<T> postOnBackgroundThread(@NonNull Callable<T> callable) {
+ return getBackgroundExecutor().submit(callable);
+ }
+
+ /**
+ * Posts the runnable on the main thread.
+ *
+ * @deprecated moving work to the main thread should be done via the main executor provided to
+ * {@link com.google.common.util.concurrent.FutureCallback} via
+ * {@link android.content.Context#getMainExecutor()} or by calling an SDK method such as
+ * {@link android.app.Activity#runOnUiThread(Runnable)} or
+ * {@link android.content.Context#getMainThreadHandler()} where appropriate.
+ */
+ @Deprecated
+ public static void postOnMainThread(@NonNull Runnable runnable) {
+ getUiThreadHandler().post(runnable);
+ }
+
+ /**
+ * Provides a shared {@link ListeningExecutorService} created using a fixed thread pool executor
+ */
+ @NonNull
+ public static synchronized ListeningExecutorService getBackgroundExecutor() {
+ if (sListeningService == null) {
+ sListeningService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(
+ Runtime.getRuntime().availableProcessors()));
+ }
+ return sListeningService;
+ }
+}
diff --git a/packages/SettingsLib/res/drawable/avatar_choose_photo_circled.xml b/packages/SettingsLib/res/drawable/avatar_choose_photo_circled.xml
deleted file mode 100644
index 97aec740ea43..000000000000
--- a/packages/SettingsLib/res/drawable/avatar_choose_photo_circled.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
- ~ Copyright (C) 2022 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <stroke
- android:width="2dp"
- android:color="?android:attr/colorPrimary"/>
- </shape>
- </item>
- <item
- android:left="@dimen/avatar_picker_icon_inset"
- android:right="@dimen/avatar_picker_icon_inset"
- android:top="@dimen/avatar_picker_icon_inset"
- android:bottom="@dimen/avatar_picker_icon_inset"
- android:drawable="@drawable/ic_avatar_choose_photo"/>
-</layer-list>
diff --git a/packages/SettingsLib/res/drawable/avatar_take_photo_circled.xml b/packages/SettingsLib/res/drawable/avatar_take_photo_circled.xml
deleted file mode 100644
index 7033aaeec911..000000000000
--- a/packages/SettingsLib/res/drawable/avatar_take_photo_circled.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
- ~ Copyright (C) 2022 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <shape android:shape="oval">
- <stroke
- android:width="2dp"
- android:color="?android:attr/colorPrimary"/>
- </shape>
- </item>
- <item
- android:left="@dimen/avatar_picker_icon_inset"
- android:right="@dimen/avatar_picker_icon_inset"
- android:top="@dimen/avatar_picker_icon_inset"
- android:bottom="@dimen/avatar_picker_icon_inset"
- android:drawable="@drawable/ic_avatar_take_photo"/>
-</layer-list>
diff --git a/packages/SettingsLib/res/values/arrays.xml b/packages/SettingsLib/res/values/arrays.xml
index 1b29e8367a78..5a4d3ce5661b 100644
--- a/packages/SettingsLib/res/values/arrays.xml
+++ b/packages/SettingsLib/res/values/arrays.xml
@@ -639,15 +639,6 @@
<item>disabled</item>
</array>
- <!-- Images offered as options in the avatar picker. If populated, the avatar_image_descriptions
- array must also be populated with a content description for each image. -->
- <array name="avatar_images"/>
-
- <!-- Content descriptions for each of the images in the avatar_images array. When overlaid
- these values should be translated, but this empty array must not be translated or it may
- replace the real descriptions with an empty array. -->
- <string-array name="avatar_image_descriptions" translatable="false"/>
-
<!-- NOTE: if you change this, you must also add the corresponding scale key and lookup table to
frameworks/base/core/java/android/content/res/FontScaleConverterFactory.java -->
<string-array name="entryvalues_font_size" translatable="false">
diff --git a/packages/SettingsLib/res/values/dimens.xml b/packages/SettingsLib/res/values/dimens.xml
index 07854bd3e5d8..2bd4d023cd72 100644
--- a/packages/SettingsLib/res/values/dimens.xml
+++ b/packages/SettingsLib/res/values/dimens.xml
@@ -84,13 +84,6 @@
<dimen name="add_a_photo_icon_size_in_user_info_dialog">32dp</dimen>
<dimen name="user_name_height_in_user_info_dialog">48sp</dimen>
- <integer name="avatar_picker_columns">3</integer>
- <dimen name="avatar_size_in_picker">96dp</dimen>
- <dimen name="avatar_picker_padding">6dp</dimen>
- <dimen name="avatar_picker_margin">2dp</dimen>
-
- <dimen name="avatar_picker_icon_inset">25dp</dimen>
-
<!-- Minimum increment between density scales. -->
<fraction name="display_density_min_scale_interval">9%</fraction>
<!-- Maximum density scale. The actual scale used depends on the device. -->
diff --git a/packages/SettingsLib/res/values/strings.xml b/packages/SettingsLib/res/values/strings.xml
index 46c649474af0..7e6b004be9b8 100644
--- a/packages/SettingsLib/res/values/strings.xml
+++ b/packages/SettingsLib/res/values/strings.xml
@@ -1564,10 +1564,6 @@
<string name="guest_notification_non_ephemeral_non_first_login">Reset to delete session
activity now, or you can save or delete activity on exit</string>
- <!-- An option in a photo selection dialog to take a new photo [CHAR LIMIT=50] -->
- <string name="user_image_take_photo">Take a photo</string>
- <!-- An option in a photo selection dialog to choose a pre-existing image [CHAR LIMIT=50] -->
- <string name="user_image_choose_photo">Choose an image</string>
<!-- Accessibility message for the photo selector which is a button/popup with the current photo [CHAR LIMIT=50] -->
<string name="user_image_photo_selector">Select photo</string>
@@ -1685,12 +1681,6 @@
<string name="accessibility_no_calling">No calling.</string>
- <!-- Title for a screen allowing the user to choose a profile picture. [CHAR LIMIT=NONE] -->
- <string name="avatar_picker_title">Choose a profile picture</string>
-
- <!-- Content description for a default user icon. [CHAR LIMIT=NONE] -->
- <string name="default_user_icon_description">Default user icon</string>
-
<!-- Title for the 'physical keyboard' settings screen. [CHAR LIMIT=35] -->
<string name="physical_keyboard_title">Physical keyboard</string>
<!-- Title for the keyboard layout preference dialog. [CHAR LIMIT=35] -->
diff --git a/packages/SettingsLib/src/com/android/settingslib/users/EditUserPhotoController.java b/packages/SettingsLib/src/com/android/settingslib/users/EditUserPhotoController.java
index b2de5a948836..cdc3f123eff7 100644
--- a/packages/SettingsLib/src/com/android/settingslib/users/EditUserPhotoController.java
+++ b/packages/SettingsLib/src/com/android/settingslib/users/EditUserPhotoController.java
@@ -62,6 +62,9 @@ public class EditUserPhotoController {
private static final String AVATAR_PICKER_ACTION = "com.android.avatarpicker"
+ ".FULL_SCREEN_ACTIVITY";
+ private static final String EXTRA_FILE_AUTHORITY = "file_authority";
+ private static final String EXTRA_DEFAULT_ICON_TINT_COLOR = "default_icon_tint_color";
+
static final String EXTRA_IS_USER_NEW = "is_user_new";
private final Activity mActivity;
@@ -73,10 +76,12 @@ public class EditUserPhotoController {
private Bitmap mNewUserPhotoBitmap;
private Drawable mNewUserPhotoDrawable;
private String mCachedDrawablePath;
+
public EditUserPhotoController(Activity activity, ActivityStarter activityStarter,
ImageView view, Bitmap savedBitmap, Drawable savedDrawable, String fileAuthority) {
this(activity, activityStarter, view, savedBitmap, savedDrawable, fileAuthority, true);
}
+
public EditUserPhotoController(Activity activity, ActivityStarter activityStarter,
ImageView view, Bitmap savedBitmap, Drawable savedDrawable, String fileAuthority,
boolean isUserNew) {
@@ -104,9 +109,9 @@ public class EditUserPhotoController {
}
if (requestCode == REQUEST_CODE_PICK_AVATAR) {
- if (data.hasExtra(AvatarPickerActivity.EXTRA_DEFAULT_ICON_TINT_COLOR)) {
+ if (data.hasExtra(EXTRA_DEFAULT_ICON_TINT_COLOR)) {
int tintColor =
- data.getIntExtra(AvatarPickerActivity.EXTRA_DEFAULT_ICON_TINT_COLOR, -1);
+ data.getIntExtra(EXTRA_DEFAULT_ICON_TINT_COLOR, -1);
onDefaultIconSelected(tintColor);
return true;
}
@@ -123,15 +128,16 @@ public class EditUserPhotoController {
}
private void showAvatarPicker(boolean isUserNew) {
- Intent intent;
+ Intent intent = new Intent(AVATAR_PICKER_ACTION);
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
if (Flags.avatarSync()) {
- intent = new Intent(AVATAR_PICKER_ACTION);
- intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.putExtra(EXTRA_IS_USER_NEW, isUserNew);
} else {
- intent = new Intent(mImageView.getContext(), AvatarPickerActivity.class);
+ // SettingsLib is used by multiple apps therefore we need to know out of all apps
+ // using settingsLib which one is the one we return value to.
+ intent.setPackage(mImageView.getContext().getApplicationContext().getPackageName());
}
- intent.putExtra(AvatarPickerActivity.EXTRA_FILE_AUTHORITY, mFileAuthority);
+ intent.putExtra(EXTRA_FILE_AUTHORITY, mFileAuthority);
mActivityStarter.startActivityForResult(intent, REQUEST_CODE_PICK_AVATAR);
}
@@ -183,7 +189,8 @@ public class EditUserPhotoController {
}
@Override
- public void onFailure(Throwable t) {}
+ public void onFailure(Throwable t) {
+ }
}, mImageView.getContext().getMainExecutor());
}
diff --git a/packages/SettingsLib/tests/integ/Android.bp b/packages/SettingsLib/tests/integ/Android.bp
index f303ab5fc54b..33d23a3ea16a 100644
--- a/packages/SettingsLib/tests/integ/Android.bp
+++ b/packages/SettingsLib/tests/integ/Android.bp
@@ -57,6 +57,7 @@ android_test {
"mockito-target-extended-minus-junit4",
"platform-test-annotations",
"truth",
+ "SettingsLibAvatarPicker",
"SettingsLibDeviceStateRotationLock",
"SettingsLibSettingsSpinner",
"SettingsLibUsageProgressBarPreference",
diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/users/AvatarPhotoControllerTest.java b/packages/SettingsLib/tests/integ/src/com/android/settingslib/users/AvatarPhotoControllerTest.java
index d988111c29d5..995314e44767 100644
--- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/users/AvatarPhotoControllerTest.java
+++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/users/AvatarPhotoControllerTest.java
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-package com.android.settingslib.users;
+package com.android.settingslib.avatarpicker;
-import static com.android.settingslib.users.AvatarPhotoController.REQUEST_CODE_CHOOSE_PHOTO;
-import static com.android.settingslib.users.AvatarPhotoController.REQUEST_CODE_CROP_PHOTO;
-import static com.android.settingslib.users.AvatarPhotoController.REQUEST_CODE_TAKE_PHOTO;
+import static com.android.settingslib.avatarpicker.AvatarPhotoController.REQUEST_CODE_CHOOSE_PHOTO;
+import static com.android.settingslib.avatarpicker.AvatarPhotoController.REQUEST_CODE_CROP_PHOTO;
+import static com.android.settingslib.avatarpicker.AvatarPhotoController.REQUEST_CODE_TAKE_PHOTO;
import static com.google.common.truth.Truth.assertThat;