History log of /packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3eb37afdf7fd1960ee73bc4cf23ff8fe5fd94320 27-Mar-2018 Bookatz <bookatz@google.com> Bluetooth talks to statsd

Fix statsd ble scan logging by logging directly from bluetooth.

Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.UidAtomTests#testBleUnoptimizedScan
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.UidAtomTests#testBleScan
Bug: 71607284
Bug: 69478888
Change-Id: Ie2df364ebd98d275947bba09952a515ed19c8634
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
78a6d872522ed230d07fa95dac1a56b127075cac 03-Mar-2018 Jack He <siyuanh@google.com> Metrics: Move bluetooth.proto to system/bt/proto

* Move bluetooth.proto to system/bt/proto/ and compile it for both
Java LITE runtime and C++ LITE runtime so that it can be shared
between Java and native code
* Modify Bluetooth code to use builder for protobuf messages
* Modify LE scan logging to log number of scan results at the end of a
scan session
* Modify AdapterService to merge native metrics before Java metrics so
that Java metrics can overwrite native metrics if needed

Bug: 33693818
Test: make, toggle Bluetooth, clearcut server-client E2E test
adb shell dumpsys bluetooth_manager --proto-bin
ACTS tests: BtMetricsTest, BtFunhausMetricsTest
Change-Id: I028df93d64faa58e7be6603a5a436517b9ebe297
(cherry picked from commit 1a7e3dc80de278cf675c266324c69b0fa866e0d6)
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
3376fb589d0279b58f42986a3e13d4498dbf2c4f 16-Jan-2018 Myles Watson <mylesgw@google.com> GATT: Standardize date in dump()

Match the output in logcat/bug reports.

"MM-dd HH:mm:ss"

Last 5 scans :
01-17 17:40:52 - 5977ms Filter 7 results (6)
01-17 17:41:19 - 5964ms Filter 8 results (6)
01-17 17:41:19 - 77019ms Filter 0 results (5)
01-17 17:42:37 - 5964ms Filter 8 results (6)
01-17 17:42:37 - 208533ms Filter 0 results (5)

Test: adb shell dumpsys bluetooth_manager
Change-Id: Ie0d4ae38abd08de9526cfd1bed5c7adcc460af19
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
c4fbd756e2645147470c486ae96f2253f5e13a52 12-Oct-2017 Jack He <siyuanh@google.com> [Script] Fix checkstyle errors (1/2)

Format code using Intellij to conform to CheckStyle requirements

Bug: 63597465
Test: make checkbuild, no manual changes, no functional changes
Change-Id: I70cd2ab8e5e6d5428ab1556658735b0d83f4fb15
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
8bc413b0b749ea9df59e858493273e05087fe887 11-Oct-2017 Jack He <siyuanh@google.com> [Manual] Rename non-public non-static variables to mCamelCase

* Run "instance field naming convention" inspection in Intellij
* Rename variables that are non-public non-static to m + Camel Case
* Renaming is done through refactor tool in Intellij
* Private variables are renamed to m + Camel Case
* Non-private variables are added with public modifier to indicate that
they are accessed externally as well

Bug: 63597465
Test: make checkbuild, no functional changes
Change-Id: I88400ac99fa1ba084cdfa35600bd3c23f1dd1a33
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
ddd9c7de15bdb40666a1c7c5ecfa5160944df923 21-Jul-2017 Ajay Panicker <apanicke@google.com> Pass all scans to battery stats

Also let battery stats know if the scan that was just stopped
was optimized or not.

Bug: 63456783
Test: runtest -x frameworks/base/core/tests/coretests/src/com/android/internal/os/BatteryStatsTests.java
Change-Id: Ic8308cdfe8654a7628fd6181dde9898483f528aa
Merged-In: Ic8308cdfe8654a7628fd6181dde9898483f528aa
(cherry picked from commit d5078f2b255eafb78881f39e23ae329f8515db58)
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
d04c0a8609b39f891d5787f051b1dfb105ceee93 11-Oct-2017 Jack He <siyuanh@google.com> [Manual] Remove redundant 'public' modifier

* Remove redundant 'public' modifier from non-public classes'
constructors
* Fixes all occurances labeled as "Redundant 'public' modifier' by
CheckStyle

Bug: 63597465
Test: make checkbuild, no functional changes
Change-Id: I45ece6deafa612fee36e06877065c903815466d2
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
99d01e04b0a52f4cf4e1e4a1d1eb70a171f3a5e2 14-Sep-2017 Vinay Kalia <vinaykalia@google.com> Fix connection time for GATT clients

Conenction time was not logged correctly in bluetooth_manager
dumpsys. Fix this by adding the wall clock time when connection
started and the elapsed time in ms for which the connection has
been active.

