Commit Graph

701 Commits

Author SHA1 Message Date
Svetoslav Ganov
ac69be543f Add Bluetooth toggle prompts - framework
If permission review is enabled toggling bluetoth on or off
results in a user prompt to collect consent. This applies
only to legacy apps, i.e. ones that don't support runtime
permissions as they target SDK 22.

Also added a configuration resource which controls whether
permission review mode is enabled. By default it is not and
an OEM can change this via an overlay. For now we also keep
the old mechanism to toggle review mode via a build property
which is still used and will be removed when clients have
transitioned.

bug:28715749

Change-Id: I94c5828ad6c8aa6b363622a26ff9da4fc2e2fac7
2016-07-22 20:40:35 -07:00
Sanket Agarwal
40bb6f3f8f Use UUIDs for call management in Headset Client (HF)
Using UUIDs that are managed by the service gives more control and error
handling in the service since it has control over assigning them.

Bug: b/29788044
Change-Id: I8483f8e61a33302ba95d544828947d7fb4a21be9
(cherry picked from commit dbeab2c6e12693fe9b06b6a680677da5325c9230)
2016-06-29 18:58:09 +00:00
Calvin On
2e540390ec Merge \\"Guard concurrent accesses to BluetoothA2dp service object\\" into nyc-mr1-dev am: 30ec4f2732
am: 1fef349549

Change-Id: I0e8fe0754588fc162482275f05d8aef9a8d97711
2016-06-22 02:44:20 +00:00
Calvin On
1fef349549 Merge \"Guard concurrent accesses to BluetoothA2dp service object\" into nyc-mr1-dev
am: 30ec4f2732

Change-Id: Ie9bcb2474c002b8118666c413d864b05eaf0245c
2016-06-22 02:38:11 +00:00
Calvin On
d7d16b9f37 Guard concurrent accesses to BluetoothA2dp service object
This fixes potential NPEs that happen on methods that access
mService after checking nullness, i.e. getConnectedDevices.

Bug: 29514788
Change-Id: Ic97054fd5a3563a374c0e863fb116c52535a6509
2016-06-22 01:08:03 +00:00
Marie Janssen
e55a3669a8 Merge \\\\"Fix links to Bluetooth Guide\\\\" am: 6ba39e5642 am: 51f620d98d am: 30975ad80b
am: fb0ee69ad0

Change-Id: I9f940c9ae6aa2845d68788bb75343754c36dee65
2016-06-22 00:12:21 +00:00
Marie Janssen
fb0ee69ad0 Merge \\\"Fix links to Bluetooth Guide\\\" am: 6ba39e5642 am: 51f620d98d
am: 30975ad80b

Change-Id: I99e17125cf95165b911c6e8f294e2f020d483cb2
2016-06-21 23:40:28 +00:00
Marie Janssen
30975ad80b Merge \\"Fix links to Bluetooth Guide\\" am: 6ba39e5642
am: 51f620d98d

Change-Id: I3818fdbfc3ad60a731bdf3b7f047a2afca04ad2e
2016-06-21 21:38:25 +00:00
Marie Janssen
51f620d98d Merge \"Fix links to Bluetooth Guide\"
am: 6ba39e5642

Change-Id: I0f4e84245e05a19403603121a9138c2076ef2282
2016-06-21 21:34:13 +00:00
Christine Hallstrom
955f8ab45c Merge \\"Fix early termination of while loop in BluetoothSocket#write\\" into nyc-mr1-dev am: ac1873b2fc
am: eb7dc19a1a

Change-Id: Ice60ffc37dbbcc317cad8db04e01234e7e923cf8
2016-06-20 17:54:57 +00:00
Marie Janssen
382871b03f Fix links to Bluetooth Guide
Change-Id: I5798c3d71c7cc9c509e0f7b04fa140168b0fdc11
2016-06-20 10:26:31 -07:00
Christine Hallstrom
ac1873b2fc Merge "Fix early termination of while loop in BluetoothSocket#write" into nyc-mr1-dev 2016-06-20 17:23:02 +00:00
Calvin On
8dad883759 Merge \"Fix race with BT disable in BLE_ON_STATE\" into nyc-dev
am: 1bf8782605

