Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a3158b8 authored by Andrew Sapperstein's avatar Andrew Sapperstein
Browse files

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
parent 0b31d6c0
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -4267,6 +4267,10 @@
    (default 2MB) -->
    (default 2MB) -->
    <integer name="config_notificationStripRemoteViewSizeBytes">2000000</integer>
    <integer name="config_notificationStripRemoteViewSizeBytes">2000000</integer>


    <!-- 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 -->
    <!-- Sharesheet: define a max number of targets per application for new shortcuts-based direct share introduced in Q -->
    <integer name="config_maxShortcutTargetsPerApp">3</integer>
    <integer name="config_maxShortcutTargetsPerApp">3</integer>


+1 −0
Original line number Original line Diff line number Diff line
@@ -3835,6 +3835,7 @@


  <java-symbol type="string" name="config_defaultSupervisionProfileOwnerComponent" />
  <java-symbol type="string" name="config_defaultSupervisionProfileOwnerComponent" />
  <java-symbol type="bool" name="config_inflateSignalStrength" />
  <java-symbol type="bool" name="config_inflateSignalStrength" />
  <java-symbol type="array" name="config_restrictedPreinstalledCarrierApps" />


  <java-symbol type="drawable" name="android_logotype" />
  <java-symbol type="drawable" name="android_logotype" />
  <java-symbol type="layout" name="platlogo_layout" />
  <java-symbol type="layout" name="platlogo_layout" />
+9 −3
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.ContentResolver;
import android.content.pm.ApplicationInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.RemoteException;
import android.os.RemoteException;
import android.permission.IPermissionManager;
import android.permission.IPermissionManager;
import android.provider.Settings;
import android.provider.Settings;
@@ -29,7 +30,9 @@ import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.ArraySet;
import android.util.Slog;
import android.util.Slog;


import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ArrayUtils;
import com.android.server.SystemConfig;
import com.android.server.SystemConfig;


import java.util.ArrayList;
import java.util.ArrayList;
@@ -143,9 +146,12 @@ public final class CarrierAppUtils {
        try {
        try {
            for (ApplicationInfo ai : candidates) {
            for (ApplicationInfo ai : candidates) {
                String packageName = ai.packageName;
                String packageName = ai.packageName;
                boolean hasPrivileges = telephonyManager != null &&
                String[] restrictedCarrierApps = Resources.getSystem().getStringArray(
                        telephonyManager.checkCarrierPrivilegesForPackageAnyPhone(packageName) ==
                        R.array.config_restrictedPreinstalledCarrierApps);
                                TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
                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
                // add hiddenUntilInstalled flag for carrier apps and associated apps
                packageManager.setSystemAppHiddenUntilInstalled(packageName, true);
                packageManager.setSystemAppHiddenUntilInstalled(packageName, true);