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

Commit 77c23265 authored by Aishwarya Mallampati's avatar Aishwarya Mallampati Committed by Android (Google) Code Review
Browse files

Merge "Remove satellite supported check before calling setSatelliteEnabledForCarrier" into main

parents 65536003 97f71107
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -5345,7 +5345,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public void setSatellitePlmn(int simSlot, @NonNull List<String> carrierPlmnList,
            @NonNull List<String> allSatellitePlmnList, Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (getHalVersion(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_2_4)) {
        if (getHalVersion(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_2_3)) {
            riljLog("setSatellitePlmn: SatelliteModemInterface is used.");
            SatelliteModemInterface.getInstance().setSatellitePlmn(
                    simSlot, carrierPlmnList, allSatellitePlmnList, result);
@@ -5378,7 +5378,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
            Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (getHalVersion(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_2_4)) {
        if (getHalVersion(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_2_3)) {
            riljLog("setSatelliteEnabledForCarrier: SatelliteModemInterface is used.");
            SatelliteModemInterface.getInstance().requestSetSatelliteEnabledForCarrier(
                    simSlot, satelliteEnabled, result);
@@ -5408,7 +5408,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void isSatelliteEnabledForCarrier(int simSlot, Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (getHalVersion(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_2_4)) {
        if (getHalVersion(HAL_SERVICE_NETWORK).less(RADIO_HAL_VERSION_2_3)) {
            riljLog("isSatelliteEnabledForCarrier: SatelliteModemInterface is used.");
            SatelliteModemInterface.getInstance().requestIsSatelliteEnabledForCarrier(
                    simSlot, result);
+13 −22
Original line number Diff line number Diff line
@@ -5813,12 +5813,6 @@ public class SatelliteController extends Handler {
                    + "SetSatelliteAttachEnableForCarrier error code =" + errorCode);
        }

        if (!isSatelliteSupportedViaCarrier(subId)) {
            plogd("Satellite for carrier is not supported. Only user setting is stored");
            callback.accept(SATELLITE_RESULT_SUCCESS);
            return;
        }

        Phone phone = SatelliteServiceUtils.getPhone(subId);
        if (phone == null) {
            ploge("evaluateEnablingSatelliteForCarrier: phone is null for subId=" + subId);
@@ -5828,9 +5822,9 @@ public class SatelliteController extends Handler {

        /* Request to enable or disable the satellite in the cellular modem only when the desired
        state and the current state are different. */
        boolean isSatelliteExpectedToBeEnabled = !isSatelliteRestrictedForCarrier(subId);
        boolean isSatelliteExpectedToBeEnabled = !isSatelliteRestrictedForCarrier(subId)
                && isSatelliteSupportedViaCarrier(subId);
        if (isSatelliteExpectedToBeEnabled != isSatelliteEnabledForCarrierAtModem(subId)) {
            if (mSatelliteModemInterface.isSatelliteServiceSupported()) {
            int simSlot = SubscriptionManager.getSlotIndex(subId);
            RequestHandleSatelliteAttachRestrictionForCarrierArgument argument =
                    new RequestHandleSatelliteAttachRestrictionForCarrierArgument(subId,
@@ -5842,9 +5836,6 @@ public class SatelliteController extends Handler {
                    EVENT_EVALUATE_SATELLITE_ATTACH_RESTRICTION_CHANGE_DONE, request);
            phone.setSatelliteEnabledForCarrier(simSlot,
                    isSatelliteExpectedToBeEnabled, onCompleted);
            } else {
                callback.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
            }
        } else {
            callback.accept(SATELLITE_RESULT_SUCCESS);
        }
+26 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import android.telephony.satellite.stub.SatelliteResult;
import android.text.TextUtils;

import com.android.internal.R;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.subscription.SubscriptionManagerService;
@@ -318,6 +319,10 @@ public class SatelliteServiceUtils {
            if (ar.exception instanceof SatelliteManager.SatelliteException) {
                errorCode = ((SatelliteManager.SatelliteException) ar.exception).getErrorCode();
                loge(caller + " SatelliteException: " + ar.exception);
            } else if (ar.exception instanceof CommandException) {
                errorCode = convertCommandExceptionErrorToSatelliteError(
                        ((CommandException) ar.exception).getCommandError());
                loge(caller + " CommandException: "  + ar.exception);
            } else {
                loge(caller + " unknown exception: " + ar.exception);
            }
@@ -326,6 +331,27 @@ public class SatelliteServiceUtils {
        return errorCode;
    }

    private static int convertCommandExceptionErrorToSatelliteError(
            CommandException.Error commandExceptionError) {
        logd("convertCommandExceptionErrorToSatelliteError: commandExceptionError="
                + commandExceptionError.toString());

        switch(commandExceptionError) {
            case REQUEST_NOT_SUPPORTED:
                return SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED;
            case RADIO_NOT_AVAILABLE:
                return SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE;
            case INTERNAL_ERR:
            case INVALID_STATE:
            case INVALID_MODEM_STATE:
                return SatelliteManager.SATELLITE_RESULT_INVALID_MODEM_STATE;
            case MODEM_ERR:
                return SatelliteManager.SATELLITE_RESULT_MODEM_ERROR;
            default:
                return SatelliteManager.SATELLITE_RESULT_ERROR;
        }
    }

    /**
     * Get valid subscription id for satellite communication.
     *