Commit Graph

1096 Commits

Author SHA1 Message Date
Hansong Zhang
9eb138bc45 Fix a typo
"DIGITIZER_TABLED" should be "DIGITIZER_TABLET"

Test: Not needed
Change-Id: I8d701655e3a32db8564aa21381febdd9f93f1bdb
2017-09-29 20:02:45 +00:00
Pulkit Bhuwalka
252eebec97 Merge "Modify Bluetooth Class of Device from Android stack" am: f4ec2ab706 am: c037004fd9
am: 69da7a1766

Change-Id: I5815862db057bf1925bfa9482a451aa0ac3b08ad
2017-09-27 20:18:38 +00:00
Pulkit Bhuwalka
c037004fd9 Merge "Modify Bluetooth Class of Device from Android stack"
am: f4ec2ab706

Change-Id: I9a0b06f44d2fe7be343fc38ce240d82f1b309d7d
2017-09-27 20:04:32 +00:00
Treehugger Robot
f4ec2ab706 Merge "Modify Bluetooth Class of Device from Android stack" 2017-09-27 19:43:17 +00:00
Pulkit Bhuwalka
66d6123880 Modify Bluetooth Class of Device from Android stack
Bug: 36015415
Test: Modified Class of Device using sample app and verified device icon
change when discovering from a remote device.

Change-Id: Ie25f10be5560f9c090ebe489d5f3bb00cbca81ef
2017-09-20 15:51:49 -07:00
Ruina Liu
57a1d7a669 Merge "Fix extracting 32-bit uuid error via calling method uuidToBytes" am: ac421b8f44 am: 8c65620d31
am: 311d031d22

Change-Id: I151f0dc74bfeca44db6aa0c428f8cfbb8b2d3891
2017-09-18 18:06:30 +00:00
Ruina Liu
8c65620d31 Merge "Fix extracting 32-bit uuid error via calling method uuidToBytes"
am: ac421b8f44

Change-Id: I9c6b453e0ef71a70cd972a47763d042943fe3f36
2017-09-18 17:53:31 +00:00
Ruina Liu
044e0fe5c5 Fix extracting 32-bit uuid error via calling method uuidToBytes
A new defined method of uuidToBytes is used to convert
Bluetooth uuid to bytes in the case of BLE advertising.
But the most significant 16 bits of a 32-bit uuid
will be cleared after the and operations with
0X0000FFFF00000000L in the function of
getServiceIdentifierFromParcelUuid.
0XFFFFFFFF00000000L should be used as bit mask.

Change-Id: I83e22ffbecd718540e644289fee12bf9c3b66305
Test: Advertise with payload contains 32-bit uuid
2017-09-15 17:08:32 -07:00
Jakub Pawlowski
4df0b1590c Merge changes from topic "incl_svc_parsing_fix" am: fee4546fd6 am: 3aa179fabd
am: e22de0f23f

Change-Id: I30dc6840311d338976240cc86b9da9b116b175ad
2017-09-15 02:38:09 +00:00
Jakub Pawlowski
3aa179fabd Merge changes from topic "incl_svc_parsing_fix"
am: fee4546fd6

Change-Id: If7ee44287dbec54e49df9fc350b2ebdfcdaeb431
2017-09-14 23:36:00 +00:00
Jakub Pawlowski
618ea49ccf Merge "Bluetooth: fix parameter name in onConnectionUpdated" am: 1f53eb76e4 am: 8ab1ed1789
am: dd71df9d41

Change-Id: I46d8cf106ed9c2b22e5dfc2b0a38588622c140e8
2017-09-14 19:50:18 +00:00
Jakub Pawlowski
8dde5e1ce0 Fix included service parsing (3/3)
Bug: 65637368
Test: sl4a GattIncludedServiceTest
Change-Id: Idb967df9d5064b0532db7f5c250f677d1dbbc54c
2017-09-14 19:37:40 +00:00
Jakub Pawlowski
8ab1ed1789 Merge "Bluetooth: fix parameter name in onConnectionUpdated"
am: 1f53eb76e4

Change-Id: I45642dfbb8ed8bb90a1306d066844d18aa1962b3
2017-09-14 19:35:24 +00:00
Jakub Pawlowski
cf733cd020 Bluetooth: fix typo in comment
Test: none
Change-Id: I48c674049df88285268145d4140870eb4ab79a62
2017-09-14 19:24:28 +00:00
Jakub Pawlowski
14a381bc3e Bluetooth: fix parameter name in onConnectionUpdated
Test: compilation
Change-Id: I625e4ca63477b795310ebb42ca5e9a0549523cc5
2017-09-14 19:23:59 +00:00
Jakub Pawlowski
dbc067bcc7 Merge "Bluetooth: thread-safe callback invocation" am: f8c7572b8f am: c416035448
am: eef8920a9f

