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

Commit 68802fa8 authored by Noah Zimmt's avatar Noah Zimmt Committed by Nathan Harold
Browse files

[DO NOT MERGE] Revert submission 9950791-pick-precise-dataconn

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_qt-qpr1-dev-plus-aosp&target=aosp_cf_x86_phone-userdebug&lkgb=6087936&lkbb=6087980&fkbb=6087980, b/146588413
Reverted Changes:
I8445808a0: Expose PreciseDataConnectionState to Public API
Ib6a769f5a: Expose PreciseDataConnectionState to Public API

Note: these CLs are correctly merged already in master and do not need to be reverted there.

Change-Id: I102a8b8f69501bc1bcbcc3be69919d4b188b01d3
parent cc8526a5
Loading
Loading
Loading
Loading
+48 −11
Original line number Diff line number Diff line
@@ -19,9 +19,12 @@ 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;
@@ -30,16 +33,15 @@ 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.TelephonyRegistryManager;
import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;

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

import java.util.List;

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

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

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

    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;

        mTelephonyRegistryMgr.notifyDataConnectionForSubscriber(
                phoneId, subId, apnType, preciseState);
        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);
    }

    @Override
@@ -177,9 +216,7 @@ 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,
    public void notifyPreciseDataConnectionFailed(Phone sender, String apnType,
        String apn, @DataFailureCause int failCause) {
        mTelephonyRegistryMgr.notifyPreciseDataConnectionFailed(sender.getSubId(),
            sender.getPhoneId(), apnType, apn, failCause);
+9 −46
Original line number Diff line number Diff line
@@ -61,11 +61,10 @@ 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.PreciseDataConnectionState;
import android.telephony.PhysicalChannelConfig;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SignalThresholdInfo;
@@ -503,7 +502,6 @@ public class GsmCdmaPhone extends Phone {

    @UnsupportedAppUsage
    @Override
    @NonNull
    public ServiceState getServiceState() {
        if (mSST == null || mSST.mSS.getState() != ServiceState.STATE_IN_SERVICE) {
            if (mImsPhone != null) {
@@ -595,53 +593,12 @@ 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 ongoing, dispose() and removeReferences() have
            // Radio Technology Change is ongoning, dispose() and removeReferences() have
            // already been called

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

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

package com.android.internal.telephony;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
import android.app.BroadcastOptions;
@@ -50,7 +49,6 @@ 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;
@@ -2351,16 +2349,17 @@ 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, getPreciseDataConnectionState(apnType));
        mNotifier.notifyDataConnection(this, apnType, getDataConnectionState(apnType));
    }

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

@@ -2389,11 +2388,6 @@ 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);
@@ -3088,26 +3082,26 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

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

        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 typesList.toArray(new String[typesList.size()]);
        }

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

    /**
@@ -3337,10 +3331,13 @@ 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);
    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);
    }

    /**
+0 −11
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ 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;

@@ -237,16 +236,6 @@ 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
+10 −17
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ 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;

@@ -50,9 +49,9 @@ 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, String apnType, PhoneConstants.DataState state);

    void notifyDataConnectionFailed(Phone sender, String apnType);

    void notifyDataActivity(Phone sender);

@@ -64,27 +63,21 @@ 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,
    public void notifyPreciseDataConnectionFailed(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);

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

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

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

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

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

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

Loading