From 18928e90698e91d3491d73de8b2fa5ba6799f8e0 Mon Sep 17 00:00:00 2001 From: goneil Date: Wed, 28 Feb 2018 15:22:08 -0800 Subject: [PATCH] Migrate from config.xml to SystemConfig for disabled carrier apps Move config_disabledUntilUsedPreinstalledCarrierApps from config.xml to system config for pixel/nexus devices Bug: 72999375 Test: Ensure Fi is disabled by default and enabled once the Fi SIM is inserted Change-Id: I594744f0cacdfefe20873118827fda501ec199fb (cherry picked from commit eb31cd4bfed5ed23560d6618210c2ff8988ac25b) --- .../java/com/android/server/SystemConfig.java | 30 ++++++++++++- core/res/res/values/config.xml | 13 ------ core/res/res/values/symbols.xml | 1 - .../internal/telephony/CarrierAppUtils.java | 43 +++++++++++-------- 4 files changed, 55 insertions(+), 32 deletions(-) diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java index c71e505c6790e..c5be8e4a3aba6 100644 --- a/core/java/com/android/server/SystemConfig.java +++ b/core/java/com/android/server/SystemConfig.java @@ -142,12 +142,24 @@ public class SystemConfig { // Package names that are exempted from private API blacklisting final ArraySet mHiddenApiPackageWhitelist = new ArraySet<>(); + // The list of carrier applications which should be disabled until used. + // This function suppresses update notifications for these pre-installed apps. + // In SubscriptionInfoUpdater, the listed applications are disabled until used when all of the + // following conditions are met. + // 1. Not currently carrier-privileged according to the inserted SIM + // 2. Pre-installed + // 3. In the default state (enabled but not explicitly) + // And SubscriptionInfoUpdater undoes this and marks the app enabled when a SIM is inserted + // that marks the app as carrier privileged. It also grants the app default permissions + // for Phone and Location. As such, apps MUST only ever be added to this list if they + // obtain user consent to access their location through other means. + final ArraySet mDisabledUntilUsedPreinstalledCarrierApps = new ArraySet<>(); + // These are the packages of carrier-associated apps which should be disabled until used until // a SIM is inserted which grants carrier privileges to that carrier app. final ArrayMap> mDisabledUntilUsedPreinstalledCarrierAssociatedApps = new ArrayMap<>(); - final ArrayMap> mPrivAppPermissions = new ArrayMap<>(); final ArrayMap> mPrivAppDenyPermissions = new ArrayMap<>(); @@ -232,6 +244,10 @@ public class SystemConfig { return mBackupTransportWhitelist; } + public ArraySet getDisabledUntilUsedPreinstalledCarrierApps() { + return mDisabledUntilUsedPreinstalledCarrierApps; + } + public ArrayMap> getDisabledUntilUsedPreinstalledCarrierAssociatedApps() { return mDisabledUntilUsedPreinstalledCarrierAssociatedApps; } @@ -630,6 +646,18 @@ public class SystemConfig { associatedPkgs.add(pkgname); } XmlUtils.skipCurrentTag(parser); + } else if ("disabled-until-used-preinstalled-carrier-app".equals(name) + && allowAppConfigs) { + String pkgname = parser.getAttributeValue(null, "package"); + if (pkgname == null) { + Slog.w(TAG, + " without " + + "package in " + permFile + " at " + + parser.getPositionDescription()); + } else { + mDisabledUntilUsedPreinstalledCarrierApps.add(pkgname); + } + XmlUtils.skipCurrentTag(parser); } else if ("privapp-permissions".equals(name) && allowPrivappPermissions) { // privapp permissions from system, vendor and product partitions are stored // separately. This is to prevent xml files in the vendor partition from diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index cf13d1c63db57..fb9d8f85d4111 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2365,19 +2365,6 @@ com.android.inputmethod.latin - - -