Add a blacklist for preinstalled carrier apps.
Allows an OEM to specify that a preinstalled carrier app, even if TelephonyManager says it should have carrier privileges, does not get granted the default permissions and does not get enabled when a compatible SIM is inserted. Bug: 138150105 Test: verified locally Change-Id: I0afec28f1f18227947c1fe9e6bb5fd0dad3b5dac Merged-In: I0afec28f1f18227947c1fe9e6bb5fd0dad3b5dac
This commit is contained in:
@@ -4143,6 +4143,10 @@
|
||||
one bar higher than they actually are -->
|
||||
<bool name="config_inflateSignalStrength">false</bool>
|
||||
|
||||
<!-- Contains a blacklist of apps that should not get pre-installed carrier app permission
|
||||
grants, even if the UICC claims that the app should be privileged. See b/138150105 -->
|
||||
<string-array name="config_restrictedPreinstalledCarrierApps" translatable="false"/>
|
||||
|
||||
<!-- Sharesheet: define a max number of targets per application for new shortcuts-based direct share introduced in Q -->
|
||||
<integer name="config_maxShortcutTargetsPerApp">3</integer>
|
||||
</resources>
|
||||
|
||||
@@ -3813,6 +3813,7 @@
|
||||
|
||||
<java-symbol type="string" name="config_defaultSupervisionProfileOwnerComponent" />
|
||||
<java-symbol type="bool" name="config_inflateSignalStrength" />
|
||||
<java-symbol type="array" name="config_restrictedPreinstalledCarrierApps" />
|
||||
|
||||
<java-symbol type="drawable" name="android_logotype" />
|
||||
<java-symbol type="layout" name="platlogo_layout" />
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.content.ContentResolver;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.TelephonyManager;
|
||||
@@ -28,7 +29,9 @@ import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.R;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.server.SystemConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -140,9 +143,12 @@ public final class CarrierAppUtils {
|
||||
try {
|
||||
for (ApplicationInfo ai : candidates) {
|
||||
String packageName = ai.packageName;
|
||||
boolean hasPrivileges = telephonyManager != null &&
|
||||
telephonyManager.checkCarrierPrivilegesForPackageAnyPhone(packageName) ==
|
||||
TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
|
||||
String[] restrictedCarrierApps = Resources.getSystem().getStringArray(
|
||||
R.array.config_restrictedPreinstalledCarrierApps);
|
||||
boolean hasPrivileges = telephonyManager != null
|
||||
&& telephonyManager.checkCarrierPrivilegesForPackageAnyPhone(packageName)
|
||||
== TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS
|
||||
&& !ArrayUtils.contains(restrictedCarrierApps, packageName);
|
||||
|
||||
// add hiddenUntilInstalled flag for carrier apps and associated apps
|
||||
packageManager.setSystemAppHiddenUntilInstalled(packageName, true);
|
||||
|
||||
Reference in New Issue
Block a user