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

Commit d04f7bb4 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge changes from topics "pdcs_builder", "refactor_pdcs",...

Merge changes from topics "pdcs_builder", "refactor_pdcs", "remove_apn_name_types", "transport_type_and_id"

* changes:
  Refactored precise data connection state
  Added transport type and id in precise data connection state
  Removed APN name and types from PreciseDataConnectionState
  Added builder for PreciseDataConnectionState
parents 2e5c0bce 696c04fa
Loading
Loading
Loading
Loading
+3 −20
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.internal.telephony;

import android.annotation.NonNull;
import android.content.Context;
import android.telephony.Annotation.DataFailureCause;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.Annotation.SrvccState;
import android.telephony.BarringInfo;
@@ -32,7 +31,6 @@ import android.telephony.ServiceState;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyRegistryManager;
import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;

@@ -124,15 +122,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
    }

    @Override
    public void notifyDataConnection(
            Phone sender, String apnType, PreciseDataConnectionState preciseState) {

        int subId = sender.getSubId();
        int phoneId = sender.getPhoneId();
        int apnTypeBitmask = ApnSetting.getApnTypesBitmaskFromString(apnType);

        mTelephonyRegistryMgr.notifyDataConnectionForSubscriber(
                phoneId, subId, apnTypeBitmask, preciseState);
    public void notifyDataConnection(Phone sender, PreciseDataConnectionState preciseState) {
        mTelephonyRegistryMgr.notifyDataConnectionForSubscriber(sender.getPhoneId(),
                sender.getSubId(), preciseState);
    }

    @Override
@@ -169,15 +161,6 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        mTelephonyRegistryMgr.notifyImsDisconnectCause(sender.getSubId(), imsReasonInfo);
    }

    @Override
    /** Notify the TelephonyRegistry that a data connection has failed with a specified cause */
    public void notifyDataConnectionFailed(Phone sender, String apnType,
        String apn, @DataFailureCause int failCause) {
        mTelephonyRegistryMgr.notifyPreciseDataConnectionFailed(
                sender.getSubId(), sender.getPhoneId(),
                ApnSetting.getApnTypesBitmaskFromString(apnType), apn, failCause);
    }

    @Override
    public void notifySrvccStateChanged(Phone sender, @SrvccState int state) {
        mTelephonyRegistryMgr.notifySrvccStateChanged(sender.getSubId(), state);
+1 −34
Original line number Diff line number Diff line
@@ -65,11 +65,9 @@ import android.telephony.AccessNetworkConstants;
import android.telephony.BarringInfo;
import android.telephony.CarrierConfigManager;
import android.telephony.CellIdentity;
import android.telephony.DataFailCause;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.PhoneNumberUtils;
import android.telephony.PreciseDataConnectionState;
import android.telephony.ServiceState;
import android.telephony.ServiceState.RilRadioTechnology;
import android.telephony.SignalThresholdInfo;
@@ -84,7 +82,6 @@ import android.util.Pair;

import com.android.ims.ImsManager;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.cdma.CdmaMmiCode;
import com.android.internal.telephony.cdma.CdmaSubscriptionSourceManager;
import com.android.internal.telephony.dataconnection.DataEnabledSettings;
@@ -631,37 +628,7 @@ public class GsmCdmaPhone extends Phone {
    }

    @Override
    public PreciseDataConnectionState getPreciseDataConnectionState(String apnType) {
        // If we are OOS, then all data connections are null.
        // FIXME: we need to figure out how to report the EIMS PDN connectivity here, which
        // should imply emergency attach - today emergency attach is unknown at the AP,
        // so, we take a guess.
        boolean isEmergencyData = isPhoneTypeGsm()
                && apnType.equals(PhoneConstants.APN_TYPE_EMERGENCY);

        if (mSST == null
                || ((mSST.getCurrentDataConnectionState() != ServiceState.STATE_IN_SERVICE)
                        && !isEmergencyData)) {
            return new PreciseDataConnectionState(TelephonyManager.DATA_DISCONNECTED,
                    TelephonyManager.NETWORK_TYPE_UNKNOWN,
                    ApnSetting.getApnTypesBitmaskFromString(apnType),
                    apnType, null, DataFailCause.NONE, null);
        }

        // must never be null
        final DcTracker dctForApn = getActiveDcTrackerForApn(apnType);

        int networkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
        // Always non-null
        ServiceState ss = getServiceState();
        if (ss != null) {
            networkType = ss.getDataNetworkType();
        }

        return dctForApn.getPreciseDataConnectionState(apnType, isDataSuspended(), networkType);
    }

    boolean isDataSuspended() {
    public boolean isDataSuspended() {
        return mCT.mState != PhoneConstants.State.IDLE && !mSST.isConcurrentVoiceAndDataAllowed();
    }

+9 −24
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import android.sysprop.TelephonyProperties;
import android.telecom.VideoProfile;
import android.telephony.AccessNetworkConstants;
import android.telephony.Annotation.ApnType;
import android.telephony.Annotation.DataFailureCause;
import android.telephony.CarrierConfigManager;
import android.telephony.CarrierRestrictionRules;
import android.telephony.CellIdentity;
@@ -2540,23 +2539,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    }

    /** Send notification with an updated PreciseDataConnectionState to a single data connection */
    public void notifyDataConnection(String apnType) {
        mNotifier.notifyDataConnection(this, apnType, getPreciseDataConnectionState(apnType));
    }

    /** Send notification with an updated PreciseDataConnectionState to all data connections */
    public void notifyAllActiveDataConnections() {
        if (mTransportManager != null) {
            for (int transportType : mTransportManager.getAvailableTransports()) {
                DcTracker dct = getDcTracker(transportType);
                if (dct != null) {
                    for (String apnType : dct.getConnectedApnTypes()) {
                        mNotifier.notifyDataConnection(
                                this, apnType, getPreciseDataConnectionState(apnType));
                    }
                }
            }
        }
    public void notifyDataConnection(PreciseDataConnectionState state) {
        mNotifier.notifyDataConnection(this, state);
    }

    @UnsupportedAppUsage
@@ -2908,6 +2892,13 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return null;
    }

    /**
     * @return {@code true} if data is suspended.
     */
    public boolean isDataSuspended() {
        return false;
    }

    /**
     * send burst DTMF tone, it can send the string as single character or multiple character
     * ignore if there is no active call or not valid digits string.
@@ -3570,12 +3561,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    public void notifyCallForwardingIndicator() {
    }

    /** Send a notification that a particular data connection has failed with specified cause. */
    public void notifyDataConnectionFailed(
            String apnType, String apn, @DataFailureCause int failCause) {
        mNotifier.notifyDataConnectionFailed(this, apnType, apn, failCause);
    }

    /**
     * Sets the SIM voice message waiting indicator records.
     * @param line GSM Subscriber Profile Number, one-based. Only '1' is supported
+1 −7
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.internal.telephony;

import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.telephony.Annotation.DataFailureCause;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.Annotation.SrvccState;
import android.telephony.BarringInfo;
@@ -58,8 +57,7 @@ public interface PhoneNotifier {
    void notifyCallForwardingChanged(Phone sender);

    /** Send a notification that the Data Connection for a particular apnType has changed */
    void notifyDataConnection(
            Phone sender, String apnType, PreciseDataConnectionState preciseState);
    void notifyDataConnection(Phone sender, PreciseDataConnectionState preciseState);

    void notifyDataActivity(Phone sender);

@@ -71,10 +69,6 @@ public interface PhoneNotifier {

    void notifyImsDisconnectCause(Phone sender, ImsReasonInfo imsReasonInfo);

    /** Send a notification that a particular data connection has failed with specified cause. */
    void notifyDataConnectionFailed(Phone sender, String apnType, String apn,
                                                  @DataFailureCause int failCause);

    /** Send a notification that the SRVCC state has changed.*/
    void notifySrvccStateChanged(Phone sender, @SrvccState int state);

+0 −5
Original line number Diff line number Diff line
@@ -3410,10 +3410,6 @@ public class ServiceStateTracker extends Handler {
                }
            }

            if (hasCssIndicatorChanged) {
                mPhone.notifyAllActiveDataConnections();
            }

            mReasonDataDenied = mNewReasonDataDenied;
            mMaxDataCalls = mNewMaxDataCalls;
            mRejectCode = mNewRejectCode;
@@ -3563,7 +3559,6 @@ public class ServiceStateTracker extends Handler {
                    || hasDataTransportPreferenceChanged) {
                setDataNetworkTypeForPhone(mSS.getRilDataRadioTechnology());
                notifyDataRegStateRilRadioTechnologyChanged(transport);
                mPhone.notifyAllActiveDataConnections();
            }

            if (hasDataAttached.get(transport)) {
Loading