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

Commit 8387422c authored by Sarah Chin's avatar Sarah Chin Committed by Android (Google) Code Review
Browse files

Merge "Support pointing APIs"

parents 2e5b97eb b97d340e
Loading
Loading
Loading
Loading
+63 −0
Original line number Diff line number Diff line
@@ -5242,6 +5242,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
@@ -6164,7 +6164,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);
@@ -6202,7 +6212,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;
@@ -5975,6 +5976,7 @@ public class RILUtils {
            default: return SatelliteImplBase.FEATURE_UNKNOWN;
        }
    }

    /**
     * Convert from android.hardware.radio.satellite.PointingInfo to
     * android.telephony.satellite.stub.PointingInfo
@@ -6014,6 +6016,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.
     *