|
17 | 17 |
|
18 | 18 | import android.app.admin.DevicePolicyManager;
|
19 | 19 | import android.content.ComponentName;
|
| 20 | +import android.content.Intent; |
| 21 | +import android.content.pm.PackageManager; |
20 | 22 | import android.content.pm.PackageManager.NameNotFoundException;
|
21 | 23 | import android.graphics.Bitmap;
|
22 | 24 | import android.os.Bundle;
|
@@ -66,6 +68,21 @@ public interface DevicePolicyManagerGateway {
|
66 | 68 | */
|
67 | 69 | boolean isOrganizationOwnedDeviceWithManagedProfile();
|
68 | 70 |
|
| 71 | + /** |
| 72 | + * See {@link android.os.UserManager#isHeadlessSystemUserMode()}. |
| 73 | + */ |
| 74 | + boolean isHeadlessSystemUserMode(); |
| 75 | + |
| 76 | + /** |
| 77 | + * See {@link android.os.UserManager#isUserForeground()}. |
| 78 | + */ |
| 79 | + boolean isUserForeground(); |
| 80 | + |
| 81 | + /** |
| 82 | + * See {@link android.app.admin.DevicePolicyManager#listForegroundAffiliatedUsers()}. |
| 83 | + */ |
| 84 | + List<UserHandle> listForegroundAffiliatedUsers(); |
| 85 | + |
69 | 86 | /**
|
70 | 87 | * See {@link android.app.admin.DevicePolicyManager#createAndManageUser(android.content.ComponentName, String, android.content.ComponentName, android.os.PersistableBundle, int)}.
|
71 | 88 | */
|
@@ -208,6 +225,19 @@ void wipeData(int flags, @NonNull Consumer<Void> onSuccess,
|
208 | 225 | */
|
209 | 226 | @NonNull List<String> getUserControlDisabledPackages();
|
210 | 227 |
|
| 228 | + /** |
| 229 | + * See {@link android.app.admin.DevicePolicyManager#setPermittedInputMethods( |
| 230 | + * android.content.ComponentName, List)}. |
| 231 | + */ |
| 232 | + boolean setPermittedInputMethods(List<String> packageNames, @NonNull Consumer<Void> onSuccess, |
| 233 | + @NonNull Consumer<Exception> onError); |
| 234 | + |
| 235 | + /** |
| 236 | + * See {@link android.app.admin.DevicePolicyManager#setPermittedInputMethods( |
| 237 | + * android.content.ComponentName, List)}. |
| 238 | + */ |
| 239 | + boolean setPermittedInputMethods(List<String> packageNames); |
| 240 | + |
211 | 241 | /**
|
212 | 242 | * See {@link android.app.admin.DevicePolicyManager#removeActiveAdmin(android.content.ComponentName)}.
|
213 | 243 | */
|
@@ -240,6 +270,30 @@ void setPasswordQuality(int quality, @NonNull Consumer<Void> onSuccess,
|
240 | 270 | void transferOwnership(@NonNull ComponentName target, @Nullable PersistableBundle bundle,
|
241 | 271 | @NonNull Consumer<Void> onSuccess, @NonNull Consumer<Exception> onError);
|
242 | 272 |
|
| 273 | + /** |
| 274 | + * See android.app.admin.DevicePolicyManager#setUsbDataSignalingEnabled( |
| 275 | + * android.content.ComponentName, boolean) |
| 276 | + */ |
| 277 | + void setUsbDataSignalingEnabled(boolean enabled, @NonNull Consumer<Void> onSuccess, |
| 278 | + @NonNull Consumer<Exception> onError); |
| 279 | + |
| 280 | + /** |
| 281 | + * Same as {@link #setUsbDataSignalingEnabled(boolean, Consumer, Consumer)}, but ignoring |
| 282 | + * callbacks. |
| 283 | + */ |
| 284 | + void setUsbDataSignalingEnabled(boolean enabled); |
| 285 | + |
| 286 | + /** |
| 287 | + * See {@link android.app.admin.DevicePolicyManager#setPreferentialNetworkServiceEnabled(ComponentName, boolean)}. |
| 288 | + */ |
| 289 | + void setPreferentialNetworkServiceEnabled(boolean enabled, |
| 290 | + @NonNull Consumer<Void> onSuccess, @NonNull Consumer<Exception> onError); |
| 291 | + |
| 292 | + /** |
| 293 | + * See {@link android.app.admin.DevicePolicyManager#isPreferentialNetworkServiceEnabled(ComponentName)}. |
| 294 | + */ |
| 295 | + boolean isPreferentialNetworkServiceEnabled(); |
| 296 | + |
243 | 297 | /**
|
244 | 298 | * See {@link android.app.admin.DevicePolicyManager#setPackagesSuspended(ComponentName, String[], boolean)}.
|
245 | 299 | */
|
@@ -267,11 +321,31 @@ void setApplicationHidden(String packageName, boolean suspended, @NonNull Consum
|
267 | 321 | */
|
268 | 322 | void setPersonalAppsSuspended(boolean suspended, @NonNull Consumer<Void> onSuccess,
|
269 | 323 | @NonNull Consumer<Exception> onError);
|
| 324 | + |
270 | 325 | /**
|
271 | 326 | * See {@link android.app.admin.DevicePolicyManager#getPersonalAppsSuspendedReasons(ComponentName)}.
|
272 | 327 | */
|
273 | 328 | int getPersonalAppsSuspendedReasons();
|
274 | 329 |
|
| 330 | + // TODO(b/171350084): use on CosuConfig |
| 331 | + /** |
| 332 | + * See {@link android.app.admin.DevicePolicyManager#enableSystemApp(ComponentName, String)}. |
| 333 | + */ |
| 334 | + void enableSystemApp(String packageName, @NonNull Consumer<Void> onSuccess, |
| 335 | + @NonNull Consumer<Exception> onError); |
| 336 | + |
| 337 | + /** |
| 338 | + * See {@link android.app.admin.DevicePolicyManager#enableSystemApp(ComponentName, Intent)}. |
| 339 | + */ |
| 340 | + void enableSystemApp(Intent intent, @NonNull Consumer<Integer> onSuccess, |
| 341 | + @NonNull Consumer<Exception> onError); |
| 342 | + |
| 343 | + /** |
| 344 | + * Queries {@link PackageManager} to get the list of apps that are disabled for the user. |
| 345 | + */ |
| 346 | + @NonNull |
| 347 | + List<String> getDisabledSystemApps(); |
| 348 | + |
275 | 349 | // TODO(b/171350084): use in other places
|
276 | 350 | /**
|
277 | 351 | * See {@link android.app.admin.DevicePolicyManager#setLockTaskPackages(ComponentName, String[])}.
|
@@ -320,7 +394,7 @@ void setApplicationRestrictions(String packageName, Bundle settings,
|
320 | 394 | * See {@link android.app.admin.DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)}.
|
321 | 395 | */
|
322 | 396 | void setPermissionGrantState(String packageName, String permission, int grantState,
|
323 |
| - @NonNull Consumer<Boolean> onSuccess, @NonNull Consumer<Exception> onError); |
| 397 | + @NonNull Consumer<Void> onSuccess, @NonNull Consumer<Exception> onError); |
324 | 398 |
|
325 | 399 | /**
|
326 | 400 | * See {@link android.app.admin.DevicePolicyManager#getPermissionGrantState(ComponentName, String, String)}.
|
@@ -349,6 +423,23 @@ void setDeviceOwnerLockScreenInfo(CharSequence info, @NonNull Consumer<Void> onS
|
349 | 423 | */
|
350 | 424 | CharSequence getDeviceOwnerLockScreenInfo();
|
351 | 425 |
|
| 426 | + /** |
| 427 | + * See {@link android.app.admin.DevicePolicyManager#setKeyguardDisabled(ComponentName, boolean)}. |
| 428 | + */ |
| 429 | + void setKeyguardDisabled(boolean disabled, @NonNull Consumer<Void> onSuccess, |
| 430 | + @NonNull Consumer<Exception> onError); |
| 431 | + |
| 432 | + /** |
| 433 | + * See {@link android.app.admin.DevicePolicyManager#setKeyguardDisabledFeatures(ComponentName, int)}. |
| 434 | + */ |
| 435 | + void setKeyguardDisabledFeatures(int which, @NonNull Consumer<Void> onSuccess, |
| 436 | + @NonNull Consumer<Exception> onError); |
| 437 | + |
| 438 | + /** |
| 439 | + * See {@link android.app.admin.DevicePolicyManager#getKeyguardDisabledFeatures(ComponentName)}. |
| 440 | + */ |
| 441 | + int getKeyguardDisabledFeatures(); |
| 442 | + |
352 | 443 | /**
|
353 | 444 | * Used on error callbacks to indicate a {@link android.app.admin.DevicePolicyManager} method
|
354 | 445 | * call failed.
|
|
0 commit comments