Power saving mode
You can now allow or disallow a device from entering power saving mode. Enterprises can allow power saving mode to extend battery life, or disallow power saving to optimize performance. This can be useful in certain scenarios. For example, in power saving mode, an EMM agent does not run as well and cannot receive policy updates from the IT admin server. With this APIm you can ensure that the user cannot disable your EMM agent.
allowPowerSavingMode()
An administrator uses allowPowerSavingMode() to toggle the “Power Saving Mode” status on a device. When set to false, a device can’t enter Power Saving Mode.
Permission
This API requires the com.samsung.android.knox.permission.KNOX_RESTRICTION_MGMT
permission with a protection level of signature.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
RestrictionPolicy restrictionPolicy = edm.getRestrictionPolicy();
try {
// disallow Power Saving Mode
boolean result = restrictionPolicy.allowPowerSavingMode(false);
if (true == result) {
// Power Saving Mode disallowed and cannot be enabled by user.
}
} catch (SecurityException e) {
Log.w(TAG, "SecurityException: " + e);
}
isPowerSavingModeAllowed()
An administrator uses isPowerSavingModeAllowed() to check whether Power Saving Mode is allowed or not.
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
RestrictionPolicy restrictionPolicy = edm.getRestrictionPolicy();
boolean result = false;
try {
// Check Power Saving Mode is allowed
result = restrictionPolicy.isPowerSavingModeAllowed();
} catch (RemoteException e) {
Log.e(TAG, "Remote exception : " + e);}
On this page
Is this page helpful?