-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Managed profile Android util method (#2561)
### Summary This PR creates an `AndroidPlatformUtil` method named `isInWorkProfile`, which returns a boolean based on if the host app is in a work profile. For Android level 30 (Android 11/R) and above, we are able to use the simple `isManagedProfile` method of `UserManager`. For Android level 21 (Android 5/Lollipop) and above, we get the `DevicePolicyManager` instance and get a list of the active admins. If any of these active admins are found to be the profile owner app, then we know that the calling app is in a work profile. (We do something similar in `InstallCertActivity` of the WPJ feature). If the device is below Android level 21 (should be very rare), we always return false. I tested this method out using testDPC and made sure both paths of the logic return the correct values.
- Loading branch information
1 parent
9954c92
commit 08c1ca1
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters