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

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

Remap some CommandException errors instead of reporting NORMAL_CLEARING.

When a CommandException occurs during EVENT_GET_LAST_CALL_FAIL_CAUSE, we
currently just report NORMAL_CLEARING.

There are some CommandException error codes which are truly exceptional,
so we will remap these as ERROR_UNSPECIFIED (not the best, but it is
better than NORMAL_CLEARING).  We'll also set the vendorCause to the
commandError code so that it'll appear in the Telecom logs.

Test: Build (not reproducible).
Bug: 114046998
Change-Id: I983d68a264699828355048448022a025d61e771f
parent c13b7a25
Loading
Loading
Loading
Loading
+30 −5
Original line number Diff line number Diff line
@@ -1433,11 +1433,36 @@ public class GsmCdmaCallTracker extends CallTracker {
                operationComplete();

                if (ar.exception != null) {
                    if (ar.exception instanceof CommandException) {
                        // If we get a CommandException, there are some modem-reported command
                        // errors which are truly exceptional.  We shouldn't treat these as
                        // NORMAL_CLEARING, so we'll re-map to ERROR_UNSPECIFIED.
                        CommandException commandException = (CommandException) ar.exception;
                        switch (commandException.getCommandError()) {
                            case RADIO_NOT_AVAILABLE:
                                // Intentional fall-through.
                            case NO_MEMORY:
                                // Intentional fall-through.
                            case INTERNAL_ERR:
                                // Intentional fall-through.
                            case NO_RESOURCES:
                                causeCode = CallFailCause.ERROR_UNSPECIFIED;

                                // Report the actual internal command error as the vendor cause;
                                // this will ensure it gets bubbled up into the Telecom logs.
                                vendorCause = commandException.getCommandError().toString();
                                break;
                            default:
                                causeCode = CallFailCause.NORMAL_CLEARING;
                        }
                    } else {
                        // An exception occurred...just treat the disconnect
                        // cause as "normal"
                        causeCode = CallFailCause.NORMAL_CLEARING;
                        Rlog.i(LOG_TAG,
                            "Exception during getLastCallFailCause, assuming normal disconnect");
                                "Exception during getLastCallFailCause, assuming normal "
                                        + "disconnect");
                    }
                } else {
                    LastCallFailCause failCause = (LastCallFailCause)ar.result;
                    causeCode = failCause.causeCode;