270 Commits

Author SHA1 Message Date
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
TreeHugger Robot
7e86a8ebf9 Merge "Fix handling usb dialog for wall chargers." 2017-03-10 23:22:43 +00:00
Badhri Jagan Sridharan
763165803e Merge "Reformat code" 2017-03-10 20:46:29 +00:00
Badhri Jagan Sridharan
c4616503b3 Reformat code
Moving to Intellij coding format

Change-Id: I412232183f50dcb7f66bce2f07a07e242114eaa8
2017-03-10 18:48:12 +00:00
TreeHugger Robot
40cd0544bc Merge "minor cleanup" 2017-03-10 00:42:01 +00:00
Badhri Jagan Sridharan
abd229b71a Introduce debounce to filter rapidly toggling type-c ports
Type-c ports can quickly toggle between connected/disconnected
states. Introduce debounce to prevent sending spurious notifications.

Cherry-pick: https://android-review.googlesource.com/#/c/338266/
Bug: 34972898
Test: notification should not be queued for a pixel-c charger not connected
to the power outlet.
Change-Id: I4aa19f9f864fe5b77e65f6a07a3184d8aba1f5fc
2017-03-09 23:23:55 +00:00
Badhri Jagan Sridharan
843aba7745 Fix handling usb dialog for wall chargers.
UsbPort.POWER_ROLE_SINK is orthogonal to the type of the charger
attached. POWER_ROLE_SINK would be the case for AC charging and
USB charging. Therefore query BatteryManager for the charger
type.

Cherry-pick: https://android-review.googlesource.com/#/c/338265/
Bug: 34972898
Test: Charging notification should not show for pixel-c chargers.
Change-Id: I8dddcd7727b6af973bd173d2c6e325aa4be2ca3a
2017-03-09 23:17:23 +00:00
Badhri Jagan Sridharan
bb85be4261 minor cleanup
Change-Id: I9531bb03a0bf6e92895caa6b91053445f29b5a46
2017-03-09 11:38:46 -08:00
Glenn Kasten
d929cb1d92 Merge "USB audio: Use 'final' where possible" 2017-03-09 16:22:34 +00:00
Glenn Kasten
cb8724c572 Merge "Comment out unused methods" 2017-03-09 16:22:15 +00:00
Glenn Kasten
e5377dd023 Merge "Fix typo in log" 2017-03-09 16:21:45 +00:00
TreeHugger Robot
eb7ca5ca3a Merge "Skip the MTP notification when the system has the default app." 2017-03-08 03:26:13 +00:00
Glenn Kasten
615c793c31 Add units to variable names
Test: compiles OK
Change-Id: I11ec8025686aea0068ce4353df6afea3b9fc2d13
2017-03-06 17:43:49 -08:00
Glenn Kasten
3fcf85cd91 Comment out unused methods
Test: compiles OK
Change-Id: I6f5513e7c5655e91e4cc3dd8de8ec407b9f7b94e
2017-03-06 17:42:21 -08:00
Glenn Kasten
ff6615f653 USB audio: Use 'final' where possible
Test: compiles OK
Change-Id: I14677ef55b14ae0cc60b6145350e70c475cc987e
2017-03-06 17:41:47 -08:00
Glenn Kasten
7f8cf37da3 Fix typo in log
Change-Id: I5e805f4e4f296e7a9e8d12bf8372515f59099f17
2017-03-06 16:52:20 -08:00
Daichi Hirono
a455dd9f09 Skip the MTP notification when the system has the default app.
Before N, when MTP device is connected to Android, it opened the
activity selector for applications that could handle the MTP device.
For N, we updated the behavior to make it consistent with other storage
devices like USB mass storage. In N, the system showed the notification
first, then showed the activity selector after a user taps the
notification.

The N behavior causes a problem that the user always needs to tap the
MTP notification even after the user select a default application for
the MTP device.

The CLs tweaks the behavior for O so that the system can skip the MTP
notification if the system has the default app for the connected MTP
device.

The default app is one of them:

 * App selected by a user by clicking "Always use" in the activity
   selector
 * System app that is an only application which can handle the MTP
   device in the system
 * App that is an only application which can handle the MTP device in
   the system where config_disableUsbPermissionDialogs=true.

