@Implements(value=android.app.admin.DevicePolicyManager.class)
public class ShadowDevicePolicyManager
extends java.lang.Object
Shadow for DevicePolicyManager
| Constructor and Description |
|---|
ShadowDevicePolicyManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addUserRestriction(android.content.ComponentName admin,
java.lang.String key) |
void |
clearUserRestriction(android.content.ComponentName admin,
java.lang.String key) |
int |
enableSystemApp(android.content.ComponentName admin,
java.lang.String packageName) |
java.lang.String[] |
getAccountTypesWithManagementDisabled() |
java.util.List<android.content.ComponentName> |
getActiveAdmins() |
android.os.Bundle |
getApplicationRestrictions(android.content.ComponentName admin,
java.lang.String packageName) |
android.os.Bundle |
getApplicationRestrictions(java.lang.String packageName)
Returns all application restrictions of the
packageName in a Bundle. |
boolean |
getAutoTimeRequired() |
protected java.lang.String |
getDeviceOwner() |
int |
getOrganizationColor(android.content.ComponentName admin) |
java.lang.CharSequence |
getOrganizationName(android.content.ComponentName admin)
Returns organization name.
|
java.util.List<java.lang.String> |
getPermittedAccessibilityServices(android.content.ComponentName admin) |
java.util.List<java.lang.String> |
getPermittedInputMethods(android.content.ComponentName admin) |
protected android.content.ComponentName |
getProfileOwner() |
boolean |
isAdminActive(android.content.ComponentName who) |
boolean |
isApplicationHidden(android.content.ComponentName admin,
java.lang.String packageName) |
boolean |
isDeviceOwnerApp(java.lang.String packageName) |
boolean |
isProfileOwnerApp(java.lang.String packageName) |
boolean |
isUninstallBlocked(android.content.ComponentName admin,
java.lang.String packageName) |
void |
setAccountManagementDisabled(android.content.ComponentName admin,
java.lang.String accountType,
boolean disabled) |
void |
setActiveAdmin(android.content.ComponentName componentName)
Sets the given
componentName as one of the active admins. |
void |
setApplicationHidden(android.content.ComponentName admin,
java.lang.String packageName,
boolean hidden) |
void |
setApplicationRestrictions(android.content.ComponentName admin,
java.lang.String packageName,
android.os.Bundle applicationRestrictions) |
void |
setApplicationRestrictions(java.lang.String packageName,
android.os.Bundle applicationRestrictions)
Sets the application restrictions of the
packageName. |
void |
setAutoTimeRequired(android.content.ComponentName admin,
boolean required) |
void |
setDeviceOwner(android.content.ComponentName admin)
Sets the admin as active admin and device owner.
|
void |
setOrganizationColor(android.content.ComponentName admin,
int color) |
void |
setOrganizationName(android.content.ComponentName admin,
java.lang.CharSequence name)
Sets organization name.
|
boolean |
setPermittedAccessibilityServices(android.content.ComponentName admin,
java.util.List<java.lang.String> packageNames)
Sets permitted accessibility services.
|
boolean |
setPermittedInputMethods(android.content.ComponentName admin,
java.util.List<java.lang.String> packageNames)
Sets permitted input methods.
|
void |
setProfileOwner(android.content.ComponentName admin)
Sets the admin as active admin and profile owner.
|
void |
setUninstallBlocked(android.content.ComponentName admin,
java.lang.String packageName,
boolean uninstallBlocked) |
boolean |
wasPackageEverHidden(java.lang.String packageName)
Returns
true if the given packageName was ever hidden. |
boolean |
wasSystemAppEnabled(java.lang.String packageName)
Returns
true if the given packageName was a system app and was enabled. |
@Implementation public boolean isDeviceOwnerApp(java.lang.String packageName)
@Implementation public boolean isProfileOwnerApp(java.lang.String packageName)
@Implementation public boolean isAdminActive(android.content.ComponentName who)
@Implementation public java.util.List<android.content.ComponentName> getActiveAdmins()
@Implementation
public void addUserRestriction(android.content.ComponentName admin,
java.lang.String key)
@Implementation
public void clearUserRestriction(android.content.ComponentName admin,
java.lang.String key)
@Implementation
public void setApplicationHidden(android.content.ComponentName admin,
java.lang.String packageName,
boolean hidden)
@Implementation
public boolean isApplicationHidden(android.content.ComponentName admin,
java.lang.String packageName)
public boolean wasPackageEverHidden(java.lang.String packageName)
Returns true if the given packageName was ever hidden.
@Implementation
public int enableSystemApp(android.content.ComponentName admin,
java.lang.String packageName)
public boolean wasSystemAppEnabled(java.lang.String packageName)
Returns true if the given packageName was a system app and was enabled.
@Implementation
public void setUninstallBlocked(android.content.ComponentName admin,
java.lang.String packageName,
boolean uninstallBlocked)
@Implementation
public boolean isUninstallBlocked(android.content.ComponentName admin,
java.lang.String packageName)
@Implementation(minSdk=18) protected java.lang.String getDeviceOwner()
setDeviceOwner(ComponentName)@Implementation(minSdk=21) protected android.content.ComponentName getProfileOwner()
setProfileOwner(ComponentName)public void setDeviceOwner(android.content.ComponentName admin)
Sets the admin as active admin and device owner.
DevicePolicyManager.getDeviceOwner()public void setProfileOwner(android.content.ComponentName admin)
Sets the admin as active admin and profile owner.
DevicePolicyManager.getProfileOwner()public void setActiveAdmin(android.content.ComponentName componentName)
Sets the given componentName as one of the active admins.
@Implementation
public android.os.Bundle getApplicationRestrictions(android.content.ComponentName admin,
java.lang.String packageName)
public android.os.Bundle getApplicationRestrictions(java.lang.String packageName)
Returns all application restrictions of the packageName in a Bundle.
@Implementation
public void setApplicationRestrictions(android.content.ComponentName admin,
java.lang.String packageName,
android.os.Bundle applicationRestrictions)
public void setApplicationRestrictions(java.lang.String packageName,
android.os.Bundle applicationRestrictions)
Sets the application restrictions of the packageName.
The new applicationRestrictions always completely overwrites any existing ones.
@Implementation
public void setAccountManagementDisabled(android.content.ComponentName admin,
java.lang.String accountType,
boolean disabled)
@Implementation public java.lang.String[] getAccountTypesWithManagementDisabled()
@Implementation(minSdk=24)
public void setOrganizationName(android.content.ComponentName admin,
java.lang.CharSequence name)
Sets organization name.
The API can only be called by profile owner since Android N and can be called by both of profile owner and device owner since Android O.
@Implementation(minSdk=24)
public void setOrganizationColor(android.content.ComponentName admin,
int color)
@Implementation(minSdk=24) public java.lang.CharSequence getOrganizationName(android.content.ComponentName admin)
Returns organization name.
The API can only be called by profile owner since Android N.
Android framework has a hidden API for getting the organization name for device owner since Android O. This method, however, is extended to return the organization name for device owners too to make testing of setOrganizationName(ComponentName, CharSequence) easier for device owner cases.
@Implementation(minSdk=24) public int getOrganizationColor(android.content.ComponentName admin)
@Implementation
public void setAutoTimeRequired(android.content.ComponentName admin,
boolean required)
@Implementation public boolean getAutoTimeRequired()
@Implementation
public boolean setPermittedAccessibilityServices(android.content.ComponentName admin,
java.util.List<java.lang.String> packageNames)
Sets permitted accessibility services.
The API can be called by either a profile or device owner.
This method does not check already enabled non-system accessibility services, so will always set the restriction and return true.
@Implementation public java.util.List<java.lang.String> getPermittedAccessibilityServices(android.content.ComponentName admin)
@Implementation
public boolean setPermittedInputMethods(android.content.ComponentName admin,
java.util.List<java.lang.String> packageNames)
Sets permitted input methods.
The API can be called by either a profile or device owner.
This method does not check already enabled non-system input methods, so will always set the restriction and return true.
@Implementation public java.util.List<java.lang.String> getPermittedInputMethods(android.content.ComponentName admin)