Search in sources :

Example 21 with Phone

use of com.android.internal.telephony.Phone in project android_frameworks_opt_telephony by LineageOS.

the class VendorMultiSimSettingController method setUserDataEnabledForGroup.

/**
 * Make sure MOBILE_DATA of subscriptions in the same group with the subId
 * are synced.
 */
@Override
protected synchronized void setUserDataEnabledForGroup(int subId, boolean enable) {
    log("setUserDataEnabledForGroup subId " + subId + " enable " + enable);
    List<SubscriptionInfo> infoList = mSubController.getSubscriptionsInGroup(mSubController.getGroupUuid(subId), mContext.getOpPackageName(), null);
    if (infoList == null)
        return;
    for (SubscriptionInfo info : infoList) {
        int currentSubId = info.getSubscriptionId();
        if (currentSubId == subId)
            continue;
        // TODO: simplify when setUserDataEnabled becomes singleton
        if (mSubController.isActiveSubId(currentSubId)) {
            // For active subscription, call setUserDataEnabled through DataEnabledSettings.
            Phone phone = PhoneFactory.getPhone(mSubController.getPhoneId(currentSubId));
            if (phone != null) {
                phone.getDataEnabledSettings().setUserDataEnabled(enable);
            }
        } else {
            // For inactive subscription, directly write into global settings.
            GlobalSettingsHelper.setBoolean(mContext, Settings.Global.MOBILE_DATA, currentSubId, enable);
        }
    }
}
Also used : Phone(com.android.internal.telephony.Phone) SubscriptionInfo(android.telephony.SubscriptionInfo)

Aggregations

Phone (com.android.internal.telephony.Phone)21 PhoneStateListener (android.telephony.PhoneStateListener)7 ServiceState (android.telephony.ServiceState)7 SignalStrength (android.telephony.SignalStrength)7 ContentValues (android.content.ContentValues)1 AsyncResult (android.os.AsyncResult)1 PersistableBundle (android.os.PersistableBundle)1 CarrierConfigManager (android.telephony.CarrierConfigManager)1 SubscriptionInfo (android.telephony.SubscriptionInfo)1 StatsEvent (android.util.StatsEvent)1 VisibleForTesting (com.android.internal.annotations.VisibleForTesting)1 SubscriptionController (com.android.internal.telephony.SubscriptionController)1