Rewrite trust USB restriction handling
* USB HAL 1.3's enableUsbDataSignal works so well that it instantenously ejects the usb device, which means we have to be smart about handling state 1, "restrict only when locked". The way it works now * 0, do not restrict, do nothing / keep USB enabled. * 2 (new), always restrict, keep USB disabled. * 1 (default), restrict when locked. If unlocked, do not restrict. If locked but USB connected (presumably when unlocked), do not restrict to avoid ejecting that device, instead restricting USB once the device has been disconnected. * Pixels have switched to the new AIDL HAL (2.0?) * Call UsbManager directly which knows to call the right method Change-Id: Ieac764cfb48856648fc15ad50f20b0c6be332a72 While using USB HAL v1.2 or earlier, one could call UsbManager's enableUsbDataSignal(true) and it will return back true due to the USB data status always being reported as DATA_STATUS_UNKNOWN. This ends up breaking the logic to fallback to UsbRestrictor, since it was previously assumed that enableUsbDataSignal() should always return false if on an unsupported HAL version. Instead, we should check the USB HAL version separately so that we can use enableUsbDataSignal() only if we're on a supported HAL version. If not, then we attempt to use UsbRestrictor instead. Change-Id: Iddb4685d8d640d7ce223bb0ec44b0e1d5abf610b Co-Authored-By:jabashque <jabashque@gmail.com> Co-Authored-By:
Chirayu Desai <chirayu@calyxinstitute.org> Change-Id: Ib997db7427960444a4c84a35d3c0db506840abdd
Loading
Please register or sign in to comment