OSDN Git Service

android-x86/packages-apps-Bluetooth.git
7 years agoMerge "AVRCP: reduce PLAY_INTERVAL_TIMEOUT logspam" into oc-dev
TreeHugger Robot [Tue, 13 Jun 2017 01:03:03 +0000 (01:03 +0000)]
Merge "AVRCP: reduce PLAY_INTERVAL_TIMEOUT logspam" into oc-dev

7 years agoAVRCP: reduce PLAY_INTERVAL_TIMEOUT logspam
Marie Janssen [Mon, 12 Jun 2017 20:41:19 +0000 (13:41 -0700)]
AVRCP: reduce PLAY_INTERVAL_TIMEOUT logspam

Before:
06-10 20:38:36.926  1002  1520  2053 V Avrcp   : MSG_NATIVE_REQ_REGISTER_NOTIFICATION:event=5 param=1
06-10 20:38:36.926  1002  1520  2053 D Avrcp   : sendPlayPosNotificationRsp: (true) 193004 <=? 194015 <=? 195004
06-10 20:38:36.926  1002  1520  2053 D Avrcp   : sendPlayPosNotificationRsp: currentPlayState PlaybackState {state=3, position=698, buffered position=0, speed=1.0, updated=76557851, actions=794551, custom actions=[Action:mName='Thumbs up, mIcon=2130838014, mExtras=Bundle[mParcelledData.dataSize=40], Action:mName='Thumbs down, mIcon=2130838013, mExtras=Bundle[mParcelledData.dataSize=44], Action:mName='Start radio, mIcon=2130837971, mExtras=Bundle[mParcelledData.dataSize=648], Action:mName='Shuffle, mIcon=2130837998, mExtras=null], active item id=27596, error=null}
06-10 20:38:36.926  1002  1520  2053 D Avrcp   : PLAY_INTERVAL_TIMEOUT set for 1000ms from now
06-10 20:38:37.928  1002  1520  2053 V Avrcp   : MSG_PLAY_INTERVAL_TIMEOUT
06-10 20:38:37.928  1002  1520  2053 D Avrcp   : sendPlayPosNotificationRsp: (false) 193015 <=? 195017 <=? 195015
06-10 20:38:37.928  1002  1520  2053 D Avrcp   : sendPlayPosNotificationRsp: currentPlayState PlaybackState {state=3, position=698, buffered position=0, speed=1.0, updated=76557851, actions=794551, custom actions=[Action:mName='Thumbs up, mIcon=2130838014, mExtras=Bundle[mParcelledData.dataSize=40], Action:mName='Thumbs down, mIcon=2130838013, mExtras=Bundle[mParcelledData.dataSize=44], Action:mName='Start radio, mIcon=2130837971, mExtras=Bundle[mParcelledData.dataSize=648], Action:mName='Shuffle, mIcon=2130837998, mExtras=null], active item id=27596, error=null}

After:
06-12 14:27:38.217  1217  1807 V Avrcp   : MSG_NATIVE_REQ_REGISTER_NOTIFICATION:event=5 param=5
06-12 14:27:38.218  1217  1807 D Avrcp   : sendPlayPosNotificationRsp: (true) 56305 <=? 61489 <=? 66305 Playing State: 3 Timeout 5000ms
06-12 14:27:43.225  1217  1807 D Avrcp   : sendPlayPosNotificationRsp: (false) 56489 <=? 66495 <=? 66489 Playing State: 3

Test: adb logcat when playing music and connected to a device
Bug: 36802046
Change-Id: Icb3623c51ceaf0e70f3da9beb1f0a2896b4cfd65
(cherry picked from commit 0ace2d5941549e466ada4258c6c6fbb1debdf48d)

7 years agoAVRCP: fix single item queue Now Playing issues
Marie Janssen [Tue, 6 Jun 2017 20:34:33 +0000 (13:34 -0700)]
AVRCP: fix single item queue Now Playing issues

When queried (and in track change notifications) we previously returned
an item ID not allowed by the spec (0xFFFFFFFFFFFFFFFF) to a controller
when presenting a "single item queue" because the player doesn't provide
one.

Refactor the code so that the single item queue is persisted and send
NOW_PLAYING_CONTENT_CHANGED when the single item queue updates.

Tweak debugging of mediacontrollers for easier player debugging.

Test: check media info on honda carkit w/fm.player app
Bug: 62288178
Change-Id: Ic37d0c4c837436e102e9642e1f8e36e17e0dc254
(cherry picked from commit 3a80469f095e51f9be3965d67fff595eabc00293)

7 years agoPBAP: Implement Folder Version Counter(s)
Hemant Gupta [Thu, 9 Mar 2017 15:00:54 +0000 (20:30 +0530)]
PBAP: Implement Folder Version Counter(s)

Primary version counter should be updated on any change to
contact. Secondary version counter should not update when
there is change to fields other than F, FN, TEL, EMAIL or
ADDRESS. There is no default API available in android to determine
which field is updated as required for updating secondary
version counter. Implemented logic to increment the secondary
version counter by comparing updated contacts with old cached
contacts of the contact database.

Test: Verified that folder version counter gets incremented for
      change(s) in fields of Contacts as per PBAP specification.
      TestTracker: 89053
Bug: 33011817
Change-Id: I90a1ced3713c369bcde0edd627bbde57a9676708
(cherry picked from commit cf92c2759b709461acf7c36c08f4eef9c8004c85)

7 years agoPBAP: Add support for PBAP 1.2
Hemant Gupta [Fri, 17 Feb 2017 12:10:50 +0000 (17:40 +0530)]
PBAP: Add support for PBAP 1.2

Add changes required to do the SDP registration as
supported by 1.2, L2CAP related functionality and counter
related changes to support PBAP 1.2.

Test: Connected with Remote PBAP Client supporting PBAP 1.2 and
      verified that connection and transfer happens over L2CAP.
      Connected with Remote PBAP Client supporting PBAP 1.1 and
      and verified that connection and transfer happens over RFCOMM.
      TestTracker: 89053

Bug: 33011817
Change-Id: Iddace24f43a7618ccbe6a9b49bcab88dbaae0e06
(cherry picked from commit 5a37bc407ab1b8844c3541ff4e6653635b108bed)

7 years agoInitialize the RemoteDevice Class Of Device to UNCATEGORIZED
Pavlin Radoslavov [Thu, 8 Jun 2017 23:27:47 +0000 (16:27 -0700)]
Initialize the RemoteDevice Class Of Device to UNCATEGORIZED

Bug: 37615863
Test: Manual with LG HBS1100 headset
Change-Id: I0420cd517f77a4c8965c6651a24f97c29ae99f7f
(cherry picked from commit 2c5969fcd9beac52e4218d66f7f47d8ea901647a)

7 years agoPrevent opportunistic scans from changing the hardware filter
Ajay Panicker [Wed, 7 Jun 2017 00:18:00 +0000 (17:18 -0700)]
Prevent opportunistic scans from changing the hardware filter