BUG: 65543218
Test: Tested with VR headset.
Change-Id: I756f3f807bd3e3c61cadc00567e367941bc3f021
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
14f2a23baa6bc9611c9b8c7dd6287750287920a8 17-Aug-2017 Vinay Kalia <vinaykalia@google.com> Merge "Fix time stats in bluetooth_manager dumpsys"
am: 3e506c2444

Change-Id: I4c28db4259a0e3fc4e8ccb1fcfc60e0a0df27b01
cb5786ffece533c1aa4d6622ba896bba0cdc4e71 11-Aug-2017 Vinay Kalia <vinaykalia@google.com> Fix time stats in bluetooth_manager dumpsys

1. If an application starts an unfiltered scan on screen-off
then it is immediately suspended. However, the "Suspended Time"
for such a scan is not updated in bluetooth_manager dumpsys.
With this change "Suspended Time" is updated for such scans as below:

2017/08/10 15:04:01 - 5945ms Suspended 0 results (6)
└ Suspended Time: 5942ms

2. Fix a bug in calculating "Total time suspended".

Test: Tested BLE scanning application with screen off.
Change-Id: I489cf5d6854e10fc25d4ce8e7817126391d0bc89
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
da28f532aa910f314300c60dcb25b177c8e2c5a8 10-Aug-2017 Vinay Kalia <vinaykalia@google.com> Merge "Stop unfiltered BLE scanning on screen off"
am: 258f385b43

Change-Id: Ice9cb0dd6c69954f9639115e87353f0d3596793f
902923e1d4046df5e0270c19bd96cd397b3f4905 10-Aug-2017 Vinay Kalia <vinaykalia@google.com> resolve merge conflicts of 613fc2e89 to stage-aosp-master

Merged-In: I75f51146a8c604fed5997f7ad4a77fc89b5b5c44
Merged-In: I8a8492757191c603786f0ca275bacbf63d577459

Test: Verified this conflict resolution.

Change-Id: I0142a236327cc277f348d7188da0807983fc5132
319aeae6f4ebd13678b4f77375d1804978c4a1e1 20-Jul-2017 Vinay Kalia <vinaykalia@google.com> Stop unfiltered BLE scanning on screen off

Stop unfiltered BLE scans when the screen goes off.
These scans will be resumed when the screen turns on
again unless these scans are stopped by application
itself before the screen is turned on.

While screen is off, new scans are allowed to be
created but scan instances will not receive results
until the screen is turned on.

Stats in bluetooth_manager dumpsys are updated to show
suspended time as below:

LE scans (started/stopped) : 11 / 10
Scan time in ms (min/max/avg/total): 1107 / 15003 / 7623 / 83859
Total time suspended : 4257ms
Total number of results : 14
Last 5 scans :
2017/07/26 15:41:50 - 14993ms Filter 0 results (6)
2017/07/26 15:42:05 - 5021ms 0 results (6)
2017/07/26 15:42:10 - 9908ms Filter 0 results (6)
2017/07/26 15:42:20 - 5011ms 11 results (6)
└ Suspended Time: 1193ms
2017/07/26 15:42:25 - 14990ms Filter 0 results (6)
Ongoing scans :
2017/07/26 15:42:40 - 1342ms Suspended 0 results (6)
└ Suspended Time: 1239ms

BUG: 62264269
Test: Tested BLE scanning applications.

Change-Id: I017f0cdc0fc52a0a30d6cf870d7e688e5ff18df9
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
bcdae28f17c0a8422f8d996cf68071e0245fce6e 23-Jun-2017 Vinay Kalia <vinaykalia@google.com> Improve BLE scan attribution to facilitate debugging power issues

Following changes are made to improve BLE scan dumpsys:
1. All stats in AppScanStats assumed one scan per application.
This is not true for many applications. Fix scanning stats
to support multiple scans per application:
a. Fix number of scans started/stopped counters.
b. Fix scan min/max/avg/total time.
c. Fix scan start/stop indication to batterystats.

2. Show ongoing scans as a separate list of scans.

Example:
<app-name> (Registered)
LE scans (started/stopped) : 13 / 11
Scan time in ms (min/max/avg/total): 1098 / 227509 / 19805 / 257469
Total number of results : 2623
Last 5 scans :
2017/06/26 14:55:02 - 6659ms 59 results (7)
2017/06/26 14:55:13 - 1113ms 6 results (8)
2017/06/26 14:55:14 - 10012ms Filter 0 results (8)
2017/06/26 14:55:24 - 1106ms 7 results (8)
2017/06/26 14:57:56 - 10007ms 100 results (9)
Ongoing scans:
2017/06/26 14:55:09 - 227509ms 2232 results (7)
2017/06/26 14:58:06 - 50463ms Filter 0 results (9)

Application ID : 5
UUID : xxxx

BUG: 62389939
Test: Tested a few BLE scanning applications which included misbehaving
applications.

