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

Commit 3b30de8b authored by Youming Ye's avatar Youming Ye
Browse files

Fix the Mmi code cast exception

Catch the cast exception when code #157# handled by
utConfigurationCallBarringQueried, which has the argument type
ImsSsInfo[]. Since the comprehensive fix needs to change signed released
aidl interface and corresponding APIs, temporarily fix it by try catch
block, and mark TODO in R.

Bug: 132683077
Test: Build
Change-Id: Ia1634e7da8b5eb5de4827666af64d886c9172a00
parent 78dc720a
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import com.android.internal.telephony.MmiCode;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.uicc.IccRecords;

import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -1550,8 +1551,14 @@ public final class ImsPhoneMmiCode extends Handler implements MmiCode {
                sb.append(getErrorMessage(ar));
            }
        } else {
            List<ImsSsInfo> infos = (List<ImsSsInfo>) ar.result;
            if (infos.size() == 0) {
            List<ImsSsInfo> infos = null;
            try {
                infos = (List<ImsSsInfo>) ar.result;
            } catch (ClassCastException cce) {
                // TODO in R: #157# still has ImsSsInfo[] type, fix the type in IImsUtListener.aidl.
                infos = Arrays.asList((ImsSsInfo[]) ar.result);
            }
            if (infos == null || infos.size() == 0) {
                sb.append(mContext.getText(com.android.internal.R.string.serviceDisabled));
            } else {
                ImsSsInfo info;