Location setting now updates summary timely.

Subscribed the LocationPreferenceController to listen to the location
providers changed action. This allows timely summary update. Previous
approach, directly calling the updateSummary method onResume failed in
the scenario when user changed the location settings via the
QuickSettings.

Test: Added robolectric tests, and manually verified the intended
behavior on a device.
Bug: 37956060
Change-Id: I2f81713d59da3384f3c98b327d377d529d440a88
This commit is contained in:
Alex Salo
2017-05-05 15:36:27 -07:00
parent 531163412c
commit 2e52b42e3b
3 changed files with 99 additions and 23 deletions

View File

@@ -175,6 +175,12 @@ public class SecuritySettings extends SettingsPreferenceFragment
return MetricsEvent.SECURITY;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
mLocationcontroller = new LocationPreferenceController(context, getLifecycle());
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -205,7 +211,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
mTrustAgentClickIntent = savedInstanceState.getParcelable(TRUST_AGENT_CLICK_INTENT);
}
mLocationcontroller = new LocationPreferenceController(activity);
mManageDeviceAdminPreferenceController
= new ManageDeviceAdminPreferenceController(activity);
mEnterprisePrivacyPreferenceController