As checking the permissions might call UsbDevice/UsbAccessory.getSerial
again, we have to make sure that in this code paths we run with the
system's identity so that we can always resolve the serial number.
Test: CtsVerifier UsbAccessory/UsbDevice test
Fixes: 117606509
Change-Id: I777be10b806ab02046f99805806ae1a16ebb0203
Specifically for the Sony PS4 controller.
Bug: 129697606
Test: Build, install, plug in PS4 contoller, note audio continues to route to device speaker.
Change-Id: I20f5cafb616b4a673772f8e4614e1efa8ae0edb4
Contaminant detection is re-enabled when the disconnected port's
portStatus has contaminant detection disabled. During port removal,
there is no reason why contamiant detection has to re-enabled since
the port is anyways being teared down.
Bug: 129696344
Test: dumpsys usb add-port "matrix" ufp;
dumpsys usb remove-port "matrix" ufp
Change-Id: Ie146db82d93414e90ee99b4d17ec0ba5ada2ce83
While checking for possible role combinations, the SINK/HOST combination
seems to be mistakenly checked twice intead of SINK/DEVICE.
This CL fixes this. The code now checks for:
1. source & host
2. sink & host
3. source & device
4. sink & device
Cherrypicked from aosp:
https://android-review.googlesource.com/c/platform/frameworks/base/+/933377
Bug: 119142682
Test: Build success
Change-Id: I5e652fbf9313bd2c122fe728d58e577085632253
SystemUI disables contaminant detection when user wants to continue
using the port. Re-enable contaminant detection when the accessory
is unplugged.
Bug: 128534822
Test: Tested with the mock circuit.
Change-Id: I22a3c839264876409c68c6a3145c9fcc6278f381
Do not show "Safe to use USB port" when contaminant detection is
disabled by the user.
Bug: 128534822
Test: Tested with the mock circuit.
Change-Id: Iebd12f04a6d8bfd7be5d673cf5a6742cf3d6f281
For any change in port status, the following needs to be done:
1. Send port changed Broadcast
2. Log to statsd
3. Update contaminant notification.
Bug: 128534822
Test: Tested with the mock circuit.
Change-Id: I2c279a2ea0255a69c0a74a98ebf5bf680cae1fe1
Store IUsb as V1.0 instance by default and downcast when
calling V1.2 methods.
Bug: 123498520
Test: Checked dumpsys usb to reflect port status for
V1.0, V1.2, V1.3 implementations.
Change-Id: Id55d930252bff39b3b86283f3b6ab33a5e935b24
Bug: 119642987
Bug: 117330206
Bug: 77606903
Test: Ran the following sequence:
1. Add simulated port: dumpsys usb add-port "matrix" ufp
2. Set contaminant present to true:
dumpsys usb set-contaminant-status "matrix" true
Contaminant present notifcation shows up and dialog pops up upon
clicking the notification.
3. Set contaminant present to false:
dumpsys usb set-contaminant-status "matrix" false
Contaminant present notification is dismissed and the safe to use
notification shows up.
Change-Id: I33d22caafbedb2a21a0f61f663ebddf5c9e3f84b
This CL simulates contaminant presence through simulated port.
1. Add a port: dumpsys usb add-port "matrix" ufp
2. Set contaminant presence to true: dumpsys usb set-contaminant-status "matrix" true
3. Set contaminant presence to false: dumpsys usb set-contaminant-status "matrix" false
Bug: 119642987
Bug: 117330206
Bug: 77606903
Test: Made sure that dumpsys usb reflected the correct contaminant
status.
Change-Id: Iadb0ea92db65afdb25dbd32c02d9fb778bd4ec8c
Bug: 119642987
Bug: 117330206
Bug: 77606903
Test: Manually tested for contaminant notification to show up
Change-Id: If22215df1e6127aa67190f72328fbc32b9477bc2
There is a situation that getCurrentUsbFunctions callback function will
be invoked before mCurrentUsbFunctionsRequested flag updated, thus, gadget
will be reset during boot completed. Make sure mCurrentUsbFunctionsRequested
flag be updated before getCurrentUsbFunctions callback function invoked.
Bug: 119688133
Test: Verified that gadget reset does not happen
Change-Id: Id8b58d9ccd3f62c976d1292575a06554bef622a4
Signed-off-by: Howard Yen <howardyen@google.com>
This is needed by making the setup wizard use only system-api.
Test: Built, switched USB port state
Change-Id: I8e56859a5b36e7de91691522a34f7d6f62dcbb20
Fixes: 115301401
UsbDeviceAttached is logged when the device has an audio interface.
Info such as VID, PID, whether the device has hid or mass storage
interface and the duration for which the usb device was connected
would be logged as well.
Bug: 118783261
Test: Manually tested by running: adb shell cmd stats print-logs,
adb logcat | grep statsd | grep \(77\)
Change-Id: I57bbfd22ef377553daa113968fe53c4fe0f8e4d2
last_connect_duration_millis will be set to 0 for a connect event.
last_connect_duration_millis will be set to the amount of time the port
was left connected for a disconnect event.
Bug: 118783261
Test: Manually tested by running: adb shell cmd stats print-logs,
adb logcat | grep statsd | grep \(70\)
Change-Id: Ifd1df55fb6317e789a2b04236ce0a6e4665e3664
The following would the logged:
1. Status of the connection - connected/disconnected.
2. Port id as a device could have multiple ports.
Bug: 118783261
Test: Manually tested by running: adb shell cmd stats print-logs,
adb logcat | grep statsd | grep \(70\)
Change-Id: Ideea36c7745293f5b6ec9cc35fd5f709f5175d5a
onRegistration callback gets triggered as soon has the
serviceNotification object is registered with registerForNotifications.
The preexisting flag in the callback is set if the gadget hal service dies
and restarts. Use this to differentiate between the onRegistration call
for the registerForNotifications vs actual gadget hal service restart.
Do not reset usb gadget if the onRegistration callback is called as a
result of registerForNotifications. This will overcome the occasional
reset of the usb gadget hence the connection during phone bootup.
Bug: 118678530
Test: Verified that gadget reset does not happen
Change-Id: I3b94e55289bb3a53eb9e083177fd4d54bec5f4da
Also remove the "Usb" from the AIDL function since it's not really
related to USB.
Test: make
Bug: 63820489
Change-Id: Ibf23964665a115a5bc835820dcff98aaf7ba610f
This makes the AdbService the source of truth for whether ADB is enabled
on the system or not. All UsbManager checks will now query the
AdbService.
Test: make
Bug: 63820489
Change-Id: I2965a15b5fa9f747fe0ae4dc791b5e357e78253f
This doesn't do anything yet, but is needed to migrate functionality
from the USB service to the ADB service.
Bug: 63820489
Test: make
Change-Id: I402bb234a055cf0b199e0922bf92736aa659d46a
This service should not be in the USB module anymore. Move it to the
core services.
Bug: 63820489
Test: make
Change-Id: I6e07b8e3aa29fbd9d30d130ef0c882a84a12d30c
Rename the UsbDebuggingManager to AdbDebuggingManager. It doesn't
technically depend on the USB stack, so rename to make the lack of
association more clear.
Bug: 63820489
Test: make
Change-Id: Ife83d3ec9701882781f5a9562ccc5435d51d246b
First step in separating the USB and ADB stacks. The ADB functionality
does not logically need USB, so move it to its own package initially to
make further detangling more clear.
Bug: 63820489
Test: make
Change-Id: I6cf57c4ebc6ec8956cdd7ce817bdc4bcf7ff27a9
This is needed as deeper in the code we call UsbAccessory.getSerial
which behaves differently depending on the caller. I.e. we have to make
sure to have the system server identity when we call this methods.
Fixes: 117547676
Test: - Started Android Auto
- CtsVerifier USB Device and USB Accessory tests
Change-Id: I6d752ad5d2ff058dadf1e27e41247153c7db5ee6
STORAGE_SERVICE is not ready or not available to use.
UsbDeviceManager will get null value and cause null object
reference exception. Check return value before use.
Test: No exception when start USBService
Change-Id: Icdbc532894d3ca1548f327d9f63d495baa549c68
Allow multi-usb work to continue without changes spinning out of control.
Bug: 111397675
Test: Set single-mode on and verify correct behavior.
Change-Id: I70f70bbb8edae6cbd1e73bee40fe821079cba9d8
Pure refactor of USB code for simple Arc logic injection.
Should have no behavior change for AOSP.
Bug: 74258201
Test: Run USB Accessory and USB Device test.
Change-Id: I8f7dace9155ceb75bc465fbb03a26f52694c8f93
Attempt to read USB descriptor of USB hub devices results in hanging
thread on getDescriptorString_native call. Also check device
interface class/subclass as well.
Test: verified that usb host thread no longer stuch in getDescriptorString_native call on Mojave board with USB hub attached
Bug: 112657091
Change-Id: I46271dcc9c80168a650940fbde9218a54cafe8da
Using "0" as value for USB control transfer timeout
results in an unlimited timeout in case of bad USB
devices. In host kernels where hung task panic
is enabled, this results in device reboot.
So, add a finite timeout for USB control transfer.
Test: manual run and test with bad USB devices.
Change-Id: Ibc13ca4d8259a08ae7419bb3bcac9c161b1d3693
Signed-off-by: sgopal1 <saranya.gopal@intel.com>