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

Commit c6a8a641 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by Gerrit Code Review
Browse files

Merge changes from topic "getDeviceCapableModemCount"

* changes:
  Rename and publicize getMaxPhoneCount; and deprecate getPhoneCount.
  Broadcast ACTION_MULTI_SIM_CONFIG_CHANGED upon ss <-> ds switch.
parents 3e138b39 32fc480e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public class CarrierServiceBindHelper {
    public CarrierServiceBindHelper(Context context) {
        mContext = context;

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

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

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

+12 −0
Original line number Diff line number Diff line
@@ -16,7 +16,11 @@

package com.android.internal.telephony;

import static android.telephony.TelephonyManager.ACTION_MULTI_SIM_CONFIG_CHANGED;
import static android.telephony.TelephonyManager.EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED;

import android.content.Context;
import android.content.Intent;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
@@ -378,6 +382,7 @@ public class PhoneConfigurationManager {
        } else {
            log("setMultiSimProperties: Rebooting is not required to switch multi-sim config to "
                    + finalMultiSimConfig);
            broadcastSimSlotNumChange(numOfSims);
            // Register to RIL service if needed.
            for (int i = 0; i < mPhones.length; i++) {
                Phone phone = mPhones[i];
@@ -386,6 +391,13 @@ public class PhoneConfigurationManager {
        }
    }

    private void broadcastSimSlotNumChange(int numOfSims) {
        log("broadcastSimSlotNumChange numOfSims" + numOfSims);
        Intent intent = new Intent(ACTION_MULTI_SIM_CONFIG_CHANGED);
        intent.putExtra(EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED, numOfSims);
        mContext.sendBroadcast(intent);
    }

    private static void log(String s) {
        Rlog.d(LOG_TAG, s);
    }
+1 −1
Original line number 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,
                   where as in single SIM mode only instance. isMultiSimEnabled() function checks
                   whether it is single SIM or multi SIM mode */
                int numPhones = TelephonyManager.getDefault().getMaxPhoneCount();
                int numPhones = TelephonyManager.getDefault().getSupportedModemCount();

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

        if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getMaxPhoneCount()) {
        if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) {
            mPhones[phoneId].unregisterForAllDataDisconnected(h);
        }
    }
@@ -168,7 +168,7 @@ public class ProxyController {
    public boolean areAllDataDisconnected(int 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();
        } else {
            // if we can't find a phone for the given subId, it is disconnected.
Loading