2023-08-21 16:49:51 -04:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
|
|
|
Date: Mon, 27 Mar 2023 16:29:13 +0300
|
2023-08-21 17:56:38 -04:00
|
|
|
Subject: [PATCH] integrate Google's EuiccSupportPixel package
|
2023-08-21 16:49:51 -04:00
|
|
|
|
|
|
|
Depends on commit: "don't crash apps that depend on missing Gservices provider"
|
|
|
|
|
2023-08-26 15:05:28 -04:00
|
|
|
[tad@spotco.us]: handle OpenEUICC toggling here too
|
2023-08-21 16:49:51 -04:00
|
|
|
|
|
|
|
Change-Id: I49e3ff6f2ce8d74383da1c4dfd42913c713016c6
|
|
|
|
---
|
2023-08-26 15:05:28 -04:00
|
|
|
data/etc/preinstalled-packages-platform.xml | 6 ++++
|
|
|
|
.../server/ext/PackageManagerHooks.java | 31 +++++++++++++++++++
|
|
|
|
2 files changed, 37 insertions(+)
|
2023-08-21 16:49:51 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
<install-in-user-type package="com.android.wallpaperbackup">
|
|
|
|
<install-in user-type="FULL" />
|
|
|
|
</install-in-user-type>
|
|
|
|
+ <install-in-user-type package="com.google.euiccpixel">
|
|
|
|
+ <install-in user-type="SYSTEM" />
|
|
|
|
+ </install-in-user-type>
|
|
|
|
+ <install-in-user-type package="im.angry.openeuicc">
|
|
|
|
+ <install-in user-type="SYSTEM" />
|
|
|
|
+ </install-in-user-type>
|
|
|
|
</config>
|
|
|
|
diff --git a/services/core/java/com/android/server/ext/PackageManagerHooks.java b/services/core/java/com/android/server/ext/PackageManagerHooks.java
|
2023-09-01 20:51:15 -04:00
|
|
|
index 007b65349e55..3c38b9e73049 100644
|
2023-08-21 16:49:51 -04:00
|
|
|
--- a/services/core/java/com/android/server/ext/PackageManagerHooks.java
|
|
|
|
+++ b/services/core/java/com/android/server/ext/PackageManagerHooks.java
|
2023-08-26 15:05:28 -04:00
|
|
|
@@ -6,6 +6,7 @@ import android.annotation.UserIdInt;
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.content.pm.PackageManagerInternal;
|
|
|
|
import android.os.Build;
|
|
|
|
+import android.os.SystemProperties;
|
|
|
|
import android.os.UserHandle;
|
|
|
|
import android.util.ArraySet;
|
|
|
|
|
|
|
|
@@ -16,10 +17,29 @@ import com.android.server.pm.pkg.parsing.ParsingPackage;
|
2023-08-21 16:49:51 -04:00
|
|
|
|
|
|
|
public class PackageManagerHooks {
|
|
|
|
|
2023-08-26 15:05:28 -04:00
|
|
|
+ public static final String OPENEUICC_PKG_NAME = "im.angry.openeuicc";
|
|
|
|
+ public static final String OPENEUICC_TOGGLE = "persist.security.openeuicc";
|
2023-08-21 16:49:51 -04:00
|
|
|
+ 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) {
|
2023-08-26 15:05:28 -04:00
|
|
|
+ case OPENEUICC_PKG_NAME:
|
|
|
|
+ if (userId == UserHandle.USER_SYSTEM && SystemProperties.getBoolean(OPENEUICC_TOGGLE, false)) {
|
|
|
|
+ return PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
|
|
|
|
+ } else {
|
|
|
|
+ return PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
|
|
|
|
+ }
|
2023-08-21 16:49:51 -04:00
|
|
|
+ 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;
|
|
|
|
}
|
2023-08-26 15:05:28 -04:00
|
|
|
@@ -30,6 +50,16 @@ public class PackageManagerHooks {
|
2023-08-21 16:49:51 -04:00
|
|
|
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);
|
2023-08-26 15:05:28 -04:00
|
|
|
+ return;
|
|
|
|
+ case OPENEUICC_PKG_NAME:
|
|
|
|
+ // this is the same as android:enabled="false" in <application> AndroidManifest tag,
|
|
|
|
+ // it makes the package disabled by default on first boot, when there's no
|
|
|
|
+ // serialized package state
|
2023-08-30 13:46:07 -04:00
|
|
|
+ pkg.setEnabled(SystemProperties.getBoolean(OPENEUICC_TOGGLE, false));
|
2023-08-21 16:49:51 -04:00
|
|
|
+ return;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2023-08-26 15:05:28 -04:00
|
|
|
@@ -86,5 +116,6 @@ public class PackageManagerHooks {
|
2023-08-21 16:49:51 -04:00
|
|
|
|
|
|
|
// Packages in this array are restricted from interacting with and being interacted by non-system apps
|
|
|
|
private static final ArraySet<String> restrictedVisibilityPackages = new ArraySet<>(new String[] {
|
|
|
|
+ EUICC_SUPPORT_PIXEL_PKG_NAME,
|
|
|
|
});
|
|
|
|
}
|