Bug: 32119378
Test: Connecting MTP device to Android, which automatically opens system
      app. Connecting PTP device to Android, which shows a notification.
      Tapping the notifiction opens the acitivity selector.
Change-Id: I51f1d55e8c7d1db87d91ddf966631d275a171546
2017-03-03 09:24:34 +09:00
TreeHugger Robot
7bf141233b Merge "IServiceManager/ITokenManager uses "default" service name" 2017-03-01 23:06:02 +00:00
Geoffrey Pitsch
af759c52ce Channels for Frameworks notifications
Adapts all notifications used by system services to use channels.
Channels are initialized by SystemServer after the NotificationService
has started.

Test: runtest systemui-notification
Change-Id: I25c45293b786adb57787aeab4c2613c9d7c89dab
2017-03-01 10:17:15 -05:00
Tomasz Wasilczyk
4d3453637c Fix few typos.
Test: manual (watching logs)
Bug: b/35805636
Change-Id: I066e8f94e73232eb59bef86fff4a4eef5d84fbb4
2017-02-28 08:27:52 -08:00
Yifan Hong
9ecbc04c23 IServiceManager/ITokenManager 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: boots
Test: hidl_test

Bug: 33844934
Change-Id: I5774469712d70de4b2629258fe54d7f8c280d9d0
2017-02-24 17:12:53 -08:00
TreeHugger Robot
1693d77456 Merge "Consider priority when launching a USB app" 2017-02-16 21:41:00 +00:00
Badhri Jagan Sridharan
c584d77b93 Introduce debounce to filter rapidly toggling type-c ports
Type-c ports can quickly toggle between connected/disconnected
states. Introduce debounce to prevent sending spurious notifications.

Bug: 34972898
Test: notification should not be queued for a pixel-c charger not connected
to the power outlet.
Change-Id: I4aa19f9f864fe5b77e65f6a07a3184d8aba1f5fc
2017-02-15 10:21:19 -08:00
Badhri Jagan Sridharan
1b8e847a87 Fix handling usb dialog for wall chargers.
UsbPort.POWER_ROLE_SINK is orthogonal to the type of the charger
attached. POWER_ROLE_SINK would be the case for AC charging and
USB charging. Therefore query BatteryManager for the charger
type.

Bug: 34972898
Test: Charging notification should not show for pixel-c chargers.
Change-Id: I8dddcd7727b6af973bd173d2c6e325aa4be2ca3a
2017-02-15 10:21:02 -08:00
Hidenari Koshimae
87d66fd3f1 Minor formatting cleanup to remove overlong line
Change-Id: If0afb279552bc664ba579badaf35662effbd2a80
2017-02-15 11:41:34 +09:00
Badhri Jagan Sridharan
fa207eb889 Merge changes from topic 'pixel-c' into nyc-mr2-dev
am: dee514fae3

Change-Id: I4038d1fbd429fcedc4a379d764b5ef5c59dcce1d
2017-02-14 03:40:33 +00:00
Badhri Jagan Sridharan
e8b0e11371 Introduce debounce to filter rapidly toggling type-c ports [DO NOT MERGE]
Type-c ports can quickly toggle between connected/disconnected
states. Introduce debounce to prevent sending spurious notifications.

Bug: 34972898
Test: notification should not be queued for a pixel-c charger not connected
to the power outlet.
Change-Id: I4aa19f9f864fe5b77e65f6a07a3184d8aba1f5fc
2017-02-13 17:44:11 -08:00
Badhri Jagan Sridharan
8b0807c789 Fix handling usb dialog for wall chargers. [DO NOT MERGE]
UsbPort.POWER_ROLE_SINK is orthogonal to the type of the charger
attached. POWER_ROLE_SINK would be the case for AC charging and
USB charging. Therefore query BatteryManager for the charger
type.

Bug: 34972898
Test: Charging notification should not show for pixel-c chargers.
Change-Id: I8dddcd7727b6af973bd173d2c6e325aa4be2ca3a
2017-02-13 17:44:05 -08:00
TreeHugger Robot
45c87d943d Merge "Enabling USB Debugging Connected notification on Android TV" 2017-02-02 21:57:28 +00:00
Dmitri Plotnikov
d7ee7d4b34 Enabling USB Debugging Connected notification on Android TV
Bug: 34859109
Test: verified that the notification showed up in LeanbackLauncher
Change-Id: I2d5798e994df74b7d3211ccf7f22a6aff44bd681
2017-02-02 10:24:27 -08:00
Badhri Jagan Sridharan
26b6130282 Check and send usb state broadcast when devices boots am: af6d473ab0 am: 061bceafee am: df1df40f91
am: 307a387f38

