Commit Graph

1041 Commits

Author SHA1 Message Date
Vinay Kalia
7d06d7bd79 Merge "Fix BLE scan leaks" into oc-dr1-dev
am: 604a4b7171

Change-Id: I9e3f7a0d3b871e5c5e2a740ec69eacaa2cbc41e2
2017-07-29 22:17:03 +00:00
Vinay Kalia
9722971cb4 Fix BLE scan leaks
If an app starts multiple scans with same callback then
there is a collision in mLeScanClients hash map which
results in leaking first scan. This change fixes it by
not allowing the second scan with same callback.

BUG: 62389939
BUG: 38198694

Test: Tested applications which started multiple scans with
       same callback.

Change-Id: I569069a40b6f8b4b8bb070731225e732c6b23ec8
2017-07-28 23:39:15 +00:00
Jack He
79bf7d755f GATT: Expose opportunistic client API to Java
* Allow Java based programs to create an opportunistic GATT client
* Such client does not hold a GATT connection. It automatically
  disconnects when no other GATT connections are active for the
  remote device.

Bug: 63347806
Test: make, run battery service
Change-Id: Ib9333817d7f17a1fa3ddacfa51c680890bac19ec
Merged-In: Ib9333817d7f17a1fa3ddacfa51c680890bac19ec
(cherry picked from commit 13f52c8118)
2017-07-12 00:35:54 +00:00
Jack He
f0efa2c810 Merge "GATT: Expose opportunistic client API to Java"
am: 782ba0aca8

Change-Id: If29bc145c1947f2e10472565ae753696e8057dd1
2017-07-11 20:23:53 +00:00
Jack He
13f52c8118 GATT: Expose opportunistic client API to Java
* Allow Java based programs to create an opportunistic GATT client
* Such client does not hold a GATT connection. It automatically
  disconnects when no other GATT connections are active for the
  remote device.

Bug: 63347806
Test: make, run battery service
Change-Id: Ib9333817d7f17a1fa3ddacfa51c680890bac19ec
2017-07-11 18:02:52 +00:00
Jack He
266499d9d8 Support battery level reporting via Apple VSC (1/2)
* Add related constants to BluetoothHeadset

Bug: 35874078
Test: make, test with supporting headsets
Change-Id: I9f49ea28efdf6de0e751a377d879fe13a47655d5
Merged-In: I9f49ea28efdf6de0e751a377d879fe13a47655d5
(cherry picked from commit 679d0bc8f9)
2017-06-30 10:41:18 +00:00
Jack He
fff37da08d Support battery level reporting via Plantronics XEVENT (1/2)
* Add related constants to BluetoothHeadset

Bug: 35874078
Test: make, test with supporting headsets
Change-Id: Ied089a065bf9caa0d03f681950fefa2ea990bb3e
Merged-In: Ied089a065bf9caa0d03f681950fefa2ea990bb3e
(cherry picked from commit 0fcbba25b7)
2017-06-30 08:39:44 +00:00
Jack He
dfd8618b2d HFP: Modify comments for ACTION_HF_INDICATORS_VALUE_CHANGED (1/2)
* Per HFP 1.7.1 spec page 102 of 144
  EXTRA_HF_INDICATORS_IND_ID should be int
  EXTRA_HF_INDICATORS_IND_VALUE should be int

Bug: 35874078
Test: make, PTS test, unit tests
runtest -c com.android.bluetooth.btservice.RemoteDevicesTest bluetooth
Change-Id: Idd316a82bab164b6ea1701bb261b1cc3dee196f1
Merged-In: Idd316a82bab164b6ea1701bb261b1cc3dee196f1
(cherry picked from commit 73795440a5)
2017-06-30 06:22:46 +00:00
Jack He
2b07bbafa2 Add APIs to get remote device's battery level (1/2)
* Add BluetoothDevice.getBatteryLevel() API to retreive battery level
  information of remote device
* Add BluetoothDevice.ACTION_BATTERY_LEVEL_CHANGED intent to notify user
  that remote device's battery level has changed

Bug: 35874078
Test: make, pair with devices and use them
Change-Id: I41051ee25383f5f3a1e505aef6f8c526385f58bd
Merged-In: I41051ee25383f5f3a1e505aef6f8c526385f58bd
(cherry picked from commit 1d312bfa78)
2017-06-30 04:01:36 +00:00
Jack He
9fd5d0da1e Merge "Support battery level reporting via Apple VSC (1/2)"
am: 874af710b7

Change-Id: Id65e6e11308c66893cb701af8909df9fee3a131f
2017-06-29 17:53:10 +00:00
Jack He
679d0bc8f9 Support battery level reporting via Apple VSC (1/2)
* Add related constants to BluetoothHeadset

