Commit Graph

489 Commits

Author SHA1 Message Date
Chaohui Wang
c4a3a50d58 Migrate to CompoundButton
Switch and SwitchCompat are both CompoundButton.

Using CompoundButton in Java will helps migration in the future.

Bug: 306658427
Test: manual - on affected pages
Change-Id: I7cdc2601879a85d33f77239e38263320d5a6984e
2023-10-25 14:57:48 +08:00
Chaohui Wang
cfdb3b1f1b Migrate new() to SwitchPreferenceCompat
Bug: 306658427
Test: manual - on Settings pages
Change-Id: I258a8c63d5c46403c6d333a9d2f34c33cb35e27f
2023-10-24 14:05:34 +08:00
Chaohui Wang
15ca95a31b Migrate to TwoStatePreference
SwitchPreference and SwitchPreferenceCompat are both TwoStatePreference.

Using TwoStatePreference in Java will helps migration in the future.

Bug: 306771414
Test: manual - check Settings pages
Change-Id: I84e1d7b09451106797c2b23d127855c6976678ca
2023-10-23 09:28:57 +00:00
Manish Singh
6efc455f2c Show a separate tab for the Private Space
This covers all the known Settings pages using the tabbed view model.

https://docs.google.com/document/d/1CdjUjAE84-5ZEPRIfw5KYFjLVHtEZxc_sF0w95su8DA/edit?resourcekey=0-dAACT9HRexY1IyoxMmkVlw#heading=h.58jd58rmznte

Screenshots:
all apps
https://screenshot.googleplex.com/3E5Jm7Pi2JfN64r
with work tab:
https://screenshot.googleplex.com/8egk4yHK5jSENjR

PS Apps Special media management apps
https://screenshot.googleplex.com/BHHafqW7bgUwSGg
with work tab:
https://screenshot.googleplex.com/3cocdhruEmCCh5k

PS Location Services tab view
https://screenshot.googleplex.com/3DqJcT2BFTEpvYT
with work tab:
https://screenshot.googleplex.com/6Avpx6hxSrdGJw5

PS on screen keyboard tab view
https://screenshot.googleplex.com/4FzVNnBWwbUeJNw
with work tab:
https://screenshot.googleplex.com/8E8UhpWq8PL5nxU

PS password account tab view
https://screenshot.googleplex.com/6bDR4AKtth2S3EW
with work tab:
https://screenshot.googleplex.com/9msXV2TdHdJapch

PS storage tab view
https://screenshot.googleplex.com/5Nk2FTxwdmpEv3B
with work tab:
https://screenshot.googleplex.com/79tw2EaWZKfMsnC

PS appl_languages_work
https://screenshot.googleplex.com/3qrREeg3RQdHhhH

Bug: 302278487
Test: manual
Change-Id: I8cd39170827fbe251bc4075ef306206020b3a022
2023-10-11 12:32:17 +01:00
Tetiana Meronyk
8489ae99dc Revert "Disable multiuser toggle when more than 1 user is created"
Revert submission 24420426-multi_toggle

Reason for revert: This change needs to be done along with some other UI changes to avoid confusion

Reverted changes: /q/submissionid:24420426-multi_toggle

Change-Id: Ife2e03d0090fefcb4c1fa53dd007336759eb1bc7
2023-09-07 15:50:09 +00:00
Tetiana Meronyk
7968047fc5 Disable multiuser toggle when more than 1 user is created
It makes more sense to have the toggle as on permanently as long as there are other users on the device. Otherwise if we toggle off "Allow multiple users", other users get hidden. Also with current behaviour the any admin can switch the toggle and this can block any other user, including main, from being able to use the device.

Bug: 295183792
Test: atest MultiUserSwitchBarControllerTest && UserSettingsTest
Change-Id: I8cb0671d780f45c17a9bb7c9a9d3b108128ead9d
2023-08-15 15:59:14 +00:00
Tetiana Meronyk
d7a6a7f1ce Merge "Remove toggle "Turn on phone calls & SMS" from User Details of Main user" into main 2023-08-08 14:04:31 +00:00
Tetiana Meronyk
30ca0fbb3d Remove toggle "Turn on phone calls & SMS" from User Details of Main user
Admins should not be able to disable phone calls and SMS from the device owner.

