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

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

Fix minor bugs with calling APIs through vendor satellite service

Return null instead of SatelliteException if the error is ERROR_NONE
Handle SatelliteException properly to get the error code

Test: atest SatelliteManagerTest E2E with vendor satellite service
Bug: 270868171
Change-Id: I8d141c3223a7f6ab3c46ad16cc34a81f8be5468b
parent 1f2de34d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -998,13 +998,15 @@ public class SatelliteModemInterface {
    }

    public boolean isSatelliteServiceSupported() {
        // TODO: update this method
        // TODO: update this method to check a device config instead
        return mIsSatelliteServiceSupported;
    }

    private static void sendMessageWithResult(@NonNull Message message, @Nullable Object result,
            @SatelliteManager.SatelliteError int error) {
        AsyncResult.forMessage(message, result, new SatelliteException(error));
        SatelliteException exception = error == SatelliteManager.SATELLITE_ERROR_NONE
                ? null : new SatelliteException(error);
        AsyncResult.forMessage(message, result, exception);
        message.sendToTarget();
    }

+4 −3
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.AsyncResult;
import android.telephony.Rlog;
import android.telephony.SubscriptionManager;
import android.telephony.satellite.PointingInfo;
import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteDatagram;
@@ -221,10 +220,12 @@ public class SatelliteServiceUtils {
        } else {
            errorCode = SatelliteManager.SATELLITE_ERROR;
            if (ar.exception instanceof CommandException) {
                CommandException.Error error =
                        ((CommandException) (ar.exception)).getCommandError();
                CommandException.Error error = ((CommandException) ar.exception).getCommandError();
                errorCode = RILUtils.convertToSatelliteError(error);
                loge(caller + " CommandException: " + ar.exception);
            } else if (ar.exception instanceof SatelliteManager.SatelliteException) {
                errorCode = ((SatelliteManager.SatelliteException) ar.exception).getErrorCode();
                loge(caller + " SatelliteException: " + ar.exception);
            } else {
                loge(caller + " unknown exception: " + ar.exception);
            }