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

Commit e36f59c8 authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Mark internally used functions private in GsmCdmaPhone.

Includes some (mostly cosmetic) code cleanup too.

Bug: 25793157
Change-Id: I8f0eb8b3ead18f29ca146637dca6ffd659a9f699
parent dd10548e
Loading
Loading
Loading
Loading
+1 −52
Original line number Diff line number Diff line
@@ -395,26 +395,7 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
    }

    /**
     * Convert the TelephonyManager.DATA_* constants into the {@link Phone.DataActivityState} enum
     * for the public API.
     */
    public static Phone.DataActivityState convertDataActivityState(int state) {
        switch (state) {
            case TelephonyManager.DATA_ACTIVITY_IN:
                return Phone.DataActivityState.DATAIN;
            case TelephonyManager.DATA_ACTIVITY_OUT:
                return Phone.DataActivityState.DATAOUT;
            case TelephonyManager.DATA_ACTIVITY_INOUT:
                return Phone.DataActivityState.DATAINANDOUT;
            case TelephonyManager.DATA_ACTIVITY_DORMANT:
                return Phone.DataActivityState.DORMANT;
            default:
                return Phone.DataActivityState.NONE;
        }
    }

    /**
     * Convert the {@link State} enum into the PreciseCallState.PRECISE_CALL_STATE_* constants
     * Convert the {@link Call.State} enum into the PreciseCallState.PRECISE_CALL_STATE_* constants
     * for the public API.
     */
    public static int convertPreciseCallState(Call.State state) {
@@ -440,38 +421,6 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        }
    }

    /**
     * Convert the Call.State.* constants into the {@link State} enum
     * for the public API.
     */
    public static Call.State convertPreciseCallState(int state) {
        switch (state) {
            case PreciseCallState.PRECISE_CALL_STATE_ACTIVE:
                return Call.State.ACTIVE;
            case PreciseCallState.PRECISE_CALL_STATE_HOLDING:
                return Call.State.HOLDING;
            case PreciseCallState.PRECISE_CALL_STATE_DIALING:
                return Call.State.DIALING;
            case PreciseCallState.PRECISE_CALL_STATE_ALERTING:
                return Call.State.ALERTING;
            case PreciseCallState.PRECISE_CALL_STATE_INCOMING:
                return Call.State.INCOMING;
            case PreciseCallState.PRECISE_CALL_STATE_WAITING:
                return Call.State.WAITING;
            case PreciseCallState.PRECISE_CALL_STATE_DISCONNECTED:
                return Call.State.DISCONNECTED;
            case PreciseCallState.PRECISE_CALL_STATE_DISCONNECTING:
                return Call.State.DISCONNECTING;
            default:
                return Call.State.IDLE;
        }
    }

    public interface IDataStateChangedCallback {
        void onDataStateChanged(int subId, String state, String reason, String apnName,
            String apnType, boolean unavailable);
    }

    private void log(String s) {
        Rlog.d(LOG_TAG, s);
    }
