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

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

Fixed the phone number issue

The phone number from UICC should always reflect the
content from the SIM card instead of cached value.

Fix: 387519623
Test: atest SubscriptionManagerServiceTest
Flag: EXEMPT bug fixing
Change-Id: Ied676c39b8459a02ec6debf4bcfdb666ecb13dbe
parent 69f71d05
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -3919,12 +3919,10 @@ public class SubscriptionManagerService extends ISub.Stub {
            case SubscriptionManager.PHONE_NUMBER_SOURCE_UICC:
                final Phone phone = PhoneFactory.getPhone(getSlotIndex(subId));
                if (phone != null) {
                    String number = phone.getLine1Number();
                    if (!TextUtils.isEmpty(number)) {
                        return number;
                    }
                }
                    return TextUtils.emptyIfNull(phone.getLine1Number());
                } else {
                    return subInfo.getNumber();
                }
            case SubscriptionManager.PHONE_NUMBER_SOURCE_CARRIER:
                return subInfo.getNumberFromCarrier();
            case SubscriptionManager.PHONE_NUMBER_SOURCE_IMS:
+1 −2
Original line number Diff line number Diff line
@@ -107,7 +107,6 @@ import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.util.ArraySet;
import android.util.Base64;
import android.util.Log;

import com.android.internal.R;
import com.android.internal.telephony.ContextFixture;
@@ -2579,7 +2578,7 @@ public class SubscriptionManagerServiceTest extends TelephonyTest {
        // If getLine1Number is empty, then the number should be from the sub info.
        assertThat(mSubscriptionManagerServiceUT.getPhoneNumber(1,
                SubscriptionManager.PHONE_NUMBER_SOURCE_UICC, CALLING_PACKAGE, CALLING_FEATURE))
                .isEqualTo(FAKE_PHONE_NUMBER2);
                .isEqualTo("");
    }

    @Test