Modern Apps git

← MAOS.git

maos: drop Vanadium, fork Settings/SetupWizard, ship Google Sans Flex

Commit
4b22f87ef71054ace48b796932d6651ff714ddbd
Author
Vayun Mathur <[email protected]>
When
2026-09-06 19:59 UTC (3 months ago)
Parents
7747168

Diff

.gitattributes
diff --git a/.gitattributes b/.gitattributesindex 4befa4e..48161cb 100644--- a/.gitattributes+++ b/.gitattributes@@ -6,3 +6,6 @@ *.mk text eol=lf *.xml text eol=lf *.md text eol=lf++# The Google Sans Flex TTF must never be line-ending normalised by the rule above.+*.ttf -text
build-maos.sh
diff --git a/build-maos.sh b/build-maos.shindex 1037036..a7600e6 100755--- a/build-maos.sh+++ b/build-maos.sh@@ -252,7 +252,10 @@ apply_maos_patches() {     local patches="vendor/modern-apps/patches"     [[ -d "$patches" ]] || die "Missing $patches — is vendor/modern-apps synced?"     local spec repo patch-    for spec in "build/make:platform_build.patch" "vendor/adevtool:adevtool.patch"; do+    for spec in "build/make:platform_build.patch" "vendor/adevtool:adevtool.patch" \+                "frameworks/base:frameworks_base.patch" \+                "packages/apps/Settings:settings.patch" \+                "packages/apps/SetupWizard2:setupwizard2.patch"; do         repo="${spec%%:*}"; patch="$TREE/$patches/${spec##*:}"         [[ -f "$patch" ]] || die "Missing patch file: $patch"         [[ -d "$repo" ]]  || die "Missing repo for patch: $repo"
fonts/GoogleSansFlex.ttf
diff --git a/fonts/GoogleSansFlex.ttf b/fonts/GoogleSansFlex.ttfnew file mode 100755index 0000000..0ca1de3Binary files /dev/null and b/fonts/GoogleSansFlex.ttf differ
fonts/OFL.txt
diff --git a/fonts/OFL.txt b/fonts/OFL.txtnew file mode 100755index 0000000..38d9750--- /dev/null+++ b/fonts/OFL.txt@@ -0,0 +1,91 @@+This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+https://openfontlicense.org+++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION & CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.
modern_apps.mk
diff --git a/modern_apps.mk b/modern_apps.mkindex 2de9789..105e335 100644--- a/modern_apps.mk+++ b/modern_apps.mk@@ -121,6 +121,14 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \     vendor/modern-apps/sysconfig-modern-apps.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/sysconfig/sysconfig-modern-apps.xml +# 4c. Google Sans Flex as the system sans-serif. patches/frameworks_base.patch repoints the+#     sans-serif family in fonts.xml at this file; Minikin reads fonts.xml from /system/etc, so+#     this cannot be an RRO. The upstream filename contains commas, which the build dislikes,+#     so it is shipped renamed. The font is SIL Open Font Licensed - OFL.txt travels with it.+PRODUCT_COPY_FILES += \+    vendor/modern-apps/fonts/GoogleSansFlex.ttf:$(TARGET_COPY_OUT_SYSTEM)/fonts/GoogleSansFlex.ttf \+    vendor/modern-apps/fonts/OFL.txt:$(TARGET_COPY_OUT_SYSTEM)/fonts/OFL-GoogleSansFlex.txt+ # 5. MAOS branding (PRODUCT_* + ro.maos.* props). Kept separate for readability. $(call inherit-product-if-exists, vendor/modern-apps/maos_branding.mk) 
patches/frameworks_base.patch
diff --git a/patches/frameworks_base.patch b/patches/frameworks_base.patchnew file mode 100644index 0000000..b5ea606--- /dev/null+++ b/patches/frameworks_base.patch@@ -0,0 +1,205 @@+diff --git a/data/fonts/fonts.xml b/data/fonts/fonts.xml+index 8cbc3000c250..a453346df82e 100644+--- a/data/fonts/fonts.xml++++ b/data/fonts/fonts.xml+@@ -36,93 +36,84 @@+ <familyset version="23">+     <!-- first font is default -->+     <family name="sans-serif">+-        <font weight="100" style="normal">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="0" />++        <font weight="100" style="normal">GoogleSansFlex.ttf+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="100" />+         </font>+-        <font weight="200" style="normal">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="0" />++        <font weight="200" style="normal">GoogleSansFlex.ttf+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="200" />+         </font>+-        <font weight="300" style="normal">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="0" />++        <font weight="300" style="normal">GoogleSansFlex.ttf+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="300" />+         </font>+-        <font weight="400" style="normal">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="0" />++        <font weight="400" style="normal">GoogleSansFlex.ttf+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="400" />+         </font>+-        <font weight="500" style="normal">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="0" />++        <font weight="500" style="normal">GoogleSansFlex.ttf+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="500" />+         </font>+-        <font weight="600" style="normal">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="0" />++        <font weight="600" style="normal">GoogleSansFlex.ttf+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="600" />+         </font>+-        <font weight="700" style="normal">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="0" />++        <font weight="700" style="normal">GoogleSansFlex.ttf+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="700" />+         </font>+-        <font weight="800" style="normal">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="0" />++        <font weight="800" style="normal">GoogleSansFlex.ttf+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="800" />+         </font>+-        <font weight="900" style="normal">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="0" />++        <font weight="900" style="normal">GoogleSansFlex.ttf+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="900" />+         </font>+-        <font weight="100" style="italic">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="1" />++        <font weight="100" style="italic">GoogleSansFlex.ttf++          <axis tag="slnt" stylevalue="-10" />+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="100" />+         </font>+-        <font weight="200" style="italic">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="1" />++        <font weight="200" style="italic">GoogleSansFlex.ttf++          <axis tag="slnt" stylevalue="-10" />+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="200" />+         </font>+-        <font weight="300" style="italic">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="1" />++        <font weight="300" style="italic">GoogleSansFlex.ttf++          <axis tag="slnt" stylevalue="-10" />+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="300" />+         </font>+-        <font weight="400" style="italic">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="1" />++        <font weight="400" style="italic">GoogleSansFlex.ttf++          <axis tag="slnt" stylevalue="-10" />+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="400" />+         </font>+-        <font weight="500" style="italic">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="1" />++        <font weight="500" style="italic">GoogleSansFlex.ttf++          <axis tag="slnt" stylevalue="-10" />+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="500" />+         </font>+-        <font weight="600" style="italic">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="1" />++        <font weight="600" style="italic">GoogleSansFlex.ttf++          <axis tag="slnt" stylevalue="-10" />+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="600" />+         </font>+-        <font weight="700" style="italic">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="1" />++        <font weight="700" style="italic">GoogleSansFlex.ttf++          <axis tag="slnt" stylevalue="-10" />+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="700" />+         </font>+-        <font weight="800" style="italic">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="1" />++        <font weight="800" style="italic">GoogleSansFlex.ttf++          <axis tag="slnt" stylevalue="-10" />+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="800" />+         </font>+-        <font weight="900" style="italic">Roboto-Regular.ttf+-          <axis tag="ital" stylevalue="1" />++        <font weight="900" style="italic">GoogleSansFlex.ttf++          <axis tag="slnt" stylevalue="-10" />+           <axis tag="wdth" stylevalue="100" />+           <axis tag="wght" stylevalue="900" />+         </font>+@@ -383,6 +374,34 @@+     </family>+ +     <!-- fallback fonts -->++    <!--++        Google Sans Flex is Latin-focused, and the fallback families below start at Arabic:++        nothing else here draws Cyrillic, Greek, IPA or most of Latin Extended-B. Roboto++        stays first in the fallback chain so those scripts render in Roboto instead of++        tofu. It is no longer the default face, only the safety net behind it.++    -->++    <family>++        <font weight="400" style="normal">Roboto-Regular.ttf++          <axis tag="ital" stylevalue="0" />++          <axis tag="wdth" stylevalue="100" />++          <axis tag="wght" stylevalue="400" />++        </font>++        <font weight="700" style="normal">Roboto-Regular.ttf++          <axis tag="ital" stylevalue="0" />++          <axis tag="wdth" stylevalue="100" />++          <axis tag="wght" stylevalue="700" />++        </font>++        <font weight="400" style="italic">Roboto-Regular.ttf++          <axis tag="ital" stylevalue="1" />++          <axis tag="wdth" stylevalue="100" />++          <axis tag="wght" stylevalue="400" />++        </font>++        <font weight="700" style="italic">Roboto-Regular.ttf++          <axis tag="ital" stylevalue="1" />++          <axis tag="wdth" stylevalue="100" />++          <axis tag="wght" stylevalue="700" />++        </font>++    </family>+     <family lang="und-Arab" variant="elegant">+         <font weight="400" style="normal" postScriptName="NotoNaskhArabic">+             NotoNaskhArabic-Regular.ttf+diff --git a/services/core/java/com/android/server/location/LocationManagerService.java b/services/core/java/com/android/server/location/LocationManagerService.java+index e6fba2fadd1e..94a93f0e83f5 100644+--- a/services/core/java/com/android/server/location/LocationManagerService.java++++ b/services/core/java/com/android/server/location/LocationManagerService.java+@@ -23,8 +23,6 @@ import static android.app.compat.CompatChanges.isChangeEnabled;+ import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;+ import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;+ import static android.content.pm.PackageManager.PERMISSION_GRANTED;+-import static android.ext.settings.GeocoderSettings.GEOCODER_DISABLED;+-import static android.ext.settings.GeocoderSettings.GEOCODER_SETTING;+ import static android.location.LocationManager.BLOCK_PENDING_INTENT_SYSTEM_API_USAGE;+ import static android.location.LocationManager.FUSED_PROVIDER;+ import static android.location.LocationManager.GPS_HARDWARE_PROVIDER;+@@ -1485,7 +1483,12 @@ public class LocationManagerService extends ILocationManager.Stub implements+ +     @Override+     public boolean isGeocodeAvailable() {+-        return mGeocodeProvider != null && GEOCODER_SETTING.get(mContext) != GEOCODER_DISABLED++        // MAOS drops GrapheneOS's Settings.Global.geocoder gate. That setting chose between++        // GrapheneOS's and OpenStreetMap's geocoding servers, and MAOS pins the provider to++        // com.vayunmathur.networklocation, which answers from an on-device database instead -++        // so there is nothing left to choose and no UI that writes it. Leaving the gate in++        // would let a stored 0 from an older build disable geocoding with no way to undo it.++        return mGeocodeProvider != null+                 && mContext.checkCallingPermission(android.Manifest.permission.INTERNET)+                 == PERMISSION_GRANTED;+     }+@@ -1497,7 +1500,7 @@ public class LocationManagerService extends ILocationManager.Stub implements+                         mContext, request.getCallingPackage(), request.getCallingAttributionTag());+         Preconditions.checkArgument(identity.getUid() == request.getCallingUid());+ +-        if (mGeocodeProvider != null && GEOCODER_SETTING.get(mContext) != GEOCODER_DISABLED) {++        if (mGeocodeProvider != null) {+             boolean hasInternetPerm = mContext.checkCallingPermission(+                     android.Manifest.permission.INTERNET) == PERMISSION_GRANTED;+             if (hasInternetPerm) {+@@ -1525,7 +1528,7 @@ public class LocationManagerService extends ILocationManager.Stub implements+                         mContext, request.getCallingPackage(), request.getCallingAttributionTag());+         Preconditions.checkArgument(identity.getUid() == request.getCallingUid());+ +-        if (mGeocodeProvider != null && GEOCODER_SETTING.get(mContext) != GEOCODER_DISABLED) {++        if (mGeocodeProvider != null) {+             boolean hasInternetPerm = mContext.checkCallingPermission(+                     android.Manifest.permission.INTERNET) == PERMISSION_GRANTED;+             if (hasInternetPerm) {
patches/platform_build.patch
diff --git a/patches/platform_build.patch b/patches/platform_build.patchindex 2361c27..35834fa 100644--- a/patches/platform_build.patch+++ b/patches/platform_build.patch@@ -21,10 +21,10 @@ index c54d58ddf6..fe09fa2969 100644      preinstalled-packages-platform-aosp-product.xml \      ThemePicker \ diff --git a/target/product/handheld_product.mk b/target/product/handheld_product.mk-index 2a4602d43b..bd9a088fea 100644+index 2a4602d43b..7fdaddf2ee 100644 --- a/target/product/handheld_product.mk +++ b/target/product/handheld_product.mk-@@ -22,21 +22,25 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/media_product.mk)+@@ -22,25 +22,28 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/media_product.mk)    # /product packages  PRODUCT_PACKAGES += \@@ -63,6 +63,10 @@ index 2a4602d43b..bd9a088fea 100644      talkback \      ThemePicker \      ThemesStub \+-    TrichromeChrome \+     frameworks-base-overlays+ + PRODUCT_PACKAGES_DEBUG += \ diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk index 029bdd6ef3..b9729321b2 100644 --- a/target/product/handheld_system.mk
patches/settings.patch
diff --git a/patches/settings.patch b/patches/settings.patchnew file mode 100644index 0000000..10cd8f3--- /dev/null+++ b/patches/settings.patch@@ -0,0 +1,235 @@+diff --git a/res/values/strings_app_exploit_protection.xml b/res/values/strings_app_exploit_protection.xml+index 59348a1fc82..42111bf22a0 100644+--- a/res/values/strings_app_exploit_protection.xml++++ b/res/values/strings_app_exploit_protection.xml+@@ -34,7 +34,7 @@ This behavior can be disabled in the %2$s section.</string>+     <string name="aep_ir_exploit_protection_compat_mode">%1$s is enabled</string>+ +     <string name="aep_compat_mode_title">Exploit protection compatibility mode</string>+-    <string name="aep_compat_mode_summary">Improves compatibility by disabling some of the GrapheneOS exploit protections for this app</string>++    <string name="aep_compat_mode_summary">Improves compatibility by disabling some of the Modern Apps OS exploit protections for this app</string>+ +     <string name="aep_hmalloc">Hardened memory allocator</string>+     <string name="aep_hmalloc_footer">+diff --git a/res/values/strings_ext.xml b/res/values/strings_ext.xml+index 18de9b0a68d..11762c05793 100644+--- a/res/values/strings_ext.xml++++ b/res/values/strings_ext.xml+@@ -196,7 +196,7 @@ There are HTTP, HTTPS, DNS, DNS-over-TLS and DNS-over-HTTPS connectivity checks.+     <string name="duress_pwd_pref_title">Duress password</string>+     <string name="duress_pwd_description">"Duress password can be entered instead of the user password in any place that asks for it, such as the lock screen of any user and any user or work profile password prompt.+ +-Submitting the duress password will immediately make the storage contents permanently inaccessible, delete all eSIMs and then power off the device. GrapheneOS will remain installed.++Submitting the duress password will immediately make the storage contents permanently inaccessible, delete all eSIMs and then power off the device. Modern Apps OS will remain installed.+ + Duress PIN works the same way duress password does."</string>+     <string name="duress_pwd_enter_pin">Enter duress PIN</string>+@@ -226,7 +226,7 @@ Duress PIN works the same way duress password does."</string>+     <string name="alt_touchscreen_mode_confirm_button">Confirm</string>+ +     <string name="app_play_integrity_api">Play Integrity API</string>+-    <string name="app_play_integrity_top_intro">The Play Integrity API allows services to verify properties of a device through their app. Most services check for the device or strong integrity level which requires having the unmodified stock OS on a device licensing Google Mobile Services. Not every app using it will ban using GrapheneOS. GrapheneOS passes the basic integrity level and the miscellaneous checks for licensing, Play Protect, etc. work fine. We recommend leaving feedback for apps using it to ban GrapheneOS asking them to stop banning using a much more secure OS. Apps can use the standard Android hardware attestation API to verify the hardware, OS and app with GrapheneOS.</string>++    <string name="app_play_integrity_top_intro">The Play Integrity API allows services to verify properties of a device through their app. Most services check for the device or strong integrity level which requires having the unmodified stock OS on a device licensing Google Mobile Services. Not every app using it will ban using Modern Apps OS. Modern Apps OS passes the basic integrity level and the miscellaneous checks for licensing, Play Protect, etc. work fine. We recommend leaving feedback for apps using it to ban Modern Apps OS asking them to stop banning using a much more secure OS. Apps can use the standard Android hardware attestation API to verify the hardware, OS and app with Modern Apps OS.</string>+     <string name="app_play_integrity_contact_app_developer">Contact app developer</string>+     <string name="app_play_integrity_show_usage_notifications">Show usage notifications</string>+     <string name="app_play_integrity_block_usage_attempts">Block usage attempts</string>+@@ -238,6 +238,13 @@ Duress PIN works the same way duress password does."</string>+     <string name="app_play_integrity_see_all_apps">Show apps that used the Play Integrity API</string>+ +     <string name="network_location_title">Network location</string>++    <!-- Location services row covering both network location and geocoding, which Modern++         Apps OS serves from one always-on provider rather than two server pickers. -->++    <string name="network_location_geocoding_title">Network location &amp; geocoding</string>++    <!-- Summary of the row above, when the offline databases have been downloaded. -->++    <string name="network_location_geocoding_ready">Works offline</string>++    <!-- Summary of the row above, when the offline databases have not been downloaded. -->++    <string name="network_location_geocoding_setup_required">Setup required</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, Wi-Fi networks and cell towers are used.+ +diff --git a/res/xml/location_services.xml b/res/xml/location_services.xml+index e33f3a5eace..32d14f99642 100644+--- a/res/xml/location_services.xml++++ b/res/xml/location_services.xml+@@ -37,13 +37,7 @@+         <com.android.settingslib.RestrictedPreference+             android:order="1002"+             android:key="location_services_network_location"+-            android:title="@string/network_location_title"++            android:title="@string/network_location_geocoding_title"+             settings:controller="com.android.settings.location.LocationServicesNetworkLocationPreferenceController"/>+ +-        <com.android.settingslib.RestrictedPreference+-            android:key="location_services_geocoder"+-            android:order="1003"+-            android:title="@string/geocoder_title"+-            settings:controller="com.android.settings.location.LocationServicesGeocoderPreferenceController" />+-+ </PreferenceScreen>+diff --git a/src/com/android/settings/location/LocationServicesGeocoderPreferenceController.kt b/src/com/android/settings/location/LocationServicesGeocoderPreferenceController.kt+deleted file mode 100644+index 2951671fd99..00000000000+--- a/src/com/android/settings/location/LocationServicesGeocoderPreferenceController.kt++++ /dev/null+@@ -1,34 +0,0 @@+-package com.android.settings.location+-+-import android.content.Context+-import android.ext.settings.GeocoderSettings+-import androidx.preference.PreferenceScreen+-import com.android.settings.R+-import com.android.settings.ext.IntSettingPrefController+-import com.android.settings.ext.RadioButtonPickerFragment2+-+-/**+- * Preference controller for Geocoder in Location Services.+- */+-class LocationServicesGeocoderPreferenceController(ctx: Context, key: String?) :+-    IntSettingPrefController(ctx, key, GeocoderSettings.GEOCODER_SETTING) {+-+-    override fun addPrefsAfterList(fragment: RadioButtonPickerFragment2, screen: PreferenceScreen) {+-        addFooterPreference(screen, R.string.geocoder_footer)+-    }+-+-    override fun getEntries(entries: Entries) {+-        entries.add(+-            R.string.geocoder_enabled_grapheneos_server,+-            GeocoderSettings.GEOCODER_SERVER_GRAPHENEOS+-        )+-        entries.add(+-            R.string.geocoder_enabled_openstreetmap_server,+-            GeocoderSettings.GEOCODER_SERVER_OPENSTREETMAP+-        )+-        entries.add(+-            R.string.geocoder_disabled,+-            GeocoderSettings.GEOCODER_DISABLED+-        )+-    }+-}+diff --git a/src/com/android/settings/location/LocationServicesNetworkLocationPreferenceController.kt b/src/com/android/settings/location/LocationServicesNetworkLocationPreferenceController.kt+index 4b34ea66db5..8c554b97fb1 100644+--- a/src/com/android/settings/location/LocationServicesNetworkLocationPreferenceController.kt++++ b/src/com/android/settings/location/LocationServicesNetworkLocationPreferenceController.kt+@@ -1,38 +1,97 @@++/*++ * Copyright (C) 2026 Modern Apps OS++ *++ * 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.ActivityNotFoundException++import android.content.ComponentName+ import android.content.Context+-import android.ext.settings.NetworkLocationSettings+-import androidx.preference.PreferenceScreen++import android.content.Intent++import android.net.Uri++import android.os.UserManager++import android.util.Log++import androidx.preference.Preference+ import com.android.settings.R+-import com.android.settings.ext.IntSettingPrefController+-import com.android.settings.ext.RadioButtonPickerFragment2++import com.android.settings.core.BasePreferenceController++import com.android.settingslib.RestrictedPreference+ + /**+- * Preference controller for Network location in Location Services.++ * The single Location services row for network location and geocoding.++ *++ * This replaces GrapheneOS's separate "Network location" and "Geocoder" pickers. Both were++ * server choices for GrapheneOS's own NetworkLocation app, which Modern Apps OS does not ship:++ * the provider is pinned to [PROVIDER_PACKAGE], which is always on and answers from on-device++ * databases, so there is nothing left to pick. What the user can still act on is whether those++ * databases have been downloaded, which is what this row reports and links to.+  */+ class LocationServicesNetworkLocationPreferenceController(ctx: Context, key: String?) :+-    IntSettingPrefController(ctx, key, NetworkLocationSettings.NETWORK_LOCATION_SETTING) {++    BasePreferenceController(ctx, key) {++++    override fun getAvailabilityStatus(): Int = AVAILABLE++++    override fun updateState(preference: Preference) {++        (preference as RestrictedPreference)++            .checkRestrictionAndSetDisabled(UserManager.DISALLOW_CONFIG_LOCATION)++        refreshSummary(preference)++    }++++    override fun getSummary(): CharSequence = mContext.getString(++        if (databasesPresent()) {++            R.string.network_location_geocoding_ready++        } else {++            R.string.network_location_geocoding_setup_required++        }++    )+ +-    override fun addPrefsAfterList(fragment: RadioButtonPickerFragment2, screen: PreferenceScreen) {+-        addFooterPreference(screen, R.string.network_location_footer)++    override fun handlePreferenceTreeClick(preference: Preference): Boolean {++        if (preference.key != preferenceKey) return false++        val intent = Intent(Intent.ACTION_MAIN)++            .setComponent(ComponentName(PROVIDER_PACKAGE, PROVIDER_ACTIVITY))++            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)++        try {++            mContext.startActivity(intent)++        } catch (e: ActivityNotFoundException) {++            Log.e(TAG, "$PROVIDER_PACKAGE is not installed", e)++        }++        return true+     }+ +-    override fun getEntries(entries: Entries) {+-        entries.add(+-            R.string.network_location_enabled_grapheneos_apple_proxy,+-            NetworkLocationSettings.NETWORK_LOCATION_GRAPHENEOS_APPLE_PROXY+-        )+-        entries.add(+-            R.string.network_location_enabled_apple,+-            NetworkLocationSettings.NETWORK_LOCATION_APPLE+-        )+-        entries.add(+-            R.string.network_location_enabled_apple_china,+-            NetworkLocationSettings.NETWORK_LOCATION_APPLE_CHINA+-        )+-        entries.add(+-            R.string.network_location_disabled,+-            NetworkLocationSettings.NETWORK_LOCATION_DISABLED+-        )++    /**++     * Whether the provider reports every offline database on disk.++     *++     * Absent, unreadable or malformed means "not yet", which is the same thing the user has to++     * act on — so a failure here degrades to "Setup required" rather than throwing in the++     * middle of building the Location screen.++     */++    private fun databasesPresent(): Boolean = try {++        mContext.contentResolver.query(STATUS_URI, null, null, null, null)?.use { cursor ->++            cursor.moveToFirst() && cursor.getInt(0) == 1++        } ?: false++    } catch (e: Exception) {++        Log.w(TAG, "could not read $STATUS_URI", e)++        false++    }++++    private companion object {++        const val TAG = "LocationServicesNetworkLocation"++++        const val PROVIDER_PACKAGE = "com.vayunmathur.networklocation"++        const val PROVIDER_ACTIVITY = "com.vayunmathur.networklocation.MainActivity"++++        /** Mirrors `DatabaseStatusContract` in the networklocation app. */++        val STATUS_URI: Uri =++            Uri.parse("content://com.vayunmathur.networklocation.status/databases")+     }+ }
patches/setupwizard2.patch
diff --git a/patches/setupwizard2.patch b/patches/setupwizard2.patchnew file mode 100644index 0000000..5c25cf0--- /dev/null+++ b/patches/setupwizard2.patch@@ -0,0 +1,207 @@+diff --git a/java/app/grapheneos/setupwizard/action/LocationActions.kt b/java/app/grapheneos/setupwizard/action/LocationActions.kt+index 7bf31bb..ebbaeaf 100644+--- a/java/app/grapheneos/setupwizard/action/LocationActions.kt++++ b/java/app/grapheneos/setupwizard/action/LocationActions.kt+@@ -1,11 +1,5 @@+ package app.grapheneos.setupwizard.action+ +-import android.ext.settings.GeocoderSettings.GEOCODER_DISABLED+-import android.ext.settings.GeocoderSettings.GEOCODER_SERVER_GRAPHENEOS+-import android.ext.settings.GeocoderSettings.GEOCODER_SETTING+-import android.ext.settings.NetworkLocationSettings.NETWORK_LOCATION_DISABLED+-import android.ext.settings.NetworkLocationSettings.NETWORK_LOCATION_GRAPHENEOS_APPLE_PROXY+-import android.ext.settings.NetworkLocationSettings.NETWORK_LOCATION_SETTING+ import android.location.LocationManager+ import android.net.wifi.WifiManager+ import android.util.Log+@@ -25,54 +19,22 @@ object LocationActions {+         refreshCurrentState()+     }+ +-    fun setNetworkLocationEnabled(enabled: Boolean) {+-        Log.d(TAG, "setNetworkLocationEnabled: $enabled")+-        NETWORK_LOCATION_SETTING.put(+-            appContext,+-            if (enabled) NETWORK_LOCATION_GRAPHENEOS_APPLE_PROXY else NETWORK_LOCATION_DISABLED+-        )+-        refreshCurrentState()+-    }+-+     fun setWifiScanningAlwaysAvailableEnabled(enabled: Boolean) {+         Log.d(TAG, "setWifiScanningAlwaysAvailableEnabled: $enabled")+         getWifiManager().isScanAlwaysAvailable = enabled+         refreshCurrentState()+     }+ +-    fun setGeocoderEnabled(enabled: Boolean) {+-        Log.d(TAG, "setGeocoderEnabled: $enabled")+-        GEOCODER_SETTING.put(+-            appContext,+-            if (enabled) GEOCODER_SERVER_GRAPHENEOS else GEOCODER_DISABLED+-        )+-        refreshCurrentState()+-    }+-+     private fun refreshCurrentState() {+         LocationData.locationEnabled.value = getLocationManager().isLocationEnabled+         Log.d(TAG, "refreshCurrentState: locationEnabled = ${LocationData.locationEnabled.value}")+ +-        LocationData.networkLocationEnabled.value =+-            NETWORK_LOCATION_SETTING.get(appContext) != NETWORK_LOCATION_DISABLED+-        Log.d(+-            TAG,+-            "refreshCurrentState: networkLocationEnabled = ${LocationData.networkLocationEnabled.value}"+-        )+-+         @Suppress("DEPRECATION") // WifiManager.isScanAlwaysAvailable is not deprecated for platform apps+         LocationData.wifiScanningAlwaysAvailableEnabled.value = getWifiManager().isScanAlwaysAvailable+         Log.d(+             TAG,+             "refreshCurrentState: wifiScanningAlwaysAvailableEnabled = ${LocationData.wifiScanningAlwaysAvailableEnabled.value}"+         )+-+-        LocationData.geocoderEnabled.value =+-            GEOCODER_SETTING.get(appContext) != GEOCODER_DISABLED+-        Log.d(+-            TAG,+-            "refreshCurrentState: geocoderEnabled = ${LocationData.geocoderEnabled.value}"+-        )+     }+ +     private fun getLocationManager(): LocationManager {+diff --git a/java/app/grapheneos/setupwizard/data/LocationData.kt b/java/app/grapheneos/setupwizard/data/LocationData.kt+index 5691c54..ff1b3fd 100644+--- a/java/app/grapheneos/setupwizard/data/LocationData.kt++++ b/java/app/grapheneos/setupwizard/data/LocationData.kt+@@ -6,9 +6,7 @@ import app.grapheneos.setupwizard.action.LocationActions+ + object LocationData : ViewModel() {+     val locationEnabled = MutableLiveData<Boolean>()+-    val networkLocationEnabled = MutableLiveData<Boolean>()+     val wifiScanningAlwaysAvailableEnabled = MutableLiveData<Boolean>()+-    val geocoderEnabled = MutableLiveData<Boolean>()+ +     init {+         LocationActions+diff --git a/java/app/grapheneos/setupwizard/view/activity/LocationActivity.kt b/java/app/grapheneos/setupwizard/view/activity/LocationActivity.kt+index 3b660f5..6bc29ef 100644+--- a/java/app/grapheneos/setupwizard/view/activity/LocationActivity.kt++++ b/java/app/grapheneos/setupwizard/view/activity/LocationActivity.kt+@@ -17,11 +17,7 @@ class LocationActivity : SetupWizardActivity(+ ) {+     private lateinit var locationEnabled: SwitchItem+     // only initialized when in primary user+-    private lateinit var networkLocationEnabled: SwitchItem+-    // only initialized when in primary user+     private lateinit var wifiScanningAlwaysAvailableEnabled: SwitchItem+-    // only initialized when in primary user+-    private lateinit var geocoderEnabled: SwitchItem+ +     override fun bindViews() {+         val layout = requireViewById<GlifRecyclerLayout>(R.id.glif_layout)+@@ -35,18 +31,11 @@ class LocationActivity : SetupWizardActivity(+         itemGroup.addChild(locationEnabled)+         LocationData.locationEnabled.observe(this) { locationEnabled.isChecked = it }+ +-        // Network location, Wi-Fi scanning, and Geocoder are global settings.++        // Wi-Fi scanning is a global setting.++        //++        // Network location and geocoding are always on in Modern Apps OS - one pinned,++        // on-device provider serves both - so there is nothing here for the user to choose.+         if (SetupWizard.isPrimaryUser) {+-            networkLocationEnabled = SwitchItem().apply {+-                id = View.generateViewId()+-                title = getString(R.string.network_location_enabled_title)+-                summary = getString(R.string.network_location_enabled_desc)+-            }+-            itemGroup.addChild(networkLocationEnabled)+-            LocationData.networkLocationEnabled.observe(this) {+-                networkLocationEnabled.isChecked = it+-            }+-+             wifiScanningAlwaysAvailableEnabled = SwitchItem().apply {+                 id = View.generateViewId()+                 title = getString(R.string.wifi_scanning_always_available_enabled_title)+@@ -56,16 +45,6 @@ class LocationActivity : SetupWizardActivity(+             LocationData.wifiScanningAlwaysAvailableEnabled.observe(this) {+                 wifiScanningAlwaysAvailableEnabled.isChecked = it+             }+-+-            geocoderEnabled = SwitchItem().apply {+-                id = View.generateViewId()+-                title = getString(R.string.geocoder_enabled_title)+-                summary = getString(R.string.geocoder_enabled_desc)+-            }+-            itemGroup.addChild(geocoderEnabled)+-            LocationData.geocoderEnabled.observe(this) {+-                geocoderEnabled.isChecked = it+-            }+         }+ +         val adapter = RecyclerItemAdapter(itemGroup)+@@ -82,32 +61,18 @@ class LocationActivity : SetupWizardActivity(+     override fun setupActions() {+         locationEnabled.setOnCheckedChangeListener { _, isChecked ->+             if (SetupWizard.isPrimaryUser) {+-                val areDependentsEnabled = isChecked+-                networkLocationEnabled.isEnabled = areDependentsEnabled+-                wifiScanningAlwaysAvailableEnabled.isEnabled = areDependentsEnabled++                wifiScanningAlwaysAvailableEnabled.isEnabled = isChecked+             }+             LocationActions.setLocationEnabled(isChecked)+         }+ +-        // Network location, Wi-Fi scanning, and Geocoder are global settings.++        // Wi-Fi scanning is a global setting.+         if (SetupWizard.isPrimaryUser) {+-            networkLocationEnabled.run {+-                setOnCheckedChangeListener { _, isChecked ->+-                    LocationActions.setNetworkLocationEnabled(isChecked)+-                }+-            }+-+             wifiScanningAlwaysAvailableEnabled.run {+                 setOnCheckedChangeListener { _, isChecked ->+                     LocationActions.setWifiScanningAlwaysAvailableEnabled(isChecked)+                 }+             }+-+-            geocoderEnabled.run {+-                setOnCheckedChangeListener { _, isChecked ->+-                    LocationActions.setGeocoderEnabled(isChecked)+-                }+-            }+         }+ +         primaryButton.setOnClickListener { SetupWizard.next(this) }+diff --git a/res/values/strings.xml b/res/values/strings.xml+index 1aaad57..7ab5470 100644+--- a/res/values/strings.xml++++ b/res/values/strings.xml+@@ -2,8 +2,8 @@+     <string name="app_name">SetupWizard</string>+     <string name="next">Next</string>+     <string name="skip">Skip</string>+-    <string name="welcome_to_grapheneos">Welcome to GrapheneOS</string>+-    <string name="grapheneos_icon">GrapheneOS icon</string>++    <string name="welcome_to_grapheneos">Welcome to Modern Apps OS</string>++    <string name="grapheneos_icon">Modern Apps OS icon</string>+     <string name="grapheneos_desc">Privacy and security, crafted for your mobile device, usable by everyone.</string>+     <string name="lets_setup_your_device">Let\'s set up your device in a few steps.</string>+     <string name="lets_setup_your_profile">Let\'s set up your user profile in a few steps.</string>+@@ -17,14 +17,10 @@+     <string name="location_services">Location services</string>+     <string name="location_access_title">Use location</string>+     <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>+-    <string name="network_location_enabled_title">Network location</string>+-    <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>+     <string name="wifi_scanning_always_available_enabled_title">Wi-Fi scanning always available</string>+     <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>+-    <string name="geocoder_enabled_title">Geocoder</string>+-    <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>+     <string name="restore_apps_and_data"><![CDATA[Restore apps & data]]></string>+-    <string name="data_restore_desc">If you have a backup from your previous GrapheneOS device, you can restore it here.</string>++    <string name="data_restore_desc">If you have a backup from your previous Modern Apps OS device, you can restore it here.</string>+     <string name="you_re_all_set_now">You\'re all set now!</string>+     <string name="device_setup_done_desc">You\'re ready to start using your device</string>+     <string name="profile_setup_done_desc">You\'re ready to start using your user profile</string>