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

Commit f442fc38 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "[DO NOT MERGE] Revert submission...

Merge "Revert "[DO NOT MERGE] Revert submission 9950791-pick-precise-dataconn"" into qt-qpr1-dev-plus-aosp
parents 05d525ad f7e916f0
Loading
Loading
Loading
Loading
+11 −48
Original line number Diff line number Diff line
@@ -19,12 +19,9 @@ package com.android.internal.telephony;
import android.annotation.NonNull;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.net.LinkProperties;
import android.net.NetworkCapabilities;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.telephony.TelephonyRegistryManager;
import android.telephony.Annotation.DataFailureCause;
import android.telephony.Annotation.RadioPowerState;
import android.telephony.Annotation.SrvccState;
@@ -33,15 +30,16 @@ import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.PhoneCapability;
import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.TelephonyRegistryManager;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;

import com.android.internal.telephony.PhoneInternalInterface.DataActivityState;

import java.util.List;

/**
@@ -83,7 +81,7 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        int phoneId = sender.getPhoneId();
        int subId = sender.getSubId();

        Rlog.d(LOG_TAG, "nofityServiceState: mRegistry=" + mRegistry + " ss=" + ss
        Rlog.d(LOG_TAG, "notifyServiceState: mRegistry=" + mRegistry + " ss=" + ss
            + " sender=" + sender + " phondId=" + phoneId + " subId=" + subId);
        if (ss == null) {
            ss = new ServiceState();
@@ -133,51 +131,14 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
    }

    @Override
    public void notifyDataConnection(Phone sender, String apnType,
        PhoneConstants.DataState state) {
        doNotifyDataConnection(sender, apnType, state);
    }
    public void notifyDataConnection(
            Phone sender, String apnType, PreciseDataConnectionState preciseState) {

    private void doNotifyDataConnection(Phone sender, String apnType,
        PhoneConstants.DataState state) {
        int subId = sender.getSubId();
        int phoneId = sender.getPhoneId();
        long dds = SubscriptionManager.getDefaultDataSubscriptionId();
        if (DBG) {
            log("subId = " + subId + ", DDS = " + dds);
        }

        // TODO
        // use apnType as the key to which connection we're talking about.
        // pass apnType back up to fetch particular for this one.
        TelephonyManager telephony = TelephonyManager.getDefault();
        LinkProperties linkProperties = null;
        NetworkCapabilities networkCapabilities = null;
        boolean roaming = false;

        if (state == PhoneConstants.DataState.CONNECTED) {
            linkProperties = sender.getLinkProperties(apnType);
            networkCapabilities = sender.getNetworkCapabilities(apnType);
        }
        ServiceState ss = sender.getServiceState();
        if (ss != null) {
            roaming = ss.getDataRoaming();
        }
        mTelephonyRegistryMgr.notifyDataConnectionForSubscriber(phoneId, subId,
            PhoneConstantConversions.convertDataState(state),
            sender.isDataAllowed(ApnSetting.getApnTypesBitmaskFromString(apnType)),
            sender.getActiveApnHost(apnType),
            apnType,
            linkProperties,
            networkCapabilities,
            ((telephony != null) ? telephony.getDataNetworkType(subId) :
                TelephonyManager.NETWORK_TYPE_UNKNOWN), roaming);
    }

    @Override
    public void notifyDataConnectionFailed(Phone sender, String apnType) {
        mTelephonyRegistryMgr.notifyDataConnectionFailed(sender.getSubId(), sender.getPhoneId(),
            apnType);
        mTelephonyRegistryMgr.notifyDataConnectionForSubscriber(
                phoneId, subId, apnType, preciseState);
    }

    @Override
@@ -216,7 +177,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        mTelephonyRegistryMgr.notifyImsDisconnectCause(sender.getSubId(), imsReasonInfo);
    }

    public void notifyPreciseDataConnectionFailed(Phone sender, String apnType,
    @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(), apnType, apn, failCause);
+46 −9
Original line number Diff line number Diff line
@@ -62,10 +62,11 @@ import android.telephony.AccessNetworkConstants;
import android.telephony.Annotation.RilRadioTechnology;
import android.telephony.CarrierConfigManager;
import android.telephony.CellLocation;
import android.telephony.DataFailCause;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseDataConnectionState;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SignalThresholdInfo;
@@ -503,6 +504,7 @@ public class GsmCdmaPhone extends Phone {

    @UnsupportedAppUsage
    @Override
    @NonNull
    public ServiceState getServiceState() {
        if (mSST == null || mSST.mSS.getState() != ServiceState.STATE_IN_SERVICE) {
            if (mImsPhone != null) {
@@ -594,12 +596,53 @@ public class GsmCdmaPhone extends Phone {
        return mPendingMMIs;
    }

    private @NonNull DcTracker getActiveDcTrackerForApn(@NonNull String apnType) {
        int currentTransport = mTransportManager.getCurrentTransport(
                ApnSetting.getApnTypesBitmaskFromString(apnType));
        return getDcTracker(currentTransport);
    }

    @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() {
        return mCT.mState != PhoneConstants.State.IDLE && !mSST.isConcurrentVoiceAndDataAllowed();
    }

    @Override
    public PhoneConstants.DataState getDataConnectionState(String apnType) {
        PhoneConstants.DataState ret = PhoneConstants.DataState.DISCONNECTED;

        if (mSST == null) {
            // Radio Technology Change is ongoning, dispose() and removeReferences() have
            // Radio Technology Change is ongoing, dispose() and removeReferences() have
            // already been called

            ret = PhoneConstants.DataState.DISCONNECTED;
@@ -620,8 +663,7 @@ public class GsmCdmaPhone extends Phone {
                switch (getDcTracker(currentTransport).getState(apnType)) {
                    case CONNECTED:
                    case DISCONNECTING:
                        if (mCT.mState != PhoneConstants.State.IDLE
                                && !mSST.isConcurrentVoiceAndDataAllowed()) {
                        if (isDataSuspended()) {
                            ret = PhoneConstants.DataState.SUSPENDED;
                        } else {
                            ret = PhoneConstants.DataState.CONNECTED;
@@ -4134,9 +4176,4 @@ public class GsmCdmaPhone extends Phone {
    public boolean canDisablePhysicalSubscription() {
        return mCi.canToggleUiccApplicationsEnablement();
    }

    @Override
    public List<PhysicalChannelConfig> getPhysicalChannelConfigList() {
        return mSST.getPhysicalChannelConfigList();
    }
}
+29 −26
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.telephony;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
import android.app.BroadcastOptions;
@@ -50,6 +51,7 @@ import android.telephony.ClientRequestStats;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.PhoneStateListener;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseDataConnectionState;
import android.telephony.RadioAccessFamily;
import android.telephony.Rlog;
import android.telephony.ServiceState;
@@ -2349,17 +2351,16 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mNotifier.notifyMessageWaitingChanged(this);
    }

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

    public void notifyDataConnection() {
    /** Send notification with an updated PreciseDataConnectionState to all data connections */
    public void notifyAllActiveDataConnections() {
        String types[] = getActiveApnTypes();
        if (types != null) {
        for (String apnType : types) {
                mNotifier.notifyDataConnection(this, apnType,
                        getDataConnectionState(apnType));
            }
            mNotifier.notifyDataConnection(this, apnType, getPreciseDataConnectionState(apnType));
        }
    }

