Loading src/com/android/settings/location/LocationEnabler.java +4 −2 Original line number Diff line number Diff line Loading @@ -123,7 +123,8 @@ public class LocationEnabler implements LifecycleObserver, OnResume, OnPause { } return; } updateLocationEnabled(mContext, enabled, UserHandle.myUserId()); updateLocationEnabled(mContext, enabled, UserHandle.myUserId(), Settings.Secure.LOCATION_CHANGER_SYSTEM_SETTINGS); refreshLocationMode(); } Loading @@ -142,7 +143,8 @@ public class LocationEnabler implements LifecycleObserver, OnResume, OnPause { return; } updateLocationMode(mContext, currentMode, mode, ActivityManager.getCurrentUser()); updateLocationMode(mContext, currentMode, mode, ActivityManager.getCurrentUser(), Settings.Secure.LOCATION_CHANGER_SYSTEM_SETTINGS); refreshLocationMode(); } Loading tests/robotests/src/com/android/settings/location/LocationEnablerTest.java +8 −2 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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 Loading @@ -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); Loading @@ -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 Loading Loading
src/com/android/settings/location/LocationEnabler.java +4 −2 Original line number Diff line number Diff line Loading @@ -123,7 +123,8 @@ public class LocationEnabler implements LifecycleObserver, OnResume, OnPause { } return; } updateLocationEnabled(mContext, enabled, UserHandle.myUserId()); updateLocationEnabled(mContext, enabled, UserHandle.myUserId(), Settings.Secure.LOCATION_CHANGER_SYSTEM_SETTINGS); refreshLocationMode(); } Loading @@ -142,7 +143,8 @@ public class LocationEnabler implements LifecycleObserver, OnResume, OnPause { return; } updateLocationMode(mContext, currentMode, mode, ActivityManager.getCurrentUser()); updateLocationMode(mContext, currentMode, mode, ActivityManager.getCurrentUser(), Settings.Secure.LOCATION_CHANGER_SYSTEM_SETTINGS); refreshLocationMode(); } Loading
tests/robotests/src/com/android/settings/location/LocationEnablerTest.java +8 −2 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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 Loading @@ -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); Loading @@ -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 Loading