This reverts commit 513160fd80.
Bug: 68944518
Bug: 68008691
Bug: 68337205
Test: USB connection to audio device and laptop
Change-Id: If9223aae953581b2f2e3a6b1adf174528aa94132
Each USB device can have one default handler. This app is launched when
the device is plugged in. A default handler automatically gets
permission to access the device when launched.
All other apps have to request the permission to access the USB device
via UsbManager.requestPermission. In the permission dialog there is an
option to make the app the default app for the device. Of course this
only makes sense if this app declares the right properties to be
auto-launched. Hence check this and only then show this options.
Also made the string in the dialogs easier to understand.
AccessoryFilter and DeviceFilter needed to be copied so I can access
them from system-ui. No code change in these classes.
Test: requested permissions from app that could by the default for the
device and from an app that could not. Also tested "confirm" flow
that is executed when the device is plugged in and a app that
might be default is installed.
Bug: 67381583
Change-Id: I12eb7efed0ad107c70ae32433a5629108f252486
Android accessory mode timeout value is a lot larger than default
timeout value (10 seconds vs. 1 second). The large timeout
value is needed to accomodate for HUs that are not quick
to respond after MTP to Accessory mode change.
Bug: 68819844
Test: Manual
Change-Id: I665e1001f8df66fb00cbfcbf6c58d97c372797fc
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 e37eda7b41.
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