Before this patch opportunistic scans could set the hardware filter
to be an all pass filter. This would result large amounts of scan
results as short filtered scans would act as if they were unfiltered.
Now if an app is scanning opportunistically, its filter doesn't
get added to the hardware filter.

Fixes: 62280037
Test: Do a filtered scan while another app is scanning opportunistically
      and see that the scan results only increase marginally.

Change-Id: I6214a2dd14d2c5ee4c21faa440c48ce7bab0b3fe
(cherry picked from commit b5d5a9563793d32bdafacfe93e303a13d5afd364)

7 years agoMerge "AVRCP: Fix issues around trackChanged notification" into oc-dev
TreeHugger Robot [Sat, 3 Jun 2017 03:37:11 +0000 (03:37 +0000)]
Merge "AVRCP: Fix issues around trackChanged notification" into oc-dev

7 years agoJNI: Fix callback obj for Advertisement
Sunny Kapdi [Fri, 2 Jun 2017 05:49:57 +0000 (22:49 -0700)]
JNI: Fix callback obj for Advertisement

Use the Advertise callback object for all Advertisement
calls in jni

Bug: 62305016
Change-Id: I6511decdff48be58c6e45cb6b93932589ca6464e

7 years agoFix OnAdvertisingSetStopped callback not being called
Jakub Pawlowski [Fri, 2 Jun 2017 17:37:13 +0000 (10:37 -0700)]
Fix OnAdvertisingSetStopped callback not being called

Bug: 62031687
Test: sl4a AdvertisingSetTest
Change-Id: I6de84bb68d8c54d8c9685e701ca5ee4967a7b6f0

7 years agoAVRCP: Fix issues around trackChanged notification
Marie Janssen [Tue, 30 May 2017 22:37:51 +0000 (15:37 -0700)]
AVRCP: Fix issues around trackChanged notification

When the track changes, sometimes the Queue ID changes before the
Metadata, and vice versa.  Indicate that the track info has changed in
either case.

Guard against unsolicited responses since we are triggering more often.

Use the MediaController info for GetItemAttributes when the requested
id matches the current id.

Test: connect to Chrysler CK, switch to next track a few times, look for
good data.
Bug: 37707672
Change-Id: I6bffd419e22e1a029e11f9340afde54be00d3efc

7 years agoMerge "AVRCP: synchronize around mMediaController" into oc-dev
TreeHugger Robot [Thu, 1 Jun 2017 23:22:20 +0000 (23:22 +0000)]
Merge "AVRCP: synchronize around mMediaController" into oc-dev

7 years agoMerge "Improve internal state synchronization of the A2dpStateMachine" into oc-dev
TreeHugger Robot [Thu, 1 Jun 2017 20:06:25 +0000 (20:06 +0000)]
Merge "Improve internal state synchronization of the A2dpStateMachine" into oc-dev

7 years agoAdd mutex-based protection mechanism to the HFP JNI layer
Pavlin Radoslavov [Sun, 28 May 2017 19:39:08 +0000 (12:39 -0700)]
Add mutex-based protection mechanism to the HFP JNI layer

The protection mechanism is needed to avoid a race condition during
graceful cleaning up of the Bluetooth Handsfree Interface when Bluetooth
is disabled, and native upcalls like connection_state_callback()

Bug: 62116636
Test: manual
Change-Id: I6be4c0bd996beca5252e881c55279ea4f7503e7b
(cherry picked from commit 273651938dbc9bab838945f1524fb588699419c7)

7 years agoImprove internal state synchronization of the A2dpStateMachine
Pavlin Radoslavov [Thu, 1 Jun 2017 00:26:45 +0000 (17:26 -0700)]
Improve internal state synchronization of the A2dpStateMachine

 * Don't block entering Disconnected state
   If the mCurrentDevice or mTargetDevice or mIncomingDevice
   is not null, print an error message and reset the state
 * Add consistency checks when entering each state: Disconnected,
   Pending, Connected
 * Add a missing "synchronized" statement

Bug: 62164051
Test: Manual
Change-Id: I5856a88e58b42aa55d9075aa507bfa706ea52512
(cherry picked from commit 459978de76c5d152208538f61180e4a790c6e8d9)

7 years agoMerge "Send ble scan type to Batterystats" into oc-dev
Joe Onorato [Wed, 31 May 2017 19:26:45 +0000 (19:26 +0000)]
Merge "Send ble scan type to Batterystats" into oc-dev

7 years agoMerge "Turn off logspam (Bluetooth)" into oc-dev
TreeHugger Robot [Wed, 31 May 2017 01:20:35 +0000 (01:20 +0000)]
Merge "Turn off logspam (Bluetooth)" into oc-dev

7 years agoAVRCP: synchronize around mMediaController
Marie Janssen [Thu, 25 May 2017 16:36:04 +0000 (09:36 -0700)]
AVRCP: synchronize around mMediaController

There were small windows where mMediaController could be used and
modified by separate threads causing NullPointerExceptions. Synchronize
around mMediaController to avoid these issues.

Test: none
Bug: 62068020
Change-Id: I68acadefe793c4c0f7ffed108ec2e943ade138b8
(cherry picked from commit ad7a50ece55752b9b7e47cd86dc45de368c8c6d5)

7 years agoTurn off logspam (Bluetooth)
Joe Onorato [Wed, 26 Apr 2017 18:03:45 +0000 (11:03 -0700)]
Turn off logspam (Bluetooth)

For more information, see https://source.android.com/source/code-style#log-sparingly

Bug: 37252687
Test: development/tools/logblame/medium_idle_test
Change-Id: I8c839eff19fa0b00d1b6a04fbb554b39010884d9

7 years agoSwitch GATT scan timekeeping to use a different clock
Ajay Panicker [Wed, 24 May 2017 18:06:49 +0000 (11:06 -0700)]
Switch GATT scan timekeeping to use a different clock

System.currentTimeMillis() could cause a scan to have a negative scan
time if the system time changed during a scan. Switch to
SystemClock.elapsedRealtime which is guaranteed to be monotonic.

Test: Start a scan and change system time
Bug: 62057540
Change-Id: Ie4d88df96c0a133955f46c355660756e587d29c5
(cherry picked from commit 4e58faa3aa59332e4d2394e6e54d8d1579e5cc73)

7 years agoAVRCP: Fix GetItemAttributesCommand
Hemant Gupta [Fri, 12 May 2017 07:29:13 +0000 (12:59 +0530)]
AVRCP: Fix GetItemAttributesCommand

Usecase:
1) Connect DUT with remote device supporting AVRCP 1.4
2) Connect browsing channel (if not already connected).
3) Send request to retrieve player list and select browsed player.
3) Send get item attribute commands to retrieve attributes of particular uid.

Expected Result:
Item attributes of particular UID are retrieved successfully.

Observation:
Get Item Attribute command does not return any response.

Root cause:
Media id passed as argument to MediaBrowse.subscribe is of children instead of
parent as required by the API

