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

Commit baed8c3a authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Use TelephonyManager API to check if device is voice capable." am: ed6ca019 am: f2ce0b52

Change-Id: Icbca9084b06c1b5abfa7d86fc8d099e2ae12c48e
parents ec849a61 f2ce0b52
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -449,8 +449,8 @@ public class TelecomServiceImpl {
            try {
                Log.startSession("TSI.rPA");
                synchronized (mLock) {
                    if (!mContext.getApplicationContext().getResources().getBoolean(
                            com.android.internal.R.bool.config_voice_capable)) {
                    if (!((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE))
                                .isVoiceCapable()) {
                        Log.w(this,
                                "registerPhoneAccount not allowed on non-voice capable device.");
                        return;
+3 −2
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.telecom.PhoneAccount;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;

import com.android.server.telecom.CallIntentProcessor;
import com.android.server.telecom.R;
@@ -163,8 +164,8 @@ public class UserCallIntentProcessor {
     * @return {@code True} if the device is voice-capable.
     */
    private boolean isVoiceCapable() {
        return mContext.getApplicationContext().getResources().getBoolean(
                com.android.internal.R.bool.config_voice_capable);
        return ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE))
                .isVoiceCapable();
    }

    /**
+4 −2
Original line number Diff line number Diff line
@@ -190,8 +190,10 @@ public class TelecomServiceImplTest extends TelecomTestCase {
    public void setUp() throws Exception {
        super.setUp();
        mContext = mComponentContextFixture.getTestDouble().getApplicationContext();
        mComponentContextFixture.putBooleanResource(
                com.android.internal.R.bool.config_voice_capable, true);

        TelephonyManager mockTelephonyManager =
                (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
        when(mockTelephonyManager.isVoiceCapable()).thenReturn(true);

        doReturn(mContext).when(mContext).getApplicationContext();
        doNothing().when(mContext).sendBroadcastAsUser(any(Intent.class), any(UserHandle.class),
+3 −2
Original line number Diff line number Diff line
@@ -581,8 +581,9 @@ public class TelecomSystemTest extends TelecomTestCase {
        mComponentContextFixture.putResource(
                com.android.server.telecom.R.string.incall_default_class,
                mInCallServiceComponentNameX.getClassName());
        mComponentContextFixture.putBooleanResource(
                com.android.internal.R.bool.config_voice_capable, true);

        doReturn(true).when(mComponentContextFixture.getTelephonyManager())
                .isVoiceCapable();

        mInCallServiceFixtureX = new InCallServiceFixture();
        mInCallServiceFixtureY = new InCallServiceFixture();