summaryrefslogtreecommitdiff
path: root/core/java/android/os/UserManager.java
Commit message (Collapse)AuthorAgeFilesLines
* Fix security vulnerability that creates user with no restrictions when ↵Tetiana Meronyk2024-04-091-4/+19
| | | | | | | | | | accountOptions are too long. Bug: 293602970 Test: atest UserManagerTest#testAddUserAccountData_validStringValuesAreSaved_validBundleIsSaved && atest UserManagerTest#testAddUserAccountData_invalidStringValuesAreTruncated_invalidBundleIsDropped (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:8dc6feaee7c0a5cea093b5280acaad862921cf3e) Merged-In: I23c971f671546ac085060add89485cfac6691ca3 Change-Id: I23c971f671546ac085060add89485cfac6691ca3
* Merge "Move getUserSwitchability from UserManager to UserManagerService." ↵Yasin Kilicdere2023-01-101-43/+13
|\ | | | | | | into tm-qpr-dev
| * Move getUserSwitchability from UserManager to UserManagerService.Yasin Kilicdere2023-01-061-43/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UserManager.getUserSwitchability was calling telecomManager.isInCall method to see whether there is an ongoing phone call. Since the call was made from client side, it was causing a SecurityException when switcing users via adb command and breaking CtsMultiUserHostTestCases tests. This CL moves all the logic from UserManager to UserManagerService, and calls telecomManager.isInCall() with Binder.clearCallingIdentity. Bug: 257538981 Bug: 261505371 Fixes: 260184263 Test: atest CtsMultiUserHostTestCases Merged-In: Idfca1fcb89688d08878b908ceed9c64f1e7091d3 Change-Id: Idfca1fcb89688d08878b908ceed9c64f1e7091d3 (cherry picked from commit 2f17ef912ee8cc321d54b08acb119d1ad641b756)
* | Merge "docs: Explanation on "profile owner on the primary user"" into tm-dev ↵Pietro Maggi2023-01-081-2/+5
|\ \ | |/ |/| | | | | | | | | | | | | am: de6b490d72 am: 2d0e68d362 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20403491 Change-Id: If220f4e475f1bfb23848c72ce1101a5be03a1cd2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| * docs: Explanation on "profile owner on the primary user"Pietro F. Maggi2023-01-081-2/+5
| | | | | | | | | | | | | | | | | | staging: https://android.devsite.corp.google.com/reference/android/os/UserManager?db=pmaggi#DISALLOW_USB_FILE_TRANSFER Bug: 224648697 Test: documentation fix Change-Id: Ie3efcc71542753fc5e2a3d023e31b361ae2b4a83
* | Add Android Multiuser Atom which will contain number of supported users.Anna Bauza2022-08-231-17/+7
| | | | | | | | | | | | | | | | | | | | Metric [Design Doc approved](https://eldar.corp.google.com/assessments/860295929/revisions/1?jsmode=du&mods=eldarui_search#sections/999001). Bug: 240582354 Test: statsd_testdrive 10160 Change-Id: I3cfbd2f79e71df6b2952d73d5a2bd20268708129 (cherry picked from commit c3249a8704b5c2fb890378e8c39bc1e59f63918f) Merged-In: I3cfbd2f79e71df6b2952d73d5a2bd20268708129
* | Check for null application context in UserManager.Oli Lan2022-07-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | UserManager currently always uses getApplicationContext for its internal context object, but that method can return null under certain circumstances. This CL adds a null check, so that the original context is used if the app context is null. Bug: 232179155 Bug: 233915566 Test: atest UserManagerTest Test: install Apex Launcher and App Hider on device with work profile Change-Id: I26bcf693da8f5bc53126f79f9e6ffb17bd87fc84
* | Merge "Improve javadoc for Wi-Fi related policies" into tm-dev am: ↵TreeHugger Robot2022-05-181-1/+5
|\| | | | | | | | | | | | | | | | | e51b62b2a3 am: 46c447841b Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18374443 Change-Id: I1116841f8b67c8fc0859e02af4c21dae18c922bf Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| * Improve javadoc for Wi-Fi related policiesRubin Xu2022-05-161-1/+5
| | | | | | | | | | | | Bug: 226128486 Test: none Change-Id: I21f0f0eb1f9a4754d42f4ae3c8e8a36865d58afa
* | Merge "Ensure getUserName cannot return null" into tm-dev am: 1503b56202 am: ↵Adam Bookatz2022-05-041-1/+4
|\| | | | | | | | | | | | | | | | | 10b45a2107 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18126297 Change-Id: Ib4bc41d74d8f486e79e43e7b332c93a2051c562b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| * Ensure getUserName cannot return nullAdam Bookatz2022-05-021-1/+4
| | | | | | | | | | | | | | | | | | | | A user can be created with an explicitly null name, as happens in tests. But getUserName claims to never return null. So we must do a null-check here to prevent it. Bug: 227624966 Test: atest UserManagerTest Change-Id: Iea0e7b6292c6dd49df1bebc5467091a82ddaedb5
* | Guest mode updates to resolve privacy concerns in guest modeKedar Chitnis2022-04-141-2/+50
|/ | | | | | | | | | | | | | | | | | | | | | | | | - Add API in IUserManager to allow setting ephemeral user flag - Implement and export this API in UserManagerService and UserManager - Set guest as ephermal by default when createGuest in UserManager is called - Handle guest user switching in UserSwitcherController for the case of dynamic change of ephemeral state - Add persistant notification when in guest mode to indicate - if guest session is new or previously used. - if guest session will be cleared on exit or not - Add buttons in persistant notification to reset or exit guest - Add flags to enable/disable this feature Bug: 214031645 Screenshots: go/ephemeral-guest-b-214031645-ux Test: Manual test using sunfish, atest SystemUITests, atest SettingsRoboTests Relands ag/16545010 after resolving post submit issues Revert "Revert "Guest mode updates to resolve privacy concerns in guest mode"" This reverts commit dd5c440802078291a88e9f939e8a25348ec81315. Change-Id: I46b8ab527bab8fe665114ed0fffbb06a59d49a77 Merged-In: I46b8ab527bab8fe665114ed0fffbb06a59d49a77
* Merge "Expand Javadoc for DISALLOW_WIFI_TETHERING" into tm-devStephanie Bak2022-04-051-1/+5
|\
| * Expand Javadoc for DISALLOW_WIFI_TETHERINGStephanie Bak2022-04-041-1/+5
| | | | | | | | | | | | Bug: 226126768 Test: atest UserManagerTest Change-Id: I1a1e166b4238ff20f30dfd7a2664d9a33dbe020c
* | Merge "Relax permissions for isUserOfType, isUserNameSet" into tm-devAdam Bookatz2022-03-221-4/+15
|\ \
| * | Relax permissions for isUserOfType, isUserNameSetAdam Bookatz2022-03-091-4/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | * Relaxes isUserNameSet to have the same permission requirements as getUserName * Relaxes isUserOfType to have the same permissions requirements as getUserType (although the former is SystemApi and the latter is TestApi). Test: android.multiuser.cts.UserManagerTest Bug: 155116208 Bug: 155114273 Change-Id: I70a9cf98e5ff27f8db8a6616778c7d87bcccb9f9
* | RESTRICT AUTOMERGE Refactor device policy resource APIs to a separate classkholoud mohamed2022-03-191-2/+2
| | | | | | | | | | | | | | | | Bug: 217388602 Bug: 218875965 Test: atest EnterpriseResourcesTests Test: manual Change-Id: I8af03136e67057d171e97cb5a43187aa6c7f4fe7
* | Merge "Improved error code for Remove Result" into tm-devMayank Garg2022-03-151-5/+51
|\ \
| * | Improved error code for Remove ResultMayank Garg2022-03-091-5/+51
| | | | | | | | | | | | | | | | | | | | | Bug: 215555912 Test: atest UserManagerTest Change-Id: If92e9a3fcc042236c89ec13e691412dbb6a18a66
* | | Renaming isCredentialSharedWithParent to isCredentialSharableWithParentSarup Dalwani2022-03-071-3/+3
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | Renaming isCredentialSharedWithParent to isCredentialSharableWithParent, as for work profile there is possibility to enroll its own credential. Bug: 222108271 Test: atest android.multiuser.cts.UserManagerTest atest LockSettingsServiceTests Change-Id: If343342d0a5e996cbd430a4063b25fbc4874c5c0 Merged-In: If343342d0a5e996cbd430a4063b25fbc4874c5c0 (cherry picked from commit ece66c411622bfa418c7c8d5d302ac276b34c1dd)
* | Merge "Fix Guest string was not translated in UMS.userWithName()" into tm-devYasin Kilicdere2022-03-041-6/+4
|\ \
| * | Fix Guest string was not translated in UMS.userWithName()Yasin Kilicdere2022-03-031-6/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Guest users name was stuck with the language when it was created, and it wasn't changing with the active language setting. To solve that, removed name parameter from UM.createGuest() and created the guest user with a null name, then made changes in UMS.userWithName() to fill the name of guest user with the active language's translation when it has a null name. Creating a guest with a specific name is still supported through UM.createUser API. Bug: 185309160 Test: atest com.android.server.pm.UserManagerTest Change-Id: I2745aed0ea722765a11c6da40fb4159146da54c7 Merged-In: I2745aed0ea722765a11c6da40fb4159146da54c7 (cherry picked from commit c556777ca4af81c2dde2fa383baae20398e3029e)
* / Document isManagedProfile usage should probably be isProfileAdam Bookatz2022-03-031-0/+6
|/ | | | | | | | Much usage of isManagedProfile should probably really be isProfile instead, so have the javadoc explicitly point to it. Bug: 170249807 Change-Id: Ia6c3cc6d052f2b9f6581fd160410b9ef601c3bcf Test: N/A (just doc)
* Merge "Added RemoveResult annotation to RemoveUserWhenPossible call"TreeHugger Robot2022-02-121-3/+4
|\
| * Added RemoveResult annotation to RemoveUserWhenPossible callMayank Garg2022-02-111-3/+4
| | | | | | | | | | | | Bug: 215555912 Test: m Change-Id: I82dff56942cbc576a1205e09b25fcc26f882b1d7
* | UserManager.getProfileType hidden API and cachingAdam Bookatz2022-02-101-49/+77
|/ | | | | | | | | | | | | | | | | Currently we have a few APIs for isXXXProfile. In the case of managed profiles, we cachce the results. Here, we introduce a new hidden API getProfileType, which gets and caches the user type (string), if the user type is a profile. That way, we automatically have the caching benefits for all profiles, not just managed profiles. We only do this for profiles because they have a relaxed permission requirement. Other user types have strong restrictions, so we do not use their more general getters here. Test: atest UserManagerTest Change-Id: I36b4caead83954518d6fc48860af61f8988f19a9
* Merge "Expose UserManager#isProfile as a public API"Kholoud Mohamed2022-02-091-3/+3
|\
| * Expose UserManager#isProfile as a public APIkholoud mohamed2022-02-091-3/+3
| | | | | | | | | | | | | | Test: N/A Bug: 188410712 Bug: 206106797 Change-Id: Id27a56a69af7abe91f4c61cc31511fc854123704
* | Merge "Use isCredentialSharedWithParent in LockSettingsService"Sailendra Bathi2022-02-081-0/+22
|\ \
| * | Use isCredentialSharedWithParent in LockSettingsServicesailendrabathi2022-02-021-0/+22
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Created property isCredentialSharedWithParent in UserTypeDetails which is true for managed and clone profiles. This is used in LockSettingsService for sharing the locking credentials with its parent user. Bug: 214355283 Test: atest android.multiuser.cts.UserManagerTest Test: atest LockSettingsServiceTests Change-Id: I6ceaf498aadce7e713b20a4d24e4a29e812eb0ca
* / Remove allowedToRemoveOne boolean parameter from ↵Yasin Kilicdere2022-02-021-7/+2
|/ | | | | | | | UM.getRemainingCreatableProfileCount() Bug: 217364189 Test: atest android.multiuser.cts.UserManagerTest Change-Id: Idebeab6407eb90967dcd0ebbcfaba4b76a8f1263
* Merge "Add APIs to UserManager for getting remaining user/profile counts."Yasin Kilicdere2022-01-271-2/+56
|\
| * Add APIs to UserManager for getting remaining user/profile counts.Yasin Kilicdere2022-01-241-2/+56
| | | | | | | | | | | | | | | | | | | | | | Add UM.getRemainingCreatableUserCount(userType) method as a system API. Add UM.getRemainingCreatableProfileCount(userType, allowedToRemoveOne) method as a system API. Bug: 208842920 Bug: 142482943 Test: atest android.multiuser.cts.UserManagerTest Change-Id: I286fe10b2c8448aeb03ee6c791d415ef62f50451
* | Merge "Renamed removeUserOrSetEphemeral completely"TreeHugger Robot2022-01-251-27/+0
|\ \ | |/ |/|
| * Renamed removeUserOrSetEphemeral completelyMayank Garg2022-01-201-27/+0
| | | | | | | | | | | | | | | | Remaining Task: add more CTS tests for removeUserWhenPossible Bug: 199446770 Test: m Change-Id: I709ad0eeba3d01f11000b2f5647f385b17fa9c63
* | Merge "Allow updating enterprise strings in the framework"Kholoud Mohamed2022-01-241-0/+15
|\ \
| * | Allow updating enterprise strings in the frameworkkholoud mohamed2022-01-211-0/+15
| |/ | | | | | | | | | | | | Bug: 188410712 Bug: 211422509 Test: manual Change-Id: Ia27b22b6cad14c8b62f3415a4967e479c21eb30c
* | Merge "Restricting creation of Clone Profile when the device owner is set"Sarup Dalwani2022-01-241-0/+15
|\ \ | |/ |/|
| * Restricting creation of Clone Profile when the device owner is setSarup Dalwani2022-01-201-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As part of Android S, the restriction was enforced by CDD but the user creation flow did not block creation of clone profile. Creating changes that will add user restriction of type UserManager.DISALLOW_ADD_CLONE_PROFILE while setting up device owner. This restriction is checked while user creation flow and throws UserManager.CheckedUserOperationException. When the device owner is removed, the user restriction UserManager.DISALLOW_ADD_CLONE_PROFILE is removed and creation of clone profile is allowed. Bug: 211862605 Test: 1. atest FrameworksServicesTests:com.android.server.devicepolicy.DevicePolicyManagerTest 2. atest FrameworksServicesTests:com.android.server.pm.UserManagerTest 3. Manually tried creation of clone profile before setting device owner, able to create clone profile 4. Manually set device owner and tried to create clone profile, unable to create clone profile 5. Manually removed device owner and tried to create clone profile, able to create clone profile. Change-Id: Id87756601a25323e06036a3193f6a7f8f53fa71d
* | Replaced removeUserOrSetEphemeral by removeUserWhenPossibleMayank Garg2022-01-121-2/+2
| | | | | | | | | | | | Bug: 199446770 Test: m (successful build) Change-Id: I5d46b168979b954921d99183db2362a77d7fa09f
* | Merge "Added removeUserWhenPossible API as SystemAPI"Mayank Garg2022-01-111-13/+51
|\ \
| * | Added removeUserWhenPossible API as SystemAPIMayank Garg2022-01-091-13/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also converted following APIs to SystemAPI: android.os.UserManager.REMOVE_RESULT_ALREADY_BEING_REMOVED android.os.UserManager.REMOVE_RESULT_ERROR android.os.UserManager.REMOVE_RESULT_DEFERRED android.os.UserManager.REMOVE_RESULT_REMOVED Remaining task: remove all occurance of UserManager.removeUserOrSetEphemeral Bug: 197181121 Bug: 199446770 Bug: 199446810 CTS-Coverage-Bug: 199446770 Test: m system-api-stubs-docs-non-updatable-update-current-api m module-lib-api-stubs-docs-non-updatable-update-current-api Change-Id: Iea7867268950050f90d8509d7f3d09725d850a5e
* | | Prepare PropertyInvalidatedCache for SystemApiLee Shombert2022-01-041-4/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 152453213 Tag: #refactor This commit prepares PropertyInvalidatedCache to function as a system api. Specifically, the methods recompute() and bypass() which may be overridden by clients are now public (instead of protected). This forces an update to all existing clients, to accommodate the change in method visibility. Two small changes have been made as cleanup: 1. The awkwardly named debugCompareQueryResults() is now resultEquals(), which is more or less consistent with how other equality tests are named in Android. This name change affects two clients. 2. PackageManager has changed to use resultEquals() instead of maybeCheckConsistency(). This provides a simpler and more consistent use of the APIs. maybeCheckConsistency() has been made private. Test: atest PropertyInvalidatedCacheTests Change-Id: I4110f8e887a4fd8c784141e8892557a9d1b80a94
* / Add settings entrypoint to add a supervised userYasin Kilicdere2021-12-141-0/+11
|/ | | | | | | Bug: 205101183 Bug: 199868785 Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.UserSettingsTest" Change-Id: Ief48a9d974f3a40191161e02bbed605e4327c454
* Merge changes from topic "queryUser"Kholoud Mohamed2021-12-101-67/+126
|\ | | | | | | | | | | * changes: Add QUERY_USERS permission to some UserManager APIs Create new QUERY_USERS permission
| * Add QUERY_USERS permission to some UserManager APIskholoud mohamed2021-12-091-67/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The followings APIs now accept QUERY_USERS (and any other APIs that depends on them): * getUserRestrictionSources * isSameProfileGroup * getAllProfiles * isManagedProfile * canAddMoreManagedProfiles Also exposed isProfile as public, and deprecated getEnabledProfiles Test: atest android.multiuser.cts.UserManagerTest Bug: 188410712 Bug: 205707885 Bug: 206106797 Change-Id: I4cc4f7078271e42a2bcaa6965c107a6e249e00fc
* | Adding new user restrictions - DISALLOW_WIFI_DIRECT, DISALLOW_ADD_WIFI_CONFIGStephanie Bak2021-12-011-0/+39
|/ | | | | | Bug: 197558754 Test: atest UserRestrictionsTest Change-Id: I9e626834afc238aa0c24f6aff25a7834d3faf9fa
* Merge "UserManager.isUserTypeEnabled"Adam Bookatz2021-11-291-0/+19
|\
| * UserManager.isUserTypeEnabledAdam Bookatz2021-11-231-0/+19
| | | | | | | | | | | | | | | | | | | | Introduce hidden API for Settings to determine whether a given user type is enabled, so that it knows not to show the option for creating users of that type. Bug: 192577100 Test: com.android.settings.users.UserSettingsTest Change-Id: Ie99b0772dce3bb275aded0f6ef0404466a76b660
* | Merge "Adding a new user restriction DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI"Stephanie Bak2021-11-291-0/+22
|\ \