Commit Graph

309 Commits

Author SHA1 Message Date
Julia Reynolds
d6247427ac Merge "Api updates" into oc-dev am: f84467e19f
am: 7ee513c27b

Change-Id: Iafbf2f2ca92b288de7bded40772cd15eca2012ee
2017-04-27 05:15:11 +00:00
TreeHugger Robot
f84467e19f Merge "Api updates" into oc-dev 2017-04-27 04:51:46 +00:00
Thierry Strudel
ece721f8cd Merge "Update UsbService to V1_1 usb hal" 2017-04-27 03:28:12 +00:00
Badhri Jagan Sridharan
ef4b303fc2 Update UsbService to V1_1 usb hal
This CL adapts Usb service to V1_1 hal.
V1_1 hal supports reporting audio_adapter accessory
and debug accessory.

Bug: 36604276
Test: Manually test inserting an Audio accessory.
Also tested to made sure that change is compatible with V1_0
implementations
Change-Id: I8e44f5e9ae14b0e41965e8d355c99ac42af93f23
2017-04-26 21:43:07 +00:00
Julia Reynolds
bad4297600 Api updates
- Better documentation on DEFAULT_CHANNEL_ID
- Renaming getChannel/setChannel/getTimeout/setTimeout
- Add documentation to getShortcutId
- @hide parcel constructors

Test: make, make cts
Bug: 37672218

Change-Id: I695b2620c51638a84930e9d1c5fbfd6d85699b55
2017-04-25 17:00:05 -04:00
Jerry Zhang
6f9dbb1203 Reorder USB_STATE updates so config_changed is not replaced.
Because of flag INTENT.ACTION_REPLACE_PENDING, intents
sent in rapid succession could replace previous intents
that have not been processed, and it is unreliable when
or whether this happens. Since CONFIG_CHANGED cannot afford
to be lost, make sure it is sent last, so it is always
processed.

Bug: 34873000
Test: lots of unplugging/plugging
Change-Id: I9264d5129139cf3f433bbcd068e8b292fec6cd31
2017-04-24 16:58:06 -07:00
Jerry Zhang
740ca0f9f0 Don't skip intents where config changed.
Since we are adding ffs.mtp.ready to the init
scripts, we can no longer skip intents that cause
that property to be set.

This fixes the case where device is disconnected
and adb is repeatedly enabled/disabled.

Test: enable/disable adb, usb mtp
Bug: 33220530
Change-Id: I48e687c1af3f9da9e522ebe879285877c0168da8
2017-04-24 14:46:32 -07:00
Jerry Zhang
768dd994f3 Reorder USB_STATE updates so config_changed is not replaced.
Because of flag INTENT.ACTION_REPLACE_PENDING, intents
sent in rapid succession could replace previous intents
that have not been processed, and it is unreliable when
or whether this happens. Since CONFIG_CHANGED cannot afford
to be lost, make sure it is sent last, so it is always
processed.

Bug: 34873000
Test: lots of unplugging/plugging
Change-Id: I9264d5129139cf3f433bbcd068e8b292fec6cd31
2017-04-24 12:40:41 -07:00
Jerry Zhang
58bffb24d7 Merge "Upgrade logging for UsbDeviceManager to narrow down bugs." into oc-dev am: 6d3747ebe2
am: 7f986ba87b

Change-Id: I45d4b1f7fbf9268206e0c90636f02bf0d3ae5d66
2017-04-22 01:45:19 +00:00
Jerry Zhang
c889b4f4eb Upgrade logging for UsbDeviceManager to narrow down bugs.
Will be reverted once bugs are caught.

Bug: 34873000
Test: None
Change-Id: Ia43e0ccb1c22c767c6ef3edbf04cef024662cd15
2017-04-21 16:22:13 -07:00
Jerry Zhang
2c284916d7 Merge "Only send HOST_STATE intents when host mode is used." into oc-dev am: a73f9f874a
am: bf51f836ae

Change-Id: Ie358c38f98d186ed0197248fcf82db2913cfe97d
2017-04-20 13:11:48 +00:00
Jerry Zhang
41ebde2bb3 Only send HOST_STATE intents when host mode is used.
Previously HOST_STATE update intents would broadcast if the
device was in gadget mode but not configured. This would
override the sticky intent, causing MtpReceiver to fail.

