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

Commit bd971968 authored by Bonian Chen's avatar Bonian Chen Committed by Android (Google) Code Review
Browse files

Merge "[Settings] IMS feature checking before accessing VT IMS API" into tm-dev

parents cb387535 e0f10817
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settings.network.telephony;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.PersistableBundle;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
@@ -129,6 +130,12 @@ public class VideoCallingPreferenceController extends TelephonyTogglePreferenceC
        return queryImsState(mSubId).isEnabledByUser();
    }

    @VisibleForTesting
    protected boolean isImsSupported() {
        return mContext.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_TELEPHONY_IMS);
    }

    public VideoCallingPreferenceController init(int subId) {
        mSubId = subId;

@@ -154,7 +161,7 @@ public class VideoCallingPreferenceController extends TelephonyTogglePreferenceC
            return false;
        }

        return queryImsState(subId).isReadyToVideoCall();
        return isImsSupported() && queryImsState(subId).isReadyToVideoCall();
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ public class VideoCallingPreferenceControllerTest {
        mController.init(SUB_ID);
        doReturn(mQueryImsState).when(mController).queryImsState(anyInt());
        doReturn(mQueryVoLteState).when(mController).queryVoLteState(anyInt());
        doReturn(true).when(mController).isImsSupported();
        mPreference.setKey(mController.getPreferenceKey());

        mQueryImsState.setIsEnabledByPlatform(true);