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

Commit 59d3d7e5 authored by Daniel Bright's avatar Daniel Bright Committed by Gerrit Code Review
Browse files

Merge "Add CAPABILITY_ALLOWED_NETWORK_TYPES_USED"

parents c047965e df48db04
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -2151,6 +2151,13 @@ public interface CommandsInterface {
     */
     */
    int getRilVersion();
    int getRilVersion();


    /**
     * @return the radio hal version
     */
    default HalVersion getHalVersion() {
        return HalVersion.UNKNOWN;
    }

   /**
   /**
     * Sets user selected subscription at Modem.
     * Sets user selected subscription at Modem.
     *
     *
+10 −9
Original line number Original line Diff line number Diff line
@@ -31,9 +31,9 @@ import android.os.RegistrantList;
import android.os.storage.StorageManager;
import android.os.storage.StorageManager;
import android.sysprop.TelephonyProperties;
import android.sysprop.TelephonyProperties;
import android.telephony.PhoneCapability;
import android.telephony.PhoneCapability;
import android.telephony.RadioInterfaceCapabilities;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.util.ArraySet;
import android.util.Log;
import android.util.Log;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
@@ -42,6 +42,7 @@ import com.android.telephony.Rlog;
import java.util.HashMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.NoSuchElementException;
import java.util.Set;


/**
/**
 * This class manages phone's configuration which defines the potential capability (static) of the
 * This class manages phone's configuration which defines the potential capability (static) of the
@@ -73,7 +74,7 @@ public class PhoneConfigurationManager {
    private MockableInterface mMi = new MockableInterface();
    private MockableInterface mMi = new MockableInterface();
    private TelephonyManager mTelephonyManager;
    private TelephonyManager mTelephonyManager;
    private static final RegistrantList sMultiSimConfigChangeRegistrants = new RegistrantList();
    private static final RegistrantList sMultiSimConfigChangeRegistrants = new RegistrantList();
    private RadioInterfaceCapabilities mRadioInterfaceCapabilities;
    private Set<String> mRadioInterfaceCapabilities;
    private final Object mLockRadioInterfaceCapabilities = new Object();
    private final Object mLockRadioInterfaceCapabilities = new Object();


    /**
    /**
@@ -101,7 +102,7 @@ public class PhoneConfigurationManager {
        mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        //initialize with default, it'll get updated when RADIO is ON/AVAILABLE
        //initialize with default, it'll get updated when RADIO is ON/AVAILABLE
        mStaticCapability = getDefaultCapability();
        mStaticCapability = getDefaultCapability();
        mRadioConfig = RadioConfig.getInstance(mContext);
        mRadioConfig = RadioConfig.getInstance();
        mHandler = new ConfigManagerHandler();
        mHandler = new ConfigManagerHandler();
        mPhoneStatusMap = new HashMap<>();
        mPhoneStatusMap = new HashMap<>();


@@ -318,7 +319,7 @@ public class PhoneConfigurationManager {
     * Gets the radio interface capabilities for the device
     * Gets the radio interface capabilities for the device
     */
     */
    @NonNull
    @NonNull
    public synchronized RadioInterfaceCapabilities getRadioInterfaceCapabilities() {
    public synchronized Set<String> getRadioInterfaceCapabilities() {
        if (mRadioInterfaceCapabilities == null) {
        if (mRadioInterfaceCapabilities == null) {
            // Only incur cost of synchronization block if mRadioInterfaceCapabilities isn't null
            // Only incur cost of synchronization block if mRadioInterfaceCapabilities isn't null
            synchronized (mLockRadioInterfaceCapabilities) {
            synchronized (mLockRadioInterfaceCapabilities) {
@@ -338,8 +339,9 @@ public class PhoneConfigurationManager {
                }
                }
            }
            }
        }
        }
        if (mRadioInterfaceCapabilities == null) return new RadioInterfaceCapabilities();

        else return mRadioInterfaceCapabilities;
        if (mRadioInterfaceCapabilities == null) return new ArraySet<>();
        return mRadioInterfaceCapabilities;
    }
    }


    private void setupRadioInterfaceCapabilities(@NonNull AsyncResult ar) {
    private void setupRadioInterfaceCapabilities(@NonNull AsyncResult ar) {
@@ -351,8 +353,7 @@ public class PhoneConfigurationManager {
                    }
                    }
                    log("setupRadioInterfaceCapabilities: "
                    log("setupRadioInterfaceCapabilities: "
                            + "mRadioInterfaceCapabilities now setup");
                            + "mRadioInterfaceCapabilities now setup");

                    mRadioInterfaceCapabilities = (Set<String>) ar.result;
                    mRadioInterfaceCapabilities = (RadioInterfaceCapabilities) ar.result;
                }
                }
                mLockRadioInterfaceCapabilities.notify();
                mLockRadioInterfaceCapabilities.notify();
            }
            }
+4 −0
Original line number Original line Diff line number Diff line
@@ -173,6 +173,10 @@ public class PhoneFactory {
                    sCommandsInterfaces[i] = new RIL(context, networkModes[i],
                    sCommandsInterfaces[i] = new RIL(context, networkModes[i],
                            cdmaSubscription, i);
                            cdmaSubscription, i);
                }
                }
                HalVersion radioHalVersion;
                if (numPhones > 0) radioHalVersion = sCommandsInterfaces[0].getHalVersion();
                else radioHalVersion = HalVersion.UNKNOWN;
                RadioConfig.make(context, radioHalVersion);


                // Instantiate UiccController so that all other classes can just
                // Instantiate UiccController so that all other classes can just
                // call getInstance()
                // call getInstance()