Change-Id: Iaade4ce4bf06533415b49bc3635866b1bf0db937
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
b4650c79c67ba13773724ef4af9a82c1bb7c808c 31-May-2017 Joe Onorato <joeo@google.com> Merge "Send ble scan type to Batterystats" into oc-dev
ca4e714ae37050265379fc6604a4e01db9ecae15 24-May-2017 Ajay Panicker <apanicke@google.com> 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)
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
318a93083dcbcc0d70c5a4dd6e95cf8bf2f01461 24-May-2017 Ajay Panicker <apanicke@google.com> 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
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
ffec5afaea207f22ceeab0eeb73a4ec5000f91fc 23-May-2017 Bookatz <bookatz@google.com> 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
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
8dc1ac7b011ff262830a0a28f66ae53fe5f63f74 09-May-2017 Ajay Panicker <apanicke@google.com> Add scan result tracking to battery stats

Bug: 37720787
Test: View volta stats and check for results
Change-Id: I92f116686fe394b4205fc684fd4872bbc88766a5
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
8e68fb0428b6c4e6ad3aa5aadbb9815e05f723ce 03-May-2017 Ajay Panicker <apanicke@google.com> 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
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
edbc90eb917a8a509d2d03fb304763b768ec5517 03-May-2017 Ajay Panicker <apanicke@google.com> 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
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
65e839fa45222955a605f6270a240edc68b21617 20-Jan-2017 Ajay Panicker <apanicke@google.com> Change scan downgrading to be app independent

Before this patch, every time an app started a new scan it would reset the
timer to downgrade apps down to opportunistic. Now each app is kept track
of individually so that another app doing frequent short scans doesn't cause
a long scanning app to avoid downgrading.

Bug: 34224062
Test: Tested scanning multiple times with multiple apps / TestTracker:73279
Change-Id: Ibcae9115dcd0fb5325f7bc9fc5d6e0fe4bf6e062
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
bd11ad34482a898a53bbd9f55bf3607c40c648ec 04-Jan-2017 Ajay Panicker <apanicke@google.com> Add the Filter statistic to scan statistics

Test: sl4a FilterTest
Change-Id: Ic16e523524022803107b5e0653a35e3f2cbc5186
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
c82ac85eacc5607433592f476dbbe73d7670efe1 06-May-2016 Ajay Panicker <apanicke@google.com> Allow scan statistics to be displayed even if app hasn't scanned.

Bug: 28622714
Change-Id: I220d3110346e7d6f67ecfd7468779072d71b5788
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
1fdc7c138db776b02bc751fd7a80c519ea3324d1 13-Apr-2016 Ajay Panicker <apanicke@google.com> Add protection against LE scanning abuse

Added two checks to prevent abuse. The first check ensures that an
app doesn't scan too frequently in a certain time period. It is
allowed to scan again after its oldest scan exceedes said time
period. The second check ensures that an app doesn't scan for too
long. Upon starting a scan, this code waits a certain amount of time.
If the app is still scanning by that point, this code stops
the scan and forces the app to use opportunistic scanning instead.

Bug: 27357274
Change-Id: Ic99ac1f838e15ed99fe2fae643ef073d74b5c96b
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
a86ae2ce4305fb0af5522b3f46513b137e98836f 20-Apr-2016 Ajay Panicker <apanicke@google.com> Properly label app as unregistered and add NPE protection

Bug: 28252914
Change-Id: I1e28a9af96bcf0d56914fcc676a8ff85400bc1c4
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
3d69ae195b8d3918958ea703a188cc77e511da6c 05-Apr-2016 Ajay Panicker <apanicke@google.com> Fix name collected for scan initiator

Private information was being collected for the scan statistics.

Bug: 27996307
Change-Id: Idab438967f80f86f4f92e7f03cc5787f8d54e8a1
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
c30f06668bc683b13319a33775ee8f9def3283c8 09-Mar-2016 Ajay Panicker <apanicke@google.com> Add scan results to scan stats

Ex:
GATT Client Map
Entries: 1

no.nordicsemi.android.mcp
LE scans (started/stopped) : 3 / 3
Scan time in ms (min/max/avg/total): 3050 / 6901 / 4815 / 14447
Total number of results : 338
Last 3 scans :
1970/01/01 08:20:06 - 6901ms 0 results
1970/01/01 08:20:13 - 4496ms 171 results
1970/01/01 08:20:39 - 3050ms 167 results

Bug: 27294154
Change-Id: I32fd6da035f2c37302a105733ac6a9817547b7a3
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java
b7af521b6c2d1ccaaea687207dfbcd0c34489a3c 02-Mar-2016 Ajay Panicker <apanicke@google.com> Move ScanStats to its own file

ScanStats was growing too large and had many components so
it was moved into its own file.

Bug: 27294154
Change-Id: Ic20c9e74d5d8b074f7e966625fb1bffab6c94f2d
/packages/apps/Bluetooth/src/com/android/bluetooth/gatt/AppScanStats.java