Fix:
Refactor to encapsulate requested ID in the subscribe callback, call the
MediaBrowser.subscribe with the correct id.

Test: connect to carkit and check if DUT responds correctly to GetItemAttribute
Bug: 37265436
Change-Id: Ifd7e17c600c0142cd29514eedf4ff8150f632570
(cherry picked from commit 3cd52581b21ef8c35382650170c9046119213f28)

7 years agoRemove usage of ScopedLocalFrame because it is not needed
Pavlin Radoslavov [Thu, 25 May 2017 18:28:30 +0000 (11:28 -0700)]
Remove usage of ScopedLocalFrame because it is not needed

ScopedLocalFrame is needed only when we need to reserve a large
number of JNI local references. The local references in the corresponding
code is small (below the default limit of 15).

Furthermore, using ScopedLocalFrame itself can be problematic:
it is excessive (reserves 128 entries out of total 512), and does
not check for errors.

Bug: 37969574
Test: Manual
Change-Id: Ia460fe9dd61ce91c940f64a980ec7256774d2fff
(cherry picked from commit ec462d88be2751b9a42adf67123877385562b7d8)

7 years agoFix setFlags/addFlags typo
Marie Janssen [Wed, 24 May 2017 16:33:47 +0000 (09:33 -0700)]
Fix setFlags/addFlags typo

In aosp/352873 setFlags was used instead of addFlags which means wrong
semantics are used.

Test: sanity pairing tests with devices
Bug: 35853357
Change-Id: If27a870d880036aea60e8a07714a76af6de75081
(cherry picked from commit 117ee66c2a482df8ae99d4edbc1be1d03765d54a)

7 years agoAVRCP: don't remove inactive media controllers
Marie Janssen [Wed, 24 May 2017 15:21:40 +0000 (08:21 -0700)]
AVRCP: don't remove inactive media controllers

Some players change their controllers to inactive when they are
buffering, paused, or changing songs which causes us to lose track of
the controller in these states when it makes sense to keep track still.

In the case where we actually have no controller, simplify the logic
around tracking play state using A2DP feedback.

Test: Pause / Play with troublesome headphones
Bug: 38497029
Change-Id: I8e1258b85007c070fc083d9522f9fa8caa13e6f2
(cherry picked from commit c9f4e0d24e39b372452fa809b12f9c588b29abd9)

7 years agoSend ble scan type to Batterystats
Bookatz [Tue, 23 May 2017 19:36:19 +0000 (12:36 -0700)]
Send ble scan type to Batterystats

Batterystats is now informed whether the ble scan is unoptimized or not.
In this context, unoptimized means that it is none of filtered, background,
or opportunistic.

Bug: 38461344
Test: run cts-dev -m CtsIncidentHostTestCases -t com.android.server.cts.BatteryStatsValidationTest#testUnoptimizedBleScans
Change-Id: Idb199666830db24b2ef92797cdcc59e8eab16be3

7 years agoMerge "Remove logspam in service state changes" into oc-dev
TreeHugger Robot [Mon, 22 May 2017 22:54:35 +0000 (22:54 +0000)]
Merge "Remove logspam in service state changes" into oc-dev

7 years agoRemove logspam in service state changes
Ajay Panicker [Wed, 17 May 2017 21:18:37 +0000 (14:18 -0700)]
Remove logspam in service state changes

Bug: 37803501
Test: Code still compiles
Change-Id: I9b2055476f74486a3d57957d2c9e6cf7946a139e
(cherry picked from commit edbf12256878f7d1a01c12f44342ec4ffe3405ba)

7 years agoRemove logspam for empty remote device properties
Ajay Panicker [Wed, 17 May 2017 17:58:48 +0000 (10:58 -0700)]
Remove logspam for empty remote device properties

Some properties can have a length of zero, so don't display an error
message when this happens.

Bug: 37803501
Test: Code still compiles
Change-Id: If6a2f32505c61f31075b2fc87d0521020c3720ac
(cherry picked from commit 6ad1b92100edacaa55560c3df5179bafb49539c2)

7 years agoSettings: Convert notifications to use NotificationChannel (1/2)
Hemant Gupta [Tue, 16 May 2017 11:30:53 +0000 (17:00 +0530)]
Settings: Convert notifications to use NotificationChannel (1/2)

Test Setup:
===========
HW DUT: Pixel O
Remote: MecApp (SAP Client)

Usecase:
1) Connect from MecApp.
2) Accept SAP connection on DUT.

Expected Behaviour:
Notification popup for SAP connected should be displayed on UI
which provide option for user to disconnect SAP connection.

Observed Behaviour:
Notification popup for SAP connected is not displayed on UI so user
is not able to initiate disconnection from SAP server.

Root cause:
In Android O, notifications are hidden by default.
This must be changed to use notification channels so that the
priority of the notifications can be updated.

Fix:
Add notification channel before building notification from SAP.

Test: Checked if now notification for SAP connect can be seen in
notification bar when SAP is connected allowing user to disconnect.

Bug: 38331825
Change-Id: I67b0a3fd7f1df857c6288150edbef80d4a953490
(cherry picked from commit c5c434b205948c7bf6bea50fc55521904c896ce6)

7 years agoAVRCP: increase log info density
Marie Janssen [Tue, 16 May 2017 21:50:05 +0000 (14:50 -0700)]
AVRCP: increase log info density

AVRCP has a lot of log messages that have little to no info.
Particularly with carkits that poll for data all the time, this makes it hard
to debug anything.

Remove logs where there's no info, add info where it's available with the goal
of making every log message useful.

Remove variables that we don't use anymore.

Print Now Playing Queue data on the dumpsys and when we report it
back to the controller.

Test: connect to a carkit and grab a bugreport
Bug: 37707672
Bug: 36802046
Bug: 38264897
Change-Id: I4fcb5a1c625c2d212685b4df04a0ac42df3d7841
(cherry picked from commit e5384f02ec837a8f274ed59548cb6879849239f5)

7 years agoMerge "Track BLE Scanning statistics by UID instead of by package name" into oc-dev
TreeHugger Robot [Fri, 19 May 2017 17:45:44 +0000 (17:45 +0000)]
Merge "Track BLE Scanning statistics by UID instead of by package name" into oc-dev

7 years agoAVRCP: send track changed if queue id is the same
Marie Janssen [Wed, 17 May 2017 18:53:41 +0000 (11:53 -0700)]
AVRCP: send track changed if queue id is the same

Since metadata lags behind queue id changes, we need to send another
track changed to present the correct media metadata to the controller.

Test: connect to carkit and next track a few times
Bug: 37707672
Change-Id: Ifc6f3219dbffb078e4de247c67083bdbc29c52bc
(cherry picked from commit 89cbf5bfe48e75aee016ffbc7824353ff9ce242e)

7 years agoImport translations. DO NOT MERGE
Bill Yi [Thu, 18 May 2017 01:55:45 +0000 (18:55 -0700)]
Import translations. DO NOT MERGE

