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

Commit 54e4108a authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Remove TelephonyManager#isVoiceCapable calls from Telecom

Remove references to TelephonyManager#isVoiceCapable from Telecom.
Telecom now has a separate FEATURE_TELECOM feature, so it makes no
sense to call into TelephonyManager#isVoiceCapable.

Test: Updated unit tests.
Fixes: 228452834
Change-Id: I2cd67d957b95556cb6b396015894ff901f869d65
parent e3dfe2d9
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -530,12 +530,6 @@ public class TelecomServiceImpl {
            try {
                Log.startSession("TSI.rPA");
                synchronized (mLock) {
                    if (!((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE))
                                .isVoiceCapable()) {
                        Log.w(this,
                                "registerPhoneAccount not allowed on non-voice capable device.");
                        return;
                    }
                    try {
                        enforcePhoneAccountModificationForPackage(
                                account.getAccountHandle().getComponentName().getPackageName());
+0 −15
Original line number Diff line number Diff line
@@ -80,11 +80,6 @@ public class UserCallIntentProcessor {
     */
    public void processIntent(Intent intent, String callingPackageName,
            boolean canCallNonEmergency, boolean isLocalInvocation) {
        // Ensure call intents are not processed on devices that are not capable of calling.
        if (!isVoiceCapable()) {
            return;
        }

        String action = intent.getAction();

        if (Intent.ACTION_CALL.equals(action) ||
@@ -159,16 +154,6 @@ public class UserCallIntentProcessor {
        sendIntentToDestination(intent, isLocalInvocation, callingPackageName);
    }

    /**
     * Returns whether the device is voice-capable (e.g. a phone vs a tablet).
     *
     * @return {@code True} if the device is voice-capable.
     */
    private boolean isVoiceCapable() {
        return ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE))
                .isVoiceCapable();
    }

    /**
     * Potentially trampolines the intent to Telecom via TelecomServiceImpl.
     * If the caller is local to the Telecom service, we send the intent to Telecom without
+0 −4
Original line number Diff line number Diff line
@@ -199,10 +199,6 @@ public class TelecomServiceImplTest extends TelecomTestCase {
        super.setUp();
        mContext = mComponentContextFixture.getTestDouble().getApplicationContext();

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

        doReturn(mContext).when(mContext).getApplicationContext();
        doReturn(mContext).when(mContext).createContextAsUser(any(UserHandle.class), anyInt());
        doNothing().when(mContext).sendBroadcastAsUser(any(Intent.class), any(UserHandle.class),
+0 −3
Original line number Diff line number Diff line
@@ -573,9 +573,6 @@ public class TelecomSystemTest extends TelecomTestCase {
                com.android.server.telecom.R.string.incall_default_class,
                mInCallServiceComponentNameX.getClassName());

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

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