+1 −1
Original line number Original line Diff line number Diff line
@@ -360,7 +360,7 @@ public class PhoneSwitcher extends Handler {
        mLocalLog = new LocalLog(MAX_LOCAL_LOG_LINES);
        mLocalLog = new LocalLog(MAX_LOCAL_LOG_LINES);


        mSubscriptionController = SubscriptionController.getInstance();
        mSubscriptionController = SubscriptionController.getInstance();
        mRadioConfig = RadioConfig.getInstance(mContext);
        mRadioConfig = RadioConfig.getInstance();
        mValidator = CellularNetworkValidator.getInstance();
        mValidator = CellularNetworkValidator.getInstance();


        mActivePhoneRegistrants = new RegistrantList();
        mActivePhoneRegistrants = new RegistrantList();
+28 −10
Original line number Original line Diff line number Diff line
@@ -21,8 +21,7 @@ import static com.android.internal.telephony.RILConstants.REQUEST_NOT_SUPPORTED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_HAL_DEVICE_CAPABILITIES;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_HAL_DEVICE_CAPABILITIES;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_PHONE_CAPABILITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_PHONE_CAPABILITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SLOT_STATUS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SLOT_STATUS;
import static com.android.internal.telephony.RILConstants
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_LOGICAL_TO_PHYSICAL_SLOT_MAPPING;
        .RIL_REQUEST_SET_LOGICAL_TO_PHYSICAL_SLOT_MAPPING;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_DATA_MODEM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_DATA_MODEM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SWITCH_DUAL_SIM_CONFIG;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SWITCH_DUAL_SIM_CONFIG;


@@ -39,7 +38,6 @@ import android.os.Message;
import android.os.Registrant;
import android.os.Registrant;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.WorkSource;
import android.os.WorkSource;
import android.telephony.RadioInterfaceCapabilities;
import android.util.SparseArray;
import android.util.SparseArray;


import com.android.internal.telephony.uicc.IccSlotStatus;
import com.android.internal.telephony.uicc.IccSlotStatus;
@@ -80,6 +78,7 @@ public class RadioConfig extends Handler {
    /* default work source which will blame phone process */
    /* default work source which will blame phone process */
    private final WorkSource mDefaultWorkSource;
    private final WorkSource mDefaultWorkSource;
    private static RadioConfig sRadioConfig;
    private static RadioConfig sRadioConfig;
    private static final Object sLock = new Object();


    protected Registrant mSimSlotStatusRegistrant;
    protected Registrant mSimSlotStatusRegistrant;


@@ -92,12 +91,12 @@ public class RadioConfig extends Handler {
        }
        }
    }
    }


    private RadioConfig(Context context) {
    private RadioConfig(Context context, HalVersion radioHalVersion) {
        ConnectivityManager cm = (ConnectivityManager) context.getSystemService(
        ConnectivityManager cm = (ConnectivityManager) context.getSystemService(
                Context.CONNECTIVITY_SERVICE);
                Context.CONNECTIVITY_SERVICE);
        mIsMobileNetworkSupported = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);
        mIsMobileNetworkSupported = cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE);


        mRadioConfigResponse = new RadioConfigResponse(this);
        mRadioConfigResponse = new RadioConfigResponse(this, radioHalVersion);
        mRadioConfigIndication = new RadioConfigIndication(this);
        mRadioConfigIndication = new RadioConfigIndication(this);
        mServiceDeathRecipient = new ServiceDeathRecipient();
        mServiceDeathRecipient = new ServiceDeathRecipient();


@@ -108,12 +107,28 @@ public class RadioConfig extends Handler {
    /**
    /**
     * Returns the singleton static instance of RadioConfig
     * Returns the singleton static instance of RadioConfig
     */
     */
    public static RadioConfig getInstance(Context context) {
    public static RadioConfig getInstance() {
        synchronized (sLock) {
            if (sRadioConfig == null) {
            if (sRadioConfig == null) {
            sRadioConfig = new RadioConfig(context);
                throw new RuntimeException(
                        "RadioConfig.getInstance can't be called before make()");
            }
            }
            return sRadioConfig;
            return sRadioConfig;
        }
        }
    }

    /**
     * Makes the radio config based on the context and the radio hal version passed in
     */
    public static RadioConfig make(Context c, HalVersion radioHalVersion) {
        synchronized (sLock) {
            if (sRadioConfig != null) {
                throw new RuntimeException("RadioConfig.make() should only be called once");
            }
            sRadioConfig = new RadioConfig(c, radioHalVersion);
            return sRadioConfig;
        }
    }


    @Override
    @Override
    public void handleMessage(Message message) {
    public void handleMessage(Message message) {
@@ -527,7 +542,10 @@ public class RadioConfig extends Handler {
                if (DBG) {
                if (DBG) {
                    logd("RIL_REQUEST_GET_HAL_DEVICE_CAPABILITIES > REQUEST_NOT_SUPPORTED");
                    logd("RIL_REQUEST_GET_HAL_DEVICE_CAPABILITIES > REQUEST_NOT_SUPPORTED");
                }
                }
                AsyncResult.forMessage(result, new RadioInterfaceCapabilities() /* send empty */,
                AsyncResult.forMessage(result,
                        /* Send response such that all capabilities are supported (depending on
                           the hal version of course.) */
                        mRadioConfigResponse.getFullCapabilitySet(),
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
                result.sendToTarget();
            } else {
            } else {
Loading