Change-Id: I60d35a8139caf0a1c839654d6c488fede4fa37d7
2016-06-18 02:22:50 +00:00
Calvin On
173600e853 Merge \\\"Fix race with BT disable in BLE_ON_STATE\\\" into nyc-dev am: 1bf8782605 am: c535f2a520
am: db78416206

Change-Id: I9e9bcde7870f345dac8c5112b78de09263f17623
2016-06-18 00:30:33 +00:00
Andre Eisenbach
db78416206 Merge \\"Fix race with BT disable in BLE_ON_STATE\\" into nyc-dev am: 1bf8782605
am: c535f2a520

Change-Id: Ia7a8c209cb4a743d369b51f0ddc3517d18d92f0a
2016-06-18 00:25:17 +00:00
Christine Hallstrom
fc59c344bf Fix early termination of while loop in BluetoothSocket#write
While loop exits too early and misses writing remaining bytes.
Also restructured the loop itself to be more readable.

Change-Id: I71e9b331d20b5ae70175450c3346be43ab56c40c
2016-06-18 00:09:45 +00:00
Calvin On
a0b91d77d6 Fix race with BT disable in BLE_ON_STATE
This will restart the BT stack when it detects a transition
into OFF state while the user enable flag (mEnable) is set.

Bug: 29363429
Change-Id: I9839119b34c4694ad92e96240c6989008b2f8d52
2016-06-17 21:18:21 +00:00
ugo_yu
d169da95a6 Merge \\"Correct typo in BluetoothSap binder\\" into nyc-mr1-dev am: 0db08ca3e7
am: 2380af193e

Change-Id: I2e99a9b8a408abe4eba6c66f5354b0411b69f2cf
2016-06-17 21:04:18 +00:00
ugo_yu
f308ab01dc Correct typo in BluetoothSap binder
This patch fixed IBluetoothSap typo as IBluetoothMap in doBind.

Fixes: 29025598
Change-Id: Ieab3d1583839db0a33b1cfa4d2de1f27c9cb3fe4
2016-06-16 21:02:39 +00:00
Mudumba Ananth
be69ff0aa8 HFP 1.7 profile update (3/4) am: 0d98ebf997
am: 4bf18e1663

* commit '4bf18e1663a44045176ab2b55f66246482a7505a':
  HFP 1.7 profile update (3/4)

Change-Id: I9bff61dd2c8c68c76160ec19960ab07696844f84
2016-06-02 10:52:32 +00:00
Mudumba Ananth
0d98ebf997 HFP 1.7 profile update (3/4)
-> Android Framework changes to add support for
   an API to send indicator change in AG.
-> Added a system intent for broadcasting assigned number(ID)
   of the supported HF indicators and their values (if received)

Bug: 19983867
Change-Id: If26a7ae5da5686da72ebca9ec3decfe086e2ffb6
2016-06-02 10:21:55 +00:00
Christine Hallstrom
f44d5bcf4f Merge "Properly check if BT is off when shutting down radios" into nyc-mr1-dev am: 0f760e0815
am: fa72d4caff

* commit 'fa72d4caffce6f1b7adf5e04f8643fc8e2ebb243':
  Properly check if BT is off when shutting down radios

Change-Id: I16d921e8aac53b21c4007e697dc4d5e2f2a4fa4f
2016-05-27 19:17:03 +00:00
Christine Hallstrom
995c90aa18 Properly check if BT is off when shutting down radios
Use BluetoothAdapter#getState() instead of
BluetoothAdapter#isEnabled() when checking if Bluetooth has turned
off, as isEnabled() is set to false early in the shutdown process
and getState() provides a better indication of the state of BT.

Bug: 27354612
Change-Id: Ic7828f0726491d49c9a14ba5d654b24f66743662
2016-05-26 13:20:56 -07:00
TreeHugger Robot
e1b53d7cab Merge "Add missing @Deprecated annotations." 2016-05-25 17:46:40 +00:00
Pavlin Radoslavov
9a69daa706 Add missing "try ... finally" safeguards
Safeguards for code protected by ReentrantReadWriteLock.

Bug: 28734075
Bug: 28799467
Change-Id: Ib7f598a92e8df6bd855ca48cdd094c1c73a935f2
(cherry picked from commit e957a8a0b4)
2016-05-24 17:14:51 -07:00
Pavlin Radoslavov
e957a8a0b4 Add missing "try ... finally" safeguards
Safeguards for code protected by ReentrantReadWriteLock.