Change-Id: I32f296fbb89ca2868d328459214da6bce7e006b9
Auto-generated-cl: translation import

7 years agoTrack BLE Scanning statistics by UID instead of by package name
Ajay Panicker [Mon, 15 May 2017 20:33:41 +0000 (13:33 -0700)]
Track BLE Scanning statistics by UID instead of by package name

Bug: 38315257
Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCases -t com.android.server.cts.BatteryStatsValidationTest
Change-Id: I8a705f6f8169bf074a0eacc39c015bb1af04207d

7 years agoDiscover primary service by UUID for PTS tests (3/4)
Jakub Pawlowski [Tue, 16 May 2017 17:54:28 +0000 (10:54 -0700)]
Discover primary service by UUID for PTS tests (3/4)

Bug: 38123054
Test: manual
Change-Id: I1547f1dbd46e2d5e9a4e2b953b9973fb3f52a7d7
(cherry picked from commit 84685c0e90fc8ad9453157d6f2b6454974d594e8)

7 years agoMerge "Import translations. DO NOT MERGE" into oc-dev
TreeHugger Robot [Tue, 16 May 2017 18:29:36 +0000 (18:29 +0000)]
Merge "Import translations. DO NOT MERGE" into oc-dev

7 years agoImport translations. DO NOT MERGE
Bill Yi [Tue, 16 May 2017 15:01:42 +0000 (08:01 -0700)]
Import translations. DO NOT MERGE

Change-Id: I35aabe618b13bb5096f00dfe4468c95a7779ccea
Auto-generated-cl: translation import

7 years agoAVRCP: Fix concurrency issues with MediaController
Marie Janssen [Thu, 11 May 2017 23:19:46 +0000 (16:19 -0700)]
AVRCP: Fix concurrency issues with MediaController

Some callbacks could null the MediaController when we are updating it -
only update in one place and synchronize.

Test: change players while player removes
Bug: 38228028
Change-Id: I4c5f7e9d51cddabeb7f3e48da58f89202f7362e4
(cherry picked from commit f6521ba818df22d8a853d25f7c6adc1e724875e6)

7 years agoImport translations. DO NOT MERGE
Bill Yi [Sat, 13 May 2017 01:33:47 +0000 (18:33 -0700)]
Import translations. DO NOT MERGE

Change-Id: Iaea1bcc561615849e070ee478d5eb02a228dd0c8
Auto-generated-cl: translation import

7 years agoAdd scan result tracking to battery stats
Ajay Panicker [Tue, 9 May 2017 20:36:15 +0000 (13:36 -0700)]
Add scan result tracking to battery stats

Bug: 37720787
Test: View volta stats and check for results
Change-Id: I92f116686fe394b4205fc684fd4872bbc88766a5

7 years agoRemove delay received from audio layer for A2DP state changes
Ajay Panicker [Mon, 8 May 2017 20:11:39 +0000 (13:11 -0700)]
Remove delay received from audio layer for A2DP state changes

Due to changes in the audio layer, the
setBluetoothA2dpDeviceConnectionState() function now returns a
delay of 0 on a state change from disconnecting to disconnected.
After a discussion with the audio team, the delay returned by
this function isn't actually relevant to the A2DP state machine
so instead remove the dependency on the delay returned.

Bug: 37906688
Test: Disconnect from headset multiple times and see that it is
      not stuck disconnecting.

Change-Id: I108cc5230a571edbd26fcb1f985a0b14cb7123b6
(cherry picked from commit 895d2fc990ef39441731af44b3603355ddb05a46)

7 years agoFix Periodic Adv method in jni
Sunny Kapdi [Thu, 11 May 2017 00:54:19 +0000 (17:54 -0700)]
Fix Periodic Adv method in jni

Methods related to Periodic Adv are not found
due to incorrect parameter

Bug: 38212326
Change-Id: I97ee8316ff1f292d8c165e1a05499118384605e5
(cherry picked from commit cdf3539edb9002eec7b397ba449a39e097cef2d2)

7 years agoAVRCP: Add PlaybackState for Track Changed
Marie Janssen [Thu, 4 May 2017 22:53:36 +0000 (15:53 -0700)]
AVRCP: Add PlaybackState for Track Changed

MediaController.getMetadata() updates out of sync with
MediaController.getPlaybackState(), causing issues because we use
PlaybackState.getCurrentQueueId() to sent track IDs to AVRCP CT.

Add getCurrentQueueId() as an indicator of track changes.

Remove counting how many tracks have played since it's inaccurate.

Test: connect to carkit, skip tracks, metadata is updating correctly
Bug: 37707672
Change-Id: I5d190933b847622ec858eab38828902cf798f8e1
(cherry picked from commit 29174eb9ad6e255d7ec216ab9a2ce8d20e2fe13c)

7 years agoMerge "Import translations. DO NOT MERGE" into oc-dev
TreeHugger Robot [Thu, 11 May 2017 02:16:11 +0000 (02:16 +0000)]
Merge "Import translations. DO NOT MERGE" into oc-dev

7 years agoMerge "PBAP: Convert notifications to use NotificationChannel" into oc-dev
TreeHugger Robot [Thu, 11 May 2017 01:23:40 +0000 (01:23 +0000)]
Merge "PBAP: Convert notifications to use NotificationChannel" into oc-dev

7 years agoPBAP: Convert notifications to use NotificationChannel
Hemant Gupta [Tue, 9 May 2017 06:30:35 +0000 (12:00 +0530)]
PBAP: Convert notifications to use NotificationChannel

Test Setup:
===========
HW DUT: Pixel O
Remote1: MecApp PBAP Client

Steps:
=====
1. Enable BT on DUT and bond with Remote.
2. Connect from MecApp PBAP Client Tab and observe.(Request
   Authentication checkbox enabled in MecApp).

Expected Result:
================
Device should connect successfully.

Actual Result:
===========
In Step2, "The remote PBAP server did not accept the connect request error
  popup is displayed."

Reproducibility:
===========
5/5

Log trace:
Line 6855: 05-08 14:04:23.453 10051 11015 D BluetoothPbapService:
Pbap state 0 -> 2, result = 1
Line 6868: 05-08 14:04:23.465  1615  1751 E NotificationService:
Cannot post notification
without channel ID when targeting O  - notification=Notification
(pri=0 contentView=null vibrate=null
sound=default tick defaults=0x1 flags=0x18 color=0xff607d8b vis=PRIVATE)
Line 6947: 05-08 14:04:33.471 10051 10051 W BluetoothPbapService:
Release Wake Lock
Line 7155: 05-08 14:04:53.491 10051 11492 D BluetoothPbapObexServer:
onClose(): msg MSG_SERVERSESSION_CLOSE sent out.
Line 7172: 05-08 14:04:53.509 10051 10051 D BluetoothPbapService:
Pbap state 2 -> 0, result = 1

Root Cause:
In Android O, Bluetooth notifications are hidden by default.
This must be changed to use notification channels so that the
priority of the notifications can be updated.

Test: PBAP connection works fine when remote sends authentication
challenge.

