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

Commit b97d340e authored by Sarah Chin's avatar Sarah Chin Committed by Aishwarya Mallampati
Browse files

Support pointing APIs

Test: atest SatelliteManagerTest
Bug: 266249740
Change-Id: Ib7588ec540046ae85eface8a4eb64424c6e8e620
parent f03d253e
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
@@ -5230,6 +5230,69 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        callback.accept(TelephonyManager.CELL_BROADCAST_RESULT_UNSUPPORTED);
    }

    /**
     * Start receiving satellite position updates.
     * This can be called by the pointing UI when the user starts pointing to the satellite.
     * Modem should continue to report the pointing input as the device or satellite moves.
     *
     * @param result The Message to send to result of the operation to.
     **/
    public void startSatellitePositionUpdates(Message result) {
        mCi.startSendingSatellitePointingInfo(result);
    }

    /**
     * Stop receiving satellite position updates.
     * This can be called by the pointing UI when the user stops pointing to the satellite.
     *
     * @param result The Message to send to result of the operation to.
     **/
    public void stopSatellitePositionUpdates(Message result) {
        mCi.stopSendingSatellitePointingInfo(result);
    }

    /**
     * Registers for pointing info changed from satellite modem.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    public void registerForSatellitePointingInfoChanged(@NonNull Handler h,
            int what, @Nullable Object obj) {
        mCi.registerForSatellitePointingInfoChanged(h, what, obj);
    }

    /**
     * Unregisters for pointing info changed from satellite modem.
     *
     * @param h Handler to be removed from the registrant list.
     */
    public void unregisterForSatellitePointingInfoChanged(@NonNull Handler h) {
        mCi.unregisterForSatellitePointingInfoChanged(h);
    }

    /**
     * Registers for messages transfer complete from satellite modem.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    public void registerForSatelliteMessagesTransferComplete(@NonNull Handler h,
            int what, @Nullable Object obj) {
        mCi.registerForSatelliteMessagesTransferComplete(h, what, obj);
    }

    /**
     * Unregisters for messages transfer complete from satellite modem.
     *
     * @param h Handler to be removed from the registrant list.
     */
    public void unregisterForSatelliteMessagesTransferComplete(@NonNull Handler h) {
        mCi.unregisterForSatelliteMessagesTransferComplete(h);
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("Phone: subId=" + getSubId());
        pw.println(" mPhoneId=" + mPhoneId);
+22 −2
Original line number Diff line number Diff line
@@ -6162,7 +6162,17 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public void startSendingSatellitePointingInfo(Message result) {
        RadioSatelliteProxy radioSatelliteProxy =
                getRadioServiceProxy(RadioSatelliteProxy.class, result);
        if (radioSatelliteProxy.isEmpty()) return;
        if (radioSatelliteProxy.isEmpty()) {
            if (RILJ_LOGD) {
                Rlog.d(RILJ_LOG_TAG,
                        "startSendingSatellitePointingInfo: RADIO_NOT_AVAILABLE");
            }
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                result.sendToTarget();
            }
        }
        if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
            RILRequest rr = obtainRequest(RIL_REQUEST_START_SENDING_SATELLITE_POINTING_INFO, result,
                    mRILDefaultWorkSource);
@@ -6200,7 +6210,17 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public void stopSendingSatellitePointingInfo(Message result) {
        RadioSatelliteProxy radioSatelliteProxy =
                getRadioServiceProxy(RadioSatelliteProxy.class, result);
        if (radioSatelliteProxy.isEmpty()) return;
        if (radioSatelliteProxy.isEmpty()) {
            if (RILJ_LOGD) {
                Rlog.d(RILJ_LOG_TAG,
                        "startSendingSatellitePointingInfo: RADIO_NOT_AVAILABLE");
            }
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                result.sendToTarget();
            }
        }
        if (mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0)) {
            RILRequest rr = obtainRequest(RIL_REQUEST_STOP_SENDING_SATELLITE_POINTING_INFO, result,
                    mRILDefaultWorkSource);
+40 −0
Original line number Diff line number Diff line
@@ -376,6 +376,7 @@ import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.telephony.ims.stub.ImsRegistrationImplBase.ImsDeregistrationReason;
import android.telephony.satellite.PointingInfo;
import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteManager;
import android.telephony.satellite.stub.SatelliteImplBase;
import android.text.TextUtils;
import android.util.ArraySet;
@@ -5934,6 +5935,7 @@ public class RILUtils {
            default: return SatelliteImplBase.FEATURE_UNKNOWN;
        }
    }

    /**
     * Convert from android.hardware.radio.satellite.PointingInfo to
     * android.telephony.satellite.stub.PointingInfo
@@ -5973,6 +5975,44 @@ public class RILUtils {
        return halPointingInfo;
    }

    /**
     * Convert satellite-related errors from CommandException.Error to
     * SatelliteManager.SatelliteServiceResult.
     * @param error The satellite error.
     * @return The converted SatelliteServiceResult.
     */
    @SatelliteManager.SatelliteServiceResult public static int convertToSatelliteError(
            CommandException.Error error) {
        switch (error) {
            case INTERNAL_ERR:
                return SatelliteManager.SATELLITE_SERVICE_INTERNAL_ERROR;
            case MODEM_ERR:
                return SatelliteManager.SATELLITE_SERVICE_MODEM_ERROR;
            case SYSTEM_ERR:
                return SatelliteManager.SATELLITE_SERVICE_SYSTEM_ERROR;
            case INVALID_ARGUMENTS:
                return SatelliteManager.SATELLITE_SERVICE_INVALID_ARGUMENTS;
            case INVALID_MODEM_STATE:
                return SatelliteManager.SATELLITE_SERVICE_INVALID_MODEM_STATE;
            case INVALID_SIM_STATE:
                return SatelliteManager.SATELLITE_SERVICE_INVALID_SIM_STATE;
            case INVALID_STATE:
                return SatelliteManager.SATELLITE_SERVICE_INVALID_STATE;
            case RADIO_NOT_AVAILABLE:
                return SatelliteManager.SATELLITE_SERVICE_NOT_AVAILABLE;
            case REQUEST_NOT_SUPPORTED:
                return SatelliteManager.SATELLITE_SERVICE_NOT_SUPPORTED;
            case REQUEST_RATE_LIMITED:
                return SatelliteManager.SATELLITE_SERVICE_RATE_LIMITED;
            case NO_MEMORY:
                return SatelliteManager.SATELLITE_SERVICE_NO_MEMORY;
            case NO_RESOURCES:
                return SatelliteManager.SATELLITE_SERVICE_NO_RESOURCES;
            default:
                return SatelliteManager.SATELLITE_SERVICE_ERROR;
        }
    }

    /**
     * Converts the call state to HAL IMS call state.
     *