Bug: 28734075
Bug: 28799467
Change-Id: Ib7f598a92e8df6bd855ca48cdd094c1c73a935f2
2016-05-24 22:57:14 +00:00
Aurimas Liutikas
514c5ef8d5 Add missing @Deprecated annotations.
Add missing @Deprecated annotations for methods with @deprecated tag
in javadoc.

Change-Id: I35b78ccb97832d86b914c21a300444ba29e33844
2016-05-24 15:22:55 -07:00
Pavlin Radoslavov
2b016a1711 Reduced the impact of "synchronized" statements
* Removed "synchronized" statements that are not needed
* Replaced "synchronized" statements with Read/Write lock as
 appropriate. The lock protects the access to and the setting of
 BluetoothAdapter.mService and BluetoothManagerService.mBluetooth and
 associated state.

Bug: 28734075
Bug: 28799467
Change-Id: I8f8281c505f0a1ae0add1e14a3caba1f5b2a98e4
(cherry picked from commit eb50a39e98)
2016-05-24 21:17:42 +00:00
Pavlin Radoslavov
eb50a39e98 Reduced the impact of "synchronized" statements
* Removed "synchronized" statements that are not needed
* Replaced "synchronized" statements with Read/Write lock as
 appropriate. The lock protects the access to and the setting of
 BluetoothAdapter.mService and BluetoothManagerService.mBluetooth and
 associated state.

Bug: 28734075
Bug: 28799467
Change-Id: I8f8281c505f0a1ae0add1e14a3caba1f5b2a98e4
2016-05-24 01:17:29 +00:00
Sungki Kim
d35167adca Fix GATT autoConnect race condition
As pointed out here:
https://code.google.com/p/android/issues/detail?id=69834

registerApp() causes onClientRegistered() to happen before autoConnect
is set. This patch fixes that.

Bug: 28861330
Change-Id: Ie1174c0f224f5084178439420b383164d22d542c
2016-05-19 18:25:25 +00:00
Sungki Kim
636ab03dfe Fix GATT autoConnect race condition
As pointed out here:
https://code.google.com/p/android/issues/detail?id=69834

registerApp() causes onClientRegistered() to happen before autoConnect
is set. This patch fixes that.

Bug: 28861330
Change-Id: Ie1174c0f224f5084178439420b383164d22d542c
2016-05-19 18:23:44 +00:00
Wei Wang
02bc008607 Properly handle registration timeout in BLE.
Bug:25384098
Change-Id: I7877f6368c4982fcd91e68810c4da0ab7b5fc6b7
2016-05-13 18:32:15 +00:00
Adam Lesinski
3723194dc8 Merge "BluetoothManager: Make requestControllerActivityInfo one call" into nyc-dev 2016-05-12 00:59:29 +00:00
Jakub Pawlowski
2168fc29a2 Fix GATT Characteristic write type serialization
Default writeType for GATT characteristic was not being
serialized into Parcel. This cause errors when trying to
write into Characteristic.

Bug: 27910548
Change-Id: Ib2f88cf991123eaea244f16fa36deb0d773c5a33
2016-05-11 06:53:10 +00:00
Adam Lesinski
991357fe25 BluetoothManager: Make requestControllerActivityInfo one call
Instead of making multiple calls into the Bluetooth service,
make one call that can timeout. This helps prevent cases
when the Bluetooth process hangs and the system_server is calling into
it and causes a WATCHDOG restart.

Bug:28658141
Change-Id: I37778b7b6e508be420a21bdf23593ae89b38f5b8
2016-05-10 14:00:03 -07:00
Pavlin Radoslavov
2f463d4c8b Fix divergent equals and hashCode behavior
Calling Objects.hash with a byte[] will call the identity hashCode on
the byte[] and this doesn't agree with the use of Objects.deepEquals
in equals.
Bug caught by error prone.

Also, replaced usage of Objects.deepEquals(mServiceDataUuid, ...) with
Objects.equals(mServiceDataUuid, ...), because mServiceDataUuid
is an Object of type ParcelUuid.