Change-Id: Ib14b38dd04bdd73482d6b085ede7151414a5f829
2017-09-14 10:23:06 +00:00
Jakub Pawlowski
4eba1140f3 Merge "Bluetooth: fix GATT race conditions when using Handler" am: 06b29a87d7 am: 9054e03cf4
am: 79ce33fc96

Change-Id: I1cd7e411f9cea651c10ed0db1adec1212112725c
2017-09-14 10:16:41 +00:00
Jakub Pawlowski
c416035448 Merge "Bluetooth: thread-safe callback invocation"
am: f8c7572b8f

Change-Id: Iac79926b7131949367b1dad2565b6d0b405ef832
2017-09-13 22:12:16 +00:00
Jakub Pawlowski
9054e03cf4 Merge "Bluetooth: fix GATT race conditions when using Handler"
am: 06b29a87d7

Change-Id: I2760ebf88cb96e29a754a65d1ce3f5ae879d7ccc
2017-09-13 22:08:00 +00:00
Jakub Pawlowski
3eb569fc72 Bluetooth: thread-safe callback invocation
Bug: 65596701
Test: manual
Change-Id: I92a436328a3070ea842e8e652891e485406c2ed7
2017-09-13 17:31:43 +00:00
Jakub Pawlowski
eb6b3da4fc Bluetooth: fix GATT race conditions when using Handler
Bug: 65596701
Test: manual
Change-Id: Id703cea0543626bdd5a583da95615b650bbcc331
2017-09-13 17:31:24 +00:00
Vinay Kalia
ce784381fd Merge "Update ScanSettings documentation for scan modes" am: 8157ab2a0e am: be7ccdf6e9
am: 4b0748ffda

Change-Id: Icad06975358e4814a3f05a363a41a7a77511bd88
2017-09-08 20:26:37 +00:00
Vinay Kalia
be7ccdf6e9 Merge "Update ScanSettings documentation for scan modes"
am: 8157ab2a0e

Change-Id: I15a77489072925f6e99e9a0a658910616164aef3
2017-09-08 19:58:33 +00:00
Vinay Kalia
8157ab2a0e Merge "Update ScanSettings documentation for scan modes" 2017-09-08 19:50:36 +00:00
Amith Yamasani
a220790855 Merge "Javadoc update for permission requirements" into oc-mr1-dev
am: 2ce2f84999

Change-Id: I6703ab1128202f5928d574c55d0f4a9129c95b60
2017-09-08 02:39:11 +00:00
Amith Yamasani
172dd5c652 Javadoc update for permission requirements
Bluetooth scanning requires holding these permissions for results
to be delivered.

Bug: 65013767
Test: N/A
Change-Id: I0b5fa9efa7fc8d5cff25319fbd7719cedee6a4aa
2017-09-07 23:42:27 +00:00
Jack He
0146463d70 Bluetooth: Thread-safe binder invocation
* Binder object may become null between null check and actual invocation
  if using a instance private variable assignable by service connection
  callbacks
* The solution to this problem without locking is to assign existing
  binder variable to a local final variable before the null check
* Any further invocation to a disconnected binder object will result in
  RemoteException that is caught by the try-catch block
* Read and write to volatile variable is always atomic and hence thread-safe
* Removed unnecessary synchronization in BluetoothAdapter constructor
* Private mConnection objects should be final
* Simplfied several return statements where booleans can be returned
  directly
* Removed unnecessary catches for NPE since there won't be any

Bug: 64724692
Test: make, pair and use devices, no functional change
Change-Id: Ifc9d6337c0d451a01484b61243230725d5314f8e
(cherry picked from commit 16eeac356c)
2017-09-07 08:43:16 +00:00
Jack He
a672ffa42f Merge "Bluetooth: Thread-safe binder invocation"
am: 94f1fd0da2

Change-Id: I8f9c76996f02c70b8d2ea21d4eb567eaa9da246a
2017-09-06 00:30:09 +00:00
Jack He
16eeac356c Bluetooth: Thread-safe binder invocation
* Binder object may become null between null check and actual invocation
  if using a instance private variable assignable by service connection
  callbacks
* The solution to this problem without locking is to assign existing
  binder variable to a local final variable before the null check
