android.telephony.CarrierConfigManager Java Examples

The following examples show how to use android.telephony.CarrierConfigManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TelecomLoaderService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private void registerCarrierConfigChangedReceiver() {
    final PackageManagerInternal packageManagerInternal = LocalServices.getService(
            PackageManagerInternal.class);
    BroadcastReceiver receiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent.getAction().equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
                for (int userId : UserManagerService.getInstance().getUserIds()) {
                    updateSimCallManagerPermissions(packageManagerInternal, userId);
                }
            }
        }
    };

    mContext.registerReceiverAsUser(receiver, UserHandle.ALL,
        new IntentFilter(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED), null, null);
}
 
Example #2
Source File: GnssLocationProvider.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void subscriptionOrSimChanged(Context context) {
    if (DEBUG) Log.d(TAG, "received SIM related action: ");
    TelephonyManager phone = (TelephonyManager)
            mContext.getSystemService(Context.TELEPHONY_SERVICE);
    CarrierConfigManager configManager = (CarrierConfigManager)
            mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
    String mccMnc = phone.getSimOperator();
    boolean isKeepLppProfile = false;
    if (!TextUtils.isEmpty(mccMnc)) {
        if (DEBUG) Log.d(TAG, "SIM MCC/MNC is available: " + mccMnc);
        synchronized (mLock) {
            if (configManager != null) {
                PersistableBundle b = configManager.getConfig();
                if (b != null) {
                    isKeepLppProfile =
                            b.getBoolean(CarrierConfigManager.KEY_PERSIST_LPP_MODE_BOOL);
                }
            }
            if (isKeepLppProfile) {
                // load current properties for the carrier
                loadPropertiesFromResource(context, mProperties);
                String lpp_profile = mProperties.getProperty("LPP_PROFILE");
                // set the persist property LPP_PROFILE for the value
                if (lpp_profile != null) {
                    SystemProperties.set(LPP_PROFILE, lpp_profile);
                }
            } else {
                // reset the persist property
                SystemProperties.set(LPP_PROFILE, "");
            }
            reloadGpsProperties(context, mProperties);
            mNIHandler.setSuplEsEnabled(mSuplEsEnabled);
        }
    } else {
        if (DEBUG) Log.d(TAG, "SIM MCC/MNC is still not available");
    }
}
 
Example #3
Source File: Tethering.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private boolean carrierConfigAffirmsEntitlementCheckNotRequired() {
    // Check carrier config for entitlement checks
    final CarrierConfigManager configManager = (CarrierConfigManager) mContext
         .getSystemService(Context.CARRIER_CONFIG_SERVICE);
    if (configManager == null) return false;

    final PersistableBundle carrierConfig = configManager.getConfig();
    if (carrierConfig == null) return false;

    // A CarrierConfigManager was found and it has a config.
    final boolean isEntitlementCheckRequired = carrierConfig.getBoolean(
            CarrierConfigManager.KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL);
    return !isEntitlementCheckRequired;
}
 
Example #4
Source File: MmsManager.java    From weMessage with GNU Affero General Public License v3.0 5 votes vote down vote up
public MmsManager(weMessage app){
    this.app = app;

    try {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            CarrierConfigManager carrierConfigManager = (CarrierConfigManager) app.getSystemService(Context.CARRIER_CONFIG_SERVICE);
            weMessage.MAX_MMS_ATTACHMENT_SIZE = carrierConfigManager.getConfig().getInt(CarrierConfigManager.KEY_MMS_MAX_MESSAGE_SIZE_INT);
        } else {
            MmsConfig.init(app);
            weMessage.MAX_MMS_ATTACHMENT_SIZE = MmsConfig.getMaxMessageSize();
        }
    }catch (Exception ex){
        AppLogger.error("Could not fetch maximum SMS size, defaulting to 10MB", ex);
    }
}
 
Example #5
Source File: SystemServiceRegistry.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@Override
public CarrierConfigManager createService(ContextImpl ctx) {
    return new CarrierConfigManager();
}
 
Example #6
Source File: ServiceUtil.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
@TargetApi(23)
public static CarrierConfigManager getCarrierConfigManager() {
    return (CarrierConfigManager) getSystemService(Context.CARRIER_CONFIG_SERVICE);
}