Merge "Add a blacklist for preinstalled carrier apps." into qt-dev am: aa3689c4d9

am: 386126a450

Change-Id: I71c331bb025b0c0786d5bfb6f46e760ef3d8aa54
This commit is contained in:
Andrew Sapperstein
2019-08-08 14:40:05 -07:00
committed by android-build-merger
3 changed files with 14 additions and 3 deletions

View File

@@ -4241,6 +4241,10 @@
one bar higher than they actually are --> one bar higher than they actually are -->
<bool name="config_inflateSignalStrength">false</bool> <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 --> <!-- 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>

View File

@@ -3827,6 +3827,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="array" name="config_highRefreshRateBlacklist" /> <java-symbol type="array" name="config_highRefreshRateBlacklist" />

View File

@@ -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.provider.Settings; import android.provider.Settings;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
@@ -28,7 +29,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;
@@ -140,9 +143,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);