Bug: 28585195
Change-Id: Id92734874339985fedafe1a28286a6a4dcd88d3b
2016-05-06 12:45:43 -07:00
Pavlin Radoslavov
f74b830e68 Fix divergent equals and hashCode behavior
Calling Objects.hash with a byte[] will call the identity hashCode on
the byte[] and this doesn't agree with the use of Objects.deepEquals
in equals.
Bug caught by error prone.

Also, replaced usage of Objects.deepEquals(mServiceDataUuid, ...) with
Objects.equals(mServiceDataUuid, ...), because mServiceDataUuid
is an Object of type ParcelUuid.

Bug: 28585195
Change-Id: Id92734874339985fedafe1a28286a6a4dcd88d3b
2016-05-06 12:05:47 -07:00
Jakub Pawlowski
c0e8ff323e OobData documentation
Bug: 27385555
Change-Id: Ie290914e4d2b9378c6dff3ae14d96d6f8b13ab9d
2016-04-19 17:36:12 +00:00
Adam Lesinski
010bf374d8 BatteryStats: Introduce Async external stats requests
Instead of calling out to external processes with a blocking IPC,
pass along a Binder on which the external process can pass back
the response. The calling process can then wait for the reply with
a timeout.

This eliminates watchdog restarts of the system_server when an external
process like telephony or bluetooth hangs.

Bug:26842468
Change-Id: I1b242e4ed22a63f1a4a0be8c78de8ac4d7bf56c5
2016-04-15 15:27:52 -07:00
Ajay Panicker
b6e1dafe78 Allow factory reset when bluetooth is off (1/2)
Bug: 27348444
Change-Id: I6c2709371b86581709649d7faf09391230449b9b
2016-04-05 20:23:21 +00:00
Ajay Panicker
1dfa47ee3e Merge "Allow factory reset when bluetooth is off (1/2)" 2016-04-01 23:46:33 +00:00
Ajay Panicker
4bb4830b75 Get name and address without enabling Bluetooth
Bug: 27665077
Change-Id: I2a06c1a65f22b2f9095a859f5bdd39d4626da165
2016-04-01 22:53:52 +00:00
Jakub Pawlowski
db29556fe8 Fix GATT Characteristic write type serialization
Default writeType for GATT characteristic was not being
serialized into Parcel. This cause errors when trying to
write into Characteristic.

Bug: 27910548
Change-Id: Ib2f88cf991123eaea244f16fa36deb0d773c5a33
2016-04-01 17:59:09 +00:00
Andre Eisenbach
2358043983 Merge "Always use Write Request for GATT descriptor writes" 2016-04-01 00:18:48 +00:00
Ajay Panicker
db005bdce9 Allow factory reset when bluetooth is off (1/2)
Bug: 27348444
Change-Id: I6c2709371b86581709649d7faf09391230449b9b
2016-03-31 23:39:15 +00:00
Andre Eisenbach
060956bf67 Fix log spam in getCharacteristicById()
Bug: 27744135
Change-Id: I43f6358484729dedd85eb52432ad9805a66ff81e
2016-03-31 18:00:14 +00:00
Andre Eisenbach
942aebc959 Always use Write Request for GATT descriptor writes
According to the Bluetooth Core specification v4.2, Vol 3, Part G,
section 4.12.3: "The Attribute Protocol WRITE REQUEST is used used
for this sub-procedure".

Change-Id: I86e4e1d3a8bfd7d78dfed8419f8abd2d7e89b2bc
2016-03-31 17:59:44 +00:00
Joseph Pirozzo
43b5d980d8 Merge "PBAP client Settings profile." into nyc-dev 2016-03-30 21:00:54 +00:00
Joseph Pirozzo
563c700f70 PBAP client Settings profile.
Add content to Settings and SettingsLib to add a checkbox for PBAP
client profile, and remove the box for PBAP server profile when the
client profile is enabled.

Bug: 27642222
Change-Id: I125559904a8e017a01ae90b1f6425129a87cbee3
2016-03-30 12:20:51 -07:00
Andre Eisenbach
613f430177 Always use Write Request for GATT descriptor writes
According to the Bluetooth Core specification v4.2, Vol 3, Part G,
section 4.12.3: "The Attribute Protocol WRITE REQUEST is used used
for this sub-procedure".

Change-Id: I86e4e1d3a8bfd7d78dfed8419f8abd2d7e89b2bc
2016-03-30 06:48:58 +00:00