Commit 08c1ca1
authored
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.1 parent 9954c92 commit 08c1ca1
File tree
3 files changed
+33
-1
lines changed- common/src/main/java/com/microsoft/identity/common/internal
- fido
- platform
3 files changed
+33
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
261 | 263 | | |
262 | 264 | | |
263 | 265 | | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
264 | 293 | | |
265 | 294 | | |
266 | 295 | | |
| |||
0 commit comments