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

Commit cd3016eb authored by Jack Yu's avatar Jack Yu
Browse files

Renamed DisplayInfo to TelephonyDisplayInfo

To reduce ambiguity with android.view.DisplayInfo.

Test: Telephony sanity tests + unit tests
Bug: 151101989
Change-Id: Iac4556f29938d6ef57c76888321681df2935cfcd
parent 5eec2486
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -25,11 +25,11 @@ import android.telephony.BarringInfo;
import android.telephony.CallQuality;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.DisplayInfo;
import android.telephony.PhoneCapability;
import android.telephony.PreciseCallState;
import android.telephony.PreciseDataConnectionState;
import android.telephony.ServiceState;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyRegistryManager;
import android.telephony.data.ApnSetting;
@@ -202,9 +202,9 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
    }

    @Override
    public void notifyDisplayInfoChanged(Phone sender, DisplayInfo displayInfo) {
    public void notifyDisplayInfoChanged(Phone sender, TelephonyDisplayInfo telephonyDisplayInfo) {
        mTelephonyRegistryMgr.notifyDisplayInfoChanged(sender.getPhoneId(), sender.getSubId(),
                displayInfo);
                telephonyDisplayInfo);
    }

    @Override
+3 −3
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import android.telephony.CarrierRestrictionRules;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.ClientRequestStats;
import android.telephony.DisplayInfo;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.PhoneStateListener;
import android.telephony.PhysicalChannelConfig;
@@ -57,6 +56,7 @@ import android.telephony.RadioAccessSpecifier;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;
@@ -2416,8 +2416,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    }

    /** Send notification that display info has changed. */
    public void notifyDisplayInfoChanged(DisplayInfo displayInfo) {
        mNotifier.notifyDisplayInfoChanged(this, displayInfo);
    public void notifyDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo) {
        mNotifier.notifyDisplayInfoChanged(this, telephonyDisplayInfo);
    }

    public void notifySignalStrength() {
+2 −2
Original line number Diff line number Diff line
@@ -25,9 +25,9 @@ import android.telephony.BarringInfo;
import android.telephony.CallQuality;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.DisplayInfo;
import android.telephony.PhoneCapability;
import android.telephony.PreciseDataConnectionState;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;

@@ -88,7 +88,7 @@ public interface PhoneNotifier {
    void notifyUserMobileDataStateChanged(Phone sender, boolean state);

    /** Send a notification that the display info has changed */
    void notifyDisplayInfoChanged(Phone sender, DisplayInfo displayInfo);
    void notifyDisplayInfoChanged(Phone sender, TelephonyDisplayInfo telephonyDisplayInfo);

    /** Send a notification that the phone capability has changed */
    void notifyPhoneCapabilityChanged(PhoneCapability capability);
+19 −18
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ import android.telephony.Annotation.NetworkType;
import android.telephony.CarrierConfigManager;
import android.telephony.CellLocation;
import android.telephony.DataFailCause;
import android.telephony.DisplayInfo;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.PcoData;
import android.telephony.PreciseDataConnectionState;
@@ -81,6 +80,7 @@ import android.telephony.ServiceState.RilRadioTechnology;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.SubscriptionPlan;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
@@ -335,8 +335,8 @@ public class DcTracker extends Handler {
    /* Used to check whether phone was recently connected to 5G. */
    private boolean m5GWasConnected = false;

    /* Used to determine DisplayInfo to send to SysUI. */
    private DisplayInfo mDisplayInfo = null;
    /* Used to determine TelephonyDisplayInfo to send to SysUI. */
    private TelephonyDisplayInfo mTelephonyDisplayInfo = null;
    private final Map<String, Integer> m5GIconMapping = new HashMap<>();
    private String mDataIconPattern = "";

@@ -3850,7 +3850,7 @@ public class DcTracker extends Handler {
                if (!reevaluateUnmeteredConnections()) {
                    // always update on ServiceState changed so MobileSignalController gets
                    // accurate display info
                    mPhone.notifyDisplayInfoChanged(mDisplayInfo);
                    mPhone.notifyDisplayInfoChanged(mTelephonyDisplayInfo);
                }
                break;
            case DctConstants.EVENT_5G_TIMER_HYSTERESIS:
@@ -3993,11 +3993,11 @@ public class DcTracker extends Handler {
                    if (DBG) log("Invalid 5G icon configuration, config = " + pair);
                    continue;
                }
                int value = DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
                int value = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
                if (kv[1].equals("5g")) {
                    value = DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA;
                    value = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA;
                } else if (kv[1].equals("5g_plus")) {
                    value = DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE;
                    value = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE;
                }
                m5GIconMapping.put(kv[0], value);
            }
@@ -4189,13 +4189,13 @@ public class DcTracker extends Handler {
    }

    private boolean updateDisplayInfo() {
        int displayNetworkType = DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
        int displayNetworkType = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
        int dataNetworkType = mPhone.getServiceState().getDataNetworkType();
        if (mPhone.getServiceState().getNrState() != NetworkRegistrationInfo.NR_STATE_NONE
                || dataNetworkType == TelephonyManager.NETWORK_TYPE_NR || mHysteresis) {
            // process NR display network type
            displayNetworkType = getNrDisplayType();
            if (displayNetworkType == DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) {
            if (displayNetworkType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) {
                // use LTE values if 5G values aren't defined
                displayNetworkType = getLteDisplayType();
            }
@@ -4204,10 +4204,11 @@ public class DcTracker extends Handler {
            // process LTE display network type
            displayNetworkType = getLteDisplayType();
        }
        DisplayInfo displayInfo = new DisplayInfo(dataNetworkType, displayNetworkType);
        if (!displayInfo.equals(mDisplayInfo)) {
            mDisplayInfo = displayInfo;
            mPhone.notifyDisplayInfoChanged(displayInfo);
        TelephonyDisplayInfo telephonyDisplayInfo =
                new TelephonyDisplayInfo(dataNetworkType, displayNetworkType);
        if (!telephonyDisplayInfo.equals(mTelephonyDisplayInfo)) {
            mTelephonyDisplayInfo = telephonyDisplayInfo;
            mPhone.notifyDisplayInfoChanged(telephonyDisplayInfo);
            return true;
        }
        return false;
@@ -4238,21 +4239,21 @@ public class DcTracker extends Handler {

        for (String key : keys) {
            if (m5GIconMapping.containsKey(key)
                    && m5GIconMapping.get(key) != DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) {
                    && m5GIconMapping.get(key) != TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) {
                return m5GIconMapping.get(key);
            }
        }
        return DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
        return TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
    }

    private int getLteDisplayType() {
        int value = DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
        int value = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE;
        if (mPhone.getServiceState().getDataNetworkType() == TelephonyManager.NETWORK_TYPE_LTE_CA
                || mPhone.getServiceState().isUsingCarrierAggregation()) {
            value = DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA;
            value = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA;
        }
        if (isLteEnhancedAvailable()) {
            value = DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO;
            value = TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO;
        }
        return value;
    }
+18 −14
Original line number Diff line number Diff line
@@ -65,13 +65,13 @@ import android.provider.Telephony;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.CarrierConfigManager;
import android.telephony.DisplayInfo;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionPlan;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.data.DataProfile;
@@ -2086,7 +2086,8 @@ public class DcTrackerTest extends TelephonyTest {

    @Test
    public void testGetNrDisplayType() {
        ArgumentCaptor<DisplayInfo> captor = ArgumentCaptor.forClass(DisplayInfo.class);
        ArgumentCaptor<TelephonyDisplayInfo> captor =
                ArgumentCaptor.forClass(TelephonyDisplayInfo.class);
        doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType();

        // set up 5G icon configuration
@@ -2104,7 +2105,7 @@ public class DcTrackerTest extends TelephonyTest {
        waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());

        verify(mPhone, times(1)).notifyDisplayInfoChanged(captor.capture());
        assertEquals(DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
                captor.getValue().getOverrideNetworkType());

        // NR NSA, restricted
@@ -2113,7 +2114,7 @@ public class DcTrackerTest extends TelephonyTest {
        waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());

        verify(mPhone, times(2)).notifyDisplayInfoChanged(captor.capture());
        assertEquals(DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
                captor.getValue().getOverrideNetworkType());

        // NR NSA, not restricted
@@ -2122,7 +2123,7 @@ public class DcTrackerTest extends TelephonyTest {
        waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());

        verify(mPhone, times(3)).notifyDisplayInfoChanged(captor.capture());
        assertEquals(DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA,
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA,
                captor.getValue().getOverrideNetworkType());

        doReturn(NetworkRegistrationInfo.NR_STATE_CONNECTED).when(mServiceState).getNrState();
@@ -2133,7 +2134,7 @@ public class DcTrackerTest extends TelephonyTest {
        waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());

        verify(mPhone, times(4)).notifyDisplayInfoChanged(captor.capture());
        assertEquals(DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA,
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA,
                captor.getValue().getOverrideNetworkType());

        // NR NSA, millimeter wave frequency
@@ -2142,13 +2143,14 @@ public class DcTrackerTest extends TelephonyTest {
        waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());

        verify(mPhone, times(5)).notifyDisplayInfoChanged(captor.capture());
        assertEquals(DisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE,
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE,
                captor.getValue().getOverrideNetworkType());
    }

    @Test
    public void testGetLteDisplayType() {
        ArgumentCaptor<DisplayInfo> captor = ArgumentCaptor.forClass(DisplayInfo.class);
        ArgumentCaptor<TelephonyDisplayInfo> captor =
                ArgumentCaptor.forClass(TelephonyDisplayInfo.class);

        // normal LTE
        doReturn(TelephonyManager.NETWORK_TYPE_LTE).when(mServiceState).getDataNetworkType();
@@ -2156,7 +2158,7 @@ public class DcTrackerTest extends TelephonyTest {
        waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());

        verify(mPhone, times(1)).notifyDisplayInfoChanged(captor.capture());
        assertEquals(DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
                captor.getValue().getOverrideNetworkType());

        // LTE CA
@@ -2165,7 +2167,7 @@ public class DcTrackerTest extends TelephonyTest {
        waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());

        verify(mPhone, times(2)).notifyDisplayInfoChanged(captor.capture());
        assertEquals(DisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA,
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA,
                captor.getValue().getOverrideNetworkType());

        // TODO: LTE ADVANCED PRO
@@ -2173,16 +2175,18 @@ public class DcTrackerTest extends TelephonyTest {

    @Test
    public void testUpdateDisplayInfo() {
        ArgumentCaptor<DisplayInfo> captor = ArgumentCaptor.forClass(DisplayInfo.class);
        ArgumentCaptor<TelephonyDisplayInfo> captor =
                ArgumentCaptor.forClass(TelephonyDisplayInfo.class);
        doReturn(TelephonyManager.NETWORK_TYPE_HSPAP).when(mServiceState).getDataNetworkType();

        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_SERVICE_STATE_CHANGED));
        waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());

        verify(mPhone, times(1)).notifyDisplayInfoChanged(captor.capture());
        DisplayInfo displayInfo = captor.getValue();
        assertEquals(TelephonyManager.NETWORK_TYPE_HSPAP, displayInfo.getNetworkType());
        assertEquals(DisplayInfo.OVERRIDE_NETWORK_TYPE_NONE, displayInfo.getOverrideNetworkType());
        TelephonyDisplayInfo telephonyDisplayInfo = captor.getValue();
        assertEquals(TelephonyManager.NETWORK_TYPE_HSPAP, telephonyDisplayInfo.getNetworkType());
        assertEquals(TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE,
                telephonyDisplayInfo.getOverrideNetworkType());
    }

    /**