Class ShadowDevicePolicyManager
- java.lang.Object
-
- org.robolectric.shadows.ShadowDevicePolicyManager
-
@Implements(android.app.admin.DevicePolicyManager.class) public class ShadowDevicePolicyManager extends Object
-
-
Constructor Summary
Constructors Constructor Description ShadowDevicePolicyManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void__constructor__(Context context, boolean parentInstance)protected void__constructor__(Context context, IDevicePolicyManager service)protected void__constructor__(Context context, Handler handler)booleanactivateResetToken(ComponentName admin)Activates reset token for given admin.protected voidaddPersistentPreferredActivity(ComponentName admin, IntentFilter filter, ComponentName activity)protected voidaddUserRestriction(ComponentName admin, String key)protected booleanbindDeviceAdminServiceAsUser(ComponentName admin, Intent serviceIntent, ServiceConnection conn, int flags, UserHandle targetUser)Bind to the same package in another user.protected voidclearPackagePersistentPreferredActivities(ComponentName admin, String packageName)protected voidclearProfileOwner(ComponentName admin)protected voidclearUserRestriction(ComponentName admin, String key)protected voidenableSystemApp(ComponentName admin, String packageName)voidfailSetApplicationHiddenFor(Collection<String> packagesToFail)Set package names for witchDevicePolicyManager.setApplicationHidden(android.content.ComponentName, java.lang.String, boolean)should fail.protected String[]getAccountTypesWithManagementDisabled()protected List<ComponentName>getActiveAdmins()protected Set<String>getAffiliationIds(ComponentName admin)protected BundlegetApplicationRestrictions(ComponentName admin, String packageName)BundlegetApplicationRestrictions(String packageName)Returns all application restrictions of thepackageNamein aBundle.protected booleangetAutoTimeRequired()protected List<UserHandle>getBindDeviceAdminTargetUsers(ComponentName admin)Returns the list of target users that the calling device or profile owner can use when callingbindDeviceAdminServiceAsUser(android.content.ComponentName, android.content.Intent, android.content.ServiceConnection, int, android.os.UserHandle).protected booleangetCameraDisabled(ComponentName admin)protected StringgetDeviceOwner()protected intgetKeyguardDisabledFeatures(ComponentName admin)StringgetLastSetPassword()Retrieves last password set throughDevicePolicyManager.resetPassword(java.lang.String, int)orDevicePolicyManager.resetPasswordWithToken(android.content.ComponentName, java.lang.String, byte[], int).protected String[]getLockTaskPackages(ComponentName admin)protected CharSequencegetLongSupportMessage(ComponentName admin)protected intgetMaximumFailedPasswordsForWipe(ComponentName admin)protected longgetMaximumTimeToLock(ComponentName admin)protected intgetNearbyAppStreamingPolicy()protected intgetNearbyNotificationStreamingPolicy()protected intgetOrganizationColor(ComponentName admin)protected CharSequencegetOrganizationName(ComponentName admin)Returns organization name.protected intgetPasswordComplexity()protected longgetPasswordExpiration(ComponentName admin)protected longgetPasswordExpirationTimeout(ComponentName admin)protected intgetPasswordHistoryLength(ComponentName admin)protected intgetPasswordMinimumLength(ComponentName admin)protected intgetPasswordMinimumLetters(ComponentName admin)protected intgetPasswordMinimumLowerCase(ComponentName admin)protected intgetPasswordMinimumNonLetter(ComponentName admin)protected intgetPasswordMinimumNumeric(ComponentName admin)protected intgetPasswordMinimumSymbols(ComponentName admin)protected intgetPasswordMinimumUpperCase(ComponentName admin)protected intgetPasswordQuality(ComponentName admin)protected intgetPermissionGrantState(ComponentName admin, String packageName, String permission)protected intgetPermissionPolicy(ComponentName admin)protected List<String>getPermittedAccessibilityServices(ComponentName admin)protected List<String>getPermittedInputMethods(ComponentName admin)protected ComponentNamegetProfileOwner()protected StringgetProfileOwnerNameAsUser(int userId)Returns the human-readable name of the profile owner for a user if set usingsetProfileOwnerName(int, java.lang.String), otherwise null.protected CharSequencegetShortSupportMessage(ComponentName admin)protected booleangetStorageEncryption(ComponentName admin)protected intgetStorageEncryptionStatus()protected SystemUpdatePolicygetSystemUpdatePolicy()protected intgetUserProvisioningState()longgetWipeCalledTimes()voidgrantPolicy(ComponentName admin, int usesPolicy)Grants a particular device policy for an active ComponentName.protected booleanhasGrantedPolicy(ComponentName admin, int usesPolicy)protected booleanisActivePasswordSufficient()protected booleanisAdminActive(ComponentName who)protected booleanisApplicationHidden(ComponentName admin, String packageName)booleanisDeviceManaged()protected booleanisDeviceOwnerApp(String packageName)protected booleanisDeviceProvisioned()protected booleanisDeviceProvisioningConfigApplied()protected booleanisLockTaskPermitted(String pkg)protected booleanisOrganizationOwnedDeviceWithManagedProfile()Returns the value stored using in the shadow, while the real method returns the value store on the device.protected booleanisPackageSuspended(ComponentName admin, String packageName)booleanisPermissionGranted(String packageName, String permission)protected booleanisProfileOwnerApp(String packageName)protected booleanisResetPasswordTokenActive(ComponentName admin)protected booleanisUninstallBlocked(ComponentName admin, String packageName)protected booleanisUniqueDeviceAttestationSupported()protected booleanisUsbDataSignalingEnabled()protected voidlockNow()protected voidremoveActiveAdmin(ComponentName admin)protected booleanresetPassword(String password, int flags)protected booleanresetPasswordWithToken(ComponentName admin, String password, byte[] token, int flags)protected voidsetAccountManagementDisabled(ComponentName admin, String accountType, boolean disabled)voidsetActiveAdmin(ComponentName componentName)Sets the givencomponentNameas one of the active admins.voidsetActivePasswordSufficient(boolean sufficient)Sets if the password meets the current requirements.protected voidsetAffiliationIds(ComponentName admin, Set<String> ids)protected booleansetApplicationHidden(ComponentName admin, String packageName, boolean hidden)protected voidsetApplicationRestrictions(ComponentName admin, String packageName, Bundle applicationRestrictions)voidsetApplicationRestrictions(String packageName, Bundle applicationRestrictions)Sets the application restrictions of thepackageName.protected voidsetAutoTimeRequired(ComponentName admin, boolean required)voidsetBindDeviceAdminTargetUsers(List<UserHandle> bindDeviceAdminTargetUsers)Set the list of target users that the calling device or profile owner can use when callingbindDeviceAdminServiceAsUser(android.content.ComponentName, android.content.Intent, android.content.ServiceConnection, int, android.os.UserHandle).protected voidsetCameraDisabled(ComponentName admin, boolean disabled)booleansetDeviceOwner(ComponentName admin)Sets the admin as active admin and device owner.voidsetDeviceProvisioned(boolean isProvisioned)Sets whether the device is provisioned.protected voidsetDeviceProvisioningConfigApplied()voidsetIsUniqueDeviceAttestationSupported(boolean supported)voidsetIsUsbDataSignalingEnabled(boolean isEnabled)Sets USB signaling device restriction.protected voidsetKeyguardDisabledFeatures(ComponentName admin, int which)protected voidsetLockTaskPackages(ComponentName admin, String[] packages)protected voidsetLongSupportMessage(ComponentName admin, CharSequence message)protected voidsetMaximumFailedPasswordsForWipe(ComponentName admin, int num)protected voidsetMaximumTimeToLock(ComponentName admin, long timeMs)protected voidsetNearbyAppStreamingPolicy(int policy)protected voidsetNearbyNotificationStreamingPolicy(int policy)protected voidsetOrganizationColor(ComponentName admin, int color)protected voidsetOrganizationName(ComponentName admin, CharSequence name)Sets organization name.voidsetOrganizationOwnedDeviceWithManagedProfile(boolean value)Sets the return value of theDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile()method (only for Android R+).protected String[]setPackagesSuspended(ComponentName admin, String[] packageNames, boolean suspended)voidsetPasswordComplexity(int passwordComplexity)Sets the password complexity.voidsetPasswordExpiration(ComponentName admin, long timeout)Sets the password expiration time for a particular admin.protected voidsetPasswordExpirationTimeout(ComponentName admin, long timeout)protected voidsetPasswordHistoryLength(ComponentName admin, int length)protected voidsetPasswordMinimumLength(ComponentName admin, int length)protected voidsetPasswordMinimumLetters(ComponentName admin, int length)protected voidsetPasswordMinimumLowerCase(ComponentName admin, int length)protected voidsetPasswordMinimumNonLetter(ComponentName admin, int length)protected voidsetPasswordMinimumNumeric(ComponentName admin, int length)protected voidsetPasswordMinimumSymbols(ComponentName admin, int length)protected voidsetPasswordMinimumUpperCase(ComponentName admin, int length)protected voidsetPasswordQuality(ComponentName admin, int quality)protected booleansetPermissionGrantState(ComponentName admin, String packageName, String permission, int grantState)protected voidsetPermissionPolicy(ComponentName admin, int policy)protected booleansetPermittedAccessibilityServices(ComponentName admin, List<String> packageNames)Sets permitted accessibility services.protected booleansetPermittedInputMethods(ComponentName admin, List<String> packageNames)Sets permitted input methods.voidsetProfileOwner(ComponentName admin)Sets the admin as active admin and profile owner.voidsetProfileOwnerName(int userId, String name)protected booleansetResetPasswordToken(ComponentName admin, byte[] token)protected voidsetShortSupportMessage(ComponentName admin, CharSequence message)protected intsetStorageEncryption(ComponentName admin, boolean encrypt)voidsetStorageEncryptionStatus(int status)Setter forDevicePolicyManager.getStorageEncryptionStatus().voidsetSystemUpdatePolicy(SystemUpdatePolicy policy)Sets the system update policy.protected voidsetSystemUpdatePolicy(ComponentName admin, SystemUpdatePolicy policy)protected voidsetUninstallBlocked(ComponentName admin, String packageName, boolean uninstallBlocked)voidsetUserProvisioningState(int state)Sets the user provisioning state.protected voidtransferOwnership(ComponentName admin, ComponentName target, PersistableBundle bundle)booleanwasPackageEverHidden(String packageName)Returnstrueif the givenpackageNamewas ever hidden.booleanwasSystemAppEnabled(String packageName)Returnstrueif the givenpackageNamewas a system app and was enabled.protected voidwipeData(int flags)
-
-
-
Method Detail
-
__constructor__
@Implementation(maxSdk=23) protected void __constructor__(Context context, Handler handler)
-
__constructor__
@Implementation(minSdk=24, maxSdk=25) protected void __constructor__(Context context, boolean parentInstance)
-
__constructor__
@Implementation(minSdk=26) protected void __constructor__(Context context, IDevicePolicyManager service)
-
isDeviceOwnerApp
@Implementation(minSdk=18) protected boolean isDeviceOwnerApp(String packageName)
-
isProfileOwnerApp
@Implementation(minSdk=21) protected boolean isProfileOwnerApp(String packageName)
-
isAdminActive
@Implementation protected boolean isAdminActive(ComponentName who)
-
getActiveAdmins
@Implementation protected List<ComponentName> getActiveAdmins()
-
addUserRestriction
@Implementation(minSdk=21) protected void addUserRestriction(ComponentName admin, String key)
-
clearUserRestriction
@Implementation(minSdk=21) protected void clearUserRestriction(ComponentName admin, String key)
-
setApplicationHidden
@Implementation(minSdk=21) protected boolean setApplicationHidden(ComponentName admin, String packageName, boolean hidden)
-
failSetApplicationHiddenFor
public void failSetApplicationHiddenFor(Collection<String> packagesToFail)
Set package names for witchDevicePolicyManager.setApplicationHidden(android.content.ComponentName, java.lang.String, boolean)should fail.- Parameters:
packagesToFail- collection of package names ornullto clear the packages.
-
isApplicationHidden
@Implementation(minSdk=21) protected boolean isApplicationHidden(ComponentName admin, String packageName)
-
wasPackageEverHidden
public boolean wasPackageEverHidden(String packageName)
Returnstrueif the givenpackageNamewas ever hidden.
-
enableSystemApp
@Implementation(minSdk=21) protected void enableSystemApp(ComponentName admin, String packageName)
-
wasSystemAppEnabled
public boolean wasSystemAppEnabled(String packageName)
Returnstrueif the givenpackageNamewas a system app and was enabled.
-
setUninstallBlocked
@Implementation(minSdk=21) protected void setUninstallBlocked(ComponentName admin, String packageName, boolean uninstallBlocked)
-
isUninstallBlocked
@Implementation(minSdk=21) protected boolean isUninstallBlocked(ComponentName admin, String packageName)
-
setIsUniqueDeviceAttestationSupported
public void setIsUniqueDeviceAttestationSupported(boolean supported)
-
isUniqueDeviceAttestationSupported
@Implementation(minSdk=30) protected boolean isUniqueDeviceAttestationSupported()
-
setIsUsbDataSignalingEnabled
public void setIsUsbDataSignalingEnabled(boolean isEnabled)
Sets USB signaling device restriction.
-
isUsbDataSignalingEnabled
@Implementation(minSdk=31) protected boolean isUsbDataSignalingEnabled()
-
getDeviceOwner
@Implementation(minSdk=18) protected String getDeviceOwner()
- See Also:
setDeviceOwner(ComponentName)
-
isDeviceManaged
@Implementation(minSdk=24) public boolean isDeviceManaged()
- See Also:
setDeviceOwner(ComponentName)
-
getProfileOwner
@Implementation(minSdk=21) protected ComponentName getProfileOwner()
- See Also:
setProfileOwner(ComponentName)
-
getProfileOwnerNameAsUser
@Implementation(minSdk=21) protected String getProfileOwnerNameAsUser(int userId)
Returns the human-readable name of the profile owner for a user if set usingsetProfileOwnerName(int, java.lang.String), otherwise null.
-
transferOwnership
@Implementation(minSdk=28) protected void transferOwnership(ComponentName admin, ComponentName target, PersistableBundle bundle)
-
setDeviceOwner
@Implementation(minSdk=24) public boolean setDeviceOwner(ComponentName admin)
Sets the admin as active admin and device owner.- See Also:
DevicePolicyManager.getDeviceOwner()
-
setProfileOwner
public void setProfileOwner(ComponentName admin)
Sets the admin as active admin and profile owner.- See Also:
DevicePolicyManager.getProfileOwner()
-
setProfileOwnerName
public void setProfileOwnerName(int userId, String name)
-
setActiveAdmin
public void setActiveAdmin(ComponentName componentName)
Sets the givencomponentNameas one of the active admins.
-
removeActiveAdmin
@Implementation protected void removeActiveAdmin(ComponentName admin)
-
clearProfileOwner
@Implementation(minSdk=21) protected void clearProfileOwner(ComponentName admin)
-
getApplicationRestrictions
@Implementation(minSdk=21) protected Bundle getApplicationRestrictions(ComponentName admin, String packageName)
-
getApplicationRestrictions
public Bundle getApplicationRestrictions(String packageName)
Returns all application restrictions of thepackageNamein aBundle.
-
setApplicationRestrictions
@Implementation(minSdk=21) protected void setApplicationRestrictions(ComponentName admin, String packageName, Bundle applicationRestrictions)
-
setApplicationRestrictions
public void setApplicationRestrictions(String packageName, Bundle applicationRestrictions)
Sets the application restrictions of thepackageName.The new
applicationRestrictionsalways completely overwrites any existing ones.
-
setAccountManagementDisabled
@Implementation(minSdk=21) protected void setAccountManagementDisabled(ComponentName admin, String accountType, boolean disabled)
-
getAccountTypesWithManagementDisabled
@Implementation(minSdk=21) protected String[] getAccountTypesWithManagementDisabled()
-
setOrganizationName
@Implementation(minSdk=24) protected void setOrganizationName(ComponentName admin, 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.
-
setPackagesSuspended
@Implementation(minSdk=24) protected String[] setPackagesSuspended(ComponentName admin, String[] packageNames, boolean suspended)
-
isPackageSuspended
@Implementation(minSdk=24) protected boolean isPackageSuspended(ComponentName admin, String packageName) throws PackageManager.NameNotFoundException
-
setOrganizationColor
@Implementation(minSdk=24) protected void setOrganizationColor(ComponentName admin, int color)
-
getOrganizationName
@Implementation(minSdk=24) protected CharSequence getOrganizationName(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.
-
getOrganizationColor
@Implementation(minSdk=24) protected int getOrganizationColor(ComponentName admin)
-
setAutoTimeRequired
@Implementation(minSdk=21) protected void setAutoTimeRequired(ComponentName admin, boolean required)
-
getAutoTimeRequired
@Implementation(minSdk=21) protected boolean getAutoTimeRequired()
-
setPermittedAccessibilityServices
@Implementation(minSdk=21) protected boolean setPermittedAccessibilityServices(ComponentName admin, List<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.
-
getPermittedAccessibilityServices
@Implementation(minSdk=21) protected List<String> getPermittedAccessibilityServices(ComponentName admin)
-
setPermittedInputMethods
@Implementation(minSdk=21) protected boolean setPermittedInputMethods(ComponentName admin, List<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.
-
getPermittedInputMethods
@Implementation(minSdk=21) protected List<String> getPermittedInputMethods(ComponentName admin)
-
getStorageEncryptionStatus
@Implementation protected int getStorageEncryptionStatus()
- Returns:
- the previously set status; default is
DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED - See Also:
setStorageEncryptionStatus(int)
-
setStorageEncryptionStatus
public void setStorageEncryptionStatus(int status)
Setter forDevicePolicyManager.getStorageEncryptionStatus().
-
setStorageEncryption
@Implementation protected int setStorageEncryption(ComponentName admin, boolean encrypt)
-
getStorageEncryption
@Implementation protected boolean getStorageEncryption(ComponentName admin)
-
getPermissionGrantState
@Implementation(minSdk=23) protected int getPermissionGrantState(ComponentName admin, String packageName, String permission)
-
setPermissionGrantState
@Implementation(minSdk=23) protected boolean setPermissionGrantState(ComponentName admin, String packageName, String permission, int grantState)
-
lockNow
@Implementation protected void lockNow()
-
wipeData
@Implementation protected void wipeData(int flags)
-
getWipeCalledTimes
public long getWipeCalledTimes()
-
setPasswordQuality
@Implementation protected void setPasswordQuality(ComponentName admin, int quality)
-
getPasswordQuality
@Implementation protected int getPasswordQuality(ComponentName admin)
-
resetPassword
@Implementation protected boolean resetPassword(String password, int flags)
-
resetPasswordWithToken
@Implementation(minSdk=26) protected boolean resetPasswordWithToken(ComponentName admin, String password, byte[] token, int flags)
-
isResetPasswordTokenActive
@Implementation(minSdk=26) protected boolean isResetPasswordTokenActive(ComponentName admin)
-
setResetPasswordToken
@Implementation(minSdk=26) protected boolean setResetPasswordToken(ComponentName admin, byte[] token)
-
setPasswordMinimumLength
@Implementation protected void setPasswordMinimumLength(ComponentName admin, int length)
-
getPasswordMinimumLength
@Implementation protected int getPasswordMinimumLength(ComponentName admin)
-
setPasswordMinimumLetters
@Implementation protected void setPasswordMinimumLetters(ComponentName admin, int length)
-
getPasswordMinimumLetters
@Implementation protected int getPasswordMinimumLetters(ComponentName admin)
-
setPasswordMinimumLowerCase
@Implementation protected void setPasswordMinimumLowerCase(ComponentName admin, int length)
-
getPasswordMinimumLowerCase
@Implementation protected int getPasswordMinimumLowerCase(ComponentName admin)
-
setPasswordMinimumUpperCase
@Implementation protected void setPasswordMinimumUpperCase(ComponentName admin, int length)
-
getPasswordMinimumUpperCase
@Implementation protected int getPasswordMinimumUpperCase(ComponentName admin)
-
setPasswordMinimumNonLetter
@Implementation protected void setPasswordMinimumNonLetter(ComponentName admin, int length)
-
getPasswordMinimumNonLetter
@Implementation protected int getPasswordMinimumNonLetter(ComponentName admin)
-
setPasswordMinimumNumeric
@Implementation protected void setPasswordMinimumNumeric(ComponentName admin, int length)
-
getPasswordMinimumNumeric
@Implementation protected int getPasswordMinimumNumeric(ComponentName admin)
-
setPasswordMinimumSymbols
@Implementation protected void setPasswordMinimumSymbols(ComponentName admin, int length)
-
getPasswordMinimumSymbols
@Implementation protected int getPasswordMinimumSymbols(ComponentName admin)
-
setMaximumFailedPasswordsForWipe
@Implementation protected void setMaximumFailedPasswordsForWipe(ComponentName admin, int num)
-
getMaximumFailedPasswordsForWipe
@Implementation protected int getMaximumFailedPasswordsForWipe(ComponentName admin)
-
setCameraDisabled
@Implementation protected void setCameraDisabled(ComponentName admin, boolean disabled)
-
getCameraDisabled
@Implementation protected boolean getCameraDisabled(ComponentName admin)
-
setPasswordExpirationTimeout
@Implementation protected void setPasswordExpirationTimeout(ComponentName admin, long timeout)
-
getPasswordExpirationTimeout
@Implementation protected long getPasswordExpirationTimeout(ComponentName admin)
-
setPasswordExpiration
public void setPasswordExpiration(ComponentName admin, long timeout)
Sets the password expiration time for a particular admin.- Parameters:
admin- which DeviceAdminReceiver this request is associated with.timeout- the password expiration time, in milliseconds since epoch.
-
getPasswordExpiration
@Implementation protected long getPasswordExpiration(ComponentName admin)
-
setMaximumTimeToLock
@Implementation protected void setMaximumTimeToLock(ComponentName admin, long timeMs)
-
getMaximumTimeToLock
@Implementation protected long getMaximumTimeToLock(ComponentName admin)
-
setPasswordHistoryLength
@Implementation protected void setPasswordHistoryLength(ComponentName admin, int length)
-
getPasswordHistoryLength
@Implementation protected int getPasswordHistoryLength(ComponentName admin)
-
setActivePasswordSufficient
public void setActivePasswordSufficient(boolean sufficient)
Sets if the password meets the current requirements.- Parameters:
sufficient- indicates the password meets the current requirements
-
isActivePasswordSufficient
@Implementation protected boolean isActivePasswordSufficient()
-
setDeviceProvisioned
public void setDeviceProvisioned(boolean isProvisioned)
Sets whether the device is provisioned.
-
isDeviceProvisioned
@Implementation(minSdk=26) protected boolean isDeviceProvisioned()
-
setDeviceProvisioningConfigApplied
@Implementation(minSdk=26) protected void setDeviceProvisioningConfigApplied()
-
isDeviceProvisioningConfigApplied
@Implementation(minSdk=26) protected boolean isDeviceProvisioningConfigApplied()
-
setPasswordComplexity
public void setPasswordComplexity(int passwordComplexity)
Sets the password complexity.
-
getPasswordComplexity
@Implementation(minSdk=29) protected int getPasswordComplexity()
-
getLastSetPassword
public String getLastSetPassword()
Retrieves last password set throughDevicePolicyManager.resetPassword(java.lang.String, int)orDevicePolicyManager.resetPasswordWithToken(android.content.ComponentName, java.lang.String, byte[], int).
-
activateResetToken
public boolean activateResetToken(ComponentName admin)
Activates reset token for given admin.- Parameters:
admin- WhichDeviceAdminReceiverthis request is associated with.- Returns:
- if the activation state changed.
- Throws:
IllegalArgumentException- if there is no token set for this admin.
-
addPersistentPreferredActivity
@Implementation(minSdk=21) protected void addPersistentPreferredActivity(ComponentName admin, IntentFilter filter, ComponentName activity)
-
clearPackagePersistentPreferredActivities
@Implementation(minSdk=21) protected void clearPackagePersistentPreferredActivities(ComponentName admin, String packageName)
-
setKeyguardDisabledFeatures
@Implementation(minSdk=17) protected void setKeyguardDisabledFeatures(ComponentName admin, int which)
-
getKeyguardDisabledFeatures
@Implementation(minSdk=17) protected int getKeyguardDisabledFeatures(ComponentName admin)
-
setUserProvisioningState
public void setUserProvisioningState(int state)
Sets the user provisioning state.- Parameters:
state- to store provisioning state
-
getUserProvisioningState
@Implementation(minSdk=24) protected int getUserProvisioningState()
- Returns:
- Returns the provisioning state for the current user.
-
hasGrantedPolicy
@Implementation protected boolean hasGrantedPolicy(ComponentName admin, int usesPolicy)
-
setLockTaskPackages
@Implementation(minSdk=21) protected void setLockTaskPackages(ComponentName admin, String[] packages)
-
getLockTaskPackages
@Implementation(minSdk=21) protected String[] getLockTaskPackages(ComponentName admin)
-
isLockTaskPermitted
@Implementation(minSdk=21) protected boolean isLockTaskPermitted(String pkg)
-
setAffiliationIds
@Implementation(minSdk=26) protected void setAffiliationIds(ComponentName admin, Set<String> ids)
-
getAffiliationIds
@Implementation(minSdk=26) protected Set<String> getAffiliationIds(ComponentName admin)
-
setPermissionPolicy
@Implementation(minSdk=23) protected void setPermissionPolicy(ComponentName admin, int policy)
-
getPermissionPolicy
@Implementation(minSdk=23) protected int getPermissionPolicy(ComponentName admin)
-
grantPolicy
public void grantPolicy(ComponentName admin, int usesPolicy)
Grants a particular device policy for an active ComponentName.- Parameters:
admin- the ComponentName which DeviceAdminReceiver this request is associated with. Must be an active administrator, or an exception will be thrown. This value must never be null.usesPolicy- the uses-policy to check
-
getSystemUpdatePolicy
@Implementation(minSdk=23) protected SystemUpdatePolicy getSystemUpdatePolicy()
-
setSystemUpdatePolicy
@Implementation(minSdk=23) protected void setSystemUpdatePolicy(ComponentName admin, SystemUpdatePolicy policy)
-
setSystemUpdatePolicy
public void setSystemUpdatePolicy(SystemUpdatePolicy policy)
Sets the system update policy.
-
setBindDeviceAdminTargetUsers
public void setBindDeviceAdminTargetUsers(List<UserHandle> bindDeviceAdminTargetUsers)
Set the list of target users that the calling device or profile owner can use when callingbindDeviceAdminServiceAsUser(android.content.ComponentName, android.content.Intent, android.content.ServiceConnection, int, android.os.UserHandle).
-
getBindDeviceAdminTargetUsers
@Implementation(minSdk=26) protected List<UserHandle> getBindDeviceAdminTargetUsers(ComponentName admin)
Returns the list of target users that the calling device or profile owner can use when callingbindDeviceAdminServiceAsUser(android.content.ComponentName, android.content.Intent, android.content.ServiceConnection, int, android.os.UserHandle).- See Also:
setBindDeviceAdminTargetUsers(List)
-
bindDeviceAdminServiceAsUser
@Implementation(minSdk=26) protected boolean bindDeviceAdminServiceAsUser(ComponentName admin, Intent serviceIntent, ServiceConnection conn, int flags, UserHandle targetUser)
Bind to the same package in another user.This validates that the targetUser is one from
getBindDeviceAdminTargetUsers(ComponentName)but does not actually bind to a different user, instead binding to the same user.It also does not validate the service being bound to.
-
setShortSupportMessage
@Implementation(minSdk=24) protected void setShortSupportMessage(ComponentName admin, CharSequence message)
-
getShortSupportMessage
@Implementation(minSdk=24) protected CharSequence getShortSupportMessage(ComponentName admin)
-
setLongSupportMessage
@Implementation(minSdk=24) protected void setLongSupportMessage(ComponentName admin, CharSequence message)
-
getLongSupportMessage
@Implementation(minSdk=24) protected CharSequence getLongSupportMessage(ComponentName admin)
-
setOrganizationOwnedDeviceWithManagedProfile
public void setOrganizationOwnedDeviceWithManagedProfile(boolean value)
Sets the return value of theDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile()method (only for Android R+).
-
isOrganizationOwnedDeviceWithManagedProfile
@Implementation(minSdk=30) protected boolean isOrganizationOwnedDeviceWithManagedProfile()
Returns the value stored using in the shadow, while the real method returns the value store on the device.The value can be set by
setOrganizationOwnedDeviceWithManagedProfile(boolean)and isfalseby default.
-
getNearbyNotificationStreamingPolicy
@Implementation(minSdk=31) protected int getNearbyNotificationStreamingPolicy()
-
setNearbyNotificationStreamingPolicy
@Implementation(minSdk=31) protected void setNearbyNotificationStreamingPolicy(int policy)
-
getNearbyAppStreamingPolicy
@Implementation(minSdk=31) protected int getNearbyAppStreamingPolicy()
-
setNearbyAppStreamingPolicy
@Implementation(minSdk=31) protected void setNearbyAppStreamingPolicy(int policy)
-
-