Loading res/values/cm_strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -371,4 +371,8 @@ <!-- Jump to lockscreen tuner to let user change lockscreen shortcuts --> <string name="open_lockscreen_tuner">Change shortcuts</string> <!-- Battery saving mode for Location - GPS will be disabled --> <string name="location_mode_battery_saving_title">Battery saving mode</string> <string name="location_mode_battery_saving_summary">Use only Wi\u2011Fi, Bluetooth, or mobile networks to determine location (less accurate)</string> </resources> res/xml/location_settings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,11 @@ android:title="@string/location_settings_title" settings:keywords="@string/keywords_location"> <SwitchPreference android:key="location_battery_saving_mode" android:title="@string/location_mode_battery_saving_title" android:summary="@string/location_mode_battery_saving_summary" /> <PreferenceCategory android:key="recent_location_requests" android:title="@string/location_category_recent_location_requests"/> Loading src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java +1 −2 Original line number Diff line number Diff line Loading @@ -86,8 +86,7 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider } else if (className.equals(WifiCallingSuggestionActivity.class.getName())) { return WifiCallingSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(NightDisplaySuggestionActivity.class.getName())) { return context.getPackageManager().hasSystemFeature("org.lineageos.livedisplay") || NightDisplayPreferenceController.isSuggestionComplete(context); return NightDisplayPreferenceController.isSuggestionComplete(context); } else if (className.equals(NewDeviceIntroSuggestionActivity.class.getName())) { return NewDeviceIntroSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(ZenSuggestionActivity.class.getName())) { Loading src/com/android/settings/location/LocationModePreferenceController.java 0 → 100644 +84 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.location; import android.content.Context; import android.provider.Settings; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceScreen; import android.support.v7.preference.TwoStatePreference; import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settingslib.core.lifecycle.Lifecycle; public class LocationModePreferenceController extends LocationBasePreferenceController implements Preference.OnPreferenceChangeListener { private static final String KEY_LOCATION_MODE = "location_battery_saving_mode"; private Preference mPreference; private boolean mAvailable; private int mLocationMode = Settings.Secure.LOCATION_MODE_HIGH_ACCURACY; public LocationModePreferenceController(Context context, Lifecycle lifecycle) { super(context, lifecycle); mAvailable = context.getResources().getBoolean(R.bool.config_location_mode_available); } @Override public String getPreferenceKey() { return KEY_LOCATION_MODE; } @Override public boolean isAvailable() { return mAvailable; } @Override public void updateState(Preference preference) { ((TwoStatePreference) preference).setChecked( mLocationMode == Settings.Secure.LOCATION_MODE_BATTERY_SAVING); // Restricted user can't change the location mode, so disable the master switch. // However, in some corner cases, the location might still be enabled and therefore, // the master switch should be disabled, but checked at the same time. preference.setEnabled(mLocationEnabler.isEnabled(mLocationMode)); } @Override public void displayPreference(PreferenceScreen screen) { super.displayPreference(screen); mPreference = screen.findPreference(getPreferenceKey()); } @Override public void onLocationModeChanged(int mode, boolean restricted) { mLocationMode = mode; updateState(mPreference); } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { mLocationEnabler.setLocationMode((Boolean) newValue ? Settings.Secure.LOCATION_MODE_BATTERY_SAVING : Settings.Secure.LOCATION_MODE_HIGH_ACCURACY); return true; } } src/com/android/settings/location/LocationSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ public class LocationSettings extends DashboardFragment { final List<AbstractPreferenceController> controllers = new ArrayList<>(); controllers.add(new AppLocationPermissionPreferenceController(context)); controllers.add(new LocationForWorkPreferenceController(context, lifecycle)); controllers.add(new LocationModePreferenceController(context, lifecycle)); controllers.add( new RecentLocationRequestPreferenceController(context, fragment, lifecycle)); controllers.add(new LocationScanningPreferenceController(context)); Loading Loading
res/values/cm_strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -371,4 +371,8 @@ <!-- Jump to lockscreen tuner to let user change lockscreen shortcuts --> <string name="open_lockscreen_tuner">Change shortcuts</string> <!-- Battery saving mode for Location - GPS will be disabled --> <string name="location_mode_battery_saving_title">Battery saving mode</string> <string name="location_mode_battery_saving_summary">Use only Wi\u2011Fi, Bluetooth, or mobile networks to determine location (less accurate)</string> </resources>
res/xml/location_settings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,11 @@ android:title="@string/location_settings_title" settings:keywords="@string/keywords_location"> <SwitchPreference android:key="location_battery_saving_mode" android:title="@string/location_mode_battery_saving_title" android:summary="@string/location_mode_battery_saving_summary" /> <PreferenceCategory android:key="recent_location_requests" android:title="@string/location_category_recent_location_requests"/> Loading
src/com/android/settings/dashboard/suggestions/SuggestionFeatureProviderImpl.java +1 −2 Original line number Diff line number Diff line Loading @@ -86,8 +86,7 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider } else if (className.equals(WifiCallingSuggestionActivity.class.getName())) { return WifiCallingSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(NightDisplaySuggestionActivity.class.getName())) { return context.getPackageManager().hasSystemFeature("org.lineageos.livedisplay") || NightDisplayPreferenceController.isSuggestionComplete(context); return NightDisplayPreferenceController.isSuggestionComplete(context); } else if (className.equals(NewDeviceIntroSuggestionActivity.class.getName())) { return NewDeviceIntroSuggestionActivity.isSuggestionComplete(context); } else if (className.equals(ZenSuggestionActivity.class.getName())) { Loading
src/com/android/settings/location/LocationModePreferenceController.java 0 → 100644 +84 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.location; import android.content.Context; import android.provider.Settings; import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceScreen; import android.support.v7.preference.TwoStatePreference; import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settingslib.core.lifecycle.Lifecycle; public class LocationModePreferenceController extends LocationBasePreferenceController implements Preference.OnPreferenceChangeListener { private static final String KEY_LOCATION_MODE = "location_battery_saving_mode"; private Preference mPreference; private boolean mAvailable; private int mLocationMode = Settings.Secure.LOCATION_MODE_HIGH_ACCURACY; public LocationModePreferenceController(Context context, Lifecycle lifecycle) { super(context, lifecycle); mAvailable = context.getResources().getBoolean(R.bool.config_location_mode_available); } @Override public String getPreferenceKey() { return KEY_LOCATION_MODE; } @Override public boolean isAvailable() { return mAvailable; } @Override public void updateState(Preference preference) { ((TwoStatePreference) preference).setChecked( mLocationMode == Settings.Secure.LOCATION_MODE_BATTERY_SAVING); // Restricted user can't change the location mode, so disable the master switch. // However, in some corner cases, the location might still be enabled and therefore, // the master switch should be disabled, but checked at the same time. preference.setEnabled(mLocationEnabler.isEnabled(mLocationMode)); } @Override public void displayPreference(PreferenceScreen screen) { super.displayPreference(screen); mPreference = screen.findPreference(getPreferenceKey()); } @Override public void onLocationModeChanged(int mode, boolean restricted) { mLocationMode = mode; updateState(mPreference); } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { mLocationEnabler.setLocationMode((Boolean) newValue ? Settings.Secure.LOCATION_MODE_BATTERY_SAVING : Settings.Secure.LOCATION_MODE_HIGH_ACCURACY); return true; } }
src/com/android/settings/location/LocationSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -118,6 +118,7 @@ public class LocationSettings extends DashboardFragment { final List<AbstractPreferenceController> controllers = new ArrayList<>(); controllers.add(new AppLocationPermissionPreferenceController(context)); controllers.add(new LocationForWorkPreferenceController(context, lifecycle)); controllers.add(new LocationModePreferenceController(context, lifecycle)); controllers.add( new RecentLocationRequestPreferenceController(context, fragment, lifecycle)); controllers.add(new LocationScanningPreferenceController(context)); Loading