Bug: 35874078
Test: make, test with supporting headsets
Change-Id: I9f49ea28efdf6de0e751a377d879fe13a47655d5
2017-06-29 17:43:32 +00:00
Jack He
c286110c1a Merge "Support battery level reporting via Plantronics XEVENT (1/2)"
am: c79c4240ec

Change-Id: I6aa50e541763adfa9ebe738d98d86152cf0cd1d5
2017-06-29 17:25:26 +00:00
Jack He
0fcbba25b7 Support battery level reporting via Plantronics XEVENT (1/2)
* Add related constants to BluetoothHeadset

Bug: 35874078
Test: make, test with supporting headsets
Change-Id: Ied089a065bf9caa0d03f681950fefa2ea990bb3e
2017-06-29 17:17:14 +00:00
Andre Eisenbach
df1831d2ee Merge "HFP: Modify comments for ACTION_HF_INDICATORS_VALUE_CHANGED (1/2)"
am: 5790bae2f4

Change-Id: I480ef38d5aa61aa153ee53d325e8b249c1eab222
2017-06-29 08:39:40 +00:00
Jack He
73795440a5 HFP: Modify comments for ACTION_HF_INDICATORS_VALUE_CHANGED (1/2)
* Per HFP 1.7.1 spec page 102 of 144
  EXTRA_HF_INDICATORS_IND_ID should be int
  EXTRA_HF_INDICATORS_IND_VALUE should be int

Bug: 35874078
Test: make, PTS test, unit tests
runtest -c com.android.bluetooth.btservice.RemoteDevicesTest bluetooth

Change-Id: Idd316a82bab164b6ea1701bb261b1cc3dee196f1
2017-06-29 08:30:37 +00:00
Jack He
96f98f255b Merge "Add APIs to get remote device's battery level (1/2)"
am: ceaccbfe70

Change-Id: Ic3253ef666632aaaffe8e1547dc563cd3bca9e37
2017-06-28 08:32:54 +00:00
Jack He
1d312bfa78 Add APIs to get remote device's battery level (1/2)
* Add BluetoothDevice.getBatteryLevel() API to retreive battery level
  information of remote device
* Add BluetoothDevice.ACTION_BATTERY_LEVEL_CHANGED intent to notify user
  that remote device's battery level has changed

Bug: 35874078
Test: make, pair with devices and use them
Change-Id: I41051ee25383f5f3a1e505aef6f8c526385f58bd
2017-06-27 16:53:09 -07:00
Marie Janssen
f71b0bedcf Merge "Bluetooth: minor documentation fix to de-confuse" am: 5a56873612
am: 3205ff1331

Change-Id: I0cd44ad8d22da154d0bf666b9075a3fcbc655439
2017-06-23 03:38:17 +00:00
Marie Janssen
553c8c7753 Bluetooth: minor documentation fix to de-confuse
It was somewhat unclear which is the preferred method of retrieving a
BluetoothAdapter.  Make it clear that using BluetoothManager is
preferred, and remove references to the old method in BluetoothManager
docs since it is only avaialable in API 18 or higher.

Test: recompile, check that documentation is updated
Fix: 33355430
Change-Id: Ia20b4e45dca03bc2f13c2ab477799b89c5e14f45
2017-06-22 20:49:55 +00:00
Amith Yamasani
ef863368b4 Merge "Clarify startScan API on how to get results" into oc-dev
am: 78f3a0f722

Change-Id: Ibc04014f224ecbc666c8296a2b25d939fbfc9921
2017-06-22 13:48:51 +00:00
Amith Yamasani
5d45ac6e68 Merge "Clarify startScan API on how to get results" into oc-dev
am: 78f3a0f722

Change-Id: Ib58abc3ef4eb3c525af9ec2bb6f66e794b659030
2017-06-22 01:20:36 +00:00
TreeHugger Robot
78f3a0f722 Merge "Clarify startScan API on how to get results" into oc-dev 2017-06-22 01:14:18 +00:00
Amith Yamasani
9622137f3f Clarify startScan API on how to get results
Make it clear in BluetoothLeScanner on how to get results
when starting a scan for a PendingIntent.

Bug: 38365430
Test: make offline-sdk-docs
Change-Id: I0bf88d751c89a8a478db985713357e153ac08595
2017-06-21 14:06:44 -07:00
Jakub Pawlowski
50bad313e4 Merge "Remove legacy advertiser from map after it's no longer used" into oc-dev
am: 271e0aa02a

