Adapt scan settings based on client state.
If BLE scanning client goes into non-foreground state then force
SCAN_MODE_LOW_POWER scan settings for this client. Restore the original
scan settings if the scanning client comes back to foreground.
Update scanning interval/window numbers for more power savings.
Test: Ran following tests manually:
1: Foreground to background transition (and vice-vera) of an
application doing filtered scans.
2: Foreground to background transition (and vice-vera) of an
application doing unfiltered scans.
3: Screen on-off (and vice-versa) while an application is doing
filtered scans.
4: Screen on-off (and vice-versa) while an application is doing
unfiltered scans.
5. Repeated above tests for all modes: Opportunistic, low power,
balanced and low latency.
6. Measured power improvements for updated scanning interval/window
numbers.
BUG: 38198694
BUG: 62491228
Change-Id: Id80fcdcae6021667232339dc1f637f3903b2fc05
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 943d267..1ed2a5c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -66,6 +66,7 @@
<uses-permission android:name="android.permission.REAL_GET_TASKS" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_ROUTING" />
<uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
+ <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<!-- For PBAP Owner Vcard Info -->
<uses-permission android:name="android.permission.READ_PROFILE"/>