Change-Id: Icf4b4e4f48fea450b71bd7ccd88db7d089ea286e
2017-01-31 01:14:33 +00:00
Jerry Zhang
ed642e81b4 Only send usb disconnect intents after boot. am: c1bc0a844d am: dc9c094deb am: 9877c70d9d
am: 1064ee66d5

Change-Id: If501641b5a7cbb4264f40f3bcf2add35e0851f78
2017-01-31 01:13:20 +00:00
Badhri Jagan Sridharan
af6d473ab0 Check and send usb state broadcast when devices boots
Broadcasts are not sent until BOOT_COMPLETED is received.
When the device boots with usb plugged, the UPDATE_STATE
for connted and configured would be received way before
BOOT_COMPLETED is received. Since, devices can continue
to stay in same usb configuration(set through persistent
property trigger), check and send a usb state broadcast
if needed.

BUG: 34451258
Test: Manually checked to verify the broadcasts sent.
Change-Id: I8eca5f241ad758f5c4f1afa6c9807868dfd6195a
2017-01-31 00:41:49 +00:00
Jerry Zhang
c1bc0a844d Only send usb disconnect intents after boot.
This prevents cases where the device starts up and attempts
to change the config, but intents cannot yet be sent.

A patch to resend this skipped intent is necessary to
finish fixing the bug.

Bug: 34451258
Test: Check that usb state is properly handled on boot
Change-Id: I9d79c67ce8982fd5b43fa40781b66bb9ae820694
2017-01-30 14:34:57 -08:00
Badhri Jagan Sridharan
d979398983 Merge "Refactor UsbPortManager to use the binderised USB HAL" 2017-01-24 23:46:25 +00:00
Jerry Zhang
4882496232 Refactored setCurrentFunction and setUsbDataUnlocked into single method.
This gets rid of an extraneous configuration change when going from
adb to adb + file transfer as previously the config would have been
reset once for functions and once for data unlocked.

It also simplifies some of the code.

Bug: 31814300
Test: manually changing usb configurations
Change-Id: Ica10a195338b2189db13113f44657393db110bee
(cherry picked from commit 7a396be6d5ba8914933a54b5bfac25e118db0e9f)
2017-01-24 13:26:51 -08:00
Badhri Jagan Sridharan
823287d28e Refactor UsbPortManager to use the binderised USB HAL
Move to a USB HAL to handle type-c ports as upstream is
considering in merging a generic type-c interface to mainline
kernel. However, the new sysfs interface can see minor changes
in the future as the sysfs interface is sitll going to land
in testing and it is still under review.

Bug: 31015010
Test: Manually tested on Angler and sailfish for type-c role switches.
Change-Id: I26771074c4b4f79a133e519bc6d35a4864a696d8
2017-01-23 17:13:15 -08:00
Christopher Tate
4ca071da28 Send USB_STATE broadcast to manifest receivers
Bug 34594920

Change-Id: I5d026f469710960b792dcf1bfebc1c07f90c6182
2017-01-23 14:35:28 -08:00
Christopher Tate
42a386b771 Enable background restrictions
Apps that target O+ are always subject to background restrictions.
Legacy apps' background restriction is subject to the OP_RUN_IN_BACKGROUND
app op.

Apps with these properties are exempted from background restrictions:
  - persistent process
  - currently on the idle battery whitelist
  - global whitelist for things like bluetooth services

Bug 30953212

Change-Id: Icc19b2fbc05f40dcf8c3fc4abf718c373dc8d4f6
2017-01-19 16:23:02 -08:00
Chris Tate
9e83cbbc10 Revert "Enable background restrictions"
This reverts commit 21f778060badb1e78bffde05e8de7662d275003d.

Change-Id: I65586f9739da84fb32b51b0ea166b8288c41d1b3
2017-01-19 01:12:19 +00:00