Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS on Xiaomi device

Yes i did find a solution for this, basically there’s an extra setting for chinese phones,

In developer options, enable "USB Debugging (Security settings)

Detail in here https://forum.xda-developers.com/t/i-cant-enable-write_secure_settings-for-an-app-over-adb.3855596/

Hope it helps!