USB debugging is turned on again with every boot
Expected Behavior
When USB debugging is turned off in developer settings, it should stay off after the next reboot. (When USB debugging is off the prop sys.usb.config has the value mtp)
Current Behavior
When USB debugging is turned off in developer settings, it gets enabled after the next boot. (Although USB preferences is set to "no data transfer". Right after boot the prop sys.usb.config has the value adb.)
Possible Solution
I tried setting the prop sys.usb.config to mtp but this has no impact on an USB shell connection, only an internal terminal app didn't work anymore.
Update: I found a prop to disable USB debugging right from start: persist.sys.usb.config=none. If I set this with the "MagiskHide Props Config" module USB debugging stays off after booting.
There is also a setting ro.debuggable=1 in /default.prop. In LineageOS patch 209834 I found a patch to enable USB debugging when ro.debuggable equals 1. So if either the patch gets reversed or ro.debuggable is set to 0 USB debugging should stay off after booting.
Setting persist.sys.usb.config=none enables USB debugging for some seconds during booting, so ro.debuggable=0 would be the better option in the light of security. I'd just edit /default.prop (after remounting /system/etc/prop.default read-writeable) and set it to 0, but I am not sure if there are any other consequences - and with the next update this settign would be gone.
Steps to Reproduce
- Turn off USB debugging in developer settings.
- Reboot.
- Check developer settings, USB settings is turned on again. Connect PC through USB and run adb shell - shell connection is established.
/device polaris /version lineage-16.0 /date 2019-03-09 /kernel 4.9.162-perf-g2660d995 #1 SMP PREEMPT Sat Mar 9 06:43:50 UTC 2019 aarch64 /baseband AT4.0.c2.6-301-0214_2211_7aa7b8a,AT4.0.c2.6-301-0214_2211_7aa7b8a /mods Google Apps, F-Droid, Magisk 18.1 with modules ANXMiuiCamera + MagiskHide Props Config
I have read the directions.