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

Commit b4d94a8c authored by Lei Yu's avatar Lei Yu Committed by Android (Google) Code Review
Browse files

Merge "Handle null intent in WifiCallingPreferenceController" into qt-dev

parents 4af74dd8 41bb2cb6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -114,6 +114,10 @@ public class WifiCallingPreferenceController extends TelephonyBasePreferenceCont
        if (mSimCallManager != null) {
            Intent intent = MobileNetworkUtils.buildPhoneAccountConfigureIntent(mContext,
                    mSimCallManager);
            if (intent == null) {
                // Do nothing in this case since preference is invisible
                return;
            }
            final PackageManager pm = mContext.getPackageManager();
            List<ResolveInfo> resolutions = pm.queryIntentActivities(intent, 0);
            preference.setTitle(resolutions.get(0).loadLabel(pm));
+9 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.PersistableBundle;
import android.provider.Settings;
import android.telecom.PhoneAccountHandle;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -117,6 +118,14 @@ public class WifiCallingPreferenceControllerTest {
        assertThat(mPreference.isEnabled()).isFalse();
    }

    @Test
    public void updateState_invalidPhoneAccountHandle_shouldNotCrash() {
        mController.mSimCallManager = new PhoneAccountHandle(null /* invalid */, "");

        //Should not crash
        mController.updateState(mPreference);
    }

    @Test
    public void updateState_wfcNonRoaming() {
        assertNull(mController.mSimCallManager);