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

Commit 32fc480e authored by Malcolm Chen's avatar Malcolm Chen
Browse files

Rename and publicize getMaxPhoneCount; and deprecate getPhoneCount.

To have better names reflecting what getPhoneCount / getMaxPhoneCount
actually represent, we replace them with getActiveModemCount and
getSupportedModemCount. As getPhoneCount is public API, we mark
it as @Deprecated.

Bug: 141388730
Test: build
Change-Id: I2a64309347407fb22d50bc93f61b9e6754a20cca
Merged-In: I2a64309347407fb22d50bc93f61b9e6754a20cca
parent 333fea1a
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -106,7 +106,7 @@ public class CarrierServiceBindHelper {
    public CarrierServiceBindHelper(Context context) {
    public CarrierServiceBindHelper(Context context) {
        mContext = context;
        mContext = context;


        int numPhones = TelephonyManager.from(context).getMaxPhoneCount();
        int numPhones = TelephonyManager.from(context).getSupportedModemCount();
        mBindings = new AppBinding[numPhones];
        mBindings = new AppBinding[numPhones];
        mLastSimState = new String[numPhones];
        mLastSimState = new String[numPhones];


+1 −1
Original line number Original line Diff line number Diff line
@@ -183,7 +183,7 @@ public class MultiSimSettingController extends Handler {


        // Initialize mCarrierConfigLoadedSubIds and register to listen to carrier config change.
        // Initialize mCarrierConfigLoadedSubIds and register to listen to carrier config change.
        final int phoneCount = ((TelephonyManager) mContext.getSystemService(
        final int phoneCount = ((TelephonyManager) mContext.getSystemService(
                Context.TELEPHONY_SERVICE)).getMaxPhoneCount();
                Context.TELEPHONY_SERVICE)).getSupportedModemCount();
        mCarrierConfigLoadedSubIds = new int[phoneCount];
        mCarrierConfigLoadedSubIds = new int[phoneCount];
        Arrays.fill(mCarrierConfigLoadedSubIds, SubscriptionManager.INVALID_SUBSCRIPTION_ID);
        Arrays.fill(mCarrierConfigLoadedSubIds, SubscriptionManager.INVALID_SUBSCRIPTION_ID);


+1 −1
Original line number Original line Diff line number Diff line
@@ -146,7 +146,7 @@ public class PhoneFactory {
                /* In case of multi SIM mode two instances of Phone, RIL are created,
                /* In case of multi SIM mode two instances of Phone, RIL are created,
                   where as in single SIM mode only instance. isMultiSimEnabled() function checks
                   where as in single SIM mode only instance. isMultiSimEnabled() function checks
                   whether it is single SIM or multi SIM mode */
                   whether it is single SIM or multi SIM mode */
                int numPhones = TelephonyManager.getDefault().getMaxPhoneCount();
                int numPhones = TelephonyManager.getDefault().getSupportedModemCount();


                int[] networkModes = new int[numPhones];
                int[] networkModes = new int[numPhones];
                sPhones = new Phone[numPhones];
                sPhones = new Phone[numPhones];
+3 −3
Original line number Original line Diff line number Diff line
@@ -151,7 +151,7 @@ public class ProxyController {
    public void registerForAllDataDisconnected(int subId, Handler h, int what) {
    public void registerForAllDataDisconnected(int subId, Handler h, int what) {
        int phoneId = SubscriptionController.getInstance().getPhoneId(subId);
        int phoneId = SubscriptionController.getInstance().getPhoneId(subId);


        if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getMaxPhoneCount()) {
        if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) {
            mPhones[phoneId].registerForAllDataDisconnected(h, what);
            mPhones[phoneId].registerForAllDataDisconnected(h, what);
        }
        }
    }
    }
@@ -159,7 +159,7 @@ public class ProxyController {
    public void unregisterForAllDataDisconnected(int subId, Handler h) {
    public void unregisterForAllDataDisconnected(int subId, Handler h) {
        int phoneId = SubscriptionController.getInstance().getPhoneId(subId);
        int phoneId = SubscriptionController.getInstance().getPhoneId(subId);


        if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getMaxPhoneCount()) {
        if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) {
            mPhones[phoneId].unregisterForAllDataDisconnected(h);
            mPhones[phoneId].unregisterForAllDataDisconnected(h);
        }
        }
    }
    }
@@ -168,7 +168,7 @@ public class ProxyController {
    public boolean areAllDataDisconnected(int subId) {
    public boolean areAllDataDisconnected(int subId) {
        int phoneId = SubscriptionController.getInstance().getPhoneId(subId);
        int phoneId = SubscriptionController.getInstance().getPhoneId(subId);


        if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getMaxPhoneCount()) {
        if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) {
            return mPhones[phoneId].areAllDataDisconnected();
            return mPhones[phoneId].areAllDataDisconnected();
        } else {
        } else {
            // if we can't find a phone for the given subId, it is disconnected.
            // if we can't find a phone for the given subId, it is disconnected.
+2 −1
Original line number Original line Diff line number Diff line
@@ -77,7 +77,8 @@ import java.util.List;
public class SubscriptionInfoUpdater extends Handler {
public class SubscriptionInfoUpdater extends Handler {
    private static final String LOG_TAG = "SubscriptionInfoUpdater";
    private static final String LOG_TAG = "SubscriptionInfoUpdater";
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    private static final int PROJECT_SIM_NUM = TelephonyManager.getDefault().getMaxPhoneCount();
    private static final int PROJECT_SIM_NUM = TelephonyManager.getDefault()
            .getSupportedModemCount();


    private static final boolean DBG = true;
    private static final boolean DBG = true;


Loading