Bug: 38149308
Change-Id: Ifff0a81912f1bf11edc73279a9a127b791188d02

7 years agoAVRCP: Prevent concurrent access of Browser List
Marie Janssen [Tue, 2 May 2017 18:31:44 +0000 (11:31 -0700)]
AVRCP: Prevent concurrent access of Browser List

Concurrent access to mBrowsePlayerInfoList could happen still.

Test: none - concurrently change sessions and add a player?
Change-Id: Ibb2e1010eb1326387c04dae4ab2413d6aa3b2034
Bug: 37896665
(cherry picked from commit 5146bd27869df5473aa53e6271266f51733971ef)

7 years agoImport translations. DO NOT MERGE
Bill Yi [Wed, 10 May 2017 19:18:57 +0000 (12:18 -0700)]
Import translations. DO NOT MERGE

Change-Id: I27cdf3524ec621fc63bf2db65fb9811c75ffb9b7
Auto-generated-cl: translation import

7 years agoAVRCP: Stop MediaBrowser attempts on shutdown
Marie Janssen [Fri, 28 Apr 2017 20:23:33 +0000 (13:23 -0700)]
AVRCP: Stop MediaBrowser attempts on shutdown

Once we start our atttempts to connect to MediaBrowsers, we can get a
signal to shut down which means we could connect to a MediaBrowser and
then never disconnect, leaking a service connection.

Test: rapid on-off of the Bluetooth in settings
Change-Id: I0364b387f9b2e4ca1f65d122060ed4c153b9d70d
Fixes: 37634554
(cherry picked from commit be66a1bf5584a2a7985666ab20c5e9b54053e17d)

7 years agoMerge "Import translations. DO NOT MERGE" into oc-dev
TreeHugger Robot [Tue, 9 May 2017 18:21:22 +0000 (18:21 +0000)]
Merge "Import translations. DO NOT MERGE" into oc-dev

7 years agoImport translations. DO NOT MERGE
Bill Yi [Tue, 9 May 2017 12:08:18 +0000 (05:08 -0700)]
Import translations. DO NOT MERGE

Change-Id: I3444b9ba2b1728ac766b6c9f5c9bb9be36b31251
Auto-generated-cl: translation import

7 years agoAVRCP: Fix crash when app change during shutdown
Marie Janssen [Wed, 3 May 2017 22:26:46 +0000 (15:26 -0700)]
AVRCP: Fix crash when app change during shutdown

If you turned off Bluetooth and then immediately changed the app that
media keys went to, a NPE could be generated.

Test: shutdown bt then quick-switch to telecom immediately
Change-Id: Ifbca7446d94aa411b642b42131f603c8f9d1c31e
Bug: 37865933
(cherry picked from commit 7c7cc128e93e7e1db8a5ed7f69583ddc6d99493e)

7 years agoAVRCP: set addressed player on key dispatch
Marie Janssen [Thu, 4 May 2017 23:36:06 +0000 (16:36 -0700)]
AVRCP: set addressed player on key dispatch

MediaSessionManager.Callback.onAddressedPlayerChanged isn't being called
consistently when the package that receives media keys changes.

This affects media metadata showing up because the addressed player
controls the mMediaController.

Update the addressed player for every media key press as a workaround.

Adjust logging to reduce logspam.

Test: connect to carkit, play from GPM then switch to Youtube.
Bug: 37789858
Bug: 34471252
Bug: 37998705
Bug: 37865298
Change-Id: Ic94bb97d51f48f9799edfca0d5f9a9b2872b0132
(cherry picked from commit 78d53f7d7133cb5a32e1160e1c1a23f2e8174978)

