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

Commit d79e4463 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Add support for recognizing WPS calls which change caller ID state.

WPS calls can use the *31# or #31# prefixes to enable or disable caller ID when dialed.  This CL adds support for recognizing calls with these prefixes as a WPS call.

Test: Added new unit tests to verify dial behavior for WPS calls with
caller ID activate/deactivate prefix.
Fixes: 173797422
Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1511375
Merged-In: I4cb717630ade3f7e4195dcdbef34952450c42ba0
Change-Id: I4cb717630ade3f7e4195dcdbef34952450c42ba0
(cherry picked from commit 5906e562)
parent d4a7c567
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -152,6 +152,10 @@ public class GsmCdmaPhone extends Phone {
    public static final int RESTART_ECM_TIMER = 0; // restart Ecm timer
    public static final int CANCEL_ECM_TIMER = 1; // cancel Ecm timer
    private static final String PREFIX_WPS = "*272";
    // WPS prefix when CLIR is being deactivated for the call.
    private static final String PREFIX_WPS_CLIR_DEACTIVATE = "#31#*272";
    // WPS prefix when CLIS is being activated for the call.
    private static final String PREFIX_WPS_CLIR_ACTIVATE = "*31#*272";
    private CdmaSubscriptionSourceManager mCdmaSSM;
    public int mCdmaSubscriptionSource = CdmaSubscriptionSourceManager.SUBSCRIPTION_SOURCE_UNKNOWN;
    private PowerManager.WakeLock mWakeLock;
@@ -1326,7 +1330,9 @@ public class GsmCdmaPhone extends Phone {
                .getBoolean(CarrierConfigManager.KEY_CARRIER_USE_IMS_FIRST_FOR_EMERGENCY_BOOL);

        /** Check if the call is Wireless Priority Service call */
        boolean isWpsCall = dialString != null ? dialString.startsWith(PREFIX_WPS) : false;
        boolean isWpsCall = dialString != null ? (dialString.startsWith(PREFIX_WPS)
                || dialString.startsWith(PREFIX_WPS_CLIR_ACTIVATE)
                || dialString.startsWith(PREFIX_WPS_CLIR_DEACTIVATE)) : false;
        boolean allowWpsOverIms = configManager.getConfigForSubId(getSubId())
                .getBoolean(CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL);

+78 −3
Original line number Diff line number Diff line
@@ -502,8 +502,8 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
            mContextFixture.getCarrierConfigBundle().putBoolean(
                    CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, false);

            Connection connection = mPhoneUT.dial("*27216505551212",
                    new PhoneInternalInterface.DialArgs.Builder().build());
            mPhoneUT.dial("*27216505551212", new PhoneInternalInterface.DialArgs.Builder().build());

            verify(mCT).dialGsm("*27216505551212", null, null);
            verify(mImsCT).hangupAllConnections();
        } catch (CallStateException e) {
@@ -511,6 +511,44 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        }
    }

    @Test
    @SmallTest
    public void testWpsClirActiveDialOverCs() throws Exception {
        try {
            setupForWpsCallTest();

            mContextFixture.getCarrierConfigBundle().putBoolean(
                    CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, false);

            mPhoneUT.dial("*31#*27216505551212",
                    new PhoneInternalInterface.DialArgs.Builder().build());

            verify(mCT).dialGsm("*27216505551212", CommandsInterface.CLIR_SUPPRESSION, null, null);
            verify(mImsCT).hangupAllConnections();
        } catch (CallStateException e) {
            fail();
        }
    }

    @Test
    @SmallTest
    public void testWpsClirInactiveDialOverCs() throws Exception {
        try {
            setupForWpsCallTest();

            mContextFixture.getCarrierConfigBundle().putBoolean(
                    CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, false);

            mPhoneUT.dial("#31#*27216505551212",
                    new PhoneInternalInterface.DialArgs.Builder().build());

            verify(mCT).dialGsm("*27216505551212", CommandsInterface.CLIR_INVOCATION, null, null);
            verify(mImsCT).hangupAllConnections();
        } catch (CallStateException e) {
            fail();
        }
    }

    @Test
    @SmallTest
    public void testWpsDialOverIms() throws Exception {
@@ -520,7 +558,7 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
            mContextFixture.getCarrierConfigBundle().putBoolean(
                    CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, true);

            Connection connection = mPhoneUT.dial("*27216505551212",
            mPhoneUT.dial("*27216505551212",
                    new PhoneInternalInterface.DialArgs.Builder().build());
            verify(mCT).dialGsm("*27216505551212", null, null);
            verify(mImsCT, never()).hangupAllConnections();
@@ -529,6 +567,43 @@ public class GsmCdmaPhoneTest extends TelephonyTest {
        }
    }

    @Test
    @SmallTest
    public void testWpsClirActiveDialOverIms() throws Exception {
        try {
            setupForWpsCallTest();

            mContextFixture.getCarrierConfigBundle().putBoolean(
                    CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, true);

            mPhoneUT.dial("*31#*27216505551212",
                    new PhoneInternalInterface.DialArgs.Builder().build());
            verify(mCT).dialGsm("*27216505551212", CommandsInterface.CLIR_SUPPRESSION, null, null);
            verify(mImsCT, never()).hangupAllConnections();
        } catch (CallStateException e) {
            fail();
        }
    }

    @Test
    @SmallTest
    public void testWpsClirInactiveDialOverIms() throws Exception {
        try {
            setupForWpsCallTest();

            mContextFixture.getCarrierConfigBundle().putBoolean(
                    CarrierConfigManager.KEY_SUPPORT_WPS_OVER_IMS_BOOL, true);

            mPhoneUT.dial("#31#*27216505551212",
                    new PhoneInternalInterface.DialArgs.Builder().build());

            verify(mCT).dialGsm("*27216505551212", CommandsInterface.CLIR_INVOCATION, null, null);
            verify(mImsCT, never()).hangupAllConnections();
        } catch (CallStateException e) {
            fail();
        }
    }

    @Test
    @SmallTest
    public void testHandlePinMmi() {