Added USB audio-class 2.0 format type descriptors.
Added Tree parsing.
Rearchitected reporting (again) to better support reuse and scale.
Bug: 64301464
Test: Run code against representative USB audio peripherals and verify
that each correctly handles or ignores all descriptors and the correct
device semantics (headset / not-headset) are still calculated.
Change-Id: I1b3b01ab1cd804ed876bf6427c3afba15eea6a6e
When MTP or PTP is in the config and user changes,
it clears dataUnlocked but sets the functions to
mCurrentFunctions which will leave MTP or PTP in the
config. If dataUnlocked is false, we want to remove
MTP/PTP from the config when adb is enabled, and leave
them in otherwise. This is done automatically by
setting functions to null.
Bug: 64822515
Test: Change users while adb / mtp connected.
Change-Id: I82561f82e06f247c967438a473b08b5098d39ccb
While bootup, usb gets configured when the property triggers are
run. While in oemOverride, the current configuration is persisted
in sys.usb.<bootmode>.config. Do not reconfigure the stack if the
current configuration is same as the new configuration.
Bug: 64225494
Change-Id: Id35d110bf3fa8f58d05e14941716d4ad2b196f8d
New title: Analog audio accessory detected
New message: The attached device is not compatible with this
phone. Tap to learn more.
Also switch to bigTextStyle as the notification message
takes more than one line to display.
Bug: 63962800
Test: Attached analog audio accessory to verify the notification
manually. Also verified that the charging notification remians
untouched.
Change-Id: I5c395bdf3c3dd11f3be8835ec773f087afdc85d9
The decision whether to show or hide the "Usb supplying power.."
notification is based on two different broadcasts
1. USB_DEVICE_ATTACHED/DETACHED
2. USB_PORT_CHANGED
Depending on how long the port takes to enumerate, the required
intents might arrive in different order. Previously, it was assumed
that the ATTACHED broadcast would arrive before the PORT_CHANGED
broadcast and the code was aggressive to reduce the number of
times the decision to display/hide the notification is made.
This might cause the notification to be displayed in some instances
when it is not supposed to be displayed. This CL makes the usb service
to always reevaluate whenever USB_DEVICE_ATTACHED/DETACHED is
received.
Also, adding logs to print whenever the notification in enqueued/
dequeued.
Bug: 63785369
Test: Verified that the notification is displayed when connecting
to another pixel device and hidden when mouse or headset is
connected.
Change-Id: I30650a2d9923d01a1fce4b9450e65ec7f4e6557b
Accessory mode implements debounce timeout ACCESSORY_REQUEST_TIMEOUT
within which when a disconnect is seen, the accessory function would
be removed from the usb configuration but mCurrentAccessory would
not be set to NULL until the timeout expires.
Also, setEnabledFunctions(null, false, false) does not force an
additional disconnect when accessory function has already been
removed from usb configuration.
BUG: 62241238
Change-Id: I25973475fb02d613e11396bcad5e88656ad8940a
Accessory connects / disconnects can occur before
boot complete, so don't broadcast intents if that
is the case.
Bug: 63114621
Test: connect/disconnect an accessory
Change-Id: Ib8f9eb97ce1630004511fcc1fb84594ccc812c06
Accessory connects / disconnects can occur before
boot complete, so don't broadcast intents if that
is the case.
Bug: 63114621
Test: connect/disconnect an accessory
Change-Id: Ib8f9eb97ce1630004511fcc1fb84594ccc812c06
This reverts commit e37eda7b413099f881f348aeafc5d2d33639484e.
I83e7e8efdff9cd662e179240336abebedf859c62 adds the missing
dependency to let desugar work.
Bug: 63078196
Test: m -j ANDROID_COMPILE_WITH_JACK=false
We got a report from a user in which ptp was set in the
persistent config, likely from a previous version.
This causes errors in the usb state and is not removed
by an ota. To fix, remove ptp in the same place that mtp
is removed from the persistent config.
Bug: 62202885
Test: Add ptp to persistent config, verify removed.
Change-Id: I5ebd93b9c8a49bcaca5a3362e49ed1e1acf50a9b
Clients (viz. Tethering) use UsbManager@setCurrentFunction(null, ..)
to make the device switch to default functions. While in OemMode,
this gets set to the last enabled functions list. Instead,
enable MTP or ADB depending on whether ADB is enabled or not.
This is the expected behavior for normal boot as well.
Bug: 37491031
Test: Verified that the device falls back to either mtp or adb while
in OemOverride mode.
Change-Id: I1c26d1d0ee3c015b597d40771cd765b783cd91bb
Some users depended on adbd continuing to run after disconnect
in order to use scripts with nohup. This change allows this
use case to keep working since only mtp has to be force
set.
Bug: 38227228
Test: adb shell "nohup sh /sdcard/script" where script contains
"sleep 5; touch /sdcard/done" and verified file still appears even if
disconnected during sleep.
Test: am force-stop com.android.providers.media, still connects
Change-Id: I25ae2b922fa4d06109ac8cf5e43e1c47a33c46a6
A forward match is a intent-target (aka. match) that switches between the
personal and work profile's intent resolver.
This can be unnecessary if there are no work profile matches.
We need to remove these unnecessary matches early as the default activity
resolution code considers a system app as default _only_ if it is the only
match. Before there could still the an unnecessary forward match under
consideration.
Test: Connected USB accessory that only matches a system app on the personal
profile.
Before we showed a confirm-dialog, now we consider the system app
as default and automatically launch it.
Fixes: 37530439
Change-Id: I7bc9b969fc0b9abae4d15dd3f268783d05b91f9a
Link to android.hidl.manager-V1.0-java shared libraryto prevent
duplicate copies of the library present in process address
space.
Bug: 38036660
Test: Verified that the UsbService reports status of the ports through
dumpsys usb.
Change-Id: Ie3de4f9bbe28061e7cc464fa3cab2f6bd6fe6995