public final class CarrierAppUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
disableCarrierAppsUntilPrivileged(String callingPackage,
IPackageManager packageManager,
ContentResolver contentResolver,
int userId)
Like
disableCarrierAppsUntilPrivileged(String, IPackageManager, TelephonyManager,
ContentResolver, int) , but assumes that no carrier apps have carrier privileges. |
static void |
disableCarrierAppsUntilPrivileged(String callingPackage,
IPackageManager packageManager,
TelephonyManager telephonyManager,
ContentResolver contentResolver,
int userId)
Handle preinstalled carrier apps which should be disabled until a matching SIM is inserted.
|
static void |
disableCarrierAppsUntilPrivileged(String callingPackage,
IPackageManager packageManager,
TelephonyManager telephonyManager,
ContentResolver contentResolver,
int userId,
String[] systemCarrierAppsDisabledUntilUsed,
ArrayMap<String,List<String>> systemCarrierAssociatedAppsDisabledUntilUsed) |
static List<ApplicationInfo> |
getDefaultCarrierAppCandidates(IPackageManager packageManager,
int userId)
Returns the list of "default" carrier app candidates.
|
static List<ApplicationInfo> |
getDefaultCarrierApps(IPackageManager packageManager,
TelephonyManager telephonyManager,
int userId)
Returns the list of "default" carrier apps.
|
public static void disableCarrierAppsUntilPrivileged(String callingPackage, IPackageManager packageManager, TelephonyManager telephonyManager, ContentResolver contentResolver, int userId)
SystemConfig.getDisabledUntilUsedPreinstalledCarrierAssociatedApps()
. Each app in this
list is associated with a carrier app. When the given carrier app is enabled/disabled per the
above, the associated applications are enabled/disabled to match.
When enabling a carrier app we also grant it default permissions.
This method is idempotent and is safe to be called at any time; it should be called once at
system startup prior to any application running, as well as any time the set of carrier
privileged apps may have changed.public static void disableCarrierAppsUntilPrivileged(String callingPackage, IPackageManager packageManager, ContentResolver contentResolver, int userId)
disableCarrierAppsUntilPrivileged(String, IPackageManager, TelephonyManager,
ContentResolver, int)
, but assumes that no carrier apps have carrier privileges.
This prevents a potential race condition on first boot - since the app's default state is
enabled, we will initially disable it when the telephony stack is first initialized as it has
not yet read the carrier privilege rules. However, since telephony is initialized later on
late in boot, the app being disabled may have already been started in response to certain
broadcasts. The app will continue to run (briefly) after being disabled, before the Package
Manager can kill it, and this can lead to crashes as the app is in an unexpected state.public static void disableCarrierAppsUntilPrivileged(String callingPackage, IPackageManager packageManager, TelephonyManager telephonyManager, ContentResolver contentResolver, int userId, String[] systemCarrierAppsDisabledUntilUsed, ArrayMap<String,List<String>> systemCarrierAssociatedAppsDisabledUntilUsed)
public static List<ApplicationInfo> getDefaultCarrierApps(IPackageManager packageManager, TelephonyManager telephonyManager, int userId)
getDefaultCarrierAppCandidates(IPackageManager, int)
which currently have carrier
privileges per the SIM(s) inserted in the device.public static List<ApplicationInfo> getDefaultCarrierAppCandidates(IPackageManager packageManager, int userId)
disableCarrierAppsUntilPrivileged(String, IPackageManager,
TelephonyManager, ContentResolver, int)
, as well as the apps which should have default
permissions granted, when a matching SIM is inserted.
Whether or not the app is actually considered a default app depends on whether the app has
carrier privileges as determined by the SIMs in the device.