Skip to content

Commit

Permalink
add network location setting
Browse files Browse the repository at this point in the history
  • Loading branch information
soupslurpr committed Nov 15, 2024
1 parent ca70a56 commit 0bb79fd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions res/values/strings_ext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,14 @@ Duress PIN works the same way duress password does."</string>
<string name="alt_touchscreen_mode_confirm_message">Confirm that the touchscreen is working. Without confirmation, alternative touchscreen mode will be disabled after several seconds.</string>
<string name="alt_touchscreen_mode_confirm_button">Confirm</string>

<string name="network_location_title">Network location</string>
<string name="network_location_footer">
"Network location is a method of determining your device’s location by using various nearby signals, such as Wi-Fi networks, Bluetooth devices, and cell towers. Your device scans for these signals and sends their identifiers to a server, which then provides positioning data that your device uses to estimate its location. Currently, only Wi-Fi networks are used.

This method can be particularly useful when GNSS is unavailable or unreliable, such as indoors or in areas with poor satellite reception. Network location provides a quicker way to determine your location before a GNSS lock is acquired or when GNSS signals are weak."
</string>
<string name="network_location_enabled_grapheneos_proxy">GrapheneOS proxy</string>
<string name="network_location_enabled_apple_server">Apple server</string>
<string name="network_location_disabled">Off</string>

</resources>
6 changes: 6 additions & 0 deletions res/xml/location_services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@
android:title="@string/location_scanning_bluetooth_always_scanning_title"
settings:controller="com.android.settings.location.LocationServicesBluetoothScanningPreferenceController"/>

<com.android.settingslib.RestrictedPreference
android:order="1002"
android:key="location_services_network_location"
android:title="@string/network_location_title"
settings:controller="com.android.settings.location.LocationServicesNetworkLocationPreferenceController"/>

</PreferenceScreen>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.android.settings.location

import android.content.Context
import android.ext.settings.NetworkLocationSettings
import androidx.preference.PreferenceScreen
import com.android.settings.R
import com.android.settings.ext.IntSettingPrefController
import com.android.settings.ext.RadioButtonPickerFragment2

/**
* Preference controller for Network location in Location Services.
*/
class LocationServicesNetworkLocationPreferenceController(ctx: Context, key: String?) :
IntSettingPrefController(ctx, key, NetworkLocationSettings.NETWORK_LOCATION_SETTING) {

override fun addPrefsAfterList(fragment: RadioButtonPickerFragment2, screen: PreferenceScreen) {
addFooterPreference(screen, R.string.network_location_footer)
}

override fun getEntries(entries: Entries) {
entries.add(
R.string.network_location_enabled_grapheneos_proxy,
NetworkLocationSettings.NETWORK_LOCATION_SERVER_GRAPHENEOS_PROXY
)
entries.add(
R.string.network_location_enabled_apple_server,
NetworkLocationSettings.NETWORK_LOCATION_SERVER_APPLE
)
entries.add(
R.string.network_location_disabled,
NetworkLocationSettings.NETWORK_LOCATION_DISABLED
)
}
}

0 comments on commit 0bb79fd

Please sign in to comment.