MAOS.git
Publicgit clone https://git.maproj.org/MAOS.gitMAOS.git / patches / setupwizard2.patch
setupwizard2.patch220 lines · 11.2 KiBRaw
| 1 | diff --git a/AndroidManifest.xml b/AndroidManifest.xml |
| 2 | index 9f988f1..81ed5f6 100644 |
| 3 | --- a/AndroidManifest.xml |
| 4 | +++ b/AndroidManifest.xml |
| 5 | @@ -20,6 +20,8 @@ |
| 6 | <uses-permission android:name="app.seamlessupdate.client.OPEN_SECURITY_PREVIEW_SETTINGS" /> |
| 7 | |
| 8 | |
| 9 | + <!-- MAOS: opt out of the GrapheneOS Sensors permission (never requested nor granted). --> |
| 10 | + <uses-permission android:name="com.vayunmathur.permission.SENSORS_OPTOUT" /> |
| 11 | <application |
| 12 | android:name=".App" |
| 13 | android:label="@string/app_name" |
| 14 | diff --git a/java/app/grapheneos/setupwizard/action/LocationActions.kt b/java/app/grapheneos/setupwizard/action/LocationActions.kt |
| 15 | index 7bf31bb..ebbaeaf 100644 |
| 16 | --- a/java/app/grapheneos/setupwizard/action/LocationActions.kt |
| 17 | +++ b/java/app/grapheneos/setupwizard/action/LocationActions.kt |
| 18 | @@ -1,11 +1,5 @@ |
| 19 | package app.grapheneos.setupwizard.action |
| 20 | |
| 21 | -import android.ext.settings.GeocoderSettings.GEOCODER_DISABLED |
| 22 | -import android.ext.settings.GeocoderSettings.GEOCODER_SERVER_GRAPHENEOS |
| 23 | -import android.ext.settings.GeocoderSettings.GEOCODER_SETTING |
| 24 | -import android.ext.settings.NetworkLocationSettings.NETWORK_LOCATION_DISABLED |
| 25 | -import android.ext.settings.NetworkLocationSettings.NETWORK_LOCATION_GRAPHENEOS_APPLE_PROXY |
| 26 | -import android.ext.settings.NetworkLocationSettings.NETWORK_LOCATION_SETTING |
| 27 | import android.location.LocationManager |
| 28 | import android.net.wifi.WifiManager |
| 29 | import android.util.Log |
| 30 | @@ -25,54 +19,22 @@ object LocationActions { |
| 31 | refreshCurrentState() |
| 32 | } |
| 33 | |
| 34 | - fun setNetworkLocationEnabled(enabled: Boolean) { |
| 35 | - Log.d(TAG, "setNetworkLocationEnabled: $enabled") |
| 36 | - NETWORK_LOCATION_SETTING.put( |
| 37 | - appContext, |
| 38 | - if (enabled) NETWORK_LOCATION_GRAPHENEOS_APPLE_PROXY else NETWORK_LOCATION_DISABLED |
| 39 | - ) |
| 40 | - refreshCurrentState() |
| 41 | - } |
| 42 | - |
| 43 | fun setWifiScanningAlwaysAvailableEnabled(enabled: Boolean) { |
| 44 | Log.d(TAG, "setWifiScanningAlwaysAvailableEnabled: $enabled") |
| 45 | getWifiManager().isScanAlwaysAvailable = enabled |
| 46 | refreshCurrentState() |
| 47 | } |
| 48 | |
| 49 | - fun setGeocoderEnabled(enabled: Boolean) { |
| 50 | - Log.d(TAG, "setGeocoderEnabled: $enabled") |
| 51 | - GEOCODER_SETTING.put( |
| 52 | - appContext, |
| 53 | - if (enabled) GEOCODER_SERVER_GRAPHENEOS else GEOCODER_DISABLED |
| 54 | - ) |
| 55 | - refreshCurrentState() |
| 56 | - } |
| 57 | - |
| 58 | private fun refreshCurrentState() { |
| 59 | LocationData.locationEnabled.value = getLocationManager().isLocationEnabled |
| 60 | Log.d(TAG, "refreshCurrentState: locationEnabled = ${LocationData.locationEnabled.value}") |
| 61 | |
| 62 | - LocationData.networkLocationEnabled.value = |
| 63 | - NETWORK_LOCATION_SETTING.get(appContext) != NETWORK_LOCATION_DISABLED |
| 64 | - Log.d( |
| 65 | - TAG, |
| 66 | - "refreshCurrentState: networkLocationEnabled = ${LocationData.networkLocationEnabled.value}" |
| 67 | - ) |
| 68 | - |
| 69 | @Suppress("DEPRECATION") // WifiManager.isScanAlwaysAvailable is not deprecated for platform apps |
| 70 | LocationData.wifiScanningAlwaysAvailableEnabled.value = getWifiManager().isScanAlwaysAvailable |
| 71 | Log.d( |
| 72 | TAG, |
| 73 | "refreshCurrentState: wifiScanningAlwaysAvailableEnabled = ${LocationData.wifiScanningAlwaysAvailableEnabled.value}" |
| 74 | ) |
| 75 | - |
| 76 | - LocationData.geocoderEnabled.value = |
| 77 | - GEOCODER_SETTING.get(appContext) != GEOCODER_DISABLED |
| 78 | - Log.d( |
| 79 | - TAG, |
| 80 | - "refreshCurrentState: geocoderEnabled = ${LocationData.geocoderEnabled.value}" |
| 81 | - ) |
| 82 | } |
| 83 | |
| 84 | private fun getLocationManager(): LocationManager { |
| 85 | diff --git a/java/app/grapheneos/setupwizard/data/LocationData.kt b/java/app/grapheneos/setupwizard/data/LocationData.kt |
| 86 | index 5691c54..ff1b3fd 100644 |
| 87 | --- a/java/app/grapheneos/setupwizard/data/LocationData.kt |
| 88 | +++ b/java/app/grapheneos/setupwizard/data/LocationData.kt |
| 89 | @@ -6,9 +6,7 @@ import app.grapheneos.setupwizard.action.LocationActions |
| 90 | |
| 91 | object LocationData : ViewModel() { |
| 92 | val locationEnabled = MutableLiveData<Boolean>() |
| 93 | - val networkLocationEnabled = MutableLiveData<Boolean>() |
| 94 | val wifiScanningAlwaysAvailableEnabled = MutableLiveData<Boolean>() |
| 95 | - val geocoderEnabled = MutableLiveData<Boolean>() |
| 96 | |
| 97 | init { |
| 98 | LocationActions |
| 99 | diff --git a/java/app/grapheneos/setupwizard/view/activity/LocationActivity.kt b/java/app/grapheneos/setupwizard/view/activity/LocationActivity.kt |
| 100 | index 3b660f5..6bc29ef 100644 |
| 101 | --- a/java/app/grapheneos/setupwizard/view/activity/LocationActivity.kt |
| 102 | +++ b/java/app/grapheneos/setupwizard/view/activity/LocationActivity.kt |
| 103 | @@ -17,11 +17,7 @@ class LocationActivity : SetupWizardActivity( |
| 104 | ) { |
| 105 | private lateinit var locationEnabled: SwitchItem |
| 106 | // only initialized when in primary user |
| 107 | - private lateinit var networkLocationEnabled: SwitchItem |
| 108 | - // only initialized when in primary user |
| 109 | private lateinit var wifiScanningAlwaysAvailableEnabled: SwitchItem |
| 110 | - // only initialized when in primary user |
| 111 | - private lateinit var geocoderEnabled: SwitchItem |
| 112 | |
| 113 | override fun bindViews() { |
| 114 | val layout = requireViewById<GlifRecyclerLayout>(R.id.glif_layout) |
| 115 | @@ -35,18 +31,11 @@ class LocationActivity : SetupWizardActivity( |
| 116 | itemGroup.addChild(locationEnabled) |
| 117 | LocationData.locationEnabled.observe(this) { locationEnabled.isChecked = it } |
| 118 | |
| 119 | - // Network location, Wi-Fi scanning, and Geocoder are global settings. |
| 120 | + // Wi-Fi scanning is a global setting. |
| 121 | + // |
| 122 | + // Network location and geocoding are always on in Modern Apps OS - one pinned, |
| 123 | + // on-device provider serves both - so there is nothing here for the user to choose. |
| 124 | if (SetupWizard.isPrimaryUser) { |
| 125 | - networkLocationEnabled = SwitchItem().apply { |
| 126 | - id = View.generateViewId() |
| 127 | - title = getString(R.string.network_location_enabled_title) |
| 128 | - summary = getString(R.string.network_location_enabled_desc) |
| 129 | - } |
| 130 | - itemGroup.addChild(networkLocationEnabled) |
| 131 | - LocationData.networkLocationEnabled.observe(this) { |
| 132 | - networkLocationEnabled.isChecked = it |
| 133 | - } |
| 134 | - |
| 135 | wifiScanningAlwaysAvailableEnabled = SwitchItem().apply { |
| 136 | id = View.generateViewId() |
| 137 | title = getString(R.string.wifi_scanning_always_available_enabled_title) |
| 138 | @@ -56,16 +45,6 @@ class LocationActivity : SetupWizardActivity( |
| 139 | LocationData.wifiScanningAlwaysAvailableEnabled.observe(this) { |
| 140 | wifiScanningAlwaysAvailableEnabled.isChecked = it |
| 141 | } |
| 142 | - |
| 143 | - geocoderEnabled = SwitchItem().apply { |
| 144 | - id = View.generateViewId() |
| 145 | - title = getString(R.string.geocoder_enabled_title) |
| 146 | - summary = getString(R.string.geocoder_enabled_desc) |
| 147 | - } |
| 148 | - itemGroup.addChild(geocoderEnabled) |
| 149 | - LocationData.geocoderEnabled.observe(this) { |
| 150 | - geocoderEnabled.isChecked = it |
| 151 | - } |
| 152 | } |
| 153 | |
| 154 | val adapter = RecyclerItemAdapter(itemGroup) |
| 155 | @@ -82,32 +61,18 @@ class LocationActivity : SetupWizardActivity( |
| 156 | override fun setupActions() { |
| 157 | locationEnabled.setOnCheckedChangeListener { _, isChecked -> |
| 158 | if (SetupWizard.isPrimaryUser) { |
| 159 | - val areDependentsEnabled = isChecked |
| 160 | - networkLocationEnabled.isEnabled = areDependentsEnabled |
| 161 | - wifiScanningAlwaysAvailableEnabled.isEnabled = areDependentsEnabled |
| 162 | + wifiScanningAlwaysAvailableEnabled.isEnabled = isChecked |
| 163 | } |
| 164 | LocationActions.setLocationEnabled(isChecked) |
| 165 | } |
| 166 | |
| 167 | - // Network location, Wi-Fi scanning, and Geocoder are global settings. |
| 168 | + // Wi-Fi scanning is a global setting. |
| 169 | if (SetupWizard.isPrimaryUser) { |
| 170 | - networkLocationEnabled.run { |
| 171 | - setOnCheckedChangeListener { _, isChecked -> |
| 172 | - LocationActions.setNetworkLocationEnabled(isChecked) |
| 173 | - } |
| 174 | - } |
| 175 | - |
| 176 | wifiScanningAlwaysAvailableEnabled.run { |
| 177 | setOnCheckedChangeListener { _, isChecked -> |
| 178 | LocationActions.setWifiScanningAlwaysAvailableEnabled(isChecked) |
| 179 | } |
| 180 | } |
| 181 | - |
| 182 | - geocoderEnabled.run { |
| 183 | - setOnCheckedChangeListener { _, isChecked -> |
| 184 | - LocationActions.setGeocoderEnabled(isChecked) |
| 185 | - } |
| 186 | - } |
| 187 | } |
| 188 | |
| 189 | primaryButton.setOnClickListener { SetupWizard.next(this) } |
| 190 | diff --git a/res/values/strings.xml b/res/values/strings.xml |
| 191 | index 1aaad57..7ab5470 100644 |
| 192 | --- a/res/values/strings.xml |
| 193 | +++ b/res/values/strings.xml |
| 194 | @@ -2,8 +2,8 @@ |
| 195 | <string name="app_name">SetupWizard</string> |
| 196 | <string name="next">Next</string> |
| 197 | <string name="skip">Skip</string> |
| 198 | - <string name="welcome_to_grapheneos">Welcome to GrapheneOS</string> |
| 199 | - <string name="grapheneos_icon">GrapheneOS icon</string> |
| 200 | + <string name="welcome_to_grapheneos">Welcome to Modern Apps OS</string> |
| 201 | + <string name="grapheneos_icon">Modern Apps OS icon</string> |
| 202 | <string name="grapheneos_desc">Privacy and security, crafted for your mobile device, usable by everyone.</string> |
| 203 | <string name="lets_setup_your_device">Let\'s set up your device in a few steps.</string> |
| 204 | <string name="lets_setup_your_profile">Let\'s set up your user profile in a few steps.</string> |
| 205 | @@ -17,14 +17,10 @@ |
| 206 | <string name="location_services">Location services</string> |
| 207 | <string name="location_access_title">Use location</string> |
| 208 | <string name="location_access_desc">Allow apps that have asked your permission to use your location information. This may include your current location and past locations.</string> |
| 209 | - <string name="network_location_enabled_title">Network location</string> |
| 210 | - <string name="network_location_enabled_desc">Enable network location to determine your location better (such as when indoors) and more efficiently. Nearby wireless signal identifiers will be sent to an Apple server through a GrapheneOS proxy only when network location is being used.</string> |
| 211 | <string name="wifi_scanning_always_available_enabled_title">Wi-Fi scanning always available</string> |
| 212 | <string name="wifi_scanning_always_available_enabled_desc">Allow apps and services with permission to scan for Wi-Fi networks to do so even when Wi-Fi is off. For example, when network location is on, this allows it to scan for Wi-Fi networks even when Wi-Fi is off, improving location accuracy.</string> |
| 213 | - <string name="geocoder_enabled_title">Geocoder</string> |
| 214 | - <string name="geocoder_enabled_desc">Enable geocoder to allow apps to use a network-based service hosted by GrapheneOS to convert between geographic coordinates and human-readable addresses. Some apps need this for critical functionality.</string> |
| 215 | <string name="restore_apps_and_data"><![CDATA[Restore apps & data]]></string> |
| 216 | - <string name="data_restore_desc">If you have a backup from your previous GrapheneOS device, you can restore it here.</string> |
| 217 | + <string name="data_restore_desc">If you have a backup from your previous Modern Apps OS device, you can restore it here.</string> |
| 218 | <string name="you_re_all_set_now">You\'re all set now!</string> |
| 219 | <string name="device_setup_done_desc">You\'re ready to start using your device</string> |
| 220 | <string name="profile_setup_done_desc">You\'re ready to start using your user profile</string> |