@@ -2388,6 +2389,11 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return PhoneConstants.DataState.DISCONNECTED;
    }

    /** Default implementation to get the PreciseDataConnectionState */
    public @Nullable PreciseDataConnectionState getPreciseDataConnectionState(String apnType) {
        return null;
    }

    public void notifyCellInfo(List<CellInfo> cellInfo) {
        AsyncResult ar = new AsyncResult(null, cellInfo, null);
        mCellInfoRegistrants.notifyRegistrants(ar);
@@ -3084,26 +3090,26 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    /**
     * Returns an array of string identifiers for the APN types serviced by the
     * currently active.
     * currently active subscription.
     *
     * @return The string array of APN types. Return null if no active APN types.
     */
    @UnsupportedAppUsage
    @Nullable
    @NonNull
    public String[] getActiveApnTypes() {
        if (mTransportManager != null) {
            List<String> typesList = new ArrayList<>();
            for (int transportType : mTransportManager.getAvailableTransports()) {
                if (getDcTracker(transportType) != null) {
                    typesList.addAll(Arrays.asList(
                            getDcTracker(transportType).getActiveApnTypes()));
                }
        if (mTransportManager == null || mDcTrackers == null)  {
            Rlog.e(LOG_TAG, "Invalid state for Transport/DcTrackers");
            return new String[0];
        }

            return typesList.toArray(new String[typesList.size()]);
        Set<String> activeApnTypes = new HashSet<String>();
        for (int transportType : mTransportManager.getAvailableTransports()) {
            DcTracker dct = getDcTracker(transportType);
            if (dct == null) continue; // TODO: should this ever happen?
            activeApnTypes.addAll(Arrays.asList(dct.getActiveApnTypes()));
        }

        return null;
        return activeApnTypes.toArray(new String[activeApnTypes.size()]);
    }

    /**
@@ -3333,13 +3339,10 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    public void notifyCallForwardingIndicator() {
    }

    public void notifyDataConnectionFailed(String apnType) {
        mNotifier.notifyDataConnectionFailed(this, apnType);
    }

    public void notifyPreciseDataConnectionFailed(String apnType, String apn,
                                                  @DataFailureCause int failCause) {
        mNotifier.notifyPreciseDataConnectionFailed(this, apnType, apn, failCause);
    /** 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);
    }

    /**
+11 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.ResultReceiver;
import android.telecom.VideoProfile;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.PreciseDataConnectionState;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;

@@ -236,6 +237,16 @@ public interface PhoneInternalInterface {
     */
    DataState getDataConnectionState(String apnType);

    /**
     * Get the current Precise DataState. No change notification exists at this
     * interface -- use
     * {@link android.telephony.PhoneStateListener} instead.
     *
     * @param apnType specify for which apn to get connection state info.
     * @return the PreciseDataConnectionState for the data connection supporting apnType
     */
    PreciseDataConnectionState getPreciseDataConnectionState(String apnType);

    /**
     * Get the current DataActivityState. No change notification exists at this
     * interface -- use
+17 −10
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.telephony.CallQuality;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.PhoneCapability;
import android.telephony.PreciseDataConnectionState;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;

@@ -49,9 +50,9 @@ public interface PhoneNotifier {

    void notifyCallForwardingChanged(Phone sender);

    void notifyDataConnection(Phone sender, String apnType, PhoneConstants.DataState state);

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

    void notifyDataActivity(Phone sender);

@@ -63,21 +64,27 @@ public interface PhoneNotifier {

    void notifyImsDisconnectCause(Phone sender, ImsReasonInfo imsReasonInfo);

    public void notifyPreciseDataConnectionFailed(Phone sender, String apnType, String apn,
    /** 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.*/
    /** Send a notification that the SRVCC state has changed.*/
    void notifySrvccStateChanged(Phone sender, @SrvccState int state);

    public void notifyVoiceActivationStateChanged(Phone sender, int activationState);
    /** Send a notification that the voice activation state has changed */
    void notifyVoiceActivationStateChanged(Phone sender, int activationState);

    public void notifyDataActivationStateChanged(Phone sender, int activationState);
    /** Send a notification that the data activation state has changed */
    void notifyDataActivationStateChanged(Phone sender, int activationState);

    public void notifyUserMobileDataStateChanged(Phone sender, boolean state);
    /** Send a notification that the users mobile data setting has changed */
    void notifyUserMobileDataStateChanged(Phone sender, boolean state);

    public void notifyOemHookRawEventForSubscriber(Phone sender, byte[] rawData);
    /** Send a notification with an OEM hook payload */
    void notifyOemHookRawEventForSubscriber(Phone sender, byte[] rawData);

    public void notifyPhoneCapabilityChanged(PhoneCapability capability);
    /** Send a notification that the phone capability has changed */
    void notifyPhoneCapabilityChanged(PhoneCapability capability);

    void notifyRadioPowerStateChanged(Phone sender, @RadioPowerState int state);

Loading