163 Commits

Author SHA1 Message Date
Nick Kralevich
853fde6915 UsbDeviceManager: set mUsbDataUnlocked=false on user switch am: 5701321701 am: aa330c0dc2 am: d33d66e26c
am: 581c1809c1

* commit '581c1809c1c617a39eae05aac481a114c70f09d2':
  UsbDeviceManager: set mUsbDataUnlocked=false on user switch
2015-10-29 21:57:12 +00:00
Nick Kralevich
aa330c0dc2 UsbDeviceManager: set mUsbDataUnlocked=false on user switch
am: 5701321701

* commit '5701321701a319d3f2d98365a82266eeddaed895':
  UsbDeviceManager: set mUsbDataUnlocked=false on user switch
2015-10-29 21:30:59 +00:00
Nick Kralevich
5701321701 UsbDeviceManager: set mUsbDataUnlocked=false on user switch
Make sure access to MTP data is relocked when a user switch occurs.

Bug: 25288494
Change-Id: I69dafc7f51b847f4dba1993a85fb1a51df1a5e37
2015-10-29 13:07:52 -07:00
Paul Mclean
438c220d78 Merge "Fixing problems with 1st connect of USB audio device to Fugu." 2015-10-29 13:40:47 +00:00
Paul McLean
c15f756443 Fixing problems with 1st connect of USB audio device to Fugu.
Also added some additional logging functions as we are not done
looking at connect/disconnect issues.

Leaving in tact the multi-device connect/disconnect logic (neeeds to
be revisited)

Bug: 24906368
Change-Id: Iff91c51a9c7013dde56182059f3747e1d6cd727b
2015-10-29 13:39:42 +00:00
Paul McLean
e3b077b1c6 Fixed capture-only devices not removed when disconnected.
I have brought shame upon my family.

Bug: 24932354
Change-Id: I0fce40a976f40e74f4fd87eb6f4aa93e847032cc
2015-10-28 13:39:44 -06:00
Fyodor Kupolov
dabd6b8f45 Restart USB stack only if data is unlocked
When switching users, USB stack shouldn't be restarted if mUsbDataUnlocked =
false, e.g. device is in charge only mode.

Bug: 24611765
Change-Id: I3b12f8c8926235546fe916a200aa57ed618193de
2015-10-02 15:41:46 -07:00
Xiaohui Chen
e4de5a0d3b Cleanup OWNER references.
Bug: 19913735
Change-Id: I2150c6baaab80fe11312e4401394a2a8da52e595
2015-09-23 18:50:11 +00:00
Tim Kilbourn
bcb80b03f1 am 880c6010: am 0c4050b0: am bdfbd821: am 0eb10ede: Merge "Always set the usb config when modifying it." into mnc-dr-dev
* commit '880c601013e3b58f004f65c6cacfb8e19e2ca863':
  Always set the usb config when modifying it.
2015-09-19 18:14:47 +00:00
Tim Kilbourn
bdfbd82154 am 0eb10ede: Merge "Always set the usb config when modifying it." into mnc-dr-dev
* commit '0eb10ede2364bf975721d95f7af7a1e4f4b617f8':
  Always set the usb config when modifying it.
2015-09-19 00:29:35 +00:00
Tim Kilbourn
823e805c1c Always set the usb config when modifying it.
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
2015-09-18 15:05:57 -07:00
Daniel Koulomzin
e4b3e61456 am 1a73ab76: am 4bf3dfea: am ffa2d691: Merge "Adds config flag for USB notification." into cw-e-dev
* commit '1a73ab760bedd371dbfb8850ac24555c33004ff6':
  Adds config flag for USB notification.
2015-09-10 22:06:52 +00:00
Gus Prevas
e753361508 Adds config flag for USB notification.
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
2015-09-10 13:37:59 -04:00
Yasuhiro Matsuda
92386c42a8 Merge "Broadcast ACTION_USB_STATE only if necessary." 2015-08-26 09:36:40 +00:00
Tim Kilbourn
4080a4197c am 6041a68b: am 458d4d6d: am 9b1fd822: am 2ad94499: Merge "Use init to write usb typec props." into mnc-dr-dev
* commit '6041a68babcc0ec9cc2009fcfe75848882661785':
  Use init to write usb typec props.
2015-08-19 02:21:39 +00:00
Tim Kilbourn
2ad9449969 Merge "Use init to write usb typec props." into mnc-dr-dev 2015-08-18 19:54:46 +00:00
Jason Monk
94ce8985b5 am b99fdbe8: am 6f07eaad: am cda0ab68: am 8cfbae04: Merge "Show usb charging notification when in host mode" into mnc-dr-dev
* commit 'b99fdbe84568dea0cc019dc1e4a63bb40b4067d6':
  Show usb charging notification when in host mode
