From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dmitry Muhomor Date: Mon, 27 Mar 2023 16:29:13 +0300 Subject: [PATCH] integrate Google's EuiccSupportPixel package Depends on commit: "don't crash apps that depend on missing Gservices provider" [tad@spotco.us]: handle OpenEUICC here too Change-Id: I49e3ff6f2ce8d74383da1c4dfd42913c713016c6 --- data/etc/preinstalled-packages-platform.xml | 6 ++++++ .../server/ext/PackageManagerHooks.java | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/data/etc/preinstalled-packages-platform.xml b/data/etc/preinstalled-packages-platform.xml index ff8d96dd23f2..97027ebbca2d 100644 --- a/data/etc/preinstalled-packages-platform.xml +++ b/data/etc/preinstalled-packages-platform.xml @@ -110,4 +110,10 @@ to pre-existing users, but cannot uninstall pre-existing system packages from pr + + + + + + diff --git a/services/core/java/com/android/server/ext/PackageManagerHooks.java b/services/core/java/com/android/server/ext/PackageManagerHooks.java index 007b65349e55..a69ce9999165 100644 --- a/services/core/java/com/android/server/ext/PackageManagerHooks.java +++ b/services/core/java/com/android/server/ext/PackageManagerHooks.java @@ -16,10 +16,23 @@ import com.android.server.pm.pkg.parsing.ParsingPackage; public class PackageManagerHooks { + public static final String OPEN_EUICC_PKG_NAME = "im.angry.openeuicc"; + public static final String EUICC_SUPPORT_PIXEL_PKG_NAME = "com.google.euiccpixel"; + // Called when package enabled setting is deserialized from storage @Nullable public static Integer maybeOverridePackageEnabledSetting(String pkgName, @UserIdInt int userId) { switch (pkgName) { + case OPEN_EUICC_PKG_NAME: + case EUICC_SUPPORT_PIXEL_PKG_NAME: + if (userId == UserHandle.USER_SYSTEM) { + // EuiccSupportPixel handles firmware updates and should always be enabled. + // It was previously unconditionally disabled after reboot. + return PackageManager.COMPONENT_ENABLED_STATE_DEFAULT; + } else { + // one of the previous OS versions enabled EuiccSupportPixel in all users + return PackageManager.COMPONENT_ENABLED_STATE_DISABLED; + } default: return null; } @@ -30,6 +43,10 @@ public class PackageManagerHooks { String pkgName = pkg.getPackageName(); switch (pkgName) { + case EUICC_SUPPORT_PIXEL_PKG_NAME: + // EuiccSupportPixel uses INTERNET perm only as part of its dev mode + removeUsesPermissions(pkg, Manifest.permission.INTERNET); + return; default: return; } @@ -86,5 +103,6 @@ public class PackageManagerHooks { // Packages in this array are restricted from interacting with and being interacted by non-system apps private static final ArraySet restrictedVisibilityPackages = new ArraySet<>(new String[] { + EUICC_SUPPORT_PIXEL_PKG_NAME, }); }