From 0bb79fd03ff7fe4ea8ab316f6357de8659253231 Mon Sep 17 00:00:00 2001
From: soupslurpr <92235850+soupslurpr@users.noreply.github.com>
Date: Mon, 4 Nov 2024 20:32:27 -0800
Subject: [PATCH] add network location setting
---
res/values/strings_ext.xml | 10 ++++++
res/xml/location_services.xml | 6 ++++
...icesNetworkLocationPreferenceController.kt | 34 +++++++++++++++++++
3 files changed, 50 insertions(+)
create mode 100644 src/com/android/settings/location/LocationServicesNetworkLocationPreferenceController.kt
diff --git a/res/values/strings_ext.xml b/res/values/strings_ext.xml
index 0cd5e260bb6..7446f953141 100644
--- a/res/values/strings_ext.xml
+++ b/res/values/strings_ext.xml
@@ -208,4 +208,14 @@ Duress PIN works the same way duress password does."
Confirm that the touchscreen is working. Without confirmation, alternative touchscreen mode will be disabled after several seconds.
Confirm
+ Network location
+
+"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."
+
+ GrapheneOS proxy
+ Apple server
+ Off
+
diff --git a/res/xml/location_services.xml b/res/xml/location_services.xml
index 917ef1d28f7..0c1027003ac 100644
--- a/res/xml/location_services.xml
+++ b/res/xml/location_services.xml
@@ -34,4 +34,10 @@
android:title="@string/location_scanning_bluetooth_always_scanning_title"
settings:controller="com.android.settings.location.LocationServicesBluetoothScanningPreferenceController"/>
+
+
diff --git a/src/com/android/settings/location/LocationServicesNetworkLocationPreferenceController.kt b/src/com/android/settings/location/LocationServicesNetworkLocationPreferenceController.kt
new file mode 100644
index 00000000000..3fa2a2644d5
--- /dev/null
+++ b/src/com/android/settings/location/LocationServicesNetworkLocationPreferenceController.kt
@@ -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
+ )
+ }
+}