Apply location settings on Next button press
Change-Id: I330aefc2ba3b4cfed5a5cc753fed11f6881e3ca0
diff --git a/src/org/lineageos/setupwizard/LocationSettingsActivity.java b/src/org/lineageos/setupwizard/LocationSettingsActivity.java
index 3a0bac3..e4ca1af 100644
--- a/src/org/lineageos/setupwizard/LocationSettingsActivity.java
+++ b/src/org/lineageos/setupwizard/LocationSettingsActivity.java
@@ -46,12 +46,6 @@
View locationAccessView = findViewById(R.id.location);
locationAccessView.setOnClickListener(v -> {
mLocationAccess.setChecked(!mLocationAccess.isChecked());
- mLocationManager.setLocationEnabledForUser(mLocationAccess.isChecked(),
- Process.myUserHandle());
- if (mUserManager.isManagedProfile()) {
- mUserManager.setUserRestriction(UserManager.DISALLOW_SHARE_LOCATION,
- !mLocationAccess.isChecked());
- }
});
}
@@ -66,6 +60,17 @@
}
@Override
+ protected void onNextPressed() {
+ mLocationManager.setLocationEnabledForUser(mLocationAccess.isChecked(),
+ Process.myUserHandle());
+ if (mUserManager.isManagedProfile()) {
+ mUserManager.setUserRestriction(UserManager.DISALLOW_SHARE_LOCATION,
+ !mLocationAccess.isChecked());
+ }
+ super.onNextPressed();
+ }
+
+ @Override
protected int getLayoutResId() {
return R.layout.location_settings;
}