Modern Apps git

← MAOS.git

maos: regenerate stale settings and frameworks patches from tree

Commit
19bef4bad456834e9e3d4eb5c717a2db299280ba
Author
Vayun Mathur <[email protected]>
When
2026-09-30 01:45 UTC (2 months ago)
Parents
6e2ed74

Diff

patches/frameworks_base.patch
diff --git a/patches/frameworks_base.patch b/patches/frameworks_base.patchindex 32ca99a..ba10378 100644--- a/patches/frameworks_base.patch+++ b/patches/frameworks_base.patch@@ -244,7 +244,7 @@ index b6fa05f754ac..182b9cbdced3 100644      }  } diff --git a/core/res/res/values/config_ext.xml b/core/res/res/values/config_ext.xml-index 9f66d22bca1a..6dd6906f4e34 100644+index 9f66d22bca1a..1775a9e65919 100644 --- a/core/res/res/values/config_ext.xml +++ b/core/res/res/values/config_ext.xml @@ -38,7 +38,13 @@@@ -262,6 +262,21 @@ index 9f66d22bca1a..6dd6906f4e34 100644      <java-symbol type="string" name="config_first_party_app_source_package_name" />        <!-- Certificate digests for trusted apps that will be allowed to obtain the knownSigner+@@ -51,4 +57,14 @@+     </string-array>+     <java-symbol type="array" name="read_additional_security_state_known_signers" />+ ++    <!-- Companion-device app-streaming role default holder -> Modern Apps Cast.++         COMPANION_DEVICE_APP_STREAMING has no `defaultHolders` in AOSP (the role is++         normally filled from server state), so without this pin and the++         `defaultHolders` attribute added by patches/permission_roles.patch the role++         stays empty and Cast loses the `virtual_device` set it previously drew from++         SYSTEM_AUTOMOTIVE_PROJECTION (see the automotive pin in MaosFrameworkResRRO).++         Empty default keeps AOSP behavior on devices without the overlay. -->++    <string name="config_companionDeviceAppStreaming" translatable="false"></string>++    <java-symbol type="string" name="config_companionDeviceAppStreaming" />+++ </resources> diff --git a/data/fonts/fallback_order.json b/data/fonts/fallback_order.json index 2fc3f3e3fc5b..3cac8625cdb5 100644 --- a/data/fonts/fallback_order.json@@ -503,7 +518,7 @@ index ad113a2513f3..be7aa912a7a2 100644            mLogicalDisplays.put(displayId, display); diff --git a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java-index 0d4ae75b428f..55006db8a39b 100644+index 0d4ae75b428f..c41786777ce3 100644 --- a/services/core/java/com/android/server/display/VirtualDisplayAdapter.java +++ b/services/core/java/com/android/server/display/VirtualDisplayAdapter.java @@ -20,6 +20,7 @@ import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_ALLOW@@ -514,8 +529,11 @@ index 0d4ae75b428f..55006db8a39b 100644  import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL;  import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP;  import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP;-@@ -69,6 +70,8 @@ import com.android.server.display.feature.flags.Flags;+@@ -67,8 +68,11 @@ import com.android.server.display.brightness.BrightnessUtils;+ import com.android.server.display.feature.DisplayManagerFlags;+ import com.android.server.display.feature.flags.Flags;  import com.android.server.display.utils.DebugTransactionDetails;++import com.android.settingslib.display.DisplayDensityConfiguration;    import java.io.PrintWriter; +import java.util.ArrayList;@@ -523,7 +541,23 @@ index 0d4ae75b428f..55006db8a39b 100644  import java.util.concurrent.atomic.AtomicInteger;    /**-@@ -366,6 +369,15 @@ public class VirtualDisplayAdapter extends DisplayAdapter {+@@ -338,6 +342,15 @@ public class VirtualDisplayAdapter extends DisplayAdapter {+ +         private static final float REFRESH_RATE = 60.0f;+ ++        /**++         * How far apart two refresh rates may be and still name the same mode.++         *++         * A rate reaches us having been through a float on the wire and a panel that++         * reports 59.94006, so exact equality is not something to depend on. Small enough++         * that 59.94 and 60 - separate modes on a real television - never match.++         */++        private static final float MODE_RATE_TOLERANCE = 0.2f;+++         private final IBinder mAppToken;+         private final int mOwnerUid;+         final String mOwnerPackageName;+@@ -366,6 +379,15 @@ public class VirtualDisplayAdapter extends DisplayAdapter {          private float mCurrentBrightness;          private final IBrightnessListener mBrightnessListener;          private final boolean mHasUniqueId;@@ -539,27 +573,33 @@ index 0d4ae75b428f..55006db8a39b 100644            public VirtualDisplayDevice(IBinder displayToken, IBinder appToken,                  int ownerUid, String ownerPackageName, Surface surface, int flags,-@@ -386,7 +398,13 @@ public class VirtualDisplayAdapter extends DisplayAdapter {+@@ -386,7 +408,19 @@ public class VirtualDisplayAdapter extends DisplayAdapter {              mDimBrightness = virtualDisplayConfig.getDimBrightness();              mCurrentBrightness = PowerManager.BRIGHTNESS_INVALID;              mBrightnessListener = virtualDisplayConfig.getBrightnessListener(); -            mMode = createMode(mWidth, mHeight, getRefreshRate()); +            for (Display.Mode declared : virtualDisplayConfig.getSupportedModes()) { +                if (declared.getPhysicalWidth() > 0 && declared.getPhysicalHeight() > 0) {++                    // The owner's own rate for this mode, because a sink can offer its largest++                    // mode more slowly than its smaller ones and the picker shows the rate next++                    // to the size. Falls back to the display's rate for an owner that declared++                    // sizes but no rates.++                    float refreshRate = declared.getRefreshRate() > 0++                            ? declared.getRefreshRate() : getRefreshRate(); +                    mDeclaredModes.add(createMode(declared.getPhysicalWidth(),-+                            declared.getPhysicalHeight(), getRefreshRate()));++                            declared.getPhysicalHeight(), refreshRate)); +                } +            }-+            mMode = modeForLocked(mWidth, mHeight);++            mMode = modeForLocked(mWidth, mHeight, getRefreshRate());              mSurface = surface;              mFlags = flags;              mCallback = callback;-@@ -580,13 +598,70 @@ public class VirtualDisplayAdapter extends DisplayAdapter {+@@ -580,13 +614,126 @@ public class VirtualDisplayAdapter extends DisplayAdapter {                  sendTraversalRequestLocked();                  mWidth = width;                  mHeight = height; -                mMode = createMode(width, height, getRefreshRate());-+                mMode = modeForLocked(width, height);++                mMode = modeForLocked(width, height, mMode.getRefreshRate());                  mDensityDpi = densityDpi;                  mInfo = null;                  mPendingChanges |= PENDING_RESIZE;@@ -567,20 +607,58 @@ index 0d4ae75b428f..55006db8a39b 100644          }   +        /**-+         * The declared mode of this size, or a fresh one when the size was never declared.++         * The declared mode of this size and rate, or a fresh one when it was never declared. +         * +         * Keeps ids stable across a resize: a display that was created from a declared list must +         * keep reporting those same ids in {@code supportedModes}, or the current mode stops +         * matching anything in the list Settings is showing.++         *++         * The rate is part of the question because a sink offers the same resolution several++         * times over - a television lists 3840x2160 at eight rates - so matching on size alone++         * returns whichever of them happens to come first and silently discards the choice.++         * The nearest rate wins rather than an exact match, because the caller's rate has++         * usually been round-tripped through a float and 59.94006 is 59.94. +         */-+        private Display.Mode modeForLocked(int width, int height) {++        private Display.Mode modeForLocked(int width, int height, float refreshRate) {++            Display.Mode best = null; +            for (Display.Mode declared : mDeclaredModes) {-+                if (declared.getPhysicalWidth() == width-+                        && declared.getPhysicalHeight() == height) {-+                    return declared;++                if (declared.getPhysicalWidth() != width++                        || declared.getPhysicalHeight() != height) {++                    continue; +                }++                if (best == null++                        || Math.abs(declared.getRefreshRate() - refreshRate)++                                < Math.abs(best.getRefreshRate() - refreshRate)) {++                    best = declared;++                }++            }++            return best != null ? best : createMode(width, height, refreshRate);++        }++++        /**++         * Move to a mode the owner declared, size, rate and all.++         *++         * Separate from {@link #resizeLocked} because a rate-only change - 1920x1080 at 60 to++         * 1920x1080 at 24 - is not a resize, and {@code resizeLocked} returns early when the++         * size and density are unchanged. That early return is correct for what it is for, and++         * would have made half of every declared mode list unreachable.++         */++        private void applyDeclaredModeLocked(Display.Mode mode) {++            final int width = mode.getPhysicalWidth();++            final int height = mode.getPhysicalHeight();++            final int densityDpi = densityForLocked(mode);++            if (mWidth == width && mHeight == height && mDensityDpi == densityDpi++                    && mMode.getModeId() == mode.getModeId()) {++                return; +            }-+            return createMode(width, height, getRefreshRate());++            sendDisplayDeviceEventLocked(this, DISPLAY_DEVICE_EVENT_CHANGED);++            sendTraversalRequestLocked();++            mWidth = width;++            mHeight = height;++            mMode = mode;++            mDensityDpi = densityDpi;++            mInfo = null;++            mPendingChanges |= PENDING_RESIZE; +        } + +        @Override@@ -592,18 +670,15 @@ index 0d4ae75b428f..55006db8a39b 100644 +            } +            if (mode == null) { +                // Back to the default, which is the largest thing the owner said the sink can do.-+                Display.Mode largest = defaultModeLocked();-+                resizeLocked(largest.getPhysicalWidth(), largest.getPhysicalHeight(), mDensityDpi);++                applyDeclaredModeLocked(defaultModeLocked()); +                return true; +            } +            for (Display.Mode declared : mDeclaredModes) { +                if (declared.getPhysicalWidth() == mode.getPhysicalWidth()-+                        && declared.getPhysicalHeight() == mode.getPhysicalHeight()) {-+                    // Density is deliberately left alone. It was chosen for the sink rather than-+                    // derived from the frame, and rescaling it here would resize every element on-+                    // screen as a side effect of a resolution change.-+                    resizeLocked(declared.getPhysicalWidth(), declared.getPhysicalHeight(),-+                            mDensityDpi);++                        && declared.getPhysicalHeight() == mode.getPhysicalHeight()++                        && Math.abs(declared.getRefreshRate() - mode.getRefreshRate())++                                <= MODE_RATE_TOLERANCE) {++                    applyDeclaredModeLocked(declared); +                    return true; +                } +            }@@ -611,12 +686,33 @@ index 0d4ae75b428f..55006db8a39b 100644 +            return false; +        } +++        /**++         * The density to compose a declared mode at.++         *++         * A resolution the owner declared describes a real external sink, so it gets the density++         * the platform gives any other external display of that size:++         * {@code calculateBaseDensity} with no physical dimensions, which is the same arithmetic++         * the owner used to pick the density the display was created at. Deriving it here rather++         * than carrying {@code mDensityDpi} across the switch is what keeps the dp workspace the++         * same size at every resolution - otherwise dropping from 4K to 1080p would halve it and++         * every element on screen would double.++         */++        private int densityForLocked(Display.Mode mode) {++            return DisplayDensityConfiguration.calculateBaseDensity(0f, 0f,++                    mode.getPhysicalWidth(), mode.getPhysicalHeight());++        }++ +        /** The largest declared mode, which is what a display with a sink should default to. */ +        private Display.Mode defaultModeLocked() { +            Display.Mode best = mDeclaredModes.get(0); +            for (Display.Mode candidate : mDeclaredModes) { +                long area = (long) candidate.getPhysicalWidth() * candidate.getPhysicalHeight();-+                if (area > (long) best.getPhysicalWidth() * best.getPhysicalHeight()) {++                long bestArea = (long) best.getPhysicalWidth() * best.getPhysicalHeight();++                // Fastest among the largest, since a resolution is declared several times++                // over at different rates and the default should be the best of them.++                if (area > bestArea++                        || (area == bestArea++                                && candidate.getRefreshRate() > best.getRefreshRate())) { +                    best = candidate; +                } +            }@@ -626,7 +722,7 @@ index 0d4ae75b428f..55006db8a39b 100644          public void stopLocked() {              Slog.d(TAG, "Virtual Display: stopping device " + mName);              setSurfaceLocked(null);-@@ -602,6 +677,7 @@ public class VirtualDisplayAdapter extends DisplayAdapter {+@@ -602,6 +749,7 @@ public class VirtualDisplayAdapter extends DisplayAdapter {              pw.println("mDisplayIdToMirror=" + mDisplayIdToMirror);              pw.println("mWindowManagerMirroring=" + mIsWindowManagerMirroring);              pw.println("mRequestedRefreshRate=" + mRequestedRefreshRate);@@ -634,7 +730,7 @@ index 0d4ae75b428f..55006db8a39b 100644          }            @Override-@@ -614,8 +690,11 @@ public class VirtualDisplayAdapter extends DisplayAdapter {+@@ -614,8 +762,11 @@ public class VirtualDisplayAdapter extends DisplayAdapter {                  mInfo.height = mHeight;                  mInfo.modeId = mMode.getModeId();                  mInfo.renderFrameRate = mMode.getRefreshRate();@@ -648,7 +744,7 @@ index 0d4ae75b428f..55006db8a39b 100644                  mInfo.densityDpi = mDensityDpi;                  mInfo.xDpi = mDensityDpi;                  mInfo.yDpi = mDensityDpi;-@@ -631,6 +710,12 @@ public class VirtualDisplayAdapter extends DisplayAdapter {+@@ -631,6 +782,12 @@ public class VirtualDisplayAdapter extends DisplayAdapter {                  if ((mFlags & VIRTUAL_DISPLAY_FLAG_ALLOWS_CONTENT_MODE_SWITCH) != 0) {                      mInfo.flags |= DisplayDeviceInfo.FLAG_ALLOWS_CONTENT_MODE_SWITCH;                  }@@ -706,20 +802,3 @@ index e6fba2fadd1e..94a93f0e83f5 100644              boolean hasInternetPerm = mContext.checkCallingPermission(                      android.Manifest.permission.INTERNET) == PERMISSION_GRANTED;              if (hasInternetPerm) {-diff --git a/packages/SettingsLib/EmergencyNumber/src/com/android/settingslib/emergencynumber/EmergencyNumberUtils.java b/packages/SettingsLib/EmergencyNumber/src/com/android/settingslib/emergencynumber/EmergencyNumberUtils.java---- a/packages/SettingsLib/EmergencyNumber/src/com/android/settingslib/emergencynumber/EmergencyNumberUtils.java-+++ b/packages/SettingsLib/EmergencyNumber/src/com/android/settingslib/emergencynumber/EmergencyNumberUtils.java-@@ -46,9 +46,12 @@- public class EmergencyNumberUtils {-     private static final String TAG = "EmergencyNumberUtils";- -+    // MAOS: Modern Apps Emergency (com.vayunmathur.emergency) owns the-+    // gesture provider, so SettingsLib must call its authority. The-+    // call() method names are unchanged.-     public static final Uri EMERGENCY_NUMBER_OVERRIDE_AUTHORITY = new Uri.Builder().scheme(-             ContentResolver.SCHEME_CONTENT)--            .authority("com.android.emergency.gesture")-+            .authority("com.vayunmathur.emergency.gesture")-             .build();-     public static final String METHOD_NAME_GET_EMERGENCY_NUMBER_OVERRIDE =-             "GET_EMERGENCY_NUMBER_OVERRIDE";
patches/settings.patch
diff --git a/patches/settings.patch b/patches/settings.patchindex 619d015..26cea00 100644--- a/patches/settings.patch+++ b/patches/settings.patch@@ -11,6 +11,70 @@ index d4e5e0e8670..6ea7e2e8713 100644      <uses-permission android:name="android.permission.CONTROL_SIM_AUTO_PIN_MANAGEMENT" />      <uses-permission android:name="android.permission.MANAGE_COMPUTER_CONTROL_CONSENT" />  +diff --git a/res/drawable/ic_homepage_screen_time.xml b/res/drawable/ic_homepage_screen_time.xml+new file mode 100644+index 00000000000..6c2eb9eee03+--- /dev/null++++ b/res/drawable/ic_homepage_screen_time.xml+@@ -0,0 +1,33 @@++<?xml version="1.0" encoding="utf-8"?>++<!--++  Copyright (C) 2026 The Android Open Source 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.++  -->++++<layer-list xmlns:android="http://schemas.android.com/apk/res/android">++++    <item>++        <com.android.settingslib.widget.AdaptiveIconShapeDrawable++            android:width="@dimen/dashboard_tile_image_size"++            android:height="@dimen/dashboard_tile_image_size"++            android:color="@color/homepage_supervision_background" />++    </item>++++    <item++        android:width="@dimen/dashboard_tile_foreground_image_size"++        android:height="@dimen/dashboard_tile_foreground_image_size"++        android:start="@dimen/dashboard_tile_foreground_image_inset"++        android:top="@dimen/dashboard_tile_foreground_image_inset"++        android:drawable="@drawable/ic_settings_screen_time_expressive" />++</layer-list>+diff --git a/res/drawable/ic_settings_screen_time_expressive.xml b/res/drawable/ic_settings_screen_time_expressive.xml+new file mode 100644+index 00000000000..8103a8b868e+--- /dev/null++++ b/res/drawable/ic_settings_screen_time_expressive.xml+@@ -0,0 +1,19 @@++<!--++  Copyright (C) 2026 The Android Open Source 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.++  -->++<com.android.settings.widget.TintDrawable++    xmlns:android="http://schemas.android.com/apk/res/android"++    android:drawable="@drawable/ic_timelapse_shape"++    android:tint="@color/homepage_supervision_foreground" /> diff --git a/res/values-en-rAU/strings.xml b/res/values-en-rAU/strings.xml index c181c5bc2b2..225af58eee0 100644 --- a/res/values-en-rAU/strings.xml@@ -135,10 +199,37 @@ index 59348a1fc82..42111bf22a0 100644      <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+index 18de9b0a68d..2802c605ed4 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.+@@ -52,26 +52,6 @@+     <string name="supl_disabled">Off</string>+     <string name="supl_disabled_summary">Will make acquiring location lock significantly slower, especially if PSDS is turned off too</string>+ +-    <string name="g_euicc_lpa_title">eSIM support</string>+-    <string name="g_euicc_lpa_enable_dialog_msg">+-A device restart is required to enable this setting.+-    </string>+-    <string name="g_euicc_lpa_disable_dialog_title">Warning</string>+-    <string name="g_euicc_lpa_disable_dialog_msg">+-"Turning off eSIM support will break the following functionality:+-+-• adding new eSIMs+-• turning existing eSIMs on or off+-• removing eSIMs, including from the lock screen (e.g. when eSIM is locked with a forgotten PIN)+-• wiping eSIMs during factory reset+-+-Device will be automatically restarted."+-    </string>+-    <string name="g_euicc_lpa_restart_button">Restart</string>+-    <string name="g_euicc_lpa_proceed_button">Proceed</string>+-    <string name="sim_action_esim_support_disabled_title">Can\'t turn off eSIM</string>+-    <string name="sim_action_esim_support_disabled_text">eSIM support is turned off. Enable eSIM support to disable the eSIM.</string>+-+     <string name="remote_provisioning_title">Attestation key provisioning</string>+     <string name="remote_provisioning_enabled_grapheneos_proxy">GrapheneOS proxy</string>+     <string name="remote_provisioning_enabled_google_server">Google server</string>+@@ -196,7 +176,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.  @@ -147,7 +238,7 @@ index 18de9b0a68d..11762c05793 100644    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>+@@ -226,7 +206,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>@@ -156,7 +247,7 @@ index 18de9b0a68d..11762c05793 100644      <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>+@@ -238,6 +218,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>@@ -189,6 +280,82 @@ index e33f3a5eace..32d14f99642 100644 -            settings:controller="com.android.settings.location.LocationServicesGeocoderPreferenceController" /> -  </PreferenceScreen>+diff --git a/res/xml/network_provider_internet.xml b/res/xml/network_provider_internet.xml+index 0ed7956c448..c62308062f3 100644+--- a/res/xml/network_provider_internet.xml++++ b/res/xml/network_provider_internet.xml+@@ -56,14 +56,6 @@+         settings:useAdminDisabledSummary="true"+         settings:controller="com.android.settings.network.MobileNetworkSummaryController" />+ +-    <com.android.settingslib.RestrictedSwitchPreference+-        android:key="google_euicc_lpa"+-        android:title="@string/g_euicc_lpa_title"+-        android:icon="@drawable/ic_sim_card"+-        android:order="-14"+-        settings:controller="com.android.settings.network.GoogleEuiccLpaController"+-        settings:userRestriction="no_config_mobile_networks"/>+-+     <com.android.settingslib.RestrictedSwitchPreference+         android:key="airplane_mode_on"+         android:title="@string/airplane_mode"+diff --git a/res/xml/top_level_settings.xml b/res/xml/top_level_settings.xml+index 5235673651a..c7d295632fc 100644+--- a/res/xml/top_level_settings.xml++++ b/res/xml/top_level_settings.xml+@@ -231,6 +231,14 @@+             settings:highlightableMenuKey="@string/menu_key_accounts_and_backup"+             settings:controller="com.android.settings.backup.TopLevelAccountsAndBackupEntryPreferenceController"/>+ ++        <com.android.settings.widget.HomepagePreference++            android:key="top_level_screen_time"++            android:title="Screen Time"++            android:summary="App usage, timers, focus and wind down"++            android:icon="@drawable/ic_timelapse"++            android:order="4"++            settings:controller="com.android.settings.supervision.TopLevelScreenTimePreferenceController"/>+++         <com.android.settings.widget.HomepagePreference+             android:key="top_level_supervision"+             android:title="@string/supervision_settings_title"+diff --git a/res/xml/top_level_settings_expressive.xml b/res/xml/top_level_settings_expressive.xml+index dc7afc722c7..0127cdfea53 100644+--- a/res/xml/top_level_settings_expressive.xml++++ b/res/xml/top_level_settings_expressive.xml+@@ -226,6 +226,14 @@+             settings:highlightableMenuKey="@string/menu_key_accounts_and_backup"+             settings:controller="com.android.settings.backup.TopLevelAccountsAndBackupEntryPreferenceController"/>+ ++        <com.android.settings.widget.HomepagePreference++            android:key="top_level_screen_time"++            android:title="Screen Time"++            android:summary="App usage, timers, focus and wind down"++            android:icon="@drawable/ic_homepage_screen_time"++            android:order="4"++            settings:controller="com.android.settings.supervision.TopLevelScreenTimePreferenceController"/>+++         <com.android.settings.widget.HomepagePreference+             android:key="top_level_supervision"+             android:title="@string/supervision_settings_title"+diff --git a/res/xml/top_level_settings_expressive_desktop.xml b/res/xml/top_level_settings_expressive_desktop.xml+index 16335e2de93..b604deff246 100644+--- a/res/xml/top_level_settings_expressive_desktop.xml++++ b/res/xml/top_level_settings_expressive_desktop.xml+@@ -221,6 +221,14 @@+             settings:highlightableMenuKey="@string/menu_key_accounts_and_backup"+             settings:controller="com.android.settings.backup.TopLevelAccountsAndBackupEntryPreferenceController"/>+ ++        <com.android.settings.widget.HomepagePreference++            android:key="top_level_screen_time"++            android:title="Screen Time"++            android:summary="App usage, timers, focus and wind down"++            android:icon="@drawable/ic_homepage_screen_time"++            android:order="4"++            settings:controller="com.android.settings.supervision.TopLevelScreenTimePreferenceController"/>+++         <com.android.settings.widget.HomepagePreference+             android:key="top_level_supervision"+             android:title="@string/supervision_settings_title" 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@@ -357,30 +524,270 @@ index 4b34ea66db5..d4c383cc0d8 100644 +            Uri.parse("content://com.vayunmathur.networklocation.status/databases")      }  }-diff --git a/res/values/config.xml b/res/values/config.xml---- a/res/values/config.xml-+++ b/res/values/config.xml-@@ -300,9 +300,13 @@-         com.android.contacts-     </string>+diff --git a/src/com/android/settings/network/GoogleEuiccLpaController.java b/src/com/android/settings/network/GoogleEuiccLpaController.java+deleted file mode 100644+index d697c3b97f1..00000000000+--- a/src/com/android/settings/network/GoogleEuiccLpaController.java++++ /dev/null+@@ -1,108 +0,0 @@+-package com.android.settings.network;+-+-import android.Manifest;+-import android.app.AlertDialog;+-import android.content.Context;+-import android.content.pm.PackageManager;+-import android.ext.PackageId;+-import android.os.PowerManager;+-import android.os.UserHandle;+-import android.permission.PermissionManager;+-+-import com.android.settings.R;+-import com.android.settings.ext.AbstractTogglePrefController;+-import com.android.settings.ext.ExtSettingControllerHelper;+-+-import static java.util.Objects.requireNonNull;+-+-public class GoogleEuiccLpaController extends AbstractTogglePrefController {+-    private static final String PKG_NAME = PackageId.G_EUICC_LPA_NAME;+-+-    private final PackageManager packageManager;+-    private final boolean isPresent;+-+-    public GoogleEuiccLpaController(Context context, String key) {+-        super(context, key);+-        packageManager = context.getPackageManager();+-+-        boolean isPresent = false;+-        try {+-            var ai = packageManager.getApplicationInfo(PKG_NAME, 0);+-            isPresent = ai.isSystemApp();+-        } catch (PackageManager.NameNotFoundException ignored) {}+-+-        this.isPresent = isPresent;+-    }+-+-    @Override+-    public boolean isChecked() {+-        try {+-            return isPresent && packageManager.getApplicationInfo(PKG_NAME, 0).enabled;+-        } catch (PackageManager.NameNotFoundException e) {+-            return false;+-        }+-    }+-+-    @Override+-    public int getAvailabilityStatus() {+-        if (!isPresent) {+-            return UNSUPPORTED_ON_DEVICE;+-        }+-        return ExtSettingControllerHelper.getGlobalSettingAvailability(mContext);+-    }+-    +-    private void setEnabled(boolean isEnabled) {+-        String pkg = PKG_NAME;+-+-        if (isEnabled) {+-            var permManager = mContext.getSystemService(PermissionManager.class);+-            UserHandle user = mContext.getUser();+-+-            String perm = Manifest.permission.CAMERA;+-            permManager.revokeRuntimePermission(pkg, perm, user, null);+-            // Previously, Camera permission was auto-granted with the FLAG_PERMISSION_SYSTEM_FIXED,+-            // which made it unchangeable by the user.+-            // Removing FLAG_PERMISSION_USER_FIXED is needed to make sure that the app is always+-            // able to show a permission request dialog after being enabled+-            int permFlagsToRemove = PackageManager.FLAG_PERMISSION_SYSTEM_FIXED+-                    | PackageManager.FLAG_PERMISSION_USER_FIXED;+-            permManager.updatePermissionFlags(pkg, perm, permFlagsToRemove, 0, user);+-        }+-+-        var powerManager = requireNonNull(mContext.getSystemService(PowerManager.class));+-+-        int ces = isEnabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED :+-                              PackageManager.COMPONENT_ENABLED_STATE_DISABLED;+-        packageManager.setApplicationEnabledSetting(pkg, ces, 0);+-+-        // Reboot is required in both cases:+-        // - OS code doesn't expect LPA to become unavailable at runtime and starts to poll for it+-        // with a high frequency+-        // - EuiccGoogle performs initialization in response to "(locked) boot completed" broadcasts+-        // - also, if current boot count is 1 (i.e. if this is the first boot), EuiccGoogle expects to+-        // be interacted with by Google's SetupWizard. Boot count will be at least 2 after reboot.+-        powerManager.reboot(null);+-    }+-+-    @Override+-    public boolean setChecked(boolean isChecked) {+-        var b = new AlertDialog.Builder(mContext);+-+-        int msg;+-        int btnText;+-        if (isChecked) {+-            msg = R.string.g_euicc_lpa_enable_dialog_msg;+-            btnText = R.string.g_euicc_lpa_restart_button;+-        } else {+-            b.setTitle(R.string.g_euicc_lpa_disable_dialog_title);+-            msg = R.string.g_euicc_lpa_disable_dialog_msg;+-            btnText = R.string.g_euicc_lpa_proceed_button;+-        }+-+-        b.setMessage(msg);+-        b.setPositiveButton(btnText, (d, btn) -> setEnabled(isChecked));+-        b.show();+-+-        return false;+-    }+-}+diff --git a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java+index 7c70d9165e7..a81b2b4edd8 100644+--- a/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java++++ b/src/com/android/settings/network/telephony/ToggleSubscriptionDialogActivity.java+@@ -18,8 +18,6 @@ package com.android.settings.network.telephony;+ + import android.content.Context;+ import android.content.Intent;+-import android.content.pm.PackageManager;+-import android.ext.PackageId;+ import android.os.Bundle;+ import android.os.UserManager;+ import android.telephony.SubscriptionInfo;+@@ -123,14 +121,6 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc+                 == View.LAYOUT_DIRECTION_RTL;+         Log.i(TAG, "isMultipleEnabledProfilesSupported():" + isMultipleEnabledProfilesSupported());  -+    <!-- MAOS: Modern Apps Emergency replaces AOSP EmergencyInfo.-+         EmergencyActionContentProvider only takes the SOS call from this-+         package, and the preference controllers resolve the edit intent-+         against it. -->-     <!-- AOSP Emergency app package name -->-     <string name="config_aosp_emergency_package_name" translatable="false">--        com.android.emergency-+        com.vayunmathur.emergency-     </string>+-        if (shouldDisallowDisablingEsim()) {+-            Log.i(TAG, "Cannot disable eSIM while eSIM support is disabled.");+-            showErrorDialog(+-                    getString(R.string.sim_action_esim_support_disabled_title),+-                    getString(R.string.sim_action_esim_support_disabled_text));+-            return;+-        }+-+         if (savedInstanceState == null) {+             if (mEnable) {+                 showEnableSubDialog();+@@ -608,47 +598,4 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc+                 cardInfo -> cardInfo.isMultipleEnabledProfilesSupported());+     }+ +-    private boolean shouldDisallowDisablingEsim() {+-        if (mEnable || mSubInfo == null) {+-            return false;+-        }+-        final boolean isActiveSub =+-                mSubInfo.getSimSlotIndex() != SubscriptionManager.INVALID_SIM_SLOT_INDEX;+-        final boolean isEuiccSub = isEuiccSubscription(mSubInfo);+-        final boolean isEsimSupportEnabled = isEsimSupportEnabled();+-        Log.d(TAG, "shouldDisallowDisablingEsim: isActive=" + isActiveSub+-                + ", isEuiccSub=" + isEuiccSub+-                + ", isEmbedded=" + mSubInfo.isEmbedded()+-                + ", cardId=" + mSubInfo.getCardId()+-                + ", isEsimSupportEnabled=" + isEsimSupportEnabled);+-        return isActiveSub && isEuiccSub && !isEsimSupportEnabled;+-    }+-+-    private boolean isEuiccSubscription(SubscriptionInfo subInfo) {+-        /* subInfo doesn't contain accurate eSIM profile info before eUICC LPA is+-         * enabled for the first time, but it should be valid afterward.+-         */+-        if (subInfo.isEmbedded()) {+-            return true;+-        }+-        final int cardId = subInfo.getCardId();+-        final List<UiccCardInfo> cardsInfo = mTelMgr.getUiccCardsInfo();+-        if (cardId > TelephonyManager.UNSUPPORTED_CARD_ID) {+-            if (cardsInfo.stream().anyMatch(cardInfo ->+-                    cardInfo != null && cardInfo.getCardId() == cardId && cardInfo.isEuicc())) {+-                return true;+-            }+-        }+-        return false;+-    }+-+-    private boolean isEsimSupportEnabled() {+-        try {+-            return getPackageManager()+-                    .getApplicationInfo(PackageId.G_EUICC_LPA_NAME, PackageManager.MATCH_SYSTEM_ONLY)+-                    .enabled;+-        } catch (PackageManager.NameNotFoundException e) {+-            return true;+-        }+-    }+ }+diff --git a/src/com/android/settings/supervision/SupervisionDashboardActivity.kt b/src/com/android/settings/supervision/SupervisionDashboardActivity.kt+index cbc52e60a8a..1b5bd0e884e 100644+--- a/src/com/android/settings/supervision/SupervisionDashboardActivity.kt++++ b/src/com/android/settings/supervision/SupervisionDashboardActivity.kt+@@ -42,6 +42,19 @@ class SupervisionDashboardActivity :  -     <!-- AOSP Emergency app intent action -->-@@ -312,7 +316,7 @@+     override fun onResume() {+         super.onResume()++        // MAOS: the AOSP supervision dashboard is replaced by the Modern Apps Parental Controls++        // app; redirect any entry (search, embedding, direct launch) into it and finish.++        run {++            val maosRedirect =++                Intent("com.vayunmathur.parentalcontrols.action.DASHBOARD")++                    .setPackage("com.vayunmathur.parentalcontrols")++                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)++            if (packageManager.queryIntentActivities(maosRedirect, 0).isNotEmpty()) {++                startActivity(maosRedirect)++                finish()++                return++            }++        }  -     <!-- Emergency app package name -->-     <string name="config_emergency_package_name" translatable="false">--        com.android.emergency-+        com.vayunmathur.emergency-     </string>+         if (!Flags.enableSupervisionSettingsUiUpdates() && shouldRedirectToSupervisionApp()) {+             val redirectIntent = getSupervisionAppIntent()+diff --git a/src/com/android/settings/supervision/TopLevelSupervisionPreferenceController.kt b/src/com/android/settings/supervision/TopLevelSupervisionPreferenceController.kt+index c689a201ec0..14b2bbdba72 100644+--- a/src/com/android/settings/supervision/TopLevelSupervisionPreferenceController.kt++++ b/src/com/android/settings/supervision/TopLevelSupervisionPreferenceController.kt+@@ -44,8 +44,11 @@ class TopLevelSupervisionPreferenceController(context: Context, key: String) :  -     <!-- Emergency app intent action -->+     override fun handlePreferenceTreeClick(preference: Preference): Boolean {+         if (preference.key == preferenceKey) {+-            val intent = Intent(mContext, SupervisionDashboardActivity::class.java)+-            intent.putExtra(EXTRA_IS_SECOND_LAYER_PAGE, true)++            // MAOS: open the Modern Apps Parental Controls app instead of the AOSP dashboard.++            val intent =++                Intent("com.vayunmathur.parentalcontrols.action.DASHBOARD")++                    .setPackage("com.vayunmathur.parentalcontrols")++                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)+             mContext.startActivity(intent)+             return true+         }+@@ -69,3 +72,34 @@ class TopLevelSupervisionPreferenceController(context: Context, key: String) :+         return AVAILABLE+     }+ }++++++/**++ * MAOS: top-level "Screen Time" entry that opens the Modern Apps Screen Time app.++ *++ * Lives in this tracked file (rather than a new source file) so settings.patch stays a set of++ * edits to existing files and re-applies cleanly after repo sync. The Screen Time app has no++ * launcher icon, so this is its entry point; shown only when it answers its dashboard action.++ */++class TopLevelScreenTimePreferenceController(context: Context, key: String) :++    BasePreferenceController(context, key) {++++    override fun getAvailabilityStatus(): Int =++        if (mContext.packageManager.queryIntentActivities(dashboardIntent(), 0).isNotEmpty()) {++            AVAILABLE++        } else {++            UNSUPPORTED_ON_DEVICE++        }++++    override fun handlePreferenceTreeClick(preference: Preference): Boolean {++        if (preference.key == preferenceKey) {++            mContext.startActivity(dashboardIntent().addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))++            return true++        }++        return super.handlePreferenceTreeClick(preference)++    }++++    private fun dashboardIntent(): Intent =++        Intent("com.vayunmathur.screentime.action.DASHBOARD")++            .setPackage("com.vayunmathur.screentime")++}