This is fixed by only updating host state if host is connected
or if host is being disconnected (was connected before).

Bug: 34873000
Test: set up lockscreen, reboot device while plugged in, unplug before
unlocking, verify usb works.

Change-Id: Ic424e678ba72401ee8ec975e915727272edf3767
2017-04-18 12:06:27 -07:00
Badhri Jagan Sridharan
82d49dfbef Repost USB and ADB notification when locale changes
Bug: 37266276
Test: Manually tested the language of active notifications after
switching language.

Change-Id: I0cef61fbd155e0c9789f52a140561c71969fbab7
2017-04-14 12:01:59 -07:00
David Stevens
9a2b5e9828 Merge "Reset the default usb package less often" into oc-dev am: 1654143680
am: 8e40723876

Change-Id: I041f7fdaf689fde58f7853af075f708b30418201
2017-04-12 01:23:07 +00:00
David Stevens
1654143680 Merge "Reset the default usb package less often" into oc-dev 2017-04-12 00:12:15 +00:00
puma_hsu
6040887f78 Just broadcast intent to bring up MTP/PTP as soon as switching function
Bug: 36113457
Bug: 34451451
Test: Turn on tethering
Change-Id: I3a7ab6fdcd157740b8e55ded67b3d5dddf15b0e0
Signed-off-by: puma_hsu <puma_hsu@htc.com>
(cherry picked from commit 4b3e46c787)
2017-04-07 12:35:21 -07:00
David Stevens
f4a2e1df94 Reset the default usb package less often
This CL makes logic for resetting the default package for handling USB
intents less agressive (added in ag/101452). First, instead of listening
for package changed events, we now listen for package replaced
broadcasts. Second, we don't reset the default package if the app being
added/updated is already the default package.

Bug: 35491880
Test: Manually tested with a work profile
Change-Id: Id1992239b5d8ace87fefeb4acd6ca1031c3c1085
2017-04-06 22:51:05 -07:00
Badhri Jagan Sridharan
5227374951 Do not show Usb dialog for USB peripherals.
This CL prevents the USB Dialog to show for peripherals such as
keyboard, mouse, flash drives etc. Usb Dialog is redundant in these
cases as the Type-C stack is expected to manage power automatically
as these devices are most likely SNK devices.

Bug: 36141499
Test: Manually tested that USB dialog doesnt show up when
a keyboard or mouse is connected.

Change-Id: I3ee45f137817425bf9acd675b044a97d1cb91d7d
2017-04-05 17:13:34 -07:00
Badhri Jagan Sridharan
d81d8d854a Pass the right index to query the descriptors
Bug: 36897770
Test: Manually tested with headset jack plugged in.
Change-Id: Icd7a983423f3c8986404770a78e3904ee095e758
2017-04-04 15:46:37 -07:00
Badhri Jagan Sridharan
f63de8831f Merge "Do not display USB charging dialogue for AUDIO class devices" 2017-04-04 17:16:29 +00:00
Badhri Jagan Sridharan
7dee1a6347 Do not display USB charging dialogue for AUDIO class devices
The CL prevents the "Supplying power to the attached device"
notification from showing up when USB digital headphones are
connected. Although, the phone is actually powering the headphones
here, there seems to be an opinion that this might confuse the users.
So, disabling the notification for better user experience.

Also, the mode chooser activity might not be applicable here as
the headphones are not expected to be a dual role device in the
near future. When connected through a hub, the power management
of the Type-c link is expected to be managed by the Type-C stack
in the hub and phone's kernel. So user might not have to manage
the direction of power flow.

Bug: 36141499
Test: Manually tested that USB dialog doesnt show up when
digital usb headphones are connected but shows up otherwise.
Change-Id: I187da9c77e294cbbceb633365adbb4623fc14a3d
2017-04-03 17:24:08 -07:00
Philip P. Moltmann
7530670d33 Merge "Not send switch intents if there is no real intent" into oc-dev am: 82331f7f73
am: 09b5ec8ee1