+47 −89
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ public class GsmCdmaPhone extends Phone {
        }
    };

    void initOnce(CommandsInterface ci, boolean unitTestMode) {
    private void initOnce(CommandsInterface ci, boolean unitTestMode) {
        if (ci instanceof SimulatedRadioControl) {
            mSimulatedRadioControl = (SimulatedRadioControl) ci;
        }
@@ -260,7 +260,7 @@ public class GsmCdmaPhone extends Phone {
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
    }

    void initRatSpecific(int precisePhoneType) {
    private void initRatSpecific(int precisePhoneType) {
        mPendingMMIs.clear();
        mIccPhoneBookIntManager.updateIccRecords(null);
        //todo: maybe not needed?? should the count also be updated on sim_state_absent?
@@ -326,7 +326,7 @@ public class GsmCdmaPhone extends Phone {
     * Sets PROPERTY_ICC_OPERATOR_ISO_COUNTRY property
     *
     */
    protected void setIsoCountryProperty(String operatorNumeric) {
    private void setIsoCountryProperty(String operatorNumeric) {
        TelephonyManager tm = TelephonyManager.from(mContext);
        if (TextUtils.isEmpty(operatorNumeric)) {
            logd("setIsoCountryProperty: clear 'gsm.sim.operator.iso-country'");
@@ -577,7 +577,7 @@ public class GsmCdmaPhone extends Phone {
     * Notify any interested party of a Phone state change
     * {@link com.android.internal.telephony.PhoneConstants.State}
     */
    /*package*/ void notifyPhoneStateChanged() {
    public void notifyPhoneStateChanged() {
        mNotifier.notifyPhoneState(this);
    }

@@ -586,7 +586,7 @@ public class GsmCdmaPhone extends Phone {
     * {@link com.android.internal.telephony.Call.State}. Use this when changes
     * in the precise call state are needed, else use notifyPhoneStateChanged.
     */
    /*package*/ void notifyPreciseCallStateChanged() {
    public void notifyPreciseCallStateChanged() {
        /* we'd love it if this was package-scoped*/
        super.notifyPreciseCallStateChangedP();
    }
@@ -595,14 +595,13 @@ public class GsmCdmaPhone extends Phone {
        super.notifyNewRingingConnectionP(c);
    }

    /*package*/ void
    notifyDisconnect(Connection cn) {
    public void notifyDisconnect(Connection cn) {
        mDisconnectRegistrants.notifyResult(cn);

        mNotifier.notifyDisconnectCause(cn.getDisconnectCause(), cn.getPreciseDisconnectCause());
    }

    void notifyUnknownConnection(Connection cn) {
    public void notifyUnknownConnection(Connection cn) {
        super.notifyUnknownConnectionP(cn);
    }

@@ -632,7 +631,7 @@ public class GsmCdmaPhone extends Phone {
    }

    //CDMA
    void sendEmergencyCallbackModeChange(){
    private void sendEmergencyCallbackModeChange(){
        //Send an Intent
        Intent intent = new Intent(TelephonyIntents.ACTION_EMERGENCY_CALLBACK_MODE_CHANGED);
        intent.putExtra(PhoneConstants.PHONE_IN_ECM_STATE, mIsPhoneInEcmState);
@@ -641,24 +640,20 @@ public class GsmCdmaPhone extends Phone {
        if (DBG) logd("sendEmergencyCallbackModeChange");
    }

    void notifySuppServiceFailed(SuppService code) {
    public void notifySuppServiceFailed(SuppService code) {
        mSuppServiceFailedRegistrants.notifyResult(code);
    }

    /*package*/
    public void
    notifyServiceStateChanged(ServiceState ss) {
    public void notifyServiceStateChanged(ServiceState ss) {
        super.notifyServiceStateChangedP(ss);
    }

    /*package*/
    public void notifyLocationChanged() {
        mNotifier.notifyCellLocation(this);
    }

    @Override
    public void
    notifyCallForwardingIndicator() {
    public void notifyCallForwardingIndicator() {
        mNotifier.notifyCallForwardingChanged(this);
    }

@@ -667,8 +662,7 @@ public class GsmCdmaPhone extends Phone {
     * {@inheritDoc}
     */
    @Override
    public void
    setSystemProperty(String property, String value) {
    public void setSystemProperty(String property, String value) {
        if (getUnitTestMode()) {
            return;
        }
@@ -703,8 +697,7 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void
    acceptCall(int videoState) throws CallStateException {
    public void acceptCall(int videoState) throws CallStateException {
        Phone imsPhone = mImsPhone;
        if ( imsPhone != null && imsPhone.getRingingCall().isRinging() ) {
            imsPhone.acceptCall(videoState);
@@ -714,14 +707,12 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void
    rejectCall() throws CallStateException {
    public void rejectCall() throws CallStateException {
        mCT.rejectCall();
    }

    @Override
    public void
    switchHoldingAndActive() throws CallStateException {
    public void switchHoldingAndActive() throws CallStateException {
        mCT.switchWaitingOrHoldingAndActive();
    }

@@ -748,10 +739,6 @@ public class GsmCdmaPhone extends Phone {
        }
    }

    public boolean canDial() {
        return mCT.canDial();
    }

    @Override
    public void conference() {
        if (mImsPhone != null && mImsPhone.canConference()) {
@@ -814,14 +801,12 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public GsmCdmaCall
    getForegroundCall() {
    public GsmCdmaCall getForegroundCall() {
        return mCT.mForegroundCall;
    }

    @Override
    public GsmCdmaCall
    getBackgroundCall() {
    public GsmCdmaCall getBackgroundCall() {
        return mCT.mBackgroundCall;
    }

@@ -860,8 +845,7 @@ public class GsmCdmaPhone extends Phone {
    }

    //GSM
    private boolean handleCallWaitingIncallSupplementaryService(
            String dialString) {
    private boolean handleCallWaitingIncallSupplementaryService(String dialString) {
        int len = dialString.length();

        if (len > 2) {
@@ -915,17 +899,14 @@ public class GsmCdmaPhone extends Phone {

                // GsmCdma index starts at 1, up to 5 connections in a call,
                if (conn != null && callIndex >= 1 && callIndex <= GsmCdmaCallTracker.MAX_CONNECTIONS_GSM) {
                    if (DBG) logd("MmiCode 2: separate call " +
                            callIndex);
                    if (DBG) logd("MmiCode 2: separate call " + callIndex);
                    mCT.separate(conn);
                } else {
                    if (DBG) logd("separate: invalid call index " +
                            callIndex);
                    if (DBG) logd("separate: invalid call index " + callIndex);
                    notifySuppServiceFailed(Phone.SuppService.SEPARATE);
                }
            } catch (CallStateException e) {
                if (DBG) Rlog.d(LOG_TAG,
                        "separate failed", e);
                if (DBG) Rlog.d(LOG_TAG, "separate failed", e);
                notifySuppServiceFailed(Phone.SuppService.SEPARATE);
            }
        } else {
@@ -938,8 +919,7 @@ public class GsmCdmaPhone extends Phone {
                    mCT.switchWaitingOrHoldingAndActive();
                }
            } catch (CallStateException e) {
                if (DBG) Rlog.d(LOG_TAG,
                        "switch failed", e);
                if (DBG) Rlog.d(LOG_TAG, "switch failed", e);
                notifySuppServiceFailed(Phone.SuppService.SWITCH);
            }
        }
@@ -947,8 +927,7 @@ public class GsmCdmaPhone extends Phone {
        return true;
    }

    private boolean handleMultipartyIncallSupplementaryService(
            String dialString) {
    private boolean handleMultipartyIncallSupplementaryService(String dialString) {
        if (dialString.length() > 1) {
            return false;
        }
@@ -986,6 +965,7 @@ public class GsmCdmaPhone extends Phone {
    public boolean handleInCallMmiCommands(String dialString) throws CallStateException {
        if (!isPhoneTypeGsm()) {
            loge("method handleInCallMmiCommands is NOT supported in CDMA!");
            return false;
        }

        Phone imsPhone = mImsPhone;
@@ -1043,14 +1023,12 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public Connection
    dial(String dialString, int videoState) throws CallStateException {
    public Connection dial(String dialString, int videoState) throws CallStateException {
        return dial(dialString, null, videoState, null);
    }

    @Override
    public Connection
    dial (String dialString, UUSInfo uusInfo, int videoState, Bundle intentExtras)
    public Connection dial (String dialString, UUSInfo uusInfo, int videoState, Bundle intentExtras)
            throws CallStateException {
        if (!isPhoneTypeGsm() && uusInfo != null) {
            throw new CallStateException("Sending UUS information NOT supported in CDMA!");
@@ -1125,8 +1103,8 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    protected Connection
    dialInternal (String dialString, UUSInfo uusInfo, int videoState, Bundle intentExtras)
    protected Connection dialInternal (String dialString, UUSInfo uusInfo, int videoState,
                                       Bundle intentExtras)
            throws CallStateException {

        // Need to make sure dialString gets parsed properly
@@ -1202,8 +1180,7 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void
    sendDtmf(char c) {
    public void sendDtmf(char c) {
        if (!PhoneNumberUtils.is12Key(c)) {
            loge("sendDtmf called with invalid character '" + c + "'");
        } else {
@@ -1214,8 +1191,7 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void
    startDtmf(char c) {
    public void startDtmf(char c) {
        if (!PhoneNumberUtils.is12Key(c)) {
            loge("startDtmf called with invalid character '" + c + "'");
        } else {
@@ -1224,8 +1200,7 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void
    stopDtmf() {
    public void stopDtmf() {
        mCi.stopDtmf(null);
    }

@@ -1250,8 +1225,7 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void
    setRadioPower(boolean power) {
    public void setRadioPower(boolean power) {
        mSST.setRadioPower(power);
    }

@@ -1569,7 +1543,7 @@ public class GsmCdmaPhone extends Phone {
        }
    }

    protected  boolean isCfEnable(int action) {
    private boolean isCfEnable(int action) {
        return (action == CF_ACTION_ENABLE) || (action == CF_ACTION_REGISTRATION);
    }

@@ -1654,8 +1628,7 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode,
                                           Message onComplete) {
    public void setOutgoingCallerIdDisplay(int commandInterfaceCLIRMode, Message onComplete) {
        if (isPhoneTypeGsm()) {
            Phone imsPhone = mImsPhone;
            if ((imsPhone != null)
@@ -1710,8 +1683,7 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void
    getAvailableNetworks(Message response) {
    public void getAvailableNetworks(Message response) {
        if (isPhoneTypeGsm() || isPhoneTypeCdmaLte()) {
            mCi.getAvailableNetworks(response);
        } else {
@@ -1720,8 +1692,7 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public void
    getNeighboringCids(Message response) {
    public void getNeighboringCids(Message response) {
        if (isPhoneTypeGsm()) {
            mCi.getNeighboringCids(response);
        } else {
@@ -1849,9 +1820,7 @@ public class GsmCdmaPhone extends Phone {
     * registrants that it is complete.
     * @param mmi MMI that is done
     */
    /*package*/
    public void
    onMMIDone(MmiCode mmi) {
    public void onMMIDone(MmiCode mmi) {

        /* Only notify complete if it's on the pending list.
         * Otherwise, it's already been handled (eg, previously canceled).
@@ -1864,17 +1833,13 @@ public class GsmCdmaPhone extends Phone {
        }
    }


    private void
    onNetworkInitiatedUssd(MmiCode mmi) {
    private void onNetworkInitiatedUssd(MmiCode mmi) {
        mMmiCompleteRegistrants.notifyRegistrants(
            new AsyncResult(null, mmi, null));
    }


    /** ussdMode is one of CommandsInterface.USSD_MODE_* */
    private void
    onIncomingUSSD (int ussdMode, String ussdMessage) {
    private void onIncomingUSSD (int ussdMode, String ussdMessage) {
        if (!isPhoneTypeGsm()) {
            loge("onIncomingUSSD: not expected on GSM");
        }
@@ -1932,7 +1897,7 @@ public class GsmCdmaPhone extends Phone {
    /**
     * Make sure the network knows our preferred setting.
     */
    protected  void syncClirSetting() {
    private void syncClirSetting() {
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
        int clirSetting = sp.getInt(CLIR_KEY + getPhoneId(), -1);
        if (clirSetting >= 0) {
@@ -2022,8 +1987,6 @@ public class GsmCdmaPhone extends Phone {
            break;

            case EVENT_RUIM_RECORDS_LOADED:
                //todo: merge this with SIM_RECORDS_LOADED. may need some cleanup on UICC side.
                // Maybe Have only one records loaded when all records are loaded??
                logd("Event EVENT_RUIM_RECORDS_LOADED Received");
                updateCurrentCarrierInProvider();
                // Notify voicemails.
@@ -2421,7 +2384,7 @@ public class GsmCdmaPhone extends Phone {
     *
     * @return true for success; false otherwise.
     */
    boolean updateCurrentCarrierInProvider(String operatorNumeric) {
    private boolean updateCurrentCarrierInProvider(String operatorNumeric) {
        if (isPhoneTypeCdma()
                || (isPhoneTypeCdmaLte() && mUiccController.getUiccCardApplication(mPhoneId,
                        UiccController.APP_FAM_3GPP) == null)) {
@@ -2714,7 +2677,7 @@ public class GsmCdmaPhone extends Phone {
     * if action is CANCEL_ECM_TIMER, cancel Ecm timer and notify apps the timer is canceled;
     * otherwise, restart Ecm timer and notify apps the timer is restarted.
     */
    void handleTimerInEmergencyCallbackMode(int action) {
    public void handleTimerInEmergencyCallbackMode(int action) {
        switch(action) {
            case CANCEL_ECM_TIMER:
                removeCallbacks(mExitEcmRunnable);
@@ -2809,8 +2772,7 @@ public class GsmCdmaPhone extends Phone {
     * the dial string "sysSelCodeInt' is the system selection code specified
     * in the carrier ota sp number schema "sch".
     */
    private static boolean
    checkOtaSpNumBasedOnSysSelCode (int sysSelCodeInt, String sch[]) {
    private static boolean checkOtaSpNumBasedOnSysSelCode(int sysSelCodeInt, String sch[]) {
        boolean isOtaSpNum = false;
        try {
            // Get how many number of system selection code ranges
@@ -3102,7 +3064,6 @@ public class GsmCdmaPhone extends Phone {

    @Override
    public void setImsRegistrationState(boolean registered) {
        super.setImsRegistrationState(registered);
        mSST.setImsRegistrationState(registered);
    }

@@ -3222,10 +3183,6 @@ public class GsmCdmaPhone extends Phone {
        return operatorNumeric;
    }

    public boolean setInternalDataEnabledFlag(boolean enable) {
        return mDcTracker.setInternalDataEnabledFlag(enable);
    }

    public void notifyEcbmTimerReset(Boolean flag) {
        mEcmTimerResetRegistrants.notifyResult(flag);
    }
@@ -3268,14 +3225,15 @@ public class GsmCdmaPhone extends Phone {
        }
    }

    protected void logd(String s) {
    private void logd(String s) {
        Rlog.d(LOG_TAG, "[GsmCdmaPhone] " + s);
    }

    protected void loge(String s) {
    private void loge(String s) {
        Rlog.e(LOG_TAG, "[GsmCdmaPhone] " + s);
    }

    @Override
    public boolean isUtEnabled() {
        Phone imsPhone = mImsPhone;
        if (imsPhone != null) {
+0 −2
Original line number Diff line number Diff line
@@ -2676,8 +2676,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * Set IMS registration state
     */
    public void setImsRegistrationState(boolean registered) {
        //todo: not needed. this only calls the function in sst, which gsmcdmaphone already does
        mDcTracker.setImsRegistrationState(registered);
    }

    /**
+0 −1
Original line number Diff line number Diff line
@@ -550,7 +550,6 @@ public class ServiceStateTracker extends Handler {
        mSignalStrength = new SignalStrength();
        mRestrictedState = new RestrictedState();
        mReportedGprsNoReg = false;
        //todo: these can always be queried from gsmcdmaphone now (regardless of phone type)
        mMdn = null;
        mMin = null;
        mPrlVersion = null;
+0 −12
Original line number Diff line number Diff line
@@ -4146,18 +4146,6 @@ public final class DcTracker extends Handler {
        return null;
    }

    public void setImsRegistrationState(boolean registered) {
        log("setImsRegistrationState - mImsRegistrationState(before): "+ mImsRegistrationState
                + ", registered(current) : " + registered);

        if (mPhone == null) return;

        ServiceStateTracker sst = mPhone.getServiceStateTracker();
        if (sst == null) return;

        sst.setImsRegistrationState(registered);
    }

    /**
     * Read APN configuration from Telephony.db for Emergency APN
     * All opertors recognize the connection request for EPDN based on APN type