Change-Id: I9e8645c808d1b1cbee242e8a953be93fbf71e4e1
2017-06-20 01:47:01 +00:00
Jakub Pawlowski
bfa502c6a6 Remove legacy advertiser from map after it's no longer used
Test: manual
Bug: 62597369
Change-Id: Ief1e1b054f29b59b1ed72514b138d4f209f9847a
2017-06-19 23:37:19 +00:00
Jakub Pawlowski
8dce179b79 Merge "Remove legacy advertiser from map after it's no longer used" am: 42b1578867
am: de1f0d7607

Change-Id: I89b5be7443dff10a3a52a0b6dbee76a5d34b8173
2017-06-19 19:40:38 +00:00
Jakub Pawlowski
2489b415ff Remove legacy advertiser from map after it's no longer used
Test: manual
Bug: 62597369
Change-Id: Ief1e1b054f29b59b1ed72514b138d4f209f9847a
2017-06-19 17:33:16 +00:00
Jakub Pawlowski
25278b0197 Merge "Bluetooth: fix connectGatt overload invocations" into oc-dev
am: 556b10a4e6

Change-Id: I9477ac6e3990a4e2db4a8254f11702b1557591f3
2017-06-09 00:03:31 +00:00
Jakub Pawlowski
3b852973e3 Merge "Bluetooth: fix connectGatt overload invocations" am: 404e9f209f
am: c0fed83b84

Change-Id: I871bc30dcd7aeb5c4a6f6c15d84b43dee84994f2
2017-06-08 21:20:27 +00:00
Jakub Pawlowski
dbf5a0a20b Bluetooth: fix connectGatt overload invocations
Merged-In: I726252e85e78bff2c9585332d2748a0d92a9f6d3
Test: sl4a GattOverBrEdrTest
Bug: 62387078
Change-Id: I5bfb87683e25f8862587e8000eb4c9bb6ff14f99
2017-06-08 21:01:24 +00:00
Jakub Pawlowski
ba1e26578e Bluetooth: fix connectGatt overload invocations
Test: sl4a GattOverBrEdrTest
Bug: 62387078
Change-Id: I5bfb87683e25f8862587e8000eb4c9bb6ff14f99
2017-06-08 17:54:29 +00:00
Jeff Sharkey
7a2e4a8486 Merge "Annotate @SystemApi with required permissions." into oc-dev
am: c1406978a4

Change-Id: I305967cad945a807c3f8234efabaad0ef8b591d1
2017-06-05 22:28:21 +00:00
Jeff Sharkey
d86b8fea43 Annotate @SystemApi with required permissions.
Most @SystemApi methods should be protected with system (or higher)
permissions, so annotate common methods with @RequiresPermission to
make automatic verification easier.

Verification is really only relevant when calling into system
services (where permissions checking can happen on the other side of
a Binder call), so annotate managers with the new @SystemService
annotation, which is now automatically documented.

This is purely a docs change; no logic changes are being made.

Test: make -j32 update-api && make -j32 offline-sdk-docs
Bug: 62263906
Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
2017-06-05 13:27:11 -06:00
Jack He
099328f38b Merge "HFP: Allow SCO audio to be forcibly connected" am: 93d7c84726 am: 10cb6f3b4c
am: 0998ec224c

Change-Id: I35533ed7e2b8f8deff741cb3296156e9ccf5e076
2017-06-01 07:15:13 +00:00
Jack He
1dd1e03f1f HFP: Allow SCO audio to be forcibly connected
* Normally, Android only allows SCO audio to be connected in several
  allowed cases (e.g. in call, in ringing, in virtual call state, etc)
* Sometimes, it is necessary to force a SCO audio connection (e.g.
  during PTS test)
* This change adds setForceScoAudio(boolean) hidden, system only method
  to allow such behaviour

Bug: 38040125
Test: PTS HFP tests
Change-Id: I28f295c98da5bebb837c2a5423c7acde81af73f7
2017-05-31 15:41:30 -07:00
Jakub Pawlowski
50f8f3db27 Add 32 and 128 bit Service Data parsing.
Bug: 62078132
Change-Id: I79ff75cd5ccbe346dca79693b074ff3cd09112dd
(cherry picked from commit 45033a7e57)
2017-05-26 16:24:40 -07:00
Jakub Pawlowski
bf79e36f57 Merge "Add 32 and 128 bit Service Data parsing." am: 725e212de3 am: 2acc8e28dd
am: 138f75bbc8

