@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 |
---|---|
protected void |
__constructor__(android.content.Context context,
boolean parentInstance) |
protected void |
__constructor__(android.content.Context context,
android.os.Handler handler) |
protected void |
__constructor__(android.content.Context context,
android.app.admin.IDevicePolicyManager service) |
boolean |
activateResetToken(android.content.ComponentName admin)
Activates reset token for given admin.
|
protected void |
addPersistentPreferredActivity(android.content.ComponentName admin,
android.content.IntentFilter filter,
android.content.ComponentName activity) |
protected void |
addUserRestriction(android.content.ComponentName admin,
java.lang.String key) |
protected void |
clearPackagePersistentPreferredActivities(android.content.ComponentName admin,
java.lang.String packageName) |
protected void |
clearProfileOwner(android.content.ComponentName admin) |
protected void |
clearUserRestriction(android.content.ComponentName admin,
java.lang.String key) |
protected void |
enableSystemApp(android.content.ComponentName admin,
java.lang.String packageName) |
void |
failSetApplicationHiddenFor(java.util.Collection<java.lang.String> packagesToFail)
Set package names for witch
DevicePolicyManager.setApplicationHidden(android.content.ComponentName, java.lang.String, boolean) should fail. |
protected java.lang.String[] |
getAccountTypesWithManagementDisabled() |
protected java.util.List<android.content.ComponentName> |
getActiveAdmins() |
protected 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 . |
protected boolean |
getAutoTimeRequired() |
protected java.lang.String |
getDeviceOwner() |
protected int |
getKeyguardDisabledFeatures(android.content.ComponentName admin) |
java.lang.String |
getLastSetPassword()
Retrieves last password set through
DevicePolicyManager.resetPassword(java.lang.String, int) or DevicePolicyManager.resetPasswordWithToken(android.content.ComponentName, java.lang.String, byte[], int) . |
protected int |
getOrganizationColor(android.content.ComponentName admin) |
protected java.lang.CharSequence |
getOrganizationName(android.content.ComponentName admin)
Returns organization name.
|
protected int |
getPermissionGrantState(android.content.ComponentName admin,
java.lang.String packageName,
java.lang.String permission) |
protected java.util.List<java.lang.String> |
getPermittedAccessibilityServices(android.content.ComponentName admin) |
protected java.util.List<java.lang.String> |
getPermittedInputMethods(android.content.ComponentName admin) |
protected android.content.ComponentName |
getProfileOwner() |
protected int |
getStorageEncryptionStatus() |
protected int |
getUserProvisioningState() |
long |
getWipeCalledTimes() |
protected boolean |
isAdminActive(android.content.ComponentName who) |
protected boolean |
isApplicationHidden(android.content.ComponentName admin,
java.lang.String packageName) |
protected boolean |
isDeviceOwnerApp(java.lang.String packageName) |
protected boolean |
isPackageSuspended(android.content.ComponentName admin,
java.lang.String packageName) |
boolean |
isPermissionGranted(java.lang.String packageName,
java.lang.String permission) |
protected boolean |
isProfileOwnerApp(java.lang.String packageName) |
protected boolean |
isResetPasswordTokenActive(android.content.ComponentName admin) |
protected boolean |
isUninstallBlocked(android.content.ComponentName admin,
java.lang.String packageName) |
protected void |
lockNow() |
protected void |
removeActiveAdmin(android.content.ComponentName admin) |
protected boolean |
resetPassword(java.lang.String password,
int flags) |
protected boolean |
resetPasswordWithToken(android.content.ComponentName admin,
java.lang.String password,
byte[] token,
int flags) |
protected 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. |
protected boolean |
setApplicationHidden(android.content.ComponentName admin,
java.lang.String packageName,
boolean hidden) |
protected 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 . |
protected void |
setAutoTimeRequired(android.content.ComponentName admin,
boolean required) |
void |
setDeviceOwner(android.content.ComponentName admin)
Sets the admin as active admin and device owner.
|
protected void |
setKeyguardDisabledFeatures(android.content.ComponentName admin,
int which) |
protected void |
setOrganizationColor(android.content.ComponentName admin,
int color) |
protected void |
setOrganizationName(android.content.ComponentName admin,
java.lang.CharSequence name)
Sets organization name.
|
protected java.lang.String[] |
setPackagesSuspended(android.content.ComponentName admin,
java.lang.String[] packageNames,
boolean suspended) |
protected void |
setPasswordMinimumLength(android.content.ComponentName admin,
int length) |
protected void |
setPasswordMinimumLetters(android.content.ComponentName admin,
int length) |
protected void |
setPasswordMinimumLowerCase(android.content.ComponentName admin,
int length) |
protected void |
setPasswordMinimumNonLetter(android.content.ComponentName admin,
int length) |
protected void |
setPasswordMinimumNumeric(android.content.ComponentName admin,
int length) |
protected void |
setPasswordMinimumSymbols(android.content.ComponentName admin,
int length) |
protected void |
setPasswordMinimumUpperCase(android.content.ComponentName admin,
int length) |
protected void |
setPasswordQuality(android.content.ComponentName admin,
int quality) |
protected boolean |
setPermissionGrantState(android.content.ComponentName admin,
java.lang.String packageName,
java.lang.String permission,
int grantState) |
protected boolean |
setPermittedAccessibilityServices(android.content.ComponentName admin,
java.util.List<java.lang.String> packageNames)
Sets permitted accessibility services.
|
protected 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.
|
protected boolean |
setResetPasswordToken(android.content.ComponentName admin,
byte[] token) |
void |
setStorageEncryptionStatus(int status)
Setter for
DevicePolicyManager.getStorageEncryptionStatus() . |
protected void |
setUninstallBlocked(android.content.ComponentName admin,
java.lang.String packageName,
boolean uninstallBlocked) |
void |
setUserProvisioningState(int state)
Sets the user provisioning state.
|
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. |
protected void |
wipeData(int flags) |
@Implementation(maxSdk=23) protected void __constructor__(android.content.Context context, android.os.Handler handler)
@Implementation(minSdk=24, maxSdk=25) protected void __constructor__(android.content.Context context, boolean parentInstance)
@Implementation(minSdk=26) protected void __constructor__(android.content.Context context, android.app.admin.IDevicePolicyManager service)
@Implementation(minSdk=18) protected boolean isDeviceOwnerApp(java.lang.String packageName)
@Implementation(minSdk=21) protected boolean isProfileOwnerApp(java.lang.String packageName)
@Implementation protected boolean isAdminActive(android.content.ComponentName who)
@Implementation protected java.util.List<android.content.ComponentName> getActiveAdmins()
@Implementation(minSdk=21) protected void addUserRestriction(android.content.ComponentName admin, java.lang.String key)
@Implementation(minSdk=21) protected void clearUserRestriction(android.content.ComponentName admin, java.lang.String key)
@Implementation(minSdk=21) protected boolean setApplicationHidden(android.content.ComponentName admin, java.lang.String packageName, boolean hidden)
public void failSetApplicationHiddenFor(java.util.Collection<java.lang.String> packagesToFail)
Set package names for witch DevicePolicyManager.setApplicationHidden(android.content.ComponentName, java.lang.String, boolean)
should fail.
packagesToFail
- collection of package names or null
to clear the packages.@Implementation(minSdk=21) protected 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(minSdk=21) protected void 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(minSdk=21) protected void setUninstallBlocked(android.content.ComponentName admin, java.lang.String packageName, boolean uninstallBlocked)
@Implementation(minSdk=21) protected 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 protected void removeActiveAdmin(android.content.ComponentName admin)
@Implementation(minSdk=21) protected void clearProfileOwner(android.content.ComponentName admin)
@Implementation(minSdk=21) protected 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(minSdk=21) protected 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(minSdk=21) protected void setAccountManagementDisabled(android.content.ComponentName admin, java.lang.String accountType, boolean disabled)
@Implementation(minSdk=21) protected java.lang.String[] getAccountTypesWithManagementDisabled()
@Implementation(minSdk=24) protected 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) protected java.lang.String[] setPackagesSuspended(android.content.ComponentName admin, java.lang.String[] packageNames, boolean suspended)
@Implementation(minSdk=24) protected boolean isPackageSuspended(android.content.ComponentName admin, java.lang.String packageName) throws android.content.pm.PackageManager.NameNotFoundException
android.content.pm.PackageManager.NameNotFoundException
@Implementation(minSdk=24) protected void setOrganizationColor(android.content.ComponentName admin, int color)
@Implementation(minSdk=24) protected 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) protected int getOrganizationColor(android.content.ComponentName admin)
@Implementation(minSdk=21) protected void setAutoTimeRequired(android.content.ComponentName admin, boolean required)
@Implementation(minSdk=21) protected boolean getAutoTimeRequired()
@Implementation(minSdk=21) protected 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(minSdk=21) protected java.util.List<java.lang.String> getPermittedAccessibilityServices(android.content.ComponentName admin)
@Implementation(minSdk=21) protected 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(minSdk=21) protected java.util.List<java.lang.String> getPermittedInputMethods(android.content.ComponentName admin)
@Implementation protected int getStorageEncryptionStatus()
DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED
setStorageEncryptionStatus(int)
public void setStorageEncryptionStatus(int status)
Setter for DevicePolicyManager.getStorageEncryptionStatus()
.
@Implementation(minSdk=23) protected int getPermissionGrantState(android.content.ComponentName admin, java.lang.String packageName, java.lang.String permission)
public boolean isPermissionGranted(java.lang.String packageName, java.lang.String permission)
@Implementation(minSdk=23) protected boolean setPermissionGrantState(android.content.ComponentName admin, java.lang.String packageName, java.lang.String permission, int grantState)
@Implementation protected void lockNow()
@Implementation protected void wipeData(int flags)
public long getWipeCalledTimes()
@Implementation protected void setPasswordQuality(android.content.ComponentName admin, int quality)
@Implementation protected boolean resetPassword(java.lang.String password, int flags)
@Implementation(minSdk=26) protected boolean resetPasswordWithToken(android.content.ComponentName admin, java.lang.String password, byte[] token, int flags)
@Implementation(minSdk=26) protected boolean isResetPasswordTokenActive(android.content.ComponentName admin)
@Implementation(minSdk=26) protected boolean setResetPasswordToken(android.content.ComponentName admin, byte[] token)
@Implementation protected void setPasswordMinimumLength(android.content.ComponentName admin, int length)
@Implementation protected void setPasswordMinimumLetters(android.content.ComponentName admin, int length)
@Implementation protected void setPasswordMinimumLowerCase(android.content.ComponentName admin, int length)
@Implementation protected void setPasswordMinimumUpperCase(android.content.ComponentName admin, int length)
@Implementation protected void setPasswordMinimumNonLetter(android.content.ComponentName admin, int length)
@Implementation protected void setPasswordMinimumNumeric(android.content.ComponentName admin, int length)
@Implementation protected void setPasswordMinimumSymbols(android.content.ComponentName admin, int length)
public java.lang.String getLastSetPassword()
Retrieves last password set through DevicePolicyManager.resetPassword(java.lang.String, int)
or DevicePolicyManager.resetPasswordWithToken(android.content.ComponentName, java.lang.String, byte[], int)
.
public boolean activateResetToken(android.content.ComponentName admin)
Activates reset token for given admin.
admin
- Which DeviceAdminReceiver
this request is associated with.java.lang.IllegalArgumentException
- if there is no token set for this admin.@Implementation(minSdk=21) protected void addPersistentPreferredActivity(android.content.ComponentName admin, android.content.IntentFilter filter, android.content.ComponentName activity)
@Implementation(minSdk=21) protected void clearPackagePersistentPreferredActivities(android.content.ComponentName admin, java.lang.String packageName)
@Implementation(minSdk=17) protected void setKeyguardDisabledFeatures(android.content.ComponentName admin, int which)
@Implementation(minSdk=17) protected int getKeyguardDisabledFeatures(android.content.ComponentName admin)
public void setUserProvisioningState(int state)
Sets the user provisioning state.
state
- to store provisioning state@Implementation(minSdk=24) protected int getUserProvisioningState()