Add a limited privilege "trade-in mode" for adbd.
If service.adb.tradeinmode is 1, adbd will setcon() into a lower
privilege mode. If for some reason setcon() fails, the property is
changed to -1 to prevent infinite loops. On user builds, adbd is also
stopped.
To test:
adb root
adb shell setprop service.adb.tradeinmode 1
abd unroot
In this limited environment, the only command allowed is "adb shell
tradeinmode". On userdebug or eng builds, "adb root" can be used to
leave trade-in mode.
Bug: 307713521
Test: manual test
Flag: com.android.tradeinmode.flags.enable_trade_in_mode
Change-Id: Ie2829b880af07469c653cb6e9f83d709e6a982bd
10 files changed