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

Commit e763635e authored by Sarah Chin's avatar Sarah Chin
Browse files

Handle RIL errors properly

Separate out RemoteException and RuntimeException so the latter throws a
SYSTEM_ERR instead of setting the radio to unavailable.
If the radio proxy does not exist, return REQUEST_NOT_SUPPORTED so the
onComplete message is sent instead of hanging

Test: atest RILTest
Bug: 231996546
Change-Id: I62e0593e6ff338f43b889287143b54137e47599d
parent 08d6c78f
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -2178,8 +2178,21 @@ public class RIL extends BaseCommands implements CommandsInterface {
                dataProxy.setupDataCall(rr.mSerial, mPhoneId, accessNetworkType, dataProfile,
                        isRoaming, allowRoaming, reason, linkProperties, pduSessionId, sliceInfo,
                        trafficDescriptor, matchAllRuleAllowed);
            } catch (RemoteException | RuntimeException e) {
            } catch (RemoteException e) {
                handleRadioProxyExceptionForRR(HAL_SERVICE_DATA, "setupDataCall", e);
            } catch (RuntimeException e) {
                riljLoge("setupDataCall RuntimeException: " + e);
                int error = RadioError.SYSTEM_ERR;
                int responseType = RadioResponseType.SOLICITED;
                processResponseInternal(HAL_SERVICE_DATA, rr.mSerial, error, responseType);
                processResponseDoneInternal(rr, error, responseType, null);
            }
        } else {
            riljLoge("setupDataCall: DataProxy is empty");
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                result.sendToTarget();
            }
        }
    }