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>
One heavy dependence between the current AMS service and activities
is process management which is heavy affected by activities and their
current state. We introduce WindowProcessController and WindowProcessListener
objects as a structured way for the process changes in AM package to
be communicated to the WM package and WindowProcessListner for activity
changes in the WM package to the communicated back to the AM package.
The ProcessRecord object in AM will own the WindowProcessController object
and also implement the WindowProcessListener.
Test: Existing tests pass
Test: go/wm-smoke-auto
Bug: 80414790
Change-Id: I9e96e841b0f95e99a597cb4629fa5d2fe45760b6
3rd step in unifying the window hierarchy that is currently split
within AM and WM packages. We separate the the internal interface used
to communicate within system server dealing with activities and their
containers (tasks, stack, display) from the rest of AM internal
interface.
Test: Existing tests pass
Test: go/wm-smoke-auto
Bug: 80414790
Change-Id: Idad77721c1fe10621b9be5dced42a0a11f0183e5
When a USB device or accessory gets plugged in the system might
automatically start activities that have a device/accessory filter set
to include the plugged in USB device.
Unfortunately we seen too many apps setting too broad of a filter and it
annoys the user that this apps wants to start every time the device gets
plugged in.
This change dumps the acitivity names and their filters so debugging
such issues is much easier.
To do this, there is some mild refactoring:
1. Split packageMatchesLocked into
- getDeviceFilters to resolve all device filters
- getAccessoryFilterer to resolve all accessories
- Check if a filter matches after resolving all filters. This is no
performance issue as usually there is only one or two filters per
activity.
2. Split queryIntentActivitiesForAllProfiles into
- A per user part, so that we can use the exact same intent-resolution
code for the dump-code
- And a loop over the per user part
Test: adb shell dumpsys usb
+ incident_report usb
+ verified that the output is as expected
Change-Id: I552c963b9a1b1c7df0adc6746af8cd42a4691cd6
UsbDescriptorParser::parseDescriptors always returned true.
Remove the return value, and remove the one constructor that
doesn't parse descriptors so the device is always in a parsed state.
Bug: 74119682
Test: Built
Change-Id: I2dd8d439405867d78102a9591dd1db36fe3959dc
The current model for setting up a functionfs
function is:
UsbDeviceManager#setCurrentFunctions() ->
intent is sent to MtpReceiver to write the descriptors ->
init/hal waits for descriptors to write, then pulls up gadget ->
Gadget is configured, a USB_STATE intent starts MtpServer
The main downside of this is a lack of reliability because
the Mtp process could be killed at any point. Normally, a
gadget is unbound if its control endpoint is closed. no_disconnect
works around this, but is still a little janky. In addition, the
extra intent delays the startup of the gadget.
With the new model, UsbDeviceManager writes the descriptors
on initialization. Since it is a system service, it won't be killed.
UsbDeviceManager#setCurrentFunctions() ->
init/hal pulls up gadget ->
Gadget is configured, a USB_STATE intent starts MtpServer
MtpServer calls UsbManager#getControlFd to get a dup of the control
endpoint.
Also modify permissions so system server can access mtp files.
Bug: 72877174
Test: Change usb configurations to ptp/mtp
Change-Id: Id17d2b5930f4e1f37ec1b4f00add9d594174ad49
Since the callbacks are async, its possible that the callback gets
called before the systemReady flag is set.
Change-Id: I5752c097e25ef30a151461540dd7d5323cc927af
Terminal type is currently used to determine presence of audio input
or output capabilities on audio devices.
Broaden the set of terminal types accepted as inputs and outputs.
Test: Verified by playing with USB-C to 3.5mm adapter with
high impedance load, checked Terminal type reported as 0x0603.
Verified no audio on old build, audio on new build.
Checked with low impedance load with and without microphone.
Checked with no load.
Bug: 73813676
Change-Id: Ib9b291e4770dc3c03157df7ac4277da1692174d7
Since adb is being removed from the functions read
from sys.usb.config anyway, it makes more sense to
set it to NONE on boot. This prevents errors with
devices that already have oem functions in the config.
Bug: 73010922
Test: Power test passes
Change-Id: I855ba228dbdd9f8c8a91842a8beb68a789fdf1e9
Keep track of the currently selected UsbAlsaDevice in a
synchronized manner.
Allow it to notify AudioService that it has been disabled
prior to replacing it with a new Audio Device.
Test: verified audio worked as expected when using
both UAC2 and non-UAC2 3.5mm adapters, with 3.5mm
plugging/unplugging and USB-C plugging/unplugging.
Change-Id: I8b76145490da38d4eec25f4f2bdb6695afa151b9
Adds support for ALSA jack detection for USB.
Spawns a new thread for ALSA jack detection on device
insert. If the device doesn't support ALSA jack detection,
the thread terminates.
Test: UAC2 audio accessory and a kernel
which supports USB ALSA Jack detection, switching between
speaker and USB works perfectly with plug/unplug at jack.
Bug: 68337205
Bug: 70632415
Change-Id: I1800660ad4d2341f19ce7be6d6b01f81a7f2d1a6
If onRegistration is called before functions
are received, adb can be kicked on boot. To fix,
don't set functions if they are still being
requested.
Bug: 73168456
Test: adb logcat doesn't dc
Change-Id: I25bfe13604f0ce0c65c3eb82bcfafd9fcae0283f