public void revokeExistingPolicy(org.wso2.emm.agent.beans.Operation operation) throws AndroidAgentException {
  if (applicationManager.isPackageInstalled(Constants.SERVICE_PACKAGE_NAME)) {
switch (operation.getCode()) {
case Constants.Operation.CAMERA:
      revokeCameraPolicy(operation);
    break;
case Constants.Operation.INSTALL_APPLICATION:
  revokeInstallAppPolicy(operation);
break;
case Constants.Operation.ENCRYPT_STORAGE:
revokeEncryptPolicy(operation);
break;
case Constants.Operation.PASSCODE_POLICY:
revokePasswordPolicy();
break;
case Constants.Operation.WIFI:
revokeWifiPolicy(operation);
break;
case Constants.Operation.DISALLOW_ADJUST_VOLUME:
case Constants.Operation.DISALLOW_CONFIG_BLUETOOTH:
case Constants.Operation.DISALLOW_CONFIG_CELL_BROADCASTS:
case Constants.Operation.DISALLOW_CONFIG_CREDENTIALS:
case Constants.Operation.DISALLOW_CONFIG_MOBILE_NETWORKS:
case Constants.Operation.DISALLOW_CONFIG_TETHERING:
case Constants.Operation.DISALLOW_CONFIG_VPN:
case Constants.Operation.DISALLOW_CONFIG_WIFI:
case Constants.Operation.DISALLOW_APPS_CONTROL:
case Constants.Operation.DISALLOW_CREATE_WINDOWS:
case Constants.Operation.DISALLOW_CROSS_PROFILE_COPY_PASTE:
case Constants.Operation.DISALLOW_DEBUGGING_FEATURES:
;
case Constants.Operation.DISALLOW_FACTORY_RESET:
case Constants.Operation.DISALLOW_ADD_USER:
case Constants.Operation.DISALLOW_INSTALL_APPS:
case Constants.Operation.DISALLOW_INSTALL_UNKNOWN_SOURCES:
case Constants.Operation.DISALLOW_MODIFY_ACCOUNTS:
case Constants.Operation.DISALLOW_MOUNT_PHYSICAL_MEDIA:
case Constants.Operation.DISALLOW_NETWORK_RESET:
case Constants.Operation.DISALLOW_OUTGOING_BEAM:
case Constants.Operation.DISALLOW_OUTGOING_CALLS:
case Constants.Operation.DISALLOW_REMOVE_USER:
case Constants.Operation.DISALLOW_SAFE_BOOT:
case Constants.Operation.DISALLOW_SHARE_LOCATION:
case Constants.Operation.DISALLOW_SMS:
case Constants.Operation.DISALLOW_UNINSTALL_APPS:
case Constants.Operation.DISALLOW_UNMUTE_MICROPHONE:
case Constants.Operation.DISALLOW_USB_FILE_TRANSFER:
case Constants.Operation.ALLOW_PARENT_PROFILE_APP_LINKING:
case Constants.Operation.ENSURE_VERIFY_APPS:
case Constants.Operation.AUTO_TIME:
case Constants.Operation.ENABLE_ADMIN:
case Constants.Operation.SET_SCREEN_CAPTURE_DISABLED:
case Constants.Operation.SET_STATUS_BAR_DISABLED:
CommonUtils.callSystemApp(context,operation.getCode(),Boolean.toString(false),null);
break;
case Constants.Operation.APP_RESTRICTION:
revokeAppRestrictionPolicy(operation);
break;
default :
throw new AndroidAgentException("Invalid operation code received");
}
}
 else {
switch (operation.getCode()) {
case Constants.Operation.CAMERA:
revokeCameraPolicy(operation);
break;
case Constants.Operation.INSTALL_APPLICATION:
revokeInstallAppPolicy(operation);
break;
case Constants.Operation.ENCRYPT_STORAGE:
revokeEncryptPolicy(operation);
break;
case Constants.Operation.PASSCODE_POLICY:
revokePasswordPolicy();
break;
case Constants.Operation.WIFI:
revokeWifiPolicy(operation);
break;
case Constants.Operation.APP_RESTRICTION:
revokeAppRestrictionPolicy(operation);
break;
}
}
}