2015-08-17 16:26:53 +00:00
Tim Kilbourn
6ea47a3542 Use init to write usb typec props.
The sysfs nodes are owned by root, so we must use init to write to
them.

Bug: 21615151
Change-Id: Ia8c838827ff45794aa359443117ac85764cf3772
2015-08-14 17:03:34 -07:00
Jason Monk
8338ed00ae Show usb charging notification when in host mode
Bug: 21615151
Change-Id: Ifc8c288a94f52ecac19990ab3d9095b1aef8efc3
2015-08-12 14:16:22 -04:00
Yasuhiro Matsuda
48b9a7c70a Broadcast ACTION_USB_STATE only if necessary.
Modify UsbDeviceManager.updateUsbStateBroadcast to broadcast
ACTION_USB_STATE intent only when any of the USB states have
changed.
By doing this, the processes that receive ACTION_USB_STATE intent
(e.g. android.process.media) are not launched during boot
unnecessarily.
This change reduces boot time by about 200 ms.

BUG: 22163689
Change-Id: I1853a23b0263d9ff608b02d6bc98fe58f584cc19
2015-08-07 17:26:41 +09:00
Nick Kralevich
1913ae958c am 8ad7c8f9: am 94933e43: am 2eafb06f: am b2c71814: am 97b68bbe: Merge "UsbDeviceManager: fix b/21429947 regression (try #2)" into mnc-dev
* commit '8ad7c8f9553611798fa39ff20cea3313c5b64922':
  UsbDeviceManager: fix b/21429947 regression (try #2)
2015-08-04 21:29:21 +00:00
Nick Kralevich
1a008c1ca0 UsbDeviceManager: fix b/21429947 regression (try #2)
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
2015-08-04 10:36:37 -07:00
Xiaohui Chen
233d94c0df clean up UserHandle.USER_OWNER reference
cleaning up a few in framework/base/services.

Bug: 19913735
Change-Id: I1af5f24d9b39d6712ad3a665effa6166e32ce3d3
2015-08-03 13:05:33 -07:00
Phil Burk
bea6528ae3 am c8dc65d1: am 3882997e: am ed839f59: am e2823cb3: am 8f5228af: Merge "UsbMidiDevice: add timestamps for input events" into mnc-dev
* commit 'c8dc65d1942a4d0e7a7a2c56a6c1b991c8927a70':
  UsbMidiDevice: add timestamps for input events
2015-07-30 22:10:53 +00:00
Phil Burk
6456a65afe UsbMidiDevice: add timestamps for input events
This will improve the accuracy of recorded MIDI performances.

Bug: 22801515
Change-Id: Ib78bc929224f2f27938c83a815eaa62f6b5f9560
Signed-off-by: Phil Burk <philburk@google.com>
2015-07-29 15:55:00 -07:00
Nick Kralevich
c0121df2e0 am d9b08e61: am d517de5a: am a8937f13: am a2adb4c5: am 06b93a48: Merge "Revert "UsbDeviceManager: fix b/21429947 regression"" into mnc-dev
* commit 'd9b08e6131c26a0ea6646a8dd3b206f53472028d':
  Revert "UsbDeviceManager: fix b/21429947 regression"
2015-07-24 05:13:36 +00:00
Nick Kralevich
7bdcbd8bfc am a508d399: am 01e00c8c: am e4f10de7: am dd856a3f: am 3b0bbd7b: Merge "UsbDeviceManager: fix b/21429947 regression" into mnc-dev
* commit 'a508d399e720b3a535832ce0b2554680197944af':
  UsbDeviceManager: fix b/21429947 regression
2015-07-24 05:11:28 +00:00
Nick Kralevich
06b93a48ad Merge "Revert "UsbDeviceManager: fix b/21429947 regression"" into mnc-dev 2015-07-23 01:46:38 +00:00
Nick Kralevich
0d767e6f09 Revert "UsbDeviceManager: fix b/21429947 regression"
This causes various problems with our testing infrastructure.

This reverts commit b210026e3d5c955628ca8b8b9191ade08891e9ef.

Bug: 22447614
Bug: 21429947
Change-Id: I57623e3d993e65b6ad89e7a7d28e9575cf638994
2015-07-23 01:45:01 +00:00
Nick Kralevich
3b0bbd7b96 Merge "UsbDeviceManager: fix b/21429947 regression" into mnc-dev 2015-07-22 21:18:59 +00:00
Nick Kralevich
b210026e3d UsbDeviceManager: fix b/21429947 regression
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
2015-07-22 12:59:47 -07:00
wang.zhenyu
ed987a52a2 Miss USB device Interface from UsbManager.getDeviceList().
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
2015-07-22 17:45:16 +00:00
Nick Kralevich
df2600d4dc am b430c4f0: am 8326ebbe: am 6b04e5b8: am 894ffd10: am 673ccfd4: Merge "UsbDeviceManager: add back support for USB overlays" into mnc-dev
* commit 'b430c4f06c763e0c0fffb6d12b606064ccc84ce3':
  UsbDeviceManager: add back support for USB overlays
2015-07-21 18:24:12 +00:00
Nick Kralevich
b430c4f06c am 8326ebbe: am 6b04e5b8: am 894ffd10: am 673ccfd4: Merge "UsbDeviceManager: add back support for USB overlays" into mnc-dev
* commit '8326ebbe9ea324cc7608e8dc754a63d905bfdb63':
  UsbDeviceManager: add back support for USB overlays
2015-07-21 18:07:11 +00:00
Nick Kralevich
2fedc4df51 UsbDeviceManager: add back support for USB overlays
Commit fcf10f7c12cb3107bdfedce6f76a8c866d154f3c removed support for USB
overlays. Add it back in, as some devices depend on it.

Bug: 22062484
Bug: 21195124
Change-Id: I74d12699201355b07475744c641e31fdc4bb5a4a
2015-07-20 15:40:54 -07:00
Jeff Brown
4085a74b4c am 209c8ced: am 6e4997db: am 8bdd92d4: am 0cb1cfdc: am 76c4c666: Add USB port manager.
* commit '209c8cedab87359564c032a3e56b3acd452e1ac9':
  Add USB port manager.
2015-07-15 23:30:28 +00:00
Jeff Brown
a50dfe9c6f am 852e51e2: am 3bc33423: am b35b8e81: am b3c11805: am 2dbccc19: Clean up USB Manager dump.
* commit '852e51e23de4dd390f81f5c5a45687595323599a':
  Clean up USB Manager dump.
2015-07-15 23:30:20 +00:00
Jeff Brown
209c8cedab am 6e4997db: am 8bdd92d4: am 0cb1cfdc: am 76c4c666: Add USB port manager.
* commit '6e4997dbfb5f0a2abac99522a52b557172757ee2':
  Add USB port manager.
2015-07-15 23:16:55 +00:00
Jeff Brown
852e51e23d am 3bc33423: am b35b8e81: am b3c11805: am 2dbccc19: Clean up USB Manager dump.
* commit '3bc33423477945a0f97ebe7948af642cc56cea7b':
  Clean up USB Manager dump.
2015-07-15 23:16:45 +00:00
Jeff Brown
76c4c6668a Add USB port manager.
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
2015-07-15 11:34:29 -07:00
Jeff Brown
2dbccc1926 Clean up USB Manager dump.
Tidy up the dump() implementation in preparation for further work.

Bug: 21615151
Change-Id: If6d94c8dc9457b8e93103541ec1798981eeb5b54
2015-07-15 11:34:29 -07:00
Xiaohui Chen
05d58afddb sys user split: fix usb debugging notice
BUG:19913735
Change-Id: Iefdf8a12f1622650bb0d61e7ffb73040e4b8d498
2015-07-14 21:43:42 +00:00
Jeff Brown
0bff26c1e9 am 9c22afe8: Fix a bad merge.
* commit '9c22afe8538cd8c849d0393751bf5bc4997bc632':
  Fix a bad merge.
2015-07-09 22:30:24 +00:00
Jeff Brown
9c22afe853 Fix a bad merge.
Change-Id: Ib722459a25c189bb800eb85d48b80bdc91a2b7db
(cherry picked from commit 2a67840c3c35a6267663e5d3ae921ee9ac614db9)
2015-07-09 22:21:50 +00:00
Jeff Brown
5c43bb82e4 am f19abb67: am 8e4dde2c: am 2ad03d0c: am c1aebfa0: Merge "Clean up USB Manager and fix ADB." into mnc-dev
* commit 'f19abb67c2604c06b140979cb527c599c37d02f4':
  Clean up USB Manager and fix ADB.
2015-07-09 20:56:00 +00:00
Jeff Brown
2a67840c3c Fix a bad merge.
Change-Id: Ib722459a25c189bb800eb85d48b80bdc91a2b7db
2015-07-09 13:36:41 -07:00
Jeff Brown
c1aebfa02c Merge "Clean up USB Manager and fix ADB." into mnc-dev 2015-07-09 20:03:29 +00:00
Jeff Brown
460a146eb8 Clean up USB Manager and fix ADB.
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
2015-07-09 12:55:56 -07:00
Zoltan Szatmary-Ban
032ba9f3d1 am 2fbfe429: am 92c1d283: am 706ad39b: am a2de7fc9: Merge "Prevent accidental unlocking of USB data transfer." into mnc-dev
* commit '2fbfe42955520c6831fd5df94d87ada875f9299b':
  Prevent accidental unlocking of USB data transfer.
2015-07-08 12:55:25 +00:00
Zoltan Szatmary-Ban
a2de7fc9fc Merge "Prevent accidental unlocking of USB data transfer." into mnc-dev 2015-07-08 11:44:35 +00:00