Bug: 294846327
Test: atest UserDetailsSettingsTest
Change-Id: Ibb8532379c6e1e22fe45f2acb5191f8f6c7f3b0a
2023-08-08 09:53:33 +00:00
Chaohui Wang
2541381259 Fix references to resources for Settings
Bug: 293810334
Test: m Settings
Change-Id: Ie140278f492ef7e1c062ec1ecae2866c521a86aa
2023-08-08 01:56:05 +00:00
Tetiana Meronyk
6b27c08150 Fix keyboard showing after dialog dismissed
When dialog for creating user was dismissed with keyboard being displayed, the keyboard stayed on the screen and could not be released due to incorrect list of methods called on dialog dismissal. This CL topic fixes onDismiss() behaviour of this dialog. Videos of current behaviour and behaviour after fixed are attached to the bug.

Bug: 291865725
Test: atest UserSettingsTest
Change-Id: Ib3ade3de9228c8ba24e7ac2e235aaeec45efbe4e
2023-07-24 10:30:32 +00:00
Tetiana Meronyk
b88bad678d Fix "Allow guest to use telephony" toggle not updating its value
Bug: 283004333
Test: atest GuestTelephonyPreferenceControllerTest
Change-Id: I2f13a989bbe6a925c0e88350dbc215f6f188fe17
2023-07-04 15:32:14 +00:00
Treehugger Robot
e42dcd738d Merge "After deleting guest user, switch back to previous instead of user0." into udc-qpr-dev 2023-06-29 16:42:19 +00:00
Tetiana Meronyk
f059fb9a27 Merge "Remove "Allow guest to use phone" from devices without telephony." into udc-qpr-dev 2023-06-29 07:31:06 +00:00
Yasin Kilicdere
2d3fed86d1 After deleting guest user, switch back to previous instead of user0.
In Setting, after deleting or exiting the guest user, or failure to
reset the guest user involves switching back to user0, which is not
possible with HSUM (headless system user mode). With this CL we're
now switching back to previous foreground user instead of system user.

Bug: 283106632
Test: manual
Change-Id: Id60063cca75d9fded7dfe0b7d7a4b871d67c4b0c
2023-06-27 12:59:16 +01:00
Tetiana Meronyk
7c6f4ae19c Remove "Allow guest to use phone" from devices without telephony.
Bug: 282741809
Test: atest UserSettingsTest
Change-Id: I8c24dc021f1461c00765b41bf80f352948d14e43
2023-06-26 18:14:58 +00:00
Tetiana Meronyk
4899e50224 Add padding to dialog
Bug: 287265141
Test: on device with multiple admins enabled (default for HSUM) create a new
user and open User details view. Toggle Make this user an admin on/off.
Observe increased padding.

Change-Id: I216a91c4685eb12986cc4c61ae7be439358f55b2
2023-06-15 13:20:17 +00:00
Tetiana Meronyk
a0040c1402 Remove unused parameter from createDialog method in User Info edit dialog
Bug: 280568195
Test: atest EditUserInfoController
Change-Id: Ib31f7d61d1d3e624c1ae28fc38602fcf566af302
2023-05-30 16:41:47 +00:00
Tetiana Meronyk
d3335c2785 Make user creation flow in a single dialog
Bug: 266548780
Test: atest UserDetailsSettingsTest
Change-Id: I3df846aa480b80321269ac7b9b8723912597aba4
2023-05-04 15:18:35 +00:00
Tetiana Meronyk
0c7c7be962 Add confirmation dialog when granting/revoking admin privileges.
Bug: 266548780
Test: atest UserDetailsSettingsTest
Change-Id: I222ab6cbda138f0df379e6b6986b5ac462479833
2023-04-17 11:31:07 +00:00
Darrell Shi
a86614db74 Hide timeout to user0 pref when switching blocked.
Do not show the "timeout to admin user" settings preference when user
switching is blocked on the current user, e.g. in demo mode.

Test: atest SettingsRoboTests:TimeoutToDockUserPreferenceControllerTest
Bug: 255277938
Change-Id: Ibd0944c69254000a453f477eb72a0ba5832e9793
2023-03-31 22:14:35 +00:00
Victor Truong
f3c9a09cac Replace SystemUser checks with MainUser.
Bug: 257333623
Test: atest CommunalPreferenceControllerTest, atest UtilsTest, atest
TimeoutToDockUserPreferenceControllerTest