public void revokeExistingPolicy ( org . wso2 . emm . agent . beans . Operation operation ) throws AndroidAgentException { if ( applicationManager . isPackageInstalled ( Constants . SERVICE_PACKAGE_NAME ) ) { switch ( operation . getCode ( ) ) { case Constants . Operation . CAMERA : revokeCameraPolicy ( operation ) ; break ; case Constants . Operation . INSTALL_APPLICATION : revokeInstallAppPolicy ( operation ) ; break ; case Constants . Operation . ENCRYPT_STORAGE : revokeEncryptPolicy ( operation ) ; break ; case Constants . Operation . PASSCODE_POLICY : revokePasswordPolicy ( ) ; break ; case Constants . Operation . WIFI : revokeWifiPolicy ( operation ) ; break ; case Constants . Operation . DISALLOW_ADJUST_VOLUME : case Constants . Operation . DISALLOW_CONFIG_BLUETOOTH : case Constants . Operation . DISALLOW_CONFIG_CELL_BROADCASTS : case Constants . Operation . DISALLOW_CONFIG_CREDENTIALS : case Constants . Operation . DISALLOW_CONFIG_MOBILE_NETWORKS : case Constants . Operation . DISALLOW_CONFIG_TETHERING : case Constants . Operation . DISALLOW_CONFIG_VPN : case Constants . Operation . DISALLOW_CONFIG_WIFI : case Constants . Operation . DISALLOW_APPS_CONTROL : case Constants . Operation . DISALLOW_CREATE_WINDOWS : case Constants . Operation . DISALLOW_CROSS_PROFILE_COPY_PASTE : case Constants . Operation . DISALLOW_DEBUGGING_FEATURES : ; case Constants . Operation . DISALLOW_FACTORY_RESET : case Constants . Operation . DISALLOW_ADD_USER : case Constants . Operation . DISALLOW_INSTALL_APPS : case Constants . Operation . DISALLOW_INSTALL_UNKNOWN_SOURCES : case Constants . Operation . DISALLOW_MODIFY_ACCOUNTS : case Constants . Operation . DISALLOW_MOUNT_PHYSICAL_MEDIA : case Constants . Operation . DISALLOW_NETWORK_RESET : case Constants . Operation . DISALLOW_OUTGOING_BEAM : case Constants . Operation . DISALLOW_OUTGOING_CALLS : case Constants . Operation . DISALLOW_REMOVE_USER : case Constants . Operation . DISALLOW_SAFE_BOOT : case Constants . Operation . DISALLOW_SHARE_LOCATION : case Constants . Operation . DISALLOW_SMS : case Constants . Operation . DISALLOW_UNINSTALL_APPS : case Constants . Operation . DISALLOW_UNMUTE_MICROPHONE : case Constants . Operation . DISALLOW_USB_FILE_TRANSFER : case Constants . Operation . ALLOW_PARENT_PROFILE_APP_LINKING : case Constants . Operation . ENSURE_VERIFY_APPS : case Constants . Operation . AUTO_TIME : case Constants . Operation . ENABLE_ADMIN : case Constants . Operation . SET_SCREEN_CAPTURE_DISABLED : case Constants . Operation . SET_STATUS_BAR_DISABLED : CommonUtils . callSystemApp ( context , operation . getCode ( ) , Boolean . toString ( false ) , null ) ; break ; case Constants . Operation . APP_RESTRICTION : revokeAppRestrictionPolicy ( operation ) ; break ; default : throw new AndroidAgentException ( "Invalid operation code received" ) ; } } else { switch ( operation . getCode ( ) ) { case Constants . Operation . CAMERA : revokeCameraPolicy ( operation ) ; break ; case Constants . Operation . INSTALL_APPLICATION : revokeInstallAppPolicy ( operation ) ; break ; case Constants . Operation . ENCRYPT_STORAGE : revokeEncryptPolicy ( operation ) ; break ; case Constants . Operation . PASSCODE_POLICY : revokePasswordPolicy ( ) ; break ; case Constants . Operation . WIFI : revokeWifiPolicy ( operation ) ; break ; case Constants . Operation . APP_RESTRICTION : revokeAppRestrictionPolicy ( operation ) ; break ; } } }
revokes emm policy on the device .
