I have run in adb
adb shell pm grant my.package.name android.permission.WRITE_SECURE_SETTINGS
And there were no errors in terminal. But how I can check if permission android.permission.WRITE_SECURE_SETTINGS
via adb been granted
You can do something like this
pkg=your.android.pkg'
perm='WRITE_SECURE_SETTINGS'
adb shell dumpsys package "$pkg" | grep "android.permission.$perm: granted=true"
to verify the permission is granted for your package.