Change-Id: I5d2a818f9f35968ced1db7f9fa4b79432a502023
2023-02-01 15:16:48 -05:00
Tetiana Meronyk
2a06ccdfd5 Merge "Add UI metrics for granting admin rights from User Switcher" 2023-01-19 23:00:11 +00:00
Tetiana Meronyk
ff36d54d2c Add UI metrics for granting admin rights from User Switcher
Bug: 260697326
Test: manual
Change-Id: Ia4f3053bb84c5daaedb9a471b8a8f5dbaad66dba
2023-01-18 17:46:09 +00:00
Tetiana Meronyk
1f824d5c18 Add restriction to prevent user from being made an admin
Bug: 261700461
Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.UserDetailsSettingsTest"
Change-Id: Ie518a17ae330e9b0864e5179dff7eb1d03f3937b
2023-01-18 00:09:13 +00:00
Tetiana Meronyk
b389e9d551 Allow creating admin users when 'config_enableMultipleAdmins' property is enabled
Bug: 262371063
Test: manual
Change-Id: I465901a8d689239d9dda252c5d6f37ec0853b317
2022-12-28 16:46:33 +00:00
Tetiana Meronyk
e5acef9034 Add UI for multiple admins on Headless
In a series of CLs under topic add_ui_for_hsum_admins UI and functionality for allowing multiple admins on HSUM build is added. In User settings and User switcher when creating a new user there is a new dialog prompting to choose admin status of the user to be created. In User details view there is a toggle that is visible to admin users that allows to modify admin status of existing users. This toggle is only applicable to full users that are not supervised, guests or a main device user.

Bug: 252790451
Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.UserDetailsSettingsTest"
Change-Id: I447dc168be30aa614aeb3f8b71ad14a7223fd7c1
2022-12-21 11:02:39 +00:00
Anna Bauza
225c81df42 add settings log to remove and switch user
Bug: 260730616
Bug: 260733849

Test: croot && make RunSettingsRoboTests -j40
Change-Id: I870d6f53f377f293adb54c86d16cccf1bacac6a9
2022-12-20 18:36:18 +00:00
William Xiao
71ee3c3a5d Merge "Default to timing out to dock user in 1 minute" into tm-qpr-dev am: 0be191aeb7 am: 26343e8926
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20683709

Change-Id: I63dedfa49ec3d7c64c156d6a5da33772abfcc4b5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-16 00:04:15 +00:00
William Xiao
ea655e9695 Default to timing out to dock user in 1 minute
Previous default was to disable the feature.

Bug: 260123067
Test: verified locally on device that the default is 1 minute for a new
user

Change-Id: I8f577d62b729eb1c1a0579a7b4eb6b50f7f7f0d8
2022-12-12 18:36:30 -08:00
João Victor Mendes Freire
16a10ba0a1 Merge "Fix user avatar not being set on rotation" 2022-12-07 13:49:32 +00:00
João Victor Mendes Freire
d97f27b816 Merge "Fix user not being redirect to user details page" 2022-12-07 13:49:21 +00:00
João Victor Mendes Freire
6754d52673 Merge "Fix settings crash on users page on config change" 2022-12-07 13:49:08 +00:00
Anna Bauza
ec91ab2bec Merge "add settings log to user creation actions" 2022-12-06 15:25:51 +00:00
João Victor Mendes Freire
8b14ffb876 Fix user avatar not being set on rotation
This commit fixes the issue where the user avatar was not being colored
(using only the gray one) when the device was rotated. Additionally, it
fixes a race condition issue of the avatar color sometimes being
different than the selected one.

Bug: 261035066
Test: manually tested && atest UserSettingsComponentTest
Change-Id: I739fa8fd5d8717b602d7ba561d9c728ce622ff10
2022-12-05 20:05:05 +00:00
João Victor Mendes Freire
b59b276b3a Fix user not being redirect to user details page
When adding a new user and rotating the device, the settings app was not
redirecting to the user settings page, was occured with the device in
portrait.

Bug: 256013217
Test: manually tested
Change-Id: I724883ff3bc3653708d02b31d66b102ab6f7b3be
2022-12-02 14:45:43 +00:00
João Victor Mendes Freire
98c58a00fd Fix settings crash on users page on config change
The background task loses the reference to the Activity once it is
destroyed and recreated after a config change (such as screen rotation).
This resulted in getContext() returning null and openUserDetails()
crashing.
To fix this, we simply store the context before dispatching the
background worker.

