summaryrefslogtreecommitdiffstats
path: root/services/usb
Commit message (Collapse)AuthorAgeFilesLines
* UsbDeviceManager: Remove charging from persisted function compositionTom Marshall2016-06-101-0/+1
| | | | | | | | | | | | | | | | | CM 12.1 supported the function composition "charging" to indicate no function compositions, only charging. CM 13.0 does not support this. Instead, mtp is used (see commits to fix b/21429947 for an explanation why this is done). When a user upgrades from 12.1 to 13.0 and the persisted function composition is "charging", modifications to the function composition, such as to add adb or mtp, will timeout and fail. This introduces a three second latency on the change. Removing the charging function when reading the persisted function composition avoids the delay. Jira: BACON-4912, OPO-765 Change-Id: Ibbf4f7ce12f97aa046fa214383580ef4d191ce25
* usb: ensure accessory detached sent on re-attachKhalid Zubair2016-05-181-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | It's possible for USB state change events to get swallowed if the cable is reconnected quickly because state changes are de-bounced with a 1 second interval. As a result an accessory detached event will not be sent if it re-attaches quickly. However, UsbDeviceManager will send an attached event when the USB connection is configured. This causes apps to misbehave and attempt to open the accessory without closing the previous one. The call to openAccessory fails (with EBUSY) because the underlying /dev/usb_accessory chardev is already open exclusively by the first accessory. Fix this issue by sending a detached event before sending an attached event if the previous accessory was not cleaned up properly. This change fixes a failure in CTSVerifier's USB Accessory Test where the test fails if you reconnect the USB cable quickly. OPO-688, FEIJ-471 Change-Id: I49690553213e866d200da1fb22c83348c6eb3491
* Merge tag 'android-6.0.1_r22' of ↵Steve Kondik2016-03-111-1/+2
|\ | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/base into cm-13.0 Android 6.0.1 release 22 Change-Id: I0d31899b234156a91accb61e0a7fb3d8d16d5062
| * UsbDeviceManager: set mUsbDataUnlocked=false on user switchNick Kralevich2015-10-291-0/+2
| |\ | | | | | | | | | | | | | | | | | | am: 5701321701 * commit '5701321701a319d3f2d98365a82266eeddaed895': UsbDeviceManager: set mUsbDataUnlocked=false on user switch
| | * UsbDeviceManager: set mUsbDataUnlocked=false on user switchNick Kralevich2015-10-291-0/+2
| | | | | | | | | | | | | | | | | | | | | Make sure access to MTP data is relocked when a user switch occurs. Bug: 25288494 Change-Id: I69dafc7f51b847f4dba1993a85fb1a51df1a5e37
| * | am 0eb10ede: Merge "Always set the usb config when modifying it." into ↵Tim Kilbourn2015-09-191-4/+3
| |\ \ | | |/ | | | | | | | | | | | | | | | mnc-dr-dev * commit '0eb10ede2364bf975721d95f7af7a1e4f4b617f8': Always set the usb config when modifying it.
| * | Adds config flag for USB notification.Gus Prevas2015-09-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change modifies UsbDeviceManager such that the ongoing system notification for USB charging state is controlled by a config flag. Bug: 23409719 Change-Id: I2ef24fe74923170a6e8dd02375b973b4025281e4
* | | SystemUi: Handle custom and dynamic tiles the same way.Adnan Begovic2015-12-101-8/+1
| | | | | | | | | | | | Change-Id: I885a75444f88a8a0e521af55b413770681c55df6
* | | base: dynamic tilesJorge Ruesga2015-12-101-1/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for dynamic tiles Video: https://cloud.ruesga.com/f/71a12e4801/ Required: topic:customtiles_respkg topic:readd_customtiles JIRA: CML-22 Change-Id: Ie17ebf09ee88bc0c53561decc27430e174814543 Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
* | | Merge tag 'android-6.0.1_r3' of ↵Steve Kondik2015-12-071-0/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://android.googlesource.com/platform/frameworks/base into cm-13.0 Android 6.0.1 release 3 Change-Id: I59b9e5a943e0860d43bcfb36ee0e8b8b072412ea
| * | | UsbDeviceManager: set mUsbDataUnlocked=false on user switchNick Kralevich2015-10-291-0/+2
| | |/ | |/| | | | | | | | | | | | | | | | Make sure access to MTP data is relocked when a user switch occurs. Bug: 25288494 Change-Id: I69dafc7f51b847f4dba1993a85fb1a51df1a5e37
* | | fw: Move Secure settings to CMSettingsd34d2015-11-122-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves all Settings.Secure.* settings that, were added to CyanogenMod, to CMSettings. * KEYBOARD_BRIGHTNESS * BUTTON_BRIGHTNESS * BUTTON_BACKLIGHT_TIMEOUT * DEV_FORCE_SHOW_NAVBAR * ADB_NOTIFY * ADB_PORT * DEVICE_HOSTNAME * KILL_APP_LONGPRESS_BACK * PROTECTED_COMPONENTS * LIVE_DISPLAY_COLOR_MATRIX * ADVANCED_REBOOT * POWER_MENU_ACTIONS * DEFAULT_THEME_COMPONENTS * THEME_PREV_BOOT_API_LEVEL Change-Id: I49e9160177ffc727b20008817ac2b5ce5e89ead5
* | | Built-in mic is not used when USB mic is disconnectedAlejandro Ochoa2015-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases when the USB microphone is disconnected, audio stack does not switch to the built-in microphone. It gets stuck in a state where it still recognizes the USB mic is still connected. Current device removal implementation only considers USB output devices such as headset. The same process should be used for input USB devices (microphone). Bug: 24932354 Change-Id: Ic2089ef5a9a318cb47336ade405f79eccd7129f8 Signed-off-by: Alejandro Ochoa <alejandro.ochoa@intel.com>
* | | Merge tag 'android-6.0.0_r26' into HEADRicardo Cerqueira2015-11-052-17/+72
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Android 6.0.0 release 26 Conflicts: cmds/bootanimation/BootAnimation.cpp core/java/android/accounts/AccountManager.java core/java/android/app/AppOpsManager.java core/java/android/os/PowerManagerInternal.java core/java/android/os/storage/IMountService.java core/java/android/provider/Settings.java core/java/com/android/internal/widget/ILockSettings.aidl core/res/res/values-mcc204-mnc12/config.xml core/res/res/values-mcc219-mnc02/config.xml core/res/res/values-mcc730-mnc07/config.xml core/res/res/values/config.xml core/res/res/values/symbols.xml packages/SystemUI/res/values/config.xml packages/SystemUI/src/com/android/systemui/doze/DozeService.java packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java packages/SystemUI/src/com/android/systemui/statusbar/ExpandableOutlineView.java packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java services/core/java/com/android/server/LocationManagerService.java services/core/java/com/android/server/am/ActivityManagerService.java services/core/java/com/android/server/pm/PackageManagerService.java services/core/java/com/android/server/power/PowerManagerService.java telecomm/java/android/telecom/Phone.java telephony/java/android/telephony/CarrierConfigManager.java telephony/java/android/telephony/RadioAccessFamily.java telephony/java/android/telephony/ServiceState.java telephony/java/android/telephony/SignalStrength.java telephony/java/android/telephony/TelephonyManager.java telephony/java/com/android/ims/ImsCallProfile.java telephony/java/com/android/ims/ImsReasonInfo.java telephony/java/com/android/ims/ImsSuppServiceNotification.aidl telephony/java/com/android/ims/ImsSuppServiceNotification.java telephony/java/com/android/ims/internal/IImsRegistrationListener.aidl telephony/java/com/android/internal/telephony/RILConstants.java Change-Id: I99c6edb8e25a77145b5adef97d0d55bfbe676959
| * | Always set the usb config when modifying it.Tim Kilbourn2015-09-181-4/+3
| |/ | | | | | | | | | | | | | | | | | | On some devices, setting system properties takes too long and we end up with races where adbd gets killed and never comes back. With this change we avoid a small optimization that checks the previous value of the config, instead opting to set it every time. Bug: 23631400 Change-Id: I7567cc2efb3d5d15c45334bd66b28877a2af0ac3
| * Merge "Use init to write usb typec props." into mnc-dr-devTim Kilbourn2015-08-181-12/+42
| |\
| | * Use init to write usb typec props.Tim Kilbourn2015-08-141-12/+42
| | | | | | | | | | | | | | | | | | | | | | | | The sysfs nodes are owned by root, so we must use init to write to them. Bug: 21615151 Change-Id: Ia8c838827ff45794aa359443117ac85764cf3772
| * | Show usb charging notification when in host modeJason Monk2015-08-121-1/+27
| |/ | | | | | | | | Bug: 21615151 Change-Id: Ifc8c288a94f52ecac19990ab3d9095b1aef8efc3
* | Fix USB intent warning on deviceAttached()tobitege2015-10-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | Use sendBroadcastAsUser() in deviceAttached(), the same as deviceDetached() does. Attached generates log entry like this: "Calling a method in the system process without a qualified user" Example log: http://pastebin.com/UBWJR4KU (see line 30) Change-Id: I2384a3cb2fd336adeb0077c5729ee3aa66c696ca
* | Framework: Forward port ADB over network (Part 2 of 2)Ricardo Cerqueira2015-10-251-41/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Includes: - ADB Over Network, integration of the adb-host mode (already present) The feature can be used/tested without the Settings part: setprop service.adb.tcp.port 5555 Note: This ADB setting is not persistent (for security purpose) and require init.rc implementation event like this : http://bit.ly/AdbTcpIP Author: Tanguy Pruvot Id: I5c61a53948349c785356cb5aae165110d75e3074 Author: sssemil <suleymanovemil8@gmail.com> Show notification on adb over network too Screenshots - http://goo.gl/TgsRI6 Id: I9ddc0aa9a4f330a06ab5d97a8645d1b31bb6f299 Change-Id: I101216c5b8ddff5040d9eeaf35afefc5cd98bbf3
* | Port "Option to hide Adb notification icon (2/2)"Tanguy Pruvot2015-10-251-33/+42
|/ | | | Change-Id: I5d40f5b0990fa3a1d02210ad4cc2ff5ada15e69c
* UsbDeviceManager: fix b/21429947 regression (try #2)Nick Kralevich2015-08-042-34/+22
| | | | | | | | | | | | | | | | | | | | | | As discussed in b/21429947 (commit 674019065bceb4150190bfb1aa63cda9de0a8560), MTP must always be enabled, even if access to the underlying MTP data is disabled. Otherwise, Android will not enumerate on the USB bus, and won't receive notifications from the kernel about USB state changes. This effectively prevents using MTP functionality on user builds, or on userdebug/eng builds with adb turned off. Always ensure that MTP is the default driver mode. Move the DISALLOW_USB_FILE_TRANSFER filtering of mUsbDataUnlocked from setting time to the time we post the sticky broadcast. Remove isUsbDataUnlocked(). It essentially duplicates data in the sticky broadcast. Bug: 22447614 Bug: 21429947 Change-Id: I9d0d94cadbf6db6281ebd77bfb7162f9d06520c2
* UsbMidiDevice: add timestamps for input eventsPhil Burk2015-07-291-3/+5
| | | | | | | | This will improve the accuracy of recorded MIDI performances. Bug: 22801515 Change-Id: Ib78bc929224f2f27938c83a815eaa62f6b5f9560 Signed-off-by: Phil Burk <philburk@google.com>
* Merge "Revert "UsbDeviceManager: fix b/21429947 regression"" into mnc-devNick Kralevich2015-07-231-1/+4
|\
| * Revert "UsbDeviceManager: fix b/21429947 regression"Nick Kralevich2015-07-231-1/+4
| | | | | | | | | | | | | | | | | | | | This causes various problems with our testing infrastructure. This reverts commit b210026e3d5c955628ca8b8b9191ade08891e9ef. Bug: 22447614 Bug: 21429947 Change-Id: I57623e3d993e65b6ad89e7a7d28e9575cf638994
* | Merge "UsbDeviceManager: fix b/21429947 regression" into mnc-devNick Kralevich2015-07-221-4/+1
|\ \ | |/
| * UsbDeviceManager: fix b/21429947 regressionNick Kralevich2015-07-221-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in b/21429947 (commit 674019065bceb4150190bfb1aa63cda9de0a8560), MTP must always be enabled, even if access to the underlying MTP data is disabled. Otherwise, Android will not enumerate on the USB bus, and won't receive notifications from the kernel about USB state changes. This effectively prevents using MTP functionality on user builds, or on userdebug/eng builds with adb turned off. Always ensure that MTP is the default driver mode. Get rid of one use of the persistent property. The persistent property was already pulled from a number of devices, and as explained in commit fcf10f7c12cb3107bdfedce6f76a8c866d154f3c, the intent was that the persistent property would only hold the persistent adb state. Bug: 22447614 Bug: 21429947 Change-Id: I8b3690a1bafb7cea0d5a69d73c1065c7fc64c653
* | Miss USB device Interface from UsbManager.getDeviceList().wang.zhenyu2015-07-221-0/+2
|/ | | | | | | | | | | | | | | | In the scenario that you connect more than one device to android phone with an usb hub, when you attach the second device,mNewConfigurationis is still corresponded to the first device unless another mNewConfiguration is created by a new operation. However,before another mNewConfiguration is created,setInterfaces() in addUsbConfiguration() has already been executed. Problem is that mNewInterfaces has already been cleared when it finished endUsbDeviceAdded for the first device. As a result,the UsbInterface descriptor in the first device's Configuration descriptor is set to null. Bug: 22657587 Change-Id: I0ba4f07c809d07ebebed633e43c3ee8e2e4c5060
* UsbDeviceManager: add back support for USB overlaysNick Kralevich2015-07-201-0/+21
| | | | | | | | | Commit fcf10f7c12cb3107bdfedce6f76a8c866d154f3c removed support for USB overlays. Add it back in, as some devices depend on it. Bug: 22062484 Bug: 21195124 Change-Id: I74d12699201355b07475744c641e31fdc4bb5a4a
* Add USB port manager.Jeff Brown2015-07-152-17/+1010
| | | | | | | | | | | | | | | | Add some new internal APIs to enumerate USB Type C ports, query their status, determine whether they support changing power or data roles, and doing so. The API also adds a new ACTION_USB_PORT_CHANGED broadcast for port state changes. The implementation includes a mechanism for simulating the behavior of the USB stack. See 'adb shell dumpsys usb -h' for details. Note that the underlying kernel driver interface is still subject to change but its behavior has been encapsulated as much as possible. Bug: 21615151 Change-Id: I0c853ae179248a4550b3e60d02a7a7e65e4546b2
* Clean up USB Manager dump.Jeff Brown2015-07-156-44/+49
| | | | | | | Tidy up the dump() implementation in preparation for further work. Bug: 21615151 Change-Id: If6d94c8dc9457b8e93103541ec1798981eeb5b54
* Fix a bad merge.Jeff Brown2015-07-091-0/+1
| | | | Change-Id: Ib722459a25c189bb800eb85d48b80bdc91a2b7db
* Merge "Clean up USB Manager and fix ADB." into mnc-devJeff Brown2015-07-092-195/+232
|\
| * Clean up USB Manager and fix ADB.Jeff Brown2015-07-092-195/+232
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Moved functions which parse the USB functions list into one common place on UsbManager. Deleted the no longer supported USB_FUNCTION_MASS_STORAGE. Ensured that the UserManager.DISALLOW_USB_FILE_TRANSFER rule is consistently applied during user switch and when changing the current USB functions and make sure it only affects MTP and PTP. Collapsed the boot completed and user switched receivers to ensure consistent ordering of side-effects. Validate the list of functions passed to setCurrentFunction() so that the separation of concerns is clearer. It was somewhat ambiguous as to whether functions such as ADB could / should be enabled through that interface. Improved the docs for clarity. Fixed a bunch of broken stuff related to the USB config persistent property (list of default functions) that could cause ADB and other functions to not work at all. Added new failsafes to ensure that we reliably get back into a happy state. Bug: 22206076 Change-Id: I02915ddfce7193a8f67a14f0d76bab22fc575dfa
* | Merge "Prevent accidental unlocking of USB data transfer." into mnc-devZoltan Szatmary-Ban2015-07-081-0/+7
|\ \ | |/ |/|
| * Prevent accidental unlocking of USB data transfer.Zoltan Szatmary-Ban2015-07-071-0/+7
| | | | | | | | | | | | | | | | When DISALLOW_USB_FILE_TRANSFER is in effect, there must be no chance to unlock data transfer over USB. Bug: 22291579 Change-Id: I990fedbfeecd90e7dd26981034d0352b83dc694e
* | UsbDeviceManager: Add back support for persistent propertyAjay Dudani2015-07-071-6/+18
|/ | | | | | | | | Take into account the value of persist.sys.usb.config when updating sys.usb.config. The persistent prop can hold information regarding additional enumerations required for the device. Bug: 21929369 Change-Id: Ic11ebf62ce114f2d0a097ad4405de71173b23139
* Merge "remove setLatestEventInfo from USB" into mnc-devChris Wren2015-06-151-28/+30
|\
| * remove setLatestEventInfo from USBChris Wren2015-06-121-28/+30
| | | | | | | | | | Bug: 18510449 Change-Id: I6b9ccaa0537c8044c5fa900ae4ea68b2676e1365
* | UsbDeviceManager: Modify default function handlingNick Kralevich2015-06-121-3/+3
|/ | | | | | | | | | | | | | When adb is enabled, there's no need to also enable MTP mode. ADB mode enabled is sufficient to get connect messages from the kernel driver. This change modifies getDefaultFunctions() to return adb mode if adb is enabled, but mtp when it's not enabled. Also stop using "none" mode as the default. "none" should only be used when toggling the driver. Bug: 21429947 Change-Id: I767491417c6c69a120fcf4f3d6ec0c73311a1a60
* Fix USB access control when adb is disabled.Nick Kralevich2015-06-102-3/+49
| | | | | | | | | | | | | | | | | | | | When adb is disabled, the default usb mode would be "none", which would turn off the driver and prevent UsbDeviceManager from receiving any new USB connect / disconnect messages. This prevents the user from ever enabling MTP and sharing data when adb is turned off. As discussed in bug 21429947, we work around this problem by keeping the USB driver in MTP mode most of the time, so that we continue to receive USB connect / disconnect messages. To avoid leaking confidential user photos, this change introduces an unlocked state. Setting the mtp enabled function is now decoupled from exposing data on the USB connection. Only if MTP is enabled and USB data has been unlocked is confidential user data allowed to be shared. Bug: 21429947 Change-Id: Iefb5c7e22dc4962bf5226f2ed3d0155b5c7b413c
* UsbMidiDevice: Only keep ALSA devices open when device is in useMike Lockwood2015-06-081-59/+170
| | | | | | | | This should fix contention problems for apps using USB APIs to implement MIDI support Bug: 20949468 Bug: 21630625 Change-Id: I32b44330ca0310a4693fd56a4b01ad399f82c1c9
* Merge "UsbDeviceManager: Don't unnecessarily touch properties" into mnc-devNick Kralevich2015-06-031-3/+16
|\
| * UsbDeviceManager: Don't unnecessarily touch propertiesNick Kralevich2015-06-021-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before setting the properties persist.sys.usb.config or sys.usb.config, check the existing values. If the values are the same as what we'd set it to, don't perform the set. Any USB property set, even if setting the property to the value it already has, triggers one of the "on property" triggers in system/core/rootdir/init.usb.rc . The script then reconfigures the driver unnecessarily, which causes instability and dropped connections when trying to use ADB. Avoid this instability by not performing property sets which would have no effect. Bug: 21404762 Bug: 18905620 Change-Id: Id3c2543308df994a0114a0661e20ca799c2dc0e8
* | usb debugging: show alert to secondary userXiaohui Chen2015-06-031-16/+29
|/ | | | | Bug: 12785423 Change-Id: If7f60899cfdaca7bdad560bd59a78f5be74c24be
* Turning off logging in ALSA device connection routines.Paul McLean2015-05-191-1/+1
| | | | | bug: 21298614 Change-Id: Ia88393698072af8f7c101382f180192646bf713e
* Pass charset to XmlPullParser.setInput instead of nullWojciech Staszkiewicz2015-05-141-3/+4
| | | | | | | | | Passing null to XmlPullParser.setInput forces it to do additional work, which can be easily avoided if we know the charset beforehand. bug: b/20849543 Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
* Modify how USB connections are handled.Nick Kralevich2015-05-132-130/+47
| | | | | | | | | | | | | | | * Introduce a new "charger only" mode. In this mode, MTP is disabled, and no file transfers can occur. * Make charger only mode the default. * Modify "persist.sys.usb.config" so it now only holds the adb status. * Make the USB settings non-persistent. Unplugging the USB connection will reset the device back to "charger only" mode. * Fixup wording per UI guidelines. TODO: Re-implement MDM restrictions for USB / MTP access controls. Bug: 18905620 Change-Id: I99a50d9132a81e98187f431166fd9fef4d437e4f
* UsbManager / UsbService / UsbDeviceManager: delete unused codeNick Kralevich2015-05-102-23/+0
| | | | | | These functions are never called. Change-Id: Ic436e1036bed717d2c64701fddd9a810abb9443e
* MidiDeviceInfo: Add version string propertyMike Lockwood2015-04-291-0/+2
| | | | | | For USB devices, this is populated with the USB device version string. Change-Id: Ia9286d5f41783e4e960a9c724bf6b85b6599fe12