I am launching DevicePolicyManager in an Activity after checking if user should be prompted to enable DeviceAdmin on device. 

If user clicks 
"Activate button", deviceAdmin will be enabled. 

If user clicks 
"Cancel" button, user will be shown a dialog that "You need to Activate Device Admin on device to proceed with the app". By clicking "OK" on this dialog, we exit the app.

This works as expected on any device. However, when "Do Not Keep Activities" is enabled on device from settings section, the above behaviour changes in case user chooses to "Cancel" the DeviceAdmin activation prompt. When user clicks Cancel on the prompt, the intent DevicePolicyManager is relaunched without showing the dialog -"You need to Activate Device Admin on device to proceed with the app". Does anybody know why this happens ?