Bug: 256021119
Test: manually tested
Change-Id: I3399fa5586de0cb5fc159204166f92902dd42de0
2022-12-02 12:46:33 +00:00
Anna Bauza
b6c3a34476 add settings log to user creation actions
Bug: 260573368
Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.UserSettingsTest"
Change-Id: If54799d074103df3a46945acab337bfa9d88dd0c
2022-12-01 19:11:57 +00:00
Jackson Michael Moreira Miranda
2122313bb5 Merge "Changing the process to create a new user" 2022-11-30 12:05:30 +00:00
Jackson Michael
e55a53b067 Changing the process to create a new user
Creating a method to run in background the process to create a new user, and making the user check and change the UI in the main thread.

Also deleted the message of created user from the handler.

Bug:246906179
Test: Manual test and unit test fixed
Change-Id: Ifb3687937987f04165fd2e099d4334c7571bb034
2022-11-25 20:19:30 +00:00
Nikhil Kumar
b61949c841 Hide remove user option for main user in multi user settings
Added isMain() user check in UserDetailsSettings.initialize and
UserDetailsSettings.canDeleteUser to hide and restrict
delete user option for main user in multi user settings.

Added unit tests for the same.

Bug: 260200162

Test: Manual test on headless to check remove user option
is not visible for the main user.

Test: Run robo tests with this command:
make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.users.UserDetailsSettingsTest"

Change-Id: Ia455611a3d0b1e0945f61f00658425b7bf6c2dae
2022-11-25 17:46:20 +00:00
Adam Bookatz
e5e232428d Introduce concept of DockUser
Dreams and docking often refers to "user zero" or "system user".
But more generally, the special user for dreams or switching-to-on-docking
need not be user 0, and in fact won't be in certain modes. So this needs updating.

Test: the files mentioned in the topic
Bug: 257333623
Change-Id: If068aa79a770bed4abf3f7ca1859a95cd1eb4ecd
Merged-In: If068aa79a770bed4abf3f7ca1859a95cd1eb4ecd
2022-11-14 19:19:21 +00:00
TreeHugger Robot
2c45688a13 Merge "Introduce concept of DockUser" 2022-11-14 15:00:56 +00:00
Adam Bookatz
81e5f3730c Introduce concept of DockUser
Dreams and docking often refers to "user zero" or "system user".
But more generally, the special user for dreams or switching-to-on-docking
need not be user 0, and in fact won't be in certain modes. So this needs updating.

Test: the files mentioned in the topic
Bug: 257333623
Change-Id: If068aa79a770bed4abf3f7ca1859a95cd1eb4ecd
2022-11-10 16:14:22 -08:00
Tetiana Meronyk
19fcb87e39 Hide "Add user" button for secondary user
Bug: 258447375
Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.UserSettingsTest" && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.MultiUserSwitchBarControllerTest"

Change-Id: I5f0fd25fb9f710f7311275b2a840663f2bf3eeab
2022-11-09 19:35:32 +00:00
Tetiana Meronyk
61d661feb9 Merge "Disable toggle on managed device with "Disallow add user" or "Disallow switch user"" 2022-11-07 09:27:30 +00:00
TreeHugger Robot
1f41a637a2 Merge "Crop avatar to circle when syncing from Contacts." into tm-qpr-dev am: 057d24bb97 am: 56f9461b45
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20347031

Change-Id: I9fd63455801f7dcd3da74f036aceb0e1f99765af
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-04 18:17:14 +00:00
Oli Lan
e402603084 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
2022-11-02 16:26:58 +00:00
Tetiana Meronyk
3ade4a3ad7 Disable toggle on managed device with "Disallow add user" or "Disallow switch user"
Bug: 244279615
Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.MultiUserSwitchBarControllerTest"
Change-Id: I3e89c8fac1828b4c9bb1c7df08687684981bda11
2022-10-24 22:06:57 +00:00
Jackson Michael
898421bd0c Adding the sections "Allow multiple users" and "Delete guest activity" on the search result
Also added new keywords strings for the both items.

Bug: 245261104
Test: Manual test and unit test
Change-Id: I3ddc1204c6dbdcd6a82ffaa55f4ca7f4bcb3783d
2022-10-13 12:31:03 +00:00
Nikhil Kumar
0661a7640f Enable Name and Avatar change without turning on multi-user
Primary user will be displayed in user list even when the
multi-user settings is disabled.
This will allow users to change the name and avatar of
primary user without enabling the multi-user feature.

Test: croot && make RunSettingsRoboTests -j40
ROBOTEST_FILTER="com.android.settings.users.UserSettingsTest"

Bug: 246732754
Change-Id: I4eb5aaf97630135960410bea7cdddc52b5848a1e
2022-09-21 14:07:42 +01:00