* Any further invocation to a disconnected binder object will result in
  RemoteException that is caught by the try-catch block
* Read and write to volatile variable is always atomic and hence thread-safe
* Removed unnecessary synchronization in BluetoothAdapter constructor
* Private mConnection objects should be final
* Simplfied several return statements where booleans can be returned
  directly
* Removed unnecessary catches for NPE since there won't be any

Bug: 64724692
Test: make, pair and use devices, no functional change
Change-Id: Ifc9d6337c0d451a01484b61243230725d5314f8e
2017-09-06 00:09:47 +00:00
Vinay Kalia
04d061e891 Merge "Update documentation for startScan"
am: 7d2219d170

Change-Id: I5ea7a5a9b0a69168a1715986e4850276299af78a
2017-09-06 00:08:24 +00:00
Vinay Kalia
958154b5e2 Update ScanSettings documentation for scan modes
SCAN_MODE_LOW_POWER is enforced for applications running
in background.

Test: BLE scanning applications.
BUG: 38198694
BUG: 62491228
Change-Id: Ib2b6c297298e05f1b088411e94cfe4789dde0821
2017-09-05 13:51:58 -07:00
Vinay Kalia
875d27e45e Update documentation for startScan
With change c4a1e1, unfiltered BLE scans are stopped on screen off
and resumed when screen is turned back on. This is done to save power.
This change updates the documentation accordingly.

BUG: 62264269
Test: Documentation update.
Change-Id: I2d8e9f9f122f978c4d4f59d4139cb51cd4e4a123
2017-09-05 11:52:35 -07:00
Jakub Pawlowski
f507490404 Fix GATT client leakage when scan is throttled (1/2)
Currently, scan throttling happens after client is registered, but
before the scan is started. This might lead to scan client being leaked.
This patch fixed that by moving check before client registration.

Bug: 64887233
Test: manual
Change-Id: I22ae624a0c51110cb69679f796926e3b2b36d0ac
Merged-In: I22ae624a0c51110cb69679f796926e3b2b36d0ac
(cherry picked from commit ee02e1ce77)
2017-08-29 17:26:23 +00:00
Jakub Pawlowski
d019cce887 Merge "Fix GATT client leakage when scan is throttled (1/2)"
am: 3cc1ad87f0

Change-Id: Ieda555f6f8bda35201327c6c6e0c97621b88671e
2017-08-29 08:09:15 +00:00
Jakub Pawlowski
ee02e1ce77 Fix GATT client leakage when scan is throttled (1/2)
Currently, scan throttling happens after client is registered, but
before the scan is started. This might lead to scan client being leaked.
This patch fixed that by moving check before client registration.

Bug: 64887233
Test: manual
Change-Id: I22ae624a0c51110cb69679f796926e3b2b36d0ac
2017-08-28 18:09:03 +00:00
Jack He
8ae5462199 Merge changes from topic "bt-fix-checkstyle-errors"
am: 838ab94a0f

Change-Id: I4e619cb17582a6cc954814654820cd945f66e1cc
2017-08-24 21:43:08 +00:00
Jack He
2992cd084c Fix checkstyle errors (2/2)
* Manual style corrections with IDE assistance
* Variable name refactors are done through IDE
* Corrected general style errors such as:
  - "final private var" -> "private final var"
  - "&&", "+", "||" should not be at the end of line
  - Non-static private variable should be like "mVar"
  - Private static variable should be like "sVar"
  - Code file should always end with newline
  - Inherited methods should be annotated with @Override
    and no @hide tags
  - Public methods should always have a JavaDoc entry
  - "int[] array" is preferred over "int array[]"
  - private methods should be accessed without "this."
    when there is no name collisions.
  - "boolean ? true : false" -> boolean
  - "boolean ? false : true" -> !boolean
  - "boolean == true" OR "boolean != false" -> boolean
  - "boolean != true" OR "boolean == false" -> !boolean

Bug: 63596319
Test: make checkbuild, no functional changes
Change-Id: Iabdc2be912a32dd63a53213d175cf1bfef268ccd
2017-08-24 19:09:58 +00:00
Jack He
a355e5efaf Fix checkstyle errors (1/2)
* Automatic style corrections through IDE

