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

Commit 9313efc0 authored by Sarah Chin's avatar Sarah Chin Committed by Android (Google) Code Review
Browse files

Merge "TelephonyDisplayInfo get network type from NetworkTypeController"

parents ac241bcd c301eb05
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -20,9 +20,7 @@ import android.annotation.NonNull;
import android.os.Handler;
import android.os.Registrant;
import android.os.RegistrantList;
import android.telephony.AccessNetworkConstants;
import android.telephony.AnomalyReporter;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.util.IndentingPrintWriter;
@@ -45,8 +43,6 @@ import javax.sip.InvalidArgumentException;
 * TelephonyDisplayInfo via {@link #getTelephonyDisplayInfo}.
 */
public class DisplayInfoController extends Handler {
    private static final String TAG = "DisplayInfoController";

    private final String mLogTag;
    private final LocalLog mLocalLog = new LocalLog(128);

@@ -90,11 +86,8 @@ public class DisplayInfoController extends Handler {
     * NetworkTypeController.
     */
    public void updateTelephonyDisplayInfo() {
        NetworkRegistrationInfo nri =  mPhone.getServiceState().getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
        int dataNetworkType = nri == null ? TelephonyManager.NETWORK_TYPE_UNKNOWN
                : nri.getAccessNetworkTechnology();
        TelephonyDisplayInfo newDisplayInfo = new TelephonyDisplayInfo(dataNetworkType,
        TelephonyDisplayInfo newDisplayInfo = new TelephonyDisplayInfo(
                mNetworkTypeController.getDataNetworkType(),
                mNetworkTypeController.getOverrideNetworkType());
        if (!newDisplayInfo.equals(mTelephonyDisplayInfo)) {
            logl("TelephonyDisplayInfo changed from " + mTelephonyDisplayInfo + " to "
+11 −7
Original line number Diff line number Diff line
@@ -214,6 +214,17 @@ public class NetworkTypeController extends StateMachine {
        return mOverrideNetworkType;
    }

    /**
     * @return The current data network type, used to create TelephonyDisplayInfo in
     * DisplayInfoController.
     */
    public @Annotation.NetworkType int getDataNetworkType() {
        NetworkRegistrationInfo nri = mServiceState.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
        return nri == null ? TelephonyManager.NETWORK_TYPE_UNKNOWN
                : nri.getAccessNetworkTechnology();
    }

    /**
     * @return {@code true} if either the primary or secondary 5G icon timers are active,
     * and {@code false} if neither are.
@@ -1325,13 +1336,6 @@ public class NetworkTypeController extends StateMachine {
                ? DataCallResponse.LINK_STATUS_DORMANT : DataCallResponse.LINK_STATUS_ACTIVE;
    }

    private int getDataNetworkType() {
        NetworkRegistrationInfo nri = mServiceState.getNetworkRegistrationInfo(
                NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
        return nri == null ? TelephonyManager.NETWORK_TYPE_UNKNOWN
                : nri.getAccessNetworkTechnology();
    }

    private String getEventName(int event) {
        try {
            return sEvents[event];