'requires:android.permission.WRITE_SECURE_SETTINGS while running adb shell commands

I am trying to edit the settings for back gesture scaling on my Oneplus 9 running Android 12 on OxygenOS. The stock settings don’t let me set limits for the back gesture on the left side of the screen, so I wanted to set it manually.

adb shell settings put secure back_gesture_inset_scale_left -1

This command successfully limited the gesture like I wanted on this same device in Android 10 and 11, but running it now gives me this error.

Exception occurred while executing 'put':
java.lang.SecurityException: Permission denial: writing to settings requires:android.permission.WRITE_SECURE_SETTINGS

Not sure how to address this, I have enabled USB Debugging, Disabled Permissions Monitoring, and still nothing. The device is recognized by adb.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source