Change-Id: I8c821ed86a85892af7a77c4a8080a1e9fde9fdfa
2017-05-26 23:14:27 +00:00
Jakub Pawlowski
45033a7e57 Add 32 and 128 bit Service Data parsing.
Bug: 62078132
Change-Id: I79ff75cd5ccbe346dca79693b074ff3cd09112dd
2017-05-26 21:11:24 +00:00
Jakub Pawlowski
9fd4462c09 Merge "Discover primary service by UUID for PTS tests (4/4)" am: abb732fc40 am: 7e80b882b7
am: 23105d57d5

Change-Id: I764d8b206940a39906c6793fef24e6d5b19a8589
2017-05-16 20:55:37 +00:00
Jakub Pawlowski
09ad0b27bb Discover primary service by UUID for PTS tests (4/4)
Bug: 38123054
Test: manual
Change-Id: I89e088e60f4325f1ece59d22efda0c907a3b716a
(cherry picked from commit fe2bf16a2b)
2017-05-16 13:50:11 -07:00
Jakub Pawlowski
fe2bf16a2b Discover primary service by UUID for PTS tests (4/4)
Bug: 38123054
Test: manual
Change-Id: I89e088e60f4325f1ece59d22efda0c907a3b716a
2017-05-16 11:37:00 -07:00
Andre Eisenbach
1360c6227e Merge "Bluetooth: HID: Add support for Set Idle and Get Idle Commands (3/4)" am: 51876abe82 am: 9413fd9e1f
am: 01d1188a8b

Change-Id: Ie92cbd1f5795d7b9f55d0e51503e7d08b61e8732
2017-05-11 01:33:18 +00:00
Hemant Gupta
cef9ce368c Bluetooth: HID: Add support for Set Idle and Get Idle Commands (3/4)
Provides an interface for application to send Set Idle
and Get Idle commands to remote HID Device. Support for these
two commands was missing from existing code, so existing code
design is reused to add support for these two commands.

Without this support following mandatory PTS test cases for HID 1.0
cannot be passed, TC_HOS_HID_BV_05/06.

Test: Executed PTS tests TC_HOS_HID_BV_05/06 and confirmed if they can
pass

Bug: 34344715
Change-Id: I548362cc328498920b2dae740f1a76b2cc2d6a67
2017-05-10 16:23:17 +00:00
Jakub Pawlowski
168bffa039 Merge "Bluetooth: Fix Periodic Adv interval check" am: cb70647418 am: 5bd173cd93
am: 36e8f468c3

Change-Id: I400564e6ab3716c2906d53e90725a0c9ffc3b082
2017-05-10 07:56:02 +00:00
Sunny Kapdi
037d3513e0 Bluetooth: Fix Periodic Adv interval check
The MIN and MAX values need to be swapped else
the parameter check in setInterval would always
fail

Bug: 37579882
Change-Id: I48538c2a61be88caaf04abd94074b3d9eb6dde96
2017-05-10 07:23:06 +00:00
Jakub Pawlowski
fec6ef8e90 Bluetooth: Fix interval low/min values
Bug: 38175945
Test: none
Change-Id: Idf487c7aafc518f2c57be78a1fa979b2c4a383d6
(cherry picked from commit 6b1f39502c)
2017-05-10 01:30:31 +00:00
Andre Eisenbach
4246cc309d Merge "Bluetooth: Fix interval low/min values" am: 66deee2bd4 am: 0771cb13a2
am: 1655862b93

Change-Id: I32d56c5d0fca7947ac754eda100b36f2ee94ffe7
2017-05-10 00:15:32 +00:00
Jakub Pawlowski
6b1f39502c Bluetooth: Fix interval low/min values
Bug: 38175945
Test: none
Change-Id: Idf487c7aafc518f2c57be78a1fa979b2c4a383d6
2017-05-09 22:59:18 +00:00
Ajay Panicker
a43bd01bd1 Bluetooth: Move Bluetooth battery stats tracking (1/2)
Move Bluetooth battery stats tracking to AppScanStats for a more
unified tracking system.

Bug: 37720787
Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCases -t com.android.server.cts.BatteryStatsValidationTest#testBleScans
      Perform BLE scan and check battery stats
Change-Id: Ie6c682374e6e258c291d3a11eede649c7747ef40
2017-05-09 17:52:36 +00:00
Ruben Brunk
c131051e28 Fix Bluetooth GATT API default handler assignment
Restores previous behaviour where GATT callbacks are invoked on the
binder thread and not the calling process main looper thread.

This fixes performance regressions as well as some
NetworkOnMainThreadException's for some applications.

Bug: 37544152
Bug: 37871717
Test: Covered by prior API tests.
Change-Id: Id8ab705dd4d7f00030e6ac29e056dde5180670e9
(cherry picked from commit 6bdc550e27)
2017-05-05 22:22:50 +00:00