7 years agoMove Bluetooth battery stats tracking (2/2)
Ajay Panicker [Tue, 2 May 2017 23:30:30 +0000 (16:30 -0700)]
Move Bluetooth battery stats tracking (2/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: I6129a83d275c7d72edc6abfc5cc72641adde8767

7 years agoMerge "Limit btsnoop file size (2/9)" into oc-dev
Ajay Panicker [Thu, 4 May 2017 22:56:16 +0000 (22:56 +0000)]
Merge "Limit btsnoop file size (2/9)" into oc-dev

7 years agoIncrease device name limit in the LE advertisement
Jakub Pawlowski [Thu, 4 May 2017 12:28:20 +0000 (05:28 -0700)]
Increase device name limit in the LE advertisement

The advertise data refactor:
https://android-review.git.corp.google.com/#/q/topic:btif-ad-data-refactor
introduced a change in behaviour. Previously, the device name was
included in full, or truncated if the device name was longer than the
advertisement. After the patch, name longer than 18 chars are truncated.

Increase the allowed device name length to 26 - the maximum size it can
get for legacy connectable advertisement.

Bug: 37870615
Test: none
Change-Id: I3464ffae32e73cefa10142c2f0509d9139475ddd
(cherry picked from commit c36b2ae522ab9bf7827cfca8f6cbb8efeaf2b8fa)

7 years agoMerge "AVRCP: Fix NPE in removeMediaController" into oc-dev
Marie Janssen [Thu, 4 May 2017 19:54:13 +0000 (19:54 +0000)]
Merge "AVRCP: Fix NPE in removeMediaController" into oc-dev

7 years agoAVRCP: Launch player when selected and not running
Marie Janssen [Wed, 3 May 2017 18:44:20 +0000 (11:44 -0700)]
AVRCP: Launch player when selected and not running

When a carkit selects a player, start it if we don't have a session
running, instead of trying to start it's browsing service instead.

Test: select browsable player as active player from carkit
Change-Id: I50a5817daf9e9a666871f01c22ffbe7fedb15ec1
Bug: 37919422
(cherry picked from commit eb3c55797d3ba16916327effa6b36acec5f1de36)

7 years agoAVRCP: Fix NPE in removeMediaController
Marie Janssen [Thu, 4 May 2017 15:26:37 +0000 (08:26 -0700)]
AVRCP: Fix NPE in removeMediaController

Test: make a SIP call, hang up.
Bug: 37976254
Change-Id: I975163aa85dc77f108d89064bbe6eadf682d3123
(cherry picked from commit a1e42e29b15323e1a4d0559235a0987200663b2f)

7 years agoMerge "AVRCP: Track players without active media sessions" into oc-dev
TreeHugger Robot [Thu, 4 May 2017 03:25:09 +0000 (03:25 +0000)]
Merge "AVRCP: Track players without active media sessions" into oc-dev

7 years agoMerge "Add persistent state for Bluetooth high quality audio support" into oc-dev
TreeHugger Robot [Thu, 4 May 2017 01:37:02 +0000 (01:37 +0000)]
Merge "Add persistent state for Bluetooth high quality audio support" into oc-dev

7 years agoAVRCP: Track players without active media sessions
Marie Janssen [Tue, 2 May 2017 22:28:23 +0000 (15:28 -0700)]
AVRCP: Track players without active media sessions

Players can be selected as addressed by MediaSessionService, then
destroy and renew their MediaSession. We want them to continue to
be addressed.

Don't remove players that destroy their MediaSession, and just forget
the controller instead.

Remove players when their package is removed though.

Report "(unknown)" when we are asked for media info for an addressed
player that has no controller.

Fix a bug where we didn't send updated metadata when it changed.
Fix an ordering bug updating the media session.

Make logging more clear when we're adding / updating / removing players.
Add dumpsys log to confirm current mMediaController is correct.

Use @Nullable and @NonNull to help with distinguishing when
MediaController can be null in AddressedMediaPlayer.

Test: send pause / play from headset, look at bugreport to confirm
Change-Id: I083745f8988e67776716db2bec5e67b697e8ee67
Bug: 36357185
Fixes: 37865298
(cherry picked from commit 384011244f5a62ed34f198b8ba91341b4efb4fb6)

7 years agoAdd persistent state for Bluetooth high quality audio support
Antony Sargent [Thu, 27 Apr 2017 00:18:23 +0000 (17:18 -0700)]
Add persistent state for Bluetooth high quality audio support

This CL implements the storage/retrieval of flags for whether Bluetooth
A2DP sink devices support optional codecs and if they should be turned
on when that device is connected. It also contains code to listen for
device connections and do two things: (1) save whether that device
supports optional codecs, and (2) either enable or disable those codecs
for playback if we had a stored preference for the device.

Bug=37441685
Test: manually

Change-Id: I5f3113342d53aeeb9ede68602da8c7ff8c853457

7 years agoMerge "Update to use LOCAL_STATIC_ANDROID_LIBRARIES" into oc-dev
Alan Viverette [Tue, 2 May 2017 17:48:35 +0000 (17:48 +0000)]
Merge "Update to use LOCAL_STATIC_ANDROID_LIBRARIES" into oc-dev

7 years agoMerge "Import translations. DO NOT MERGE" into oc-dev
TreeHugger Robot [Tue, 2 May 2017 15:38:30 +0000 (15:38 +0000)]
Merge "Import translations. DO NOT MERGE" into oc-dev

7 years agoImport translations. DO NOT MERGE
The Android Open Source Project [Tue, 2 May 2017 10:25:32 +0000 (03:25 -0700)]
Import translations. DO NOT MERGE

Change-Id: I2fd9e75bdbde1473e3c9fe484083aeb00924108d
Auto-generated-cl: translation import

7 years agoAVRCP: fix crash on callback with no player
Marie Janssen [Fri, 28 Apr 2017 01:53:43 +0000 (18:53 -0700)]
AVRCP: fix crash on callback with no player

If MediaSessionService tells us there's no place for keys to go, then we
have no player.

Test: disable com.google.music, reboot
Change-Id: I2adf884f9db991975cd0ae72abf2238ce323c517
Fixes: 37681487
(cherry picked from commit 41527b2493a4ea59933c7cd4f8d1c761598509d8)

7 years agoImport translations. DO NOT MERGE
Bill Yi [Sat, 29 Apr 2017 09:02:10 +0000 (02:02 -0700)]
Import translations. DO NOT MERGE

Change-Id: I1f53cb1845e728ba7dd8c8eaf505b22c602d329a
Auto-generated-cl: translation import

7 years agoMerge changes from topic 'bt5-cherry-pickerry-3' into oc-dev
Jakub Pawlowski [Thu, 27 Apr 2017 22:20:37 +0000 (22:20 +0000)]
Merge changes from topic 'bt5-cherry-pickerry-3' into oc-dev

* changes:
  Expose LE advertiser address for easier PTS tests (2/6)
  Read by UUID for PTS tests (2/5)

7 years agoLimit btsnoop file size (2/9)
Ajay Panicker [Tue, 18 Apr 2017 03:38:12 +0000 (20:38 -0700)]
Limit btsnoop file size (2/9)

Limit btsnoop file size by rotating between snoop files. The rotation occurrs
when a fixed number of packets have been logged and will start overwriting
the older file.

Bug: 35998031
Test: Enable snoop logs from developer options and let logs get large
Merged-In: Idf4dd2ee10d8b8aecf1066115fbb6a53ce8ea04a
Change-Id: Idf4dd2ee10d8b8aecf1066115fbb6a53ce8ea04a

7 years agoAVRCP: update metadata and state more consistently
Marie Janssen [Tue, 25 Apr 2017 01:36:19 +0000 (18:36 -0700)]
AVRCP: update metadata and state more consistently

When we get onMetadata it's not updated quite right, and the
PlaybackState gives the wrong answer for getActiveQueueItemId, which
means that we don't send the correct updated data.  Update the metadata
when we get a onPlaybackStateChanged as well, so we refresh the
metadata and notify correctly for EVENT_TRACK_CHANGED.

Keep track of the last queue item we sent and don't send an update if
the queue item has not changed.

Use A2DP streaming state only when we don't have strong signals from
Media framework.

Use PlaybackState.getLastPositionUpdateTime() instead of trying to
figure it out on our own.

Trust MediaAttributes with the track length instead of duplicating it.

Test: connect to BMW kit and skip some tracks, new data will show up
correctly
Bug: 37209435
Bug: 36016671
Bug: 36357185
Bug: 36055995
Change-Id: I332aaadeabcfe8284084a34c964e5f0d07bfeef4

(cherry picked from commit 0a429916782c20980e7f0893c503c633b8341f88)

7 years agoAVRCP: Gracefully handle missing item attributes
Marie Janssen [Wed, 26 Apr 2017 03:11:27 +0000 (20:11 -0700)]
AVRCP: Gracefully handle missing item attributes

The source of our metadata sometimes doesn't even give us basic title
information, which causes a NullPointerException when we try to fill the
Displayable Name.

Fill it with "<unknown>" when we don't know the data.

Add more useful debugging for GetFolderItems and GetItemAttributes.

Test: Tested with Audi and Porche car kit
Bug: 37657532
Bug: 37718715
Change-Id: I183f2b9c5714ebacabc8093de1c2bc166e323fae
(cherry picked from commit 89728a4d50001ac76d05efa1c916711ef9f9c2b4)

7 years agoExpose LE advertiser address for easier PTS tests (2/6)
Jakub Pawlowski [Wed, 19 Apr 2017 14:00:52 +0000 (07:00 -0700)]
Expose LE advertiser address for easier PTS tests (2/6)

This patchset adds a hidden method getOwnAddress, that lets app with
BLUETOOTH_PRIVILEGED permission to lear their own addreess. This is done
exclusively for PTS tests.

Bug: 35147497
Test: manual
Change-Id: I8da0128c1dac2995e488f1e0c48aa7d5fd399b4c
(cherry picked from commit f10e5516ed308be0493173fcd7982fb4f0a8cd0e)

7 years agoRead by UUID for PTS tests (2/5)
Jakub Pawlowski [Fri, 14 Apr 2017 14:26:22 +0000 (07:26 -0700)]
Read by UUID for PTS tests (2/5)

Add a hidden api for reading characteristic by UUID for PTS.

Bug: 35150313
Test: sl4a GattReadTest.byUuid
Change-Id: I6ec848eac1ecfbd1a4ec2bc968faff8a082d9c79
(cherry picked from commit 5fc203008497b071dc583450a53c93e11dd561ff)

7 years agoAVRCP: fix PlayItem NPE with no Addressed Player
Marie Janssen [Tue, 25 Apr 2017 18:17:03 +0000 (11:17 -0700)]
AVRCP: fix PlayItem NPE with no Addressed Player

Test: connect to audi, note no crashes
Change-Id: I584244c98b5afbc697b491886e4205f3af9083ca
Fixes: 37657913
(cherry picked from commit db2d487ba559f0e4de02bc2ad4cc7e275878b2fc)

7 years agoMerge "A2DP sink audio focus" into oc-dev
TreeHugger Robot [Thu, 27 Apr 2017 19:21:03 +0000 (19:21 +0000)]
Merge "A2DP sink audio focus" into oc-dev

7 years agoMerge "Import translations. DO NOT MERGE" into oc-dev
TreeHugger Robot [Wed, 26 Apr 2017 23:24:07 +0000 (23:24 +0000)]
Merge "Import translations. DO NOT MERGE" into oc-dev

7 years agoAVRCP: synchronize with better granularity
Marie Janssen [Tue, 25 Apr 2017 21:07:42 +0000 (14:07 -0700)]
AVRCP: synchronize with better granularity

Make synchronization more granular by synchronizing on the objects
actually being used.

Fix missing synchronization on mMediaPlayerInfoList.

Test: basic smoke test with multiple players
Change-Id: Iec451dca2c51ec6f6f35a1d0a28f2c4dd52db722
Fixes: 37651901
(cherry picked from commit a303cd6e430b887aa2c74fe585a323617d1837ab)

7 years agoA2DP sink audio focus
Joseph Pirozzo [Wed, 19 Apr 2017 17:49:06 +0000 (10:49 -0700)]
A2DP sink audio focus

Resolved a bug where BT media fails to pause and subsequently resume during
a transient audio focus loss as is seen during voice recognition.
Resolved a bug where BT media may not resume after a phone call due to an
audio focus race condition.
Resolved a bug where BT phone notifications could interrupt and disrupt
an ongoing media session such as radio or local media player.

Bug: 34853256
Bug: 36529639
Bug: 37288772
Test: runtest bluetooth -c
com.android.bluetooth.a2dpsink.A2dpSinkStreamHandlerTest
Change-Id: I5261d24fd7bbe49bf61c48fdf2c9ae86934dcd3d

(cherry picked from commit 2938b62a0f172680d726a351b609e83c4b2e81f7)

7 years agoImport translations. DO NOT MERGE
Bill Yi [Tue, 25 Apr 2017 21:08:04 +0000 (14:08 -0700)]
Import translations. DO NOT MERGE

Change-Id: I25b2cf84b29444dcca9c5ba2d471e82804072e72
Auto-generated-cl: translation import

7 years agoMerge "AVRCP: Fix getFolderItems with all items request" into oc-dev
TreeHugger Robot [Tue, 25 Apr 2017 18:14:20 +0000 (18:14 +0000)]
Merge "AVRCP: Fix getFolderItems with all items request" into oc-dev

7 years agoAVRCP: Pick a media player ASAP
Marie Janssen [Sat, 22 Apr 2017 01:22:54 +0000 (18:22 -0700)]
AVRCP: Pick a media player ASAP

Fix things to pick a "default media player" as soon as we can so that
connected devices have something to send media commands to.  This is
also in line with the spec.

Previously we were not detecting when we didn't have a media player
selected and selecting one.

Test: boot with com.android.music and connect to carkit, check logs
Bug: 36016671
Change-Id: I89175a3d513635d7cf8b75f5010967b99d5490aa
(cherry picked from commit 793470cef61d887cc26ce793e21e411733af8b38)

7 years agoAVRCP: Fix getFolderItems with all items request
Marie Janssen [Wed, 15 Feb 2017 17:52:44 +0000 (09:52 -0800)]
AVRCP: Fix getFolderItems with all items request

start item and end item are uint32_t
0xFFFFFFFF is commonly used as an indicator for "all items" end value.

Using a jint (int32_t) doesn't work, use jlong instead.

Test: browse with audi kit
Bug: 35385700
Bug: 36645066
Change-Id: I364f70a8b985796a6bcc83148a4ecc368a0c0493
(cherry picked from commit aabff2d74224e1d122a2ae767330a69b9324779e)

7 years agoMerge "AdapterProperties: Track connection state change from more profiles" into...
TreeHugger Robot [Sat, 22 Apr 2017 01:18:22 +0000 (01:18 +0000)]
Merge "AdapterProperties: Track connection state change from more profiles" into oc-dev

7 years agoAdapterProperties: Track connection state change from more profiles
Jack He [Fri, 21 Apr 2017 01:53:11 +0000 (18:53 -0700)]
AdapterProperties: Track connection state change from more profiles

* AdapterProperties should handle ACTION_CONNECTION_STATE_CHANGED intent
  from more profiles
* AdapterProperties sends BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED
  with STATE_CONNECTING and STATE_CONNECTED when first profile send out
  the same intent, and with STATE_DISCONNECTING and STATE_DISCONNECTED
  when last profile send out the same intent.
* At the same moment, AdapterProperties also update the return value for
  BluetoothAdapter.getConnectionState()
* Currently, we are only tracking HEADSET (HFP), HEADSET_CLIENT (HFP), A2DP,
  A2DP_SINK profiles, other profiles such as PAN, PBAP, HID profiles are
  not tracked properly and their state change could be missed by
  both intent users and BluetoothAdapter.getConnectionState()
* After this CL, the following profiles will be tracked:
  AVRCP_CONTROLLER, A2DP, A2DP_SINK, HEADSET, HEADSET_CLIENT,
  INPUT_HOST, INPUT_DEVICE, MAP, MAP_CLIENT, PAN, PBAP_CLIENT, SAP

Bug: 37546066
Test: make, test connect and disconnect each profiles
Change-Id: I2ef0e55f58e6f7891823137e2e4534e97a126c25
(cherry picked from commit cbdcb7e4fc76661793877f142f628864797cb970)

7 years agoAllow the Bluetooth MAC address to be updated asynchronously (1/3)
Stanley Tng [Tue, 18 Apr 2017 05:33:21 +0000 (22:33 -0700)]
Allow the Bluetooth MAC address to be updated asynchronously (1/3)

There are intermittent issues where either the returned Bluetooth
MAC address to Java framework is uninitialized or this address update
arrives too late. This fix will do 2 things:
(1) Returns error when MAC address is unavailable in the native code.
(2) Updates the MAC address later by adding a new broadcast event.

Test: Check address for these cases: factory reset, system reboot, and
Bluetooth re-enable.
Bug: 36709382

Change-Id: I6b71100c2c03c6f365f0dbc27d4e37c734145e30
(cherry picked from commit 6d5da5e7ffb69614706ca030bfe194a493b24e99)

7 years agoMerge "DO NOT MERGE ANYWHERE Publish AG audio route policy to native layers" into...
Zach Johnson [Fri, 21 Apr 2017 21:06:21 +0000 (21:06 +0000)]
Merge "DO NOT MERGE ANYWHERE Publish AG audio route policy to native layers" into cw-f-dev am: 0dd5868fb8  -s ours
am: d5ac6eff8a  -s ours

Change-Id: I2f5c068cb9ea235333b64bc1006700f1a64475a3

7 years agoMerge "DO NOT MERGE ANYWHERE Publish AG audio route policy to native layers" into...
Zach Johnson [Fri, 21 Apr 2017 21:03:20 +0000 (21:03 +0000)]
Merge "DO NOT MERGE ANYWHERE Publish AG audio route policy to native layers" into cw-f-dev
am: 0dd5868fb8  -s ours

Change-Id: I161e5313fd096a29ab86e06b79d9e2d3b9cd4397

7 years agoMerge "DO NOT MERGE ANYWHERE Publish AG audio route policy to native layers" into...
Zach Johnson [Fri, 21 Apr 2017 20:58:11 +0000 (20:58 +0000)]
Merge "DO NOT MERGE ANYWHERE Publish AG audio route policy to native layers" into cw-f-dev

7 years agoUpdate to use LOCAL_STATIC_ANDROID_LIBRARIES
Alan Viverette [Fri, 21 Apr 2017 20:29:57 +0000 (16:29 -0400)]
Update to use LOCAL_STATIC_ANDROID_LIBRARIES

Test: builds
Change-Id: Icec8b7f5606ac85dba64793a131815701525e3a6

7 years agoDO NOT MERGE ANYWHERE Publish AG audio route policy to native layers
Zach Johnson [Wed, 19 Apr 2017 04:22:34 +0000 (21:22 -0700)]
DO NOT MERGE ANYWHERE Publish AG audio route policy to native layers

Bug: 32958838
Test: manual
Change-Id: I97ec6e38b4f3243548732d2af644d6f0ad894e97

7 years agoMerge "Import translations. DO NOT MERGE" into oc-dev
TreeHugger Robot [Fri, 21 Apr 2017 07:23:25 +0000 (07:23 +0000)]
Merge "Import translations. DO NOT MERGE" into oc-dev

7 years agoImport translations. DO NOT MERGE
Bill Yi [Fri, 21 Apr 2017 03:00:54 +0000 (20:00 -0700)]
Import translations. DO NOT MERGE

Change-Id: Ib0a8aa9e3c35a0fd441de500bf4096b7459429d9
Auto-generated-cl: translation import

7 years agoMerge "Log battery stats before ScanClient gets removed" into oc-dev
TreeHugger Robot [Fri, 21 Apr 2017 02:32:31 +0000 (02:32 +0000)]
Merge "Log battery stats before ScanClient gets removed" into oc-dev

7 years agoFix JNI for sendDtmfNative
Joseph Pirozzo [Thu, 20 Apr 2017 18:30:38 +0000 (11:30 -0700)]
Fix JNI for sendDtmfNative

sendDtmfNative had the parameters reversed in the static function
declaration causing DTMF (dial tones durring a call) to crash the BT
stack.

Bug: 36359320
Test: Make a phonecall via HFP and tap digits, observe no crash and
proper AT+VTS commands in btsnoop_hci.log.

Change-Id: Icf66a22886bfebd6aebcf1033f59d0562c57db2f
(cherry picked from commit 39a589093e26ed58d5aa54d8793c43394c60becc)

7 years agoAVRCP: Fix EvictingQueue
Marie Janssen [Thu, 20 Apr 2017 19:42:14 +0000 (12:42 -0700)]
AVRCP: Fix EvictingQueue

Fixes EvictingQueue to not overflow the stack when a thing is added.

Test: runtest bluetooth -c com.android.bluetooth.avrcp.EvictingQueueTest
Bug: 33828042
Change-Id: I35f7f89152ff45edfacfe2c7e673adc1f31e1b3e
(cherry picked from commit 5e65f55d906687a682b4c7bbc9372084e4df3e53)

7 years agoLog battery stats before ScanClient gets removed
Ajay Panicker [Thu, 20 Apr 2017 01:16:42 +0000 (18:16 -0700)]
Log battery stats before ScanClient gets removed

Bug: 36977250
Test: run cts-dev -m CtsIncidentHostTestCases -t com.android.server.cts.BatteryStatsValidationTest
Change-Id: I8b926b7eeb9bdd8b54c7655a4951d21e8dffddfc

7 years agoAVRCP: Passthrough through MediaSessionService
Marie Janssen [Fri, 24 Mar 2017 18:35:08 +0000 (11:35 -0700)]
AVRCP: Passthrough through MediaSessionService

Send passthrough keys through MediaSessionService instead of trying to
interpret them ourselves, and log who they get dispatched to.

Remove the hack around down fast-forward / rewind.

This should result in a lot less confusion about which app is addressed
when the user is sending a command (such as at car connection time).

Test: play / skip, switch app on phone, reboot, start from carkit, dumpsys logs
Bug: 33828042
Bug: 37476911

Change-Id: I8c8c40cb3792254a3720f64707e67fdcc940edaa
(cherry picked from commit 44a4da788f878d1946301dbf297dd7b938dfd730)

7 years agoAVRCP: Report current playing item for now playing
Marie Janssen [Thu, 6 Apr 2017 23:38:23 +0000 (16:38 -0700)]
AVRCP: Report current playing item for now playing

According to the Bluetooth AVRCP 1.6.1 (p79):
 In the case where the media player does not natively support a Now
 Playing folder, it may present a folder containing one item, the
 currently playing media element, as would be returned by a
 GetElementAttributes command with the now playing UID.

Send this one-item list back when we don't have a queue, and try to
refresh the queue from the current player when we need to.

When a browsable player is selected, it's illegal for us to send a
response to EVT_TRACK_CHANGED with the now playing UID, so make up a
fake qid for this one item list in this case, since ids are only valid
within the current folder for database-unaware players anyway.

Respond with "no players available" when we actually don't have a
player.

Also fixes a bug where we would try to send the current queue back twice,
and reduces logspam in the main message handler by half.

Test: connect to carkit, test basic playback
Bug: 32800406
Bug: 36645066
Bug: 36055995
Bug: 36645066
Change-Id: Ia16c05bfc849359ca857b03edd5a75e21f13d6fb
(cherry picked from commit 5cbc96dc8da6b455c0d0a142d27274708ac1f208)

7 years agoMerge "Handle PendingIntent-based callback for scan results" into oc-dev
TreeHugger Robot [Thu, 20 Apr 2017 00:48:37 +0000 (00:48 +0000)]
Merge "Handle PendingIntent-based callback for scan results" into oc-dev