Android(Oreo) 8.1.0 Set DeviceOwer app causes "Workspace has been locked" I've been using my app as a deviceOwner App since lollipop.
I have a new device here which I want to be DeviceOwner too.

It is a Samsung galaxy Tab A 10.5(2018) SM-T590.

I am currently running this Version of the rom: T590XXU2ASC1.

I am not using NFC method.
I usualy create the /data/system/device_owner.xml file by myself.
But since it is not working I tryed this method:


Factory reset the tablet in recovery mode
Pass through the annoying startup menus
Set lock screen to none
Enable Usb Debugging
Install my app adb install MyApplicaton.apk
adb shell dpm set-device-owner com.example.myapplication/.MyApplicationReceiver
It always says success when i execute the command.
Start my app, i can pin/unpin my app without problem.
Reboot, and then the famous message appears everytime:
Workspace has been locked
Unauthorized software has been installed on your device.Workspace has been 
locked to prevent any unauthorized access. Contact your admin.


Then if i press on the FACTORY DATA RESET button the workspace app crashes then pops back.

I tryed the kioskModeDemo app and the androidDeviceOwner sample app and they all do the same problem.

Anybody have any hints of why this is not working anymore on Android 8(oreo)?

Thanks
I found the problem:
Once you oem unlock(custom os) your device on a certain samsung knox level API, you can't be device owner anymore on this device.

This is from Samsung Knox page:


  "Cannot create work profile" "The security policy prevents the creation of a managed device because a custom OS is or has been installed on this device". 


The device could be vulnerable to potential attacks with custom os.