Change-Id: I790378322f543762ef7fda0253e48259e9bf5d3e
2017-04-03 23:57:27 +00:00
Philip P. Moltmann
09b5ec8ee1 Merge "Not send switch intents if there is no real intent" into oc-dev
am: 82331f7f73

Change-Id: Ief39b33a90bbc6d9428006baccd6b293572d17f3
2017-04-03 23:51:02 +00:00
TreeHugger Robot
82331f7f73 Merge "Not send switch intents if there is no real intent" into oc-dev 2017-04-03 23:44:45 +00:00
Philip P. Moltmann
ebc8ee266c Not send switch intents if there is no real intent
When resolving activtities for the USB device/accessory connection UI a
special intent that allows to switch between profiles get added. This
also gets added if there is no activity in the secondary profile that
can be started.

Fixes: 36544815
Test: Added work profile. Add USB handling app only to personal profile
      and plugged in USB device -> no crash anymore

Change-Id: I311ddd53b3ff0c8406e62bac57972d4b790ebddc
2017-04-03 09:06:09 -07:00
Jeff Sharkey
558b0dd418 Consistent dump() permission checking. am: fe9a53bc45
am: 020de02854

Change-Id: Iffbf78a7b48cea41ed4b0763f2452738e084225c
2017-04-03 06:26:04 +00:00
Jeff Sharkey
020de02854 Consistent dump() permission checking.
am: fe9a53bc45

Change-Id: I300f8bc07e1266b9e78f56d085cd458862176a85
2017-04-03 06:19:02 +00:00
Jeff Sharkey
fe9a53bc45 Consistent dump() permission checking.
This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access.  It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.

Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
2017-04-02 22:29:07 -06:00
TreeHugger Robot
1810e88e82 Merge "Persist the functions from the 3rd column in oemOverride" 2017-03-31 23:07:56 +00:00
Chris Wren
e04a449143 Merge "restore the title string un UsbDeviceManager" into oc-dev
am: b0db4017e5

Change-Id: Ia3610251a9fa31b179bee8b5bae21dc24c3bed65
2017-03-31 19:58:59 +00:00
Chris Wren
a71b5918b0 restore the title string un UsbDeviceManager
Bug: 32584866
Test: make
Change-Id: I4e4dea064a1af194db5660b0765cc4c4b666584a
2017-03-31 15:39:12 -04:00
Badhri Jagan Sridharan
31af86f8ed Persist the functions from the 3rd column in oemOverride
The oemOverrides were incorrectly persisted when adb was disabled.
This CL makes the functions in the 3rd column to be persisted.

Bug: 31947358
Test: Verify oemOverride
Change-Id: Iaef19f8ffd0c829a852a33778af96a6772d1c2ad
2017-03-31 11:02:59 -07:00
Chris Wren
72eb5da93b Merge "standardize system notification IDs" into oc-dev
am: 441162562b

Change-Id: Idb39af001fefa77b6899c3c9d8816532b5e54dea
2017-03-31 17:16:30 +00:00
Chris Wren
282cfefea0 standardize system notification IDs
All the trivial cases, plus some fixes to try to
mitigate collisions with the complex ones.

Complex services to follow in another CL,

Bug: 32584866
Test: make framework services
Change-Id: Ie9663600171d8ede11676e9d66f009dbb06def03
2017-03-31 11:44:05 -04:00
Jerry Zhang
72ec482be0 Merge "Just broadcast intent to bring up MTP/PTP as soon as switching function" am: a0360e38ab am: cb6beee2af
am: dbaabf762a

Change-Id: I682e7c74c5f5e48ccb3bedbf34a2bdcf85e51c30
2017-03-28 19:11:52 +00:00
Jerry Zhang
cb6beee2af Merge "Just broadcast intent to bring up MTP/PTP as soon as switching function"
am: a0360e38ab

Change-Id: I862f38f52cef8b2b90125953593774263b862306
2017-03-28 18:57:16 +00:00
Esteban Talavera
f934d17bfb Restart USB stack if data transfer becomes unavailable
If DISALLOW_USB_FILE_TRANSFER is set while the device is
connected via USB and data transfer is enabled, restart
the USB stack to make sure that data cannot be transferred any more

