maos: regenerate stale settings and frameworks patches from tree
- Commit
f5ec533acaf561b7b70f7cd0a666edc80d229932- Author
- Vayun Mathur <[email protected]>
- When
- 2026-09-30 01:45 UTC (2 months ago)
- Parents
6e2ed74
Diff
Android.bp
diff --git a/Android.bp b/Android.bpindex 49c314a..40ef754 100644--- a/Android.bp+++ b/Android.bp@@ -445,3 +445,117 @@ android_app_import { enabled: false, }, }++// Auto is PRIVILEGED: it is the SYSTEM_AUTOMOTIVE_PROJECTION role holder (pinned via+// config_systemAutomotiveProjection in MaosFrameworkResRRO) and exercises signature|privileged+// operations (MANAGE_USB, MODIFY_AUDIO_ROUTING, CALL_PRIVILEGED, CONTROL_INCALL_EXPERIENCE+// and friends, allowlisted in privapp-permissions-modern-apps.xml). It ships its GAL+// credential in assets; the leaf expires 2026-12-09 and must be re-extracted per release+// (auto/docs/HANDOFF.md section 7 runbook).+//+// NOTE: the prebuilt (prebuilts/auto-release.apk) is staged by scripts/collect-apks.sh+// from the Modern-Apps release; until it exists the Soong module dangles and the build+// fails on the missing APK. Stage it before building.+android_app_import {+ name: "ModernAppsAuto",+ apk: "prebuilts/auto-release.apk",+ presigned: true,+ preprocessed: true,+ privileged: true,+ product_specific: true,+ dex_preopt: {+ enabled: false,+ },+}++// ParentalControls is the SYSTEM_SUPERVISION role holder - the piece AOSP leaves empty and Google+// fills with a GMS component. The framework (android.app.supervision, SupervisionService) and+// the entire Settings UI (com/android/settings/supervision) already ship in this tree, and the+// gating flag android.app.supervision.flags.enable_supervision_settings_screen is on. What was+// missing is a package answering the supervision messenger bind action, resolved through+// config_systemSupervision: with no holder, TopLevelSupervisionPreferenceController reports+// UNSUPPORTED_ON_DEVICE and Settings > Parental controls does not exist at all - which is why+// MAOS looked like it had no parental controls rather than merely unconfigured ones.+//+// NOT privileged, and deliberately absent from privapp-permissions-modern-apps.xml. It declares+// only role-granted permissions in its manifest; everything it holds arrives with the role, which is+// `signature|role` rather than `signature|privileged`, so an allowlist entry would be both+// wrong and boot-fatal under ro.control_privapp_permissions=enforce. The role's+// systemOnly="true" is satisfied by being preinstalled under /product. The pin, and the full+// list of what holding the role auto-grants, are recorded at the pin itself in+// rro/MaosFrameworkResRRO/res/values/config.xml.+android_app_import {+ name: "ModernAppsParentalControls",+ apk: "prebuilts/parentalcontrols-release.apk",+ presigned: true,+ preprocessed: true,+ product_specific: true,+ dex_preopt: {+ enabled: false,+ },+}++// ScreenTime is the self-managed wellbeing app (dashboard, timers, focus, wind-down). It+// holds the SYSTEM_WELLBEING role via the config_systemWellbeing pin in MaosFrameworkResRRO,+// which grants SUSPEND_APPS, SYSTEM_APPLICATION_OVERLAY and OBSERVE_APP_USAGE at runtime. It+// is NOT privileged: a privapp-permissions entry for a non-priv-app is boot-fatal under+// ro.control_privapp_permissions=enforce. Its reflective UsageStatsManager observer and+// PackageManager suspend access is allowlisted via hidden-api-whitelisted-app in+// sysconfig-modern-apps.xml.+android_app_import {+ name: "ModernAppsScreenTime",+ apk: "prebuilts/screentime-release.apk",+ presigned: true,+ preprocessed: true,+ product_specific: true,+ dex_preopt: {+ enabled: false,+ },+}++// Health is an ordinary user app (metrics, medications, vaccinations): it replaces nothing+// GrapheneOS ships and holds no signature|privileged permission, so it is not `privileged:+// true` and needs no privapp-permissions entry. Preinstalled only so a fresh device has it;+// everything it uses (Health Connect, notifications) is user-granted at runtime, exactly as+// from a store install.+android_app_import {+ name: "ModernAppsHealth",+ apk: "prebuilts/health-release.apk",+ presigned: true,+ preprocessed: true,+ product_specific: true,+ dex_preopt: {+ enabled: false,+ },+}++// Emergency is the emergency-info + SOS app. It REPLACES AOSP's EmergencyInfo+// (com.android.emergency) via the `overrides` below, and becomes the+// android.app.role.EMERGENCY holder automatically: EmergencyRoleBehavior has no+// config_defaultEmergency pin - it grants the role to the sole preinstalled package with an+// android.telephony.action.EMERGENCY_ASSISTANCE activity, which is this app once EmergencyInfo+// is gone (our ViewInfoActivity answers that action). EmergencyInfo is deliberately LEFT listed+// in build/make/target/product/telephony_system_ext.mk as the fallback for this app going+// missing, the same way SetupWizard2/Updater are handled above; `overrides` only applies while+// this module is installed.+//+// PRIVILEGED: it declares signature|privileged perms - CALL_PRIVILEGED (place the emergency+// call), WRITE_SECURE_SETTINGS (the gesture provider EMERGENCY_GESTURE_* writes),+// READ_PRIVILEGED_PHONE_STATE (emergency-number lookup) and MANAGE_USERS (owner card) -+// allowlisted in privapp-permissions-modern-apps.xml. Its Health Connect medical reads and+// contacts access are default-granted (fixed) in default-permissions-modern-apps.xml so an+// emergency needs no manual permission setup.+android_app_import {+ name: "ModernAppsEmergency",+ apk: "prebuilts/emergency-release.apk",+ presigned: true,+ preprocessed: true,+ privileged: true,+ product_specific: true,+ overrides: [+ "EmergencyInfo",+ ],+ dex_preopt: {+ enabled: false,+ },+}
build-maos.sh
diff --git a/build-maos.sh b/build-maos.shindex 56b5068..cb1308d 100755--- a/build-maos.sh+++ b/build-maos.sh@@ -99,7 +99,7 @@ BUILD="$TAG" MANIFEST_URL="https://github.com/GrapheneOS/platform_manifest.git" MAOS_GH="https://github.com/vayun-mathur/" # overlay repo remote (for the local manifest) MODERN_APPS_GH="vayun-mathur/Modern-Apps" # source of the prebuilt APKs-APPS=(web camera pdf contacts calculator clock files photos appstore keyboard speech calendar music communicate euicc backup networklocation findfamily share cast setupwizard logviewer updater parentalcontrols screentime emergency)+APPS=(web camera pdf contacts calculator clock files photos appstore keyboard speech calendar music communicate auto euicc backup networklocation findfamily share cast setupwizard logviewer updater parentalcontrols screentime health emergency) # ---- Derived / optional-env config ---- # ONE shared, device-independent key set (see the "Signing keys" note above).@@ -255,6 +255,7 @@ apply_maos_patches() { for spec in "build/make:platform_build.patch" "vendor/adevtool:adevtool.patch" \ "frameworks/base:frameworks_base.patch" \ "frameworks/opt/telephony:frameworks_opt_telephony.patch" \+ "packages/modules/Permission:permission_roles.patch" \ "frameworks/libs/systemui:frameworks_libs_systemui.patch" \ "build/release:build_release.patch" \ "system/sepolicy:system_sepolicy.patch" \
default-permissions-modern-apps.xml
diff --git a/default-permissions-modern-apps.xml b/default-permissions-modern-apps.xmlindex 7ba3116..2fc46fc 100644--- a/default-permissions-modern-apps.xml+++ b/default-permissions-modern-apps.xml@@ -49,4 +49,17 @@ <exception package="com.vayunmathur.files"> <permission name="android.permission.POST_NOTIFICATIONS" fixed="false" /> </exception>+ <!-- Emergency (com.vayunmathur.emergency) is the EMERGENCY role holder / stock EmergencyInfo+ replacement. These are default-granted and fixed="true" (non-revocable) so the card shows+ allergies, current medications and emergency contacts to a first responder with no manual+ setup and no way to accidentally turn them off. The two health.* reads are the Personal+ Health Record permissions for allergies and medications; a foreground read by the view+ activity is sufficient (see the app's HealthConnectMedical). -->+ <exception package="com.vayunmathur.emergency">+ <permission name="android.permission.health.READ_MEDICAL_DATA_ALLERGIES_INTOLERANCES" fixed="true" />+ <permission name="android.permission.health.READ_MEDICAL_DATA_MEDICATIONS" fixed="true" />+ <permission name="android.permission.READ_CONTACTS" fixed="true" />+ <permission name="android.permission.POST_NOTIFICATIONS" fixed="true" />+ <permission name="android.permission.READ_PHONE_STATE" fixed="true" />+ </exception> </exceptions>
patches/build_release.patch
diff --git a/patches/build_release.patch b/patches/build_release.patchindex e15b919..1d46c5b 100644--- a/patches/build_release.patch+++ b/patches/build_release.patch@@ -1,3 +1,15 @@+diff --git a/aconfig/cp2a/android.app.supervision.flags/enable_supervision_package_usage_apis_flag_values.textproto b/aconfig/cp2a/android.app.supervision.flags/enable_supervision_package_usage_apis_flag_values.textproto+new file mode 100644+index 000000000..b64f4cfaa+--- /dev/null++++ b/aconfig/cp2a/android.app.supervision.flags/enable_supervision_package_usage_apis_flag_values.textproto+@@ -0,0 +1,6 @@++flag_value {++ package: "android.app.supervision.flags"++ name: "enable_supervision_package_usage_apis"++ state: ENABLED++ permission: READ_ONLY++} diff --git a/aconfig/trunk_staging/com.android.server.display.feature.flags/virtual_displays_support_desktop_mode_flag_values.textproto b/aconfig/trunk_staging/com.android.server.display.feature.flags/virtual_displays_support_desktop_mode_flag_values.textproto new file mode 100755 index 000000000..8ecd4b885
patches/frameworks_base.patch
diff --git a/patches/frameworks_base.patch b/patches/frameworks_base.patchindex 32ca99a..957a2e8 100644--- a/patches/frameworks_base.patch+++ b/patches/frameworks_base.patch@@ -262,6 +262,22 @@ 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 +51,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 +519,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 +530,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 +542,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 +574,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 +608,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 +671,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 +687,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 +723,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 +731,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 +745,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; }
patches/permission_roles.patch
diff --git a/patches/permission_roles.patch b/patches/permission_roles.patchnew file mode 100644index 0000000..161e571--- /dev/null+++ b/patches/permission_roles.patch@@ -0,0 +1,12 @@+diff --git a/PermissionController/res/xml/roles.xml b/PermissionController/res/xml/roles.xml+index 0000000000..0000000001 100644+--- a/PermissionController/res/xml/roles.xml++++ b/PermissionController/res/xml/roles.xml+@@ -1287,6 +1287,7 @@+ <role+ name="android.app.role.COMPANION_DEVICE_APP_STREAMING"+ behavior="v33.CompanionDeviceAppStreamingRoleBehavior"++ defaultHolders="config_companionDeviceAppStreaming"+ exclusive="false"+ exclusivity="none"+ minSdkVersion="33"
patches/platform_build.patch
diff --git a/patches/platform_build.patch b/patches/platform_build.patchindex d264d2b..d2aee91 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..2efb6cd911 100644+index 2a4602d43b..8bdda16736 100644 --- a/target/product/handheld_product.mk +++ b/target/product/handheld_product.mk-@@ -22,25 +22,39 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/media_product.mk)+@@ -22,25 +22,38 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/media_product.mk) # /product packages PRODUCT_PACKAGES += \@@ -127,7 +127,6 @@ index aa70f46797..0705511932 100644 ImsServiceEntitlement \ preinstalled-packages-platform-telephony-product.xml diff --git a/target/product/telephony_system_ext.mk b/target/product/telephony_system_ext.mk-index 342020565c..1bf7cf5a35 100644 --- a/target/product/telephony_system_ext.mk +++ b/target/product/telephony_system_ext.mk @@ -20,7 +20,7 @@
patches/settings.patch
diff --git a/patches/settings.patch b/patches/settings.patchindex 619d015..8e6bc7e 100644--- a/patches/settings.patch+++ b/patches/settings.patch@@ -189,6 +189,63 @@ index e33f3a5eace..32d14f99642 100644 - settings:controller="com.android.settings.location.LocationServicesGeocoderPreferenceController" /> - </PreferenceScreen>+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..dd7f118e303 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_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_desktop.xml b/res/xml/top_level_settings_expressive_desktop.xml+index 16335e2de93..e125b031a73 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_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/src/com/android/settings/location/LocationServicesGeocoderPreferenceController.kt b/src/com/android/settings/location/LocationServicesGeocoderPreferenceController.kt deleted file mode 100644 index 2951671fd99..00000000000@@ -384,3 +441,80 @@ diff --git a/res/values/config.xml b/res/values/config.xml </string> <!-- Emergency app intent action -->+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 :+ + 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++ }++ }+ + 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) :+ + 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")++}
privapp-permissions-modern-apps.xml
diff --git a/privapp-permissions-modern-apps.xml b/privapp-permissions-modern-apps.xmlindex efcbee1..56c8dec 100644--- a/privapp-permissions-modern-apps.xml+++ b/privapp-permissions-modern-apps.xml@@ -43,6 +43,7 @@ <permission name="android.permission.BACKUP" /> <permission name="android.permission.WRITE_SECURE_SETTINGS" /> </privapp-permissions>+ <!-- Cast is PRIVILEGED: it is a remote display provider, which is what puts its receivers in Settings' Cast page. RemoteDisplayProviderWatcher.verifyServiceTrusted only trusts a provider whose app holds REMOTE_DISPLAY_PROVIDER (signature|privileged); without it the@@ -92,6 +93,44 @@ ACCESS_WIFI_STATE (normal) and app.seamlessupdate.client.OPEN_SECURITY_PREVIEW_SETTINGS (declared by the updater, not the platform) are in the app manifest and correctly not allowlisted here, matching upstream. -->+ + <!-- Modern Apps Auto (Android Auto sender, com.vayunmathur.auto) is PRIVILEGED:+ it exercises signature|privileged operations no role can grant: MANAGE_USB+ (AOAP accessory handling), MODIFY_AUDIO_ROUTING (head-unit sinks), power/user+ management around projection sessions, privileged phone-state reads for call+ templates, and the CDM/Bluetooth-privileged + incall-experience pieces of the+ wireless/call paths.++ ONLY signature|privileged permissions are listed here. Everything the+ SYSTEM_AUTOMOTIVE_PROJECTION role grants (microphone/location/nearby-devices/+ notifications sets, telephony, ADD_TRUSTED_DISPLAY / CREATE_VIRTUAL_DEVICE /+ CAPTURE_SECURE_VIDEO_OUTPUT family, companion-device association) arrives via+ the role pin (config_systemAutomotiveProjection in MaosFrameworkResRRO) and is+ deliberately absent: role grants in an allowlist are a boot failure under+ ro.control_privapp_permissions=enforce, not a belt-and-braces extra.++ The package attribute must byte-match the installed package (auto/build.gradle.kts+ applicationId com.vayunmathur.auto) for the same reason. -->+ <privapp-permissions package="com.vayunmathur.auto">+ <permission name="android.permission.MANAGE_USB" />+ <permission name="android.permission.MODIFY_AUDIO_ROUTING" />+ <permission name="android.permission.TETHER_PRIVILEGED" />+ <permission name="android.permission.CALL_PRIVILEGED" />+ <permission name="android.permission.POWER_SAVER" />+ <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE" />+ <permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />+ <permission name="android.permission.MANAGE_USERS" />+ <permission name="android.permission.BLUETOOTH_PRIVILEGED" />+ <permission name="android.permission.CONTROL_INCALL_EXPERIENCE" />+ <permission name="android.permission.MODIFY_PHONE_STATE" />+ <permission name="android.permission.LOCAL_MAC_ADDRESS" />+ <permission name="android.permission.ENTER_CAR_MODE_PRIORITIZED" />+ <permission name="android.permission.REQUEST_COMPANION_SELF_MANAGED" />+ <permission name="android.permission.COMPANION_APPROVE_WIFI_CONNECTIONS" />+ <permission name="android.permission.BIND_INCALL_SERVICE" />+ <permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />+ </privapp-permissions>+ <privapp-permissions package="com.vayunmathur.setupwizard"> <permission name="android.permission.CHANGE_CONFIGURATION" /> <permission name="android.permission.MANAGE_USER_OEM_UNLOCK_STATE" />@@ -122,21 +161,17 @@ <permission name="android.permission.ALLOCATE_AGGRESSIVE"/> </privapp-permissions> - <!-- Emergency replaces AOSP EmergencyInfo (com.android.emergency). Same six- signature|privileged perms stock allowlists in- frameworks/base/data/etc/com.android.emergency.xml: the CALL_PRIVILEGED guard- on the gesture provider, owner identity (MANAGE_USERS), the privileged half- of emergency-number lookup (READ_PRIVILEGED_PHONE_STATE), the exact SOS- countdown alarm (SCHEDULE_EXACT_ALARM), firing the call from the background- alarm (START_ACTIVITIES_FROM_BACKGROUND), and persisting the SOS gesture- toggles (WRITE_SECURE_SETTINGS). -->+ <!-- Emergency (com.vayunmathur.emergency) is the EMERGENCY role holder and replaces AOSP's+ EmergencyInfo. It needs these signature|privileged perms: CALL_PRIVILEGED places the+ emergency call, WRITE_SECURE_SETTINGS lets the gesture provider persist the+ EMERGENCY_GESTURE_* Settings.Secure keys, READ_PRIVILEGED_PHONE_STATE is the privileged+ half of the emergency-number lookup, and MANAGE_USERS reads the owner name/photo for the+ card. All degrade gracefully if absent, but the app is privileged so they are granted. --> <privapp-permissions package="com.vayunmathur.emergency">- <permission name="android.permission.CALL_PRIVILEGED"/>- <permission name="android.permission.MANAGE_USERS"/>- <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>- <permission name="android.permission.SCHEDULE_EXACT_ALARM"/>- <permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>- <permission name="android.permission.WRITE_SECURE_SETTINGS"/>+ <permission name="android.permission.CALL_PRIVILEGED" />+ <permission name="android.permission.WRITE_SECURE_SETTINGS" />+ <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE" />+ <permission name="android.permission.MANAGE_USERS" /> </privapp-permissions> </permissions>
rro/MaosFrameworkResRRO/res/values/config.xml
diff --git a/rro/MaosFrameworkResRRO/res/values/config.xml b/rro/MaosFrameworkResRRO/res/values/config.xmlindex f5d06d3..cf187fd 100644--- a/rro/MaosFrameworkResRRO/res/values/config.xml+++ b/rro/MaosFrameworkResRRO/res/values/config.xml@@ -61,6 +61,16 @@ <string name="config_backup_transport" translatable="false">com.vayunmathur.backup/.service.ConfigurableBackupTransportService</string> + <!-- System gallery role -> Modern Apps Photos. AOSP's default names com.android.gallery3d,+ which MAOS does not ship, so this role was simply unheld.++ The visible payoff is the two app-ops the role sets to allowed,+ android:write_media_images and android:write_media_video: those are what let a gallery+ edit and delete media WITHOUT a per-file consent dialog. The role also grants+ READ_MEDIA_AUDIO and START_FOREGROUND_SERVICES_FROM_BACKGROUND, and+ SystemGalleryRoleBehavior grants the photo/video permissions and ACCESS_MEDIA_LOCATION+ in code, overriding the user's choice, which the write_media app-ops override+ anyway. --> <!-- Automotive projection role -> Modern Apps Cast. This is the ONLY route by which cast can hold ADD_TRUSTED_DISPLAY, which is@@ -80,30 +90,126 @@ RECEIVE_SENSITIVE_NOTIFICATIONS and CAPTURE_SECURE_VIDEO_OUTPUT. Not "made grantable" - granted. This was weighed against platform-signing the app and chosen deliberately. - The role name is not a borrowed one: MA Cast is intended to grow automotive projection- support, so this is the correct role slightly ahead of the feature.+ The role name is not a borrowed one: MA Auto IS the automotive projection+ sender, so this is its role outright. MA Cast previously held this pin solely+ for ADD_TRUSTED_DISPLAY; it now holds COMPANION_DEVICE_APP_STREAMING+ (non-exclusive, same `virtual_device` set), so the exclusive automotive role+ is free for Auto. exclusive="true", so nothing else in MAOS may hold it. systemOnly="true" is satisfied- because cast is preinstalled. config_systemAutomotiveProjection ships EMPTY in AOSP, so- there is no existing holder to displace.+ because auto is preinstalled as a privileged prebuilt (ModernAppsAuto).+ config_systemAutomotiveProjection ships EMPTY in AOSP, so there is no existing+ holder to displace. Precedent: config_defaultSms above works the same way - the SMS role auto-grants its SMS/Phone/Contacts runtime permissions. -->- <string name="config_systemAutomotiveProjection" translatable="false">com.vayunmathur.cast</string>--<!-- System supervision app -> Modern Apps Parental Controls. Upstream defaults to empty,- in which case Settings hides the Parental controls entry (TopLevelSupervisionPreferenceController- reports UNSUPPORTED_ON_DEVICE) and the platform never binds SupervisionAppService. The pin is- the default holder of the SYSTEM_SUPERVISION role (see roles.xml defaultHolders) and the- qualifier for the SUPERVISION role (SupervisionRoleBehavior), granting MANAGE_SUPERVISION /- MANAGE_APP_OPS_MODES at runtime. No privapp-permissions entry: not a priv-app. -->+ <string name="config_systemAutomotiveProjection" translatable="false">com.vayunmathur.auto</string>++ <!-- Companion-device app-streaming role -> Modern Apps Cast.++ Cast previously held SYSTEM_AUTOMOTIVE_PROJECTION solely for ADD_TRUSTED_DISPLAY+ (see above). COMPANION_DEVICE_APP_STREAMING carries the same `virtual_device` set+ plus notifications, RECORD_AUDIO and (on 36+) the sensitive-notification app-op,+ and is exclusive="false", so Cast keeps its trusted virtual display without+ blocking Auto from the automotive role. The role has no `defaultHolders` in AOSP;+ it is pinned here and the defaultHolders attribute is added by+ patches/permission_roles.patch (packages/modules/Permission). -->+ <string name="config_companionDeviceAppStreaming" translatable="false">com.vayunmathur.cast</string>++ <!-- Supervision (parental controls) role -> Modern Apps Parental Controls.++ This pin is the ONLY reason Settings > Parental controls exists on MAOS. The framework+ (android.app.supervision, SupervisionService) and the entire Settings UI+ (com/android/settings/supervision: dashboard, PIN and recovery, bedtime schedules, app+ limits, web content filters, app store filters) already ship in this tree, and the+ gating flag android.app.supervision.flags.enable_supervision_settings_screen is on.+ What was missing is the role holder. config_systemSupervision ships EMPTY in AOSP and+ Google fills it with a GMS component; with nothing answering the supervision messenger+ bind action, SupervisionHelper.hasNecessarySupervisionComponent fails and+ TopLevelSupervisionPreferenceController reports UNSUPPORTED_ON_DEVICE, hiding the entry+ outright. That is why parental controls looked removed rather than merely switched off.++ WHAT THIS COSTS, stated plainly. SYSTEM_SUPERVISION is static, exclusive, systemOnly+ and visible="false", and holding it AUTO-GRANTS a large set: ACCESS_INSTANT_APPS,+ KILL_UID, MANAGE_APP_OPS_MODES, MANAGE_DEFAULT_APPLICATIONS, SUSPEND_APPS,+ SYSTEM_APPLICATION_OVERLAY, MANAGE_PROFILE_AND_DEVICE_OWNERS, MANAGE_SUPERVISION and+ roughly twenty MANAGE_DEVICE_POLICY_* permissions (apps control, lock and lock+ credentials, keyguard, factory reset, location, camera, runtime permissions, safe boot,+ time, users, package state, debugging features and more). That breadth is inherent to+ what a supervision app IS, since it is the app a parent uses to suspend apps and lock a+ device, but it is a role grant rather than a permission the user was asked about, so it+ is recorded here at the pin.++ Parental Controls declares no permissions of its own and has no launcher icon: it exists to+ answer the bind and to forward the install-app action to Settings' own enable flow.+ systemOnly="true" is satisfied by being preinstalled under /product. It is deliberately+ NOT in privapp-permissions-modern-apps.xml, since these are signature|role rather than+ signature|privileged and a mismatched entry there is boot-fatal. --> <string name="config_systemSupervision" translatable="false">com.vayunmathur.parentalcontrols</string> -<!-- System wellbeing app -> Modern Apps Screen Time. Upstream defaults to empty, in+ <!-- System wellbeing app -> Modern Apps Screen Time. Upstream defaults to empty, in which case Settings shows no Digital Wellbeing entry and no role holder exists to grant SUSPEND_APPS / SYSTEM_APPLICATION_OVERLAY / OBSERVE_APP_USAGE. The pin is the default holder of the SYSTEM_WELLBEING role (see roles.xml defaultHolders). No privapp-permissions entry: not a priv-app. --> <string name="config_systemWellbeing" translatable="false">com.vayunmathur.screentime</string> + <string name="config_systemGallery" translatable="false">com.vayunmathur.photos</string>++ <!-- System speech recognizer role -> Modern Apps Speech.++ This is a DIFFERENT MECHANISM from config_defaultSpeechRecognitionService above and the+ two are easy to confuse. That one names the service the framework binds; this one makes+ Speech hold the role, which is what grants the role's permissions. Both are needed.++ config_systemSpeechRecognizer ships empty in AOSP. The role grants RECORD_AUDIO and+ UPDATE_APP_OPS_STATS, so the recognizer holds the microphone without a prompt.+ Qualification needs a service answering android.speech.RecognitionService, which+ Speech's WhisperRecognitionService already declares. This is a second route to+ RECORD_AUDIO alongside the fixed="false" grant in default-permissions-modern-apps.xml.+ The two are harmless together, and that entry is deliberately kept: a role that fails+ to qualify does so silently, and the default-permissions grant is what keeps voice+ input working if that ever happens. -->+ <string name="config_systemSpeechRecognizer" translatable="false">com.vayunmathur.speech</string>++ <!-- System contacts role -> Modern Apps Contacts. AOSP's default names+ com.android.contacts, which MAOS does not ship, so this role was unheld. It grants+ ACCESS_RCS_USER_CAPABILITY_EXCHANGE and SET_DEFAULT_ACCOUNT_FOR_CONTACTS. -->+ <string name="config_systemContacts" translatable="false">com.vayunmathur.contacts</string>++ <!-- External-display resolution picker: stop filtering out modes that are not 60 Hz.++ Settings' ResolutionPreferenceFragment.isAllowedMode drops every mode outside+ 60 +/- 1 Hz when this is true, keeping only the one already in use. That filter exists+ to hold a physically-connected panel in sync with the internal display; a MA Cast+ virtual display is not driven by the same clock and has nothing to synchronise with,+ so the rule only removes real choices. With it on, a cast desktop offering+ 3840x2160, 1920x1080 and 1280x720 showed a single entry as soon as any of them+ settled below 60 - which a 4K mode does whenever the phone's encoder cannot sustain+ 60 fps at that size.++ AOSP's own default is false (core/res/res/values/config.xml); it is the Pixel device+ overlay that turns it on, and this puts it back. -->+ <bool name="config_refreshRateSynchronizationEnabled">false</bool>++ <!-- External displays: no artificial size or refresh ceiling.++ The Pixel product overlay caps external displays at 3440x1600 at 61 Hz - an ultrawide+ monitor, which is a sensible bound for what the phone drives over DisplayPort and a+ meaningless one for a display that exists only as a surface handed to an encoder. The+ cap is enforced twice: DisplayModeDirector.DisplayObserver votes against modes above+ it, and Settings' resolution picker filters them out of the list.++ The symptom was that a 4K cast desktop offered exactly one 4K entry. Every 3840x2160+ mode was rejected with "height is above the allowed limit", and the survivor was only+ there because the picker always re-adds the display's active mode. 1920x1080 and+ 1280x720 fit under the cap, which is why they alone listed all their rates.++ Zero on all three is AOSP's own default (core/res/res/values/config.xml) and disables+ the limit entirely - DisplayObserver.isExternalDisplayLimitModeEnabled requires all+ three to be positive. The trade is that a genuinely-attached monitor is no longer held+ to what the phone's DisplayPort output was tuned for either. -->+ <integer name="config_externalDisplayPeakWidth">0</integer>+ <integer name="config_externalDisplayPeakHeight">0</integer>+ <integer name="config_externalDisplayPeakRefreshRate">0</integer> </resources>
sysconfig-modern-apps.xml
diff --git a/sysconfig-modern-apps.xml b/sysconfig-modern-apps.xmlindex 11507d5..c0a707d 100644--- a/sysconfig-modern-apps.xml+++ b/sysconfig-modern-apps.xml@@ -27,16 +27,29 @@ service="com.vayunmathur.backup/.service.ConfigurableBackupTransportService" /> <allow-in-power-save package="com.vayunmathur.backup" /> - <!-- Parental Controls (com.vayunmathur.parentalcontrols) reaches the @SystemApi- UsageStatsManager app-limit observer methods reflectively. It ships presigned- (not platform-signed) but as a /product app it takes the isSystemApp() branch of- ApplicationInfo.isAllowedToUseHiddenApis(), where this whitelist entry disables- hidden-API enforcement. Without it the registration lookups return null and- app limits silently never arm. Narrower than android:usesNonSdkApi and inert for- a non-system install of the same APK. -->+ <!-- Cast reaches VirtualDisplayConfig.Builder.setSupportedModes() and setUniqueId() by+ reflection: the first declares the TV's resolutions on the cast display so Android's+ external-display resolution picker offers them, the second gives the display a stable+ unique id. Both are @SystemApi, so hidden-API enforcement blocks the reflection for a+ presigned (non-platform-signed) app and the modes never reach the picker. Exempt the+ package. ALLOW_HIDDENAPI_WHITELISTING is granted to the product partition+ (SystemConfig.java), so this is honoured from /product/etc/sysconfig. -->+ <hidden-api-whitelisted-app package="com.vayunmathur.cast" />++ <!-- Parental Controls reaches UsageStatsManager.registerAppUsageLimitObserver and its unregister+ counterpart by reflection. Both are @SystemApi members of an ordinary public class, so a+ compileOnly stub is the wrong shape - it would shadow the real UsageStatsManager for+ every other caller in the app - and reflection is what the repo uses for that case (see+ logviewer's HiddenFrameworkApi). Hidden-API enforcement blocks that for a presigned,+ non-platform-signed app, exactly as it does for cast above.++ Only the reflection needs this. The SupervisionManager and SupervisionAppService calls+ are direct, through library/supervision-stubs, and link without an exemption.++ UsageStatsService still applies its own permission check on the other side; it passes+ only because we hold the supervision role. The exemption buys visibility, not privilege. --> <hidden-api-whitelisted-app package="com.vayunmathur.parentalcontrols" /> <hidden-api-whitelisted-app package="com.vayunmathur.screentime" />- <!-- Emergency (com.vayunmathur.emergency) replaces AOSP EmergencyInfo. The SOS countdown runs as a foreground service off an exact alarm; exempt it from Doze like stock does so the countdown is not killed while the screen is off. -->