Bug: 63596319
Test: make checkbuild, no manual changes, no functional changes
Change-Id: I2397d55abc34c9b7a9b748bec6137778df3421a7
2017-08-24 19:09:48 +00:00
TreeHugger Robot
4a5fd86da3 Merge "Bluetooth: Fix startAdvertisingSet error handling" into oc-mr1-dev 2017-08-18 00:30:13 +00:00
Jakub Pawlowski
915c02c96a Merge "Bluetooth: Don't throw exception when stopAdvertisingSet fails" am: b7cbb2fe49
am: 5d0f5f46ef

Change-Id: I063ce05f79b4feb518dc34c9a4651e96f65b324e
2017-08-17 23:16:59 +00:00
Jakub Pawlowski
5d0f5f46ef Merge "Bluetooth: Don't throw exception when stopAdvertisingSet fails"
am: b7cbb2fe49

Change-Id: I5ccf67621134fe1ba9204e2a8f3502ffacef0315
2017-08-17 23:06:14 +00:00
Jakub Pawlowski
94cd5b22c1 Merge "Bluetooth: Fix startAdvertisingSet error handling" am: ed12213b59
am: e9fe99571b

Change-Id: Ideb592bf11e483494b892f7b04bb156f323746ac
2017-08-17 22:58:02 +00:00
Treehugger Robot
b7cbb2fe49 Merge "Bluetooth: Don't throw exception when stopAdvertisingSet fails" 2017-08-17 22:51:23 +00:00
Jakub Pawlowski
e9fe99571b Merge "Bluetooth: Fix startAdvertisingSet error handling"
am: ed12213b59

Change-Id: I093e849e910428c521e73072121dfdfdceb28e0d
2017-08-17 22:47:38 +00:00
Jakub Pawlowski
d56a8bec5c Bluetooth: Fix startAdvertisingSet error handling
Calls to old advertising API (startAdvertising), should never throw
exceptions. Instead, it used to post failure callback. This behaviour
was accidentally modified when implementing new API. Right now, instead
of posting error callback, we throw IllegalArgumentException if we fail
to obtain BluetoothGatt object, or the call to startAdvertisingSet
fails.

This patch brings back the old behaviour to the API. It also makes new
API post callback instead of throwing exception in this error case.

Bug: 63819108
Test: manual
Change-Id: I897b99839f899ca3f3dc609918d665c8c327b777
Merged-In: I897b99839f899ca3f3dc609918d665c8c327b777
(cherry picked from commit f7bd6b26c7)
2017-08-17 22:34:40 +00:00
Jakub Pawlowski
4cf705e17e Bluetooth: Don't throw exception when stopAdvertisingSet fails
When advertising is stopped while Bluetooth is disabled, we should not
throw any exceptions, just log the failure.
This was the default behaviour before the AdvertisingSet was introduced.

Bug: 63819108
Test: manual
Change-Id: I518e071b77b127973aee6f24fa6ced4f28bc9531
Merged-In: I518e071b77b127973aee6f24fa6ced4f28bc9531
(cherry picked from commit f73863dc29)
2017-08-17 22:34:31 +00:00
Jakub Pawlowski
f73863dc29 Bluetooth: Don't throw exception when stopAdvertisingSet fails
When advertising is stopped while Bluetooth is disabled, we should not
throw any exceptions, just log the failure.
This was the default behaviour before the AdvertisingSet was introduced.

Bug: 63819108
Test: manual
Change-Id: I518e071b77b127973aee6f24fa6ced4f28bc9531
2017-08-17 07:39:02 -07:00
Jakub Pawlowski
f7bd6b26c7 Bluetooth: Fix startAdvertisingSet error handling
Calls to old advertising API (startAdvertising), should never throw
exceptions. Instead, it used to post failure callback. This behaviour
was accidentally modified when implementing new API. Right now, instead
of posting error callback, we throw IllegalArgumentException if we fail
to obtain BluetoothGatt object, or the call to startAdvertisingSet
fails.

This patch brings back the old behaviour to the API. It also makes new
API post callback instead of throwing exception in this error case.

Bug: 63819108
Test: manual
Change-Id: I897b99839f899ca3f3dc609918d665c8c327b777
2017-08-17 07:36:37 -07:00
Vinay Kalia
1199972de1 Merge "Fix BLE scan leaks" into oc-dev
am: 6e749c392b

Change-Id: Id43b33865e287ec19a2ae4c56815d12bb402ab09
2017-08-09 21:10:53 +00:00
Jakub Pawlowski
3ee6eed62f Merge "Bluetooth: AdvertiseData parceling simplification"
am: c7da241b3e

Change-Id: Iaf58ace037810d11fcb29c2696c79664d601e87c
2017-08-09 19:15:08 +00:00