Store location changer into Settings.Secure

Bug: 68779883
Test: Manual
Change-Id: I6ec69d6c9f418a169b8bee71969716e8a44a14a5
This commit is contained in:
Lifu Tang
2018-01-23 21:12:14 -08:00
parent c4ceb8c152
commit e6032be851
2 changed files with 12 additions and 4 deletions

View File

@@ -179,7 +179,7 @@ public class LocationEnablerTest {
}
@Test
public void setLocationMode_notRestricted_shouldBroadcastUpdate() {
public void setLocationMode_notRestricted_shouldBroadcastUpdateAndSetChanger() {
when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
@@ -189,6 +189,9 @@ public class LocationEnablerTest {
argThat(actionMatches(LocationManager.MODE_CHANGING_ACTION)),
eq(UserHandle.of(ActivityManager.getCurrentUser())),
eq(WRITE_SECURE_SETTINGS));
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_CHANGER, Settings.Secure.LOCATION_CHANGER_UNKNOWN))
.isEqualTo(Settings.Secure.LOCATION_CHANGER_SYSTEM_SETTINGS);
}
@Test
@@ -202,7 +205,7 @@ public class LocationEnablerTest {
}
@Test
public void setLocationEnabled_notRestricted_shouldBroadcastUpdate() {
public void setLocationEnabled_notRestricted_shouldBroadcastUpdateAndSetChanger() {
when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF);
@@ -212,6 +215,9 @@ public class LocationEnablerTest {
argThat(actionMatches(LocationManager.MODE_CHANGING_ACTION)),
eq(UserHandle.of(ActivityManager.getCurrentUser())),
eq(WRITE_SECURE_SETTINGS));
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_CHANGER, Settings.Secure.LOCATION_CHANGER_UNKNOWN))
.isEqualTo(Settings.Secure.LOCATION_CHANGER_SYSTEM_SETTINGS);
}
@Test