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

Commit c9c7afb9 authored by Tyler Gunn's avatar Tyler Gunn Committed by Automerger Merge Worker
Browse files

Merge "Fix potential crash when displaying MMI error result." into sc-dev am: 15845fa1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/15132600

Change-Id: I4b05c3c79de9ac371bf2efef535d47e81427b12a
parents 9288177c 15845fa1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1228,7 +1228,7 @@ public final class GsmMmiCode extends Handler implements MmiCode {
    onUssdFinishedError() {
        if (mState == State.PENDING) {
            mState = State.FAILED;
            if (mMessage.length() == 0) {
            if (TextUtils.isEmpty(mMessage)) {
                mMessage = mContext.getText(com.android.internal.R.string.mmiError);
            }
            Rlog.d(LOG_TAG, "onUssdFinishedError");
+4 −6
Original line number Diff line number Diff line
@@ -346,8 +346,8 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
        return dialString;
    }

    static ImsPhoneMmiCode
    newNetworkInitiatedUssd(String ussdMessage, boolean isUssdRequest, ImsPhone phone) {
    public static ImsPhoneMmiCode newNetworkInitiatedUssd(String ussdMessage,
            boolean isUssdRequest, ImsPhone phone) {
        ImsPhoneMmiCode ret;

        ret = new ImsPhoneMmiCode(phone);
@@ -1194,12 +1194,10 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
     *
     * The radio has reset, and this is still pending
     */

    void
    onUssdFinishedError() {
    public void onUssdFinishedError() {
        if (mState == State.PENDING) {
            mState = State.FAILED;
            if (mMessage.length() == 0) {
            if (TextUtils.isEmpty(mMessage)) {
                mMessage = mContext.getText(com.android.internal.R.string.mmiError);
            }
            Rlog.d(LOG_TAG, "onUssdFinishedError: mmi=" + this);
+12 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony.gsm;

import static junit.framework.Assert.fail;

import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
@@ -95,6 +97,16 @@ public class GsmMmiCodeTest extends TelephonyTest {
        assertTrue(mGsmMmiCode == null);
    }

    @Test
    public void testNoCrashOnEmptyMessage() {
        GsmMmiCode mmi = GsmMmiCode.newNetworkInitiatedUssd(null, true, mGsmCdmaPhoneUT, null);
        try {
            mmi.onUssdFinishedError();
        } catch (Exception e) {
            fail("Shouldn't crash!!!");
        }
    }

    private void setCarrierSupportsCallerIdVerticalServiceCodesCarrierConfig() {
        final PersistableBundle bundle = new PersistableBundle();
        bundle.putBoolean(CarrierConfigManager
+12 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony.imsphone;

import static junit.framework.Assert.fail;

import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doReturn;
@@ -101,6 +103,16 @@ public class ImsPhoneMmiCodeTest extends TelephonyTest {
        assertTrue(mImsPhoneMmiCode == null);
    }

    @Test
    public void testNoCrashOnEmptyMessage() {
        ImsPhoneMmiCode mmi = ImsPhoneMmiCode.newNetworkInitiatedUssd(null, true, mImsPhoneUT);
        try {
            mmi.onUssdFinishedError();
        } catch (Exception e) {
            fail("Shouldn't crash!!!");
        }
    }

    private void setCarrierSupportsCallerIdVerticalServiceCodesCarrierConfig() {
        final PersistableBundle bundle = new PersistableBundle();
        bundle.putBoolean(CarrierConfigManager