Fix: 34487750
Bug: 34054991

Test: Checked that files cannot be transferred any more as soon as the user restriction is set
Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.UserRestrictionsTest

Change-Id: I129c226e57da2d0be356f93436b36b3303cb604c
2017-03-28 16:47:18 +01:00
puma_hsu
4b3e46c787 Just broadcast intent to bring up MTP/PTP as soon as switching function
Bug:36113457
Change-Id: I3a7ab6fdcd157740b8e55ded67b3d5dddf15b0e0
Signed-off-by: puma_hsu <puma_hsu@htc.com>
2017-03-24 16:53:30 -07:00
Badhri Jagan Sridharan
dca36e4e27 Persist functions for oemOverride across reboot
persist OEM specific functions across boot using overlays when
ro.bootmode is NOT unknown
i.e. when phone boots up into a predefined Oem mode.

The overlay tuple has 4 columns instead of three where the fourth column
is optional. When the fourth column is present, the functions mentioned
there would be persisted across reboot along with adb(if enabled).
The fourth column is read during USB device manager set up
@readOemUsbOverrideConfig.

When trySetEnabled function is called, the override function is applied
and the actual oem functions are persisted in
persist.sys.usb.<bootmode>.config.
This property is used in an "on boot" property trigger to set up the
persistent function early in the boot.
(Similar to the way persist.sys.usb.config is used to setup the
USB functions during normal boot).
persist.sys.usb.<bootMode>.func tracks the functions without override.

For example, when the following tuple,

usbradio:adb:diag,serial_cdev,rmnet_gsi,adb:diag,serial_cdev,rmnet_gsi

when ro.bootmode is usbradio, and mCurrentFunctions is adb,
the actual functions enabled would be diag,serial_cdev,rmnet_gsi,adb
(sys.usb.config) and diag,serial_cdev,rmnet_gsi would be
persisted across reboots through persist.sys.usb.usbradio.config and
the functions would be saved in persist.sys.usb.usbradio.func

Bug: 31947358
Change-Id: Ifaef17f6943c1e70721cdc8489f17e3ece03bbfc
2017-03-20 21:48:55 +00:00
Yifan Hong
60968b9783 Merge "IUsb uses "default" service name" 2017-03-20 17:51:14 +00:00
TreeHugger Robot
b234748565 Merge "format cleanup(intellij)" 2017-03-17 23:24:00 +00:00
Yifan Hong
e67d3bb2ba IUsb uses "default" service name
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.

Test: pass

Bug: 33844934
Change-Id: I7c1691daf029fb426873be79553a235c43df9f42
2017-03-17 00:40:01 +00:00
Glenn Kasten
24b7831f8b Merge "USB audio: fix imports" 2017-03-16 23:37:42 +00:00
Glenn Kasten
967e832200 Merge "Add units to variable names" 2017-03-16 23:00:29 +00:00
Badhri Jagan Sridharan
eb26052f3c format cleanup(intellij)
Change-Id: Idfa4cc769ec6726be86086879541476d9ed1d12e
2017-03-16 15:08:40 -07:00
Glenn Kasten
8066b89c48 USB audio: fix imports
Test: builds OK
Change-Id: I122e885def74b0f26786eb92a26a8cafed2f65f4
2017-03-13 09:26:11 -07:00
Hugo Benichi
a5af24cd02 Merge "Minor formatting cleanup to remove overlong line" am: d6998d4bd6 am: cc935f5e6d
am: 3d61c89305

Change-Id: I1a4311525a7b9674daa3713ca3ec7001d4bb30fe
2017-03-13 07:40:25 +00:00
Hugo Benichi
cc935f5e6d Merge "Minor formatting cleanup to remove overlong line"
am: d6998d4bd6

Change-Id: I3a4582ebfc1cb7436e570e37cacbc3cabf8c0182
2017-03-13 07:31:54 +00:00
Hugo Benichi
d6998d4bd6 Merge "Minor formatting cleanup to remove overlong line" 2017-03-13 07:23:06 +00:00
Badhri Jagan Sridharan
9fd6645637 Merge "Introduce debounce to filter rapidly toggling type-c ports" 2017-03-10 23:23:51 +00:00