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

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

Merge "Renamed DisplayInfo to TelephonyDisplayInfo"

parents 4d6b4815 a29d0e12
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -28,11 +28,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.emergency.EmergencyNumber;
@@ -208,9 +208,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;
@@ -2430,8 +2430,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
@@ -73,7 +73,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;
import android.telephony.ServiceState.RilRadioTechnology;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionPlan;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.data.ApnSetting;
@@ -331,8 +331,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 = "";

@@ -3739,7 +3739,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:
@@ -3850,11 +3850,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);
            }
@@ -4035,13 +4035,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();
            }
@@ -4050,10 +4050,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;
@@ -4084,21 +4085,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
@@ -63,13 +63,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;
@@ -2102,7 +2102,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
@@ -2121,7 +2122,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
@@ -2130,7 +2131,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
@@ -2139,7 +2140,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();
@@ -2150,7 +2151,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
@@ -2159,13 +2160,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();
@@ -2173,7 +2175,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
@@ -2182,7 +2184,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
@@ -2190,16 +2192,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());
    }

    /**