Update location app stats

- Count apps in both primary and work profiles
- Show the number of any location permitted app instead of background
  allowed apps on Location settings page
- Update the text at the top-level settings page

Bug: 129296799
Bug: 129358133
Bug: 129358508
Bug: 131432116
Test: build, flash, and test manually
Change-Id: I1a4284257a8a284140b81685efc98a2cc4a74619
This commit is contained in:
Lifu Tang
2019-04-25 14:41:41 -07:00
parent c7564be562
commit d3a6d5e860
4 changed files with 110 additions and 54 deletions

View File

@@ -76,7 +76,7 @@ public class AppLocationPermissionPreferenceControllerTest {
@Test
public void getSummary_whenLocationAppCountIsOne_shouldShowSingularString() {
mLocationManager.setLocationEnabledForUser(true, android.os.Process.myUserHandle());
mController.mNumBackground = 1;
mController.mNumHasLocation = 1;
mController.mNumTotal = 1;
assertThat(mController.getSummary()).isEqualTo(mContext.getResources().getQuantityString(
@@ -86,7 +86,7 @@ public class AppLocationPermissionPreferenceControllerTest {
@Test
public void getSummary_whenLocationAppCountIsGreaterThanOne_shouldShowPluralString() {
mLocationManager.setLocationEnabledForUser(true, android.os.Process.myUserHandle());
mController.mNumBackground = 5;
mController.mNumHasLocation = 5;
mController.mNumTotal = 10;
assertThat(mController.getSummary()).isEqualTo(mContext.getResources().getQuantityString(