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

Commit 94e6ba2f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Merge tag 'android-6.0.0_r26' into HEAD"

parents 5fd017a6 9c00d8ed
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@ public interface Phone {
    int NT_MODE_LTE_CDMA_EVDO_GSM_WCDMA  = RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA;
    int NT_MODE_LTE_ONLY                 = RILConstants.NETWORK_MODE_LTE_ONLY;
    int NT_MODE_LTE_WCDMA                = RILConstants.NETWORK_MODE_LTE_WCDMA;

    int PREFERRED_NT_MODE                = RILConstants.PREFERRED_NETWORK_MODE;

    int NT_MODE_TD_SCDMA_ONLY            = RILConstants.NETWORK_MODE_TD_SCDMA_ONLY;
@@ -1172,8 +1173,7 @@ public interface Phone {
     *
     * @see #setNetworkSelectionModeAutomatic(Message)
     */
    void selectNetworkManually(OperatorInfo network,
                            Message response);
    void selectNetworkManually(OperatorInfo network, boolean persistSelection, Message response);

    /**
     * Query the radio for the current network selection mode.
@@ -2017,6 +2017,11 @@ public interface Phone {
     */
    public void shutdownRadio();

    /**
     * Return true if the device is shutting down.
     */
    public boolean isShuttingDown();

    /**
     *  Set phone radio capability
     *
+48 −4
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ public abstract class PhoneBase extends Handler implements Phone {
                if (intent.getAction().equals(ImsManager.ACTION_IMS_SERVICE_UP)) {
                    mImsServiceReady = true;
                    updateImsPhone();
                    ImsManager.updateImsServiceConfig(mContext, mPhoneId, false);
                } else if (intent.getAction().equals(ImsManager.ACTION_IMS_SERVICE_DOWN)) {
                    mImsServiceReady = false;
                    updateImsPhone();
@@ -515,6 +516,7 @@ public abstract class PhoneBase extends Handler implements Phone {
            if (imsManager != null && imsManager.isServiceAvailable()) {
                mImsServiceReady = true;
                updateImsPhone();
                ImsManager.updateImsServiceConfig(mContext, mPhoneId, false);
            }
        }
    }
@@ -810,6 +812,9 @@ public abstract class PhoneBase extends Handler implements Phone {
       mHandoverRegistrants.notifyRegistrants(ar);
    }

    protected void setIsInEmergencyCall() {
    }

    public void migrateFrom(PhoneBase from) {
        migrate(mHandoverRegistrants, from.mHandoverRegistrants);
        migrate(mPreciseCallStateRegistrants, from.mPreciseCallStateRegistrants);
@@ -821,6 +826,9 @@ public abstract class PhoneBase extends Handler implements Phone {
        migrate(mMmiRegistrants, from.mMmiRegistrants);
        migrate(mUnknownConnectionRegistrants, from.mUnknownConnectionRegistrants);
        migrate(mSuppServiceFailedRegistrants, from.mSuppServiceFailedRegistrants);
        if (from.isInEmergencyCall()) {
            setIsInEmergencyCall();
        }
    }

    public void migrate(RegistrantList to, RegistrantList from) {
@@ -1054,7 +1062,6 @@ public abstract class PhoneBase extends Handler implements Phone {
                AsyncResult.forMessage(response, null, null);
                response.sendToTarget();
            }

        }
    }

@@ -1064,7 +1071,8 @@ public abstract class PhoneBase extends Handler implements Phone {
    }

    @Override
    public void selectNetworkManually(OperatorInfo network, Message response) {
    public void selectNetworkManually(OperatorInfo network, boolean persistSelection,
            Message response) {
        // wrap the response message in our own message along with
        // the operator's id.
        NetworkSelectMessage nsm = new NetworkSelectMessage();
@@ -1081,7 +1089,11 @@ public abstract class PhoneBase extends Handler implements Phone {
                    + "+" + network.getRadioTech(), msg);
        }

        if (persistSelection) {
            updateSavedNetworkOperator(nsm);
        } else {
            clearSavedNetworkSelection();
        }
    }

    /**
@@ -1155,6 +1167,17 @@ public abstract class PhoneBase extends Handler implements Phone {
        return new OperatorInfo(numeric, name, shrt);
    }

    /**
     * Clears the saved network selection.
     */
    private void clearSavedNetworkSelection() {
        // open the shared preferences and search with our key.
        PreferenceManager.getDefaultSharedPreferences(getContext()).edit().
                remove(NETWORK_SELECTION_KEY + getSubId()).
                remove(NETWORK_SELECTION_NAME_KEY + getSubId()).
                remove(NETWORK_SELECTION_SHORT_KEY + getSubId()).commit();
    }

    /**
     * Method to restore the previously saved operator id, or reset to
     * automatic selection, all depending upon the value in the shared
@@ -1168,7 +1191,23 @@ public abstract class PhoneBase extends Handler implements Phone {
        if (networkSelection == null || TextUtils.isEmpty(networkSelection.getOperatorNumeric())) {
            setNetworkSelectionModeAutomatic(response);
        } else {
            selectNetworkManually(networkSelection, response);
            selectNetworkManually(networkSelection, true, response);
        }
    }

    /**
     * Saves CLIR setting so that we can re-apply it as necessary
     * (in case the RIL resets it across reboots).
     */
    public void saveClirSetting(int commandInterfaceCLIRMode) {
        // Open the shared preferences editor, and write the value.
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
        SharedPreferences.Editor editor = sp.edit();
        editor.putInt(CLIR_KEY + getPhoneId(), commandInterfaceCLIRMode);

        // Commit and log the result.
        if (!editor.commit()) {
            Rlog.e(LOG_TAG, "Failed to commit CLIR preference");
        }
    }

@@ -2501,6 +2540,11 @@ public abstract class PhoneBase extends Handler implements Phone {
        getServiceStateTracker().requestShutdown();
    }

    @Override
    public boolean isShuttingDown() {
        return getServiceStateTracker().isDeviceShuttingDown();
    }

    @Override
    public void setRadioCapability(RadioCapability rc, Message response) {
        mCi.setRadioCapability(rc, response);
+6 −2
Original line number Diff line number Diff line
@@ -165,11 +165,9 @@ public class PhoneFactory {
                    if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
                        phone = TelephonyPluginDelegate.getInstance().makeGSMPhone(context,
                                sCommandsInterfaces[i], sPhoneNotifier, i);
                        phone.startMonitoringImsService();
                    } else if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
                        phone = TelephonyPluginDelegate.getInstance().makeCDMALTEPhone(context,
                                sCommandsInterfaces[i], sPhoneNotifier, i);
                        phone.startMonitoringImsService();
                    }
                    Rlog.i(LOG_TAG, "Creating Phone with type = " + phoneType + " sub = " + i);

@@ -206,6 +204,12 @@ public class PhoneFactory {

                TelephonyPluginDelegate.getInstance().
                        initExtTelephonyClasses(context, sProxyPhones, sCommandsInterfaces);
                // Start monitoring after defaults have been made.
                // Default phone must be ready before ImsPhone is created
                // because ImsService might need it when it is being opened.
                for (int i = 0; i < numPhones; i++) {
                    sProxyPhones[i].startMonitoringImsService();
                }
            }
        }
    }
+41 −8
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;

import com.android.ims.ImsManager;
import com.android.internal.telephony.cdma.CDMAPhone;
import com.android.internal.telephony.gsm.GSMPhone;
import com.android.internal.telephony.imsphone.ImsPhone;
@@ -80,9 +81,20 @@ public class PhoneProxy extends Handler implements Phone {
    private static final int EVENT_SIM_RECORDS_LOADED = 6;
    private static final int EVENT_RADIO_AVAILABLE = 7;
    protected static final int EVENT_RADIO_UNAVAILABLE = 8;
    private static final int EVENT_CARRIER_CONFIG_CHANGED = 6;

    protected int mPhoneId = 0;

    private Context mContext;
    private BroadcastReceiver mPhoneProxyReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            Rlog.d(LOG_TAG, "mPhoneProxyReceiver: action " + intent.getAction());
            if (intent.getAction().equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
                sendMessage(obtainMessage(EVENT_CARRIER_CONFIG_CHANGED));
            }
        }
    };
    private static final String LOG_TAG = "PhoneProxy";

    //***** Class Methods
@@ -104,7 +116,8 @@ public class PhoneProxy extends Handler implements Phone {
        mPhoneId = phone.getPhoneId();
        mIccSmsInterfaceManager =
                new IccSmsInterfaceManager((PhoneBase)this.mActivePhone);
        mIccCardProxy = new IccCardProxy(mActivePhone.getContext(), mCommandsInterface, mActivePhone.getPhoneId());
        mContext = mActivePhone.getContext();
        mIccCardProxy = new IccCardProxy(mContext, mCommandsInterface, mActivePhone.getPhoneId());

        IntentFilter intentFilter =
                new IntentFilter(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
@@ -116,6 +129,9 @@ public class PhoneProxy extends Handler implements Phone {
        } else if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
            mIccCardProxy.setVoiceRadioTech(ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT);
        }

        mContext.registerReceiver(mPhoneProxyReceiver, new IntentFilter(
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
    }

    private final BroadcastReceiver sConfigChangeReceiver = new BroadcastReceiver() {
@@ -171,14 +187,16 @@ public class PhoneProxy extends Handler implements Phone {
            phoneObjectUpdater(msg.arg1);
            break;

        case EVENT_SIM_RECORDS_LOADED:
        case EVENT_CARRIER_CONFIG_CHANGED:
            // Only check for the voice radio tech if it not going to be updated by the voice
            // registration changes.
            if (!mActivePhone.getContext().getResources().getBoolean(
            if (mActivePhone != null && !mContext.getResources().getBoolean(
                    com.android.internal.R.bool.config_switch_phone_on_voice_reg_state_change)) {
                mCommandsInterface.getVoiceRadioTechnology(obtainMessage(
                        EVENT_REQUEST_VOICE_RADIO_TECH_DONE));
            }
            // Force update IMS service
            ImsManager.updateImsServiceConfig(mContext, mPhoneId, true);
            break;

        default:
@@ -237,6 +255,14 @@ public class PhoneProxy extends Handler implements Phone {
                    newVoiceRadioTech = ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT;
                }
            } else {

                // If the device is shutting down, then there is no need to switch to the new phone
                // which might send unnecessary attach request to the modem.
                if (isShuttingDown()) {
                    logd("Device is shutting down. No need to switch phone now.");
                    return;
                }

                boolean matchCdma = ServiceState.isCdma(newVoiceRadioTech);
                boolean matchGsm = ServiceState.isGsm(newVoiceRadioTech);
                if ((matchCdma  &&
@@ -309,7 +335,6 @@ public class PhoneProxy extends Handler implements Phone {

        if (oldPhone != null) {
            outgoingPhoneName = ((PhoneBase) oldPhone).getPhoneName();
            oldPhone.unregisterForSimRecordsLoaded(this);
        }

        logd("Switching Voice Phone : " + outgoingPhoneName + " >>> "
@@ -335,7 +360,6 @@ public class PhoneProxy extends Handler implements Phone {
                mActivePhone.acquireOwnershipOfImsPhone(imsPhone);
            }
            mActivePhone.startMonitoringImsService();
            mActivePhone.registerForSimRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
        }

        if (oldPhone != null) {
@@ -944,8 +968,9 @@ public class PhoneProxy extends Handler implements Phone {
    }

    @Override
    public void selectNetworkManually(OperatorInfo network, Message response) {
        mActivePhone.selectNetworkManually(network, response);
    public void selectNetworkManually(OperatorInfo network, boolean persistSelection,
            Message response) {
        mActivePhone.selectNetworkManually(network, persistSelection, response);
    }

    @Override
@@ -1393,6 +1418,7 @@ public class PhoneProxy extends Handler implements Phone {
        mCommandsInterface.unregisterForAvailable(this);
        mCommandsInterface.unregisterForVoiceRadioTechChanged(this);
        mCommandsInterface.unregisterForRilConnected(this);
        mContext.unregisterReceiver(mPhoneProxyReceiver);
    }

    @Override
@@ -1512,7 +1538,11 @@ public class PhoneProxy extends Handler implements Phone {
    public ImsPhone relinquishOwnershipOfImsPhone() { return null; }

    @Override
    public void startMonitoringImsService() {}
    public void startMonitoringImsService() {
        if (mActivePhone != null) {
            mActivePhone.startMonitoringImsService();
        }
    }

    @Override
    public void acquireOwnershipOfImsPhone(ImsPhone imsPhone) { }
@@ -1550,6 +1580,9 @@ public class PhoneProxy extends Handler implements Phone {
        mActivePhone.shutdownRadio();
    }

    @Override
    public boolean isShuttingDown() { return mActivePhone.isShuttingDown(); }

    @Override
    public void setRadioCapability(RadioCapability rc, Message response) {
        mActivePhone.setRadioCapability(rc, response);
+5 −0
Original line number Diff line number Diff line
@@ -1144,6 +1144,11 @@ public abstract class ServiceStateTracker extends Handler {
        return isInNetwork(b, network, CarrierConfigManager.KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY);
    }

    /** Check if the device is shutting down. */
    public final boolean isDeviceShuttingDown() {
        return mDeviceShuttingDown;
    }

    /**
     * Consider dataRegState if voiceRegState is OOS to determine SPN to be
     * displayed
Loading