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

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

Merge "Integrate public WFC IMS registration failure intent" am: b54bc9f1 am: f8117d6a

Change-Id: I95f86b67abff40a4357ae2e903ceb9d34c2a7cb6
parents 5bd47b7e f8117d6a
Loading
Loading
Loading
Loading
+14 −2
Original line number Original line Diff line number Diff line
@@ -321,8 +321,20 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * TODO: Replace this with a proper exception; {@link CallStateException} doesn't make sense.
     * TODO: Replace this with a proper exception; {@link CallStateException} doesn't make sense.
     */
     */
    public static final String CS_FALLBACK = "cs_fallback";
    public static final String CS_FALLBACK = "cs_fallback";
    public static final String EXTRA_KEY_ALERT_TITLE = "alertTitle";
    /**
    public static final String EXTRA_KEY_ALERT_MESSAGE = "alertMessage";
     * @deprecated Use {@link android.telephony.ims.ImsManager#EXTRA_WFC_REGISTRATION_FAILURE_TITLE}
     * instead.
     */
    @Deprecated
    public static final String EXTRA_KEY_ALERT_TITLE =
            android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_TITLE;
    /**
     * @deprecated Use
     * {@link android.telephony.ims.ImsManager#EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE} instead.
     */
    @Deprecated
    public static final String EXTRA_KEY_ALERT_MESSAGE =
            android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE;
    public static final String EXTRA_KEY_ALERT_SHOW = "alertShow";
    public static final String EXTRA_KEY_ALERT_SHOW = "alertShow";
    public static final String EXTRA_KEY_NOTIFICATION_MESSAGE = "notificationMessage";
    public static final String EXTRA_KEY_NOTIFICATION_MESSAGE = "notificationMessage";


+15 −8
Original line number Original line Diff line number Diff line
@@ -16,6 +16,9 @@


package com.android.internal.telephony.imsphone;
package com.android.internal.telephony.imsphone;


import static android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE;
import static android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_TITLE;

import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAIC;
import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAIC;
import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAICr;
import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAICr;
import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAOC;
import static com.android.internal.telephony.CommandsInterface.CB_FACILITY_BAOC;
@@ -1936,16 +1939,19 @@ public class ImsPhone extends ImsPhoneBase {
                // Default result code (as passed to sendOrderedBroadcast)
                // Default result code (as passed to sendOrderedBroadcast)
                // means that intent was not received by WfcSettings.
                // means that intent was not received by WfcSettings.


                CharSequence title = intent.getCharSequenceExtra(EXTRA_KEY_ALERT_TITLE);
                CharSequence title =
                CharSequence messageAlert = intent.getCharSequenceExtra(EXTRA_KEY_ALERT_MESSAGE);
                        intent.getCharSequenceExtra(EXTRA_WFC_REGISTRATION_FAILURE_TITLE);
                CharSequence messageNotification = intent.getCharSequenceExtra(EXTRA_KEY_NOTIFICATION_MESSAGE);
                CharSequence messageAlert =
                        intent.getCharSequenceExtra(EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE);
                CharSequence messageNotification =
                        intent.getCharSequenceExtra(EXTRA_KEY_NOTIFICATION_MESSAGE);


                Intent resultIntent = new Intent(Intent.ACTION_MAIN);
                Intent resultIntent = new Intent(Intent.ACTION_MAIN);
                resultIntent.setClassName("com.android.settings",
                resultIntent.setClassName("com.android.settings",
                        "com.android.settings.Settings$WifiCallingSettingsActivity");
                        "com.android.settings.Settings$WifiCallingSettingsActivity");
                resultIntent.putExtra(EXTRA_KEY_ALERT_SHOW, true);
                resultIntent.putExtra(EXTRA_KEY_ALERT_SHOW, true);
                resultIntent.putExtra(EXTRA_KEY_ALERT_TITLE, title);
                resultIntent.putExtra(EXTRA_WFC_REGISTRATION_FAILURE_TITLE, title);
                resultIntent.putExtra(EXTRA_KEY_ALERT_MESSAGE, messageAlert);
                resultIntent.putExtra(EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE, messageAlert);
                PendingIntent resultPendingIntent =
                PendingIntent resultPendingIntent =
                        PendingIntent.getActivity(
                        PendingIntent.getActivity(
                                mContext,
                                mContext,
@@ -2070,9 +2076,10 @@ public class ImsPhone extends ImsPhoneBase {


            // If WfcSettings are active then alert will be shown
            // If WfcSettings are active then alert will be shown
            // otherwise notification will be added.
            // otherwise notification will be added.
            Intent intent = new Intent(ImsManager.ACTION_IMS_REGISTRATION_ERROR);
            Intent intent = new Intent(
            intent.putExtra(EXTRA_KEY_ALERT_TITLE, title);
                    android.telephony.ims.ImsManager.ACTION_WFC_IMS_REGISTRATION_ERROR);
            intent.putExtra(EXTRA_KEY_ALERT_MESSAGE, messageAlert);
            intent.putExtra(EXTRA_WFC_REGISTRATION_FAILURE_TITLE, title);
            intent.putExtra(EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE, messageAlert);
            intent.putExtra(EXTRA_KEY_NOTIFICATION_MESSAGE, messageNotification);
            intent.putExtra(EXTRA_KEY_NOTIFICATION_MESSAGE, messageNotification);
            mContext.sendOrderedBroadcast(intent, null, mResultReceiver,
            mContext.sendOrderedBroadcast(intent, null, mResultReceiver,
                    null, Activity.RESULT_OK, null, null);
                    null, Activity.RESULT_OK, null, null);
+7 −10
Original line number Original line Diff line number Diff line
@@ -68,7 +68,6 @@ import androidx.test.filters.FlakyTest;


import com.android.ims.FeatureConnector;
import com.android.ims.FeatureConnector;
import com.android.ims.ImsEcbmStateListener;
import com.android.ims.ImsEcbmStateListener;
import com.android.ims.ImsManager;
import com.android.ims.ImsUtInterface;
import com.android.ims.ImsUtInterface;
import com.android.ims.RcsFeatureManager;
import com.android.ims.RcsFeatureManager;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.Call;
@@ -627,15 +626,14 @@ public class ImsPhoneTest extends TelephonyTest {
        assertEquals(false, mImsPhoneUT.getWakeLock().isHeld());
        assertEquals(false, mImsPhoneUT.getWakeLock().isHeld());
    }
    }


    @FlakyTest
    @Test
    @Test
    @SmallTest
    @SmallTest
    @Ignore
    public void testProcessDisconnectReason() throws Exception {
    public void testProcessDisconnectReason() throws Exception {
        // set up CarrierConfig
        // set up CarrierConfig
        PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
        PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
        bundle.putStringArray(CarrierConfigManager.KEY_WFC_OPERATOR_ERROR_CODES_STRING_ARRAY,
        bundle.putStringArray(CarrierConfigManager.KEY_WFC_OPERATOR_ERROR_CODES_STRING_ARRAY,
                new String[]{"REG09|0"});
                new String[]{"REG09|0"});
        doReturn(true).when(mImsManager).isWfcEnabledByUser();


        // set up overlays
        // set up overlays
        String title = "title";
        String title = "title";
@@ -652,18 +650,17 @@ public class ImsPhoneTest extends TelephonyTest {
        mImsPhoneUT.processDisconnectReason(
        mImsPhoneUT.processDisconnectReason(
                new ImsReasonInfo(ImsReasonInfo.CODE_REGISTRATION_ERROR, 0, "REG09"));
                new ImsReasonInfo(ImsReasonInfo.CODE_REGISTRATION_ERROR, 0, "REG09"));


        // TODO: Verify that WFC has been turned off (can't do it right now because
        // setWfcSetting is static).
        //verify(mImsManager).setWfcSetting(any(), eq(false));

        ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
        ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
        verify(mContext).sendOrderedBroadcast(
        verify(mContext).sendOrderedBroadcast(
                intent.capture(), nullable(String.class), any(BroadcastReceiver.class),
                intent.capture(), nullable(String.class), any(BroadcastReceiver.class),
                nullable(Handler.class), eq(Activity.RESULT_OK), nullable(String.class),
                nullable(Handler.class), eq(Activity.RESULT_OK), nullable(String.class),
                nullable(Bundle.class));
                nullable(Bundle.class));
        assertEquals(ImsManager.ACTION_IMS_REGISTRATION_ERROR, intent.getValue().getAction());
        assertEquals(android.telephony.ims.ImsManager.ACTION_WFC_IMS_REGISTRATION_ERROR,
        assertEquals(title, intent.getValue().getStringExtra(Phone.EXTRA_KEY_ALERT_TITLE));
                intent.getValue().getAction());
        assertEquals(messageAlert, intent.getValue().getStringExtra(Phone.EXTRA_KEY_ALERT_MESSAGE));
        assertEquals(title, intent.getValue().getStringExtra(
                android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_TITLE));
        assertEquals(messageAlert, intent.getValue().getStringExtra(
                android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE));
        assertEquals(messageNotification,
        assertEquals(messageNotification,
                intent.getValue().getStringExtra(Phone.EXTRA_KEY_NOTIFICATION_MESSAGE));
                intent.getValue().getStringExtra(Phone.EXTRA_KEY_NOTIFICATION_MESSAGE));
    }
    }