I was going through the new Android Management API.
Now, Google has their own app called Android Device Policy which acts as an MDM app but MDM apps don't require a factory reset but why do we have to factory reset the device when enrolling with AFW using Android Management API.
Can't the Android Device Policy be manually installed and set as the device administrator?
The Android Management API currently only supports the Device Owner mode, which has to be set during device setup after factory reset.
The Device Administrator mode, which doesn't require factory reset, is not supported by the Android Management API (at least not for now). You could manually set Android Device Policy as a device administrator but you wouldn't be able to use the API to manage the device.
Device Owner was introduced in Android 5.0, it gives much more capabilities than Device Administrator but requires factory reset as a security measure to prevent someone from taking full control of an existing device and its data.