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

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

Merge "Support new and updated satellite APIs"

parents 6fd70739 61544e91
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -3164,7 +3164,14 @@ public interface CommandsInterface {
    default void getMaxCharactersPerSatelliteTextMessage(Message result) {}

    /**
     * Get time for next visibility of satellite.
     * Get whether satellite communication is allowed for the current location.
     *
     * @param result Message that will be sent back to the requester.
     */
    default void isSatelliteCommunicationAllowedForCurrentLocation(Message result) {}

    /**
     * Get the time after which the satellite will next be visible.
     *
     * @param result Message that will be sent back to the requester.
     */
+32 −17
Original line number Diff line number Diff line
@@ -5273,8 +5273,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    /**
     * Get maximum number of characters per text message on satellite.
     * @param result - message object which contains maximum characters on success
     *               and error code on failure.
     * @param result The Message to send the result of the operation to.
     */
    public void getMaxCharactersPerSatelliteTextMessage(Message result) {
        mCi.getMaxCharactersPerSatelliteTextMessage(result);
@@ -5414,9 +5413,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Registers for satellite state change from satellite modem.
     *
     * @param h - Handler for notification message.
     * @param what - User-defined message code.
     * @param obj - User object.
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    public void registerForSatelliteModemStateChange(@NonNull Handler h, int what,
            @Nullable Object obj) {
@@ -5426,7 +5425,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Unregisters for satellite state changes from satellite modem.
     *
     * @param h - Handler to be removed from registrant list.
     * @param h Handler to be removed from registrant list.
     */
    public void unregisterForSatelliteModemStateChange(@NonNull Handler h) {
        mCi.unregisterForSatelliteModeChanged(h);
@@ -5435,9 +5434,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Registers for pending message count info from satellite modem.
     *
     * @param h - Handler for notification message.
     * @param what - User-defined message code.
     * @param obj - User object.
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    public void registerForPendingMessageCount(@NonNull Handler h, int what, @Nullable Object obj) {
        mCi.registerForPendingSatelliteMessageCount(h, what, obj);
@@ -5446,7 +5445,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Unregisters for pending message count info from satellite modem.
     *
     * @param h - Handler to be removed from registrant list.
     * @param h Handler to be removed from registrant list.
     */
    public void unregisterForPendingMessageCount(@NonNull Handler h) {
        mCi.unregisterForPendingSatelliteMessageCount(h);
@@ -5455,9 +5454,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Register to receive incoming datagrams over satellite.
     *
     * @param h - Handler for notification message.
     * @param what - User-defined message code.
     * @param obj - User object.
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    public void registerForNewSatelliteDatagram(@NonNull Handler h, int what,
            @Nullable Object obj) {
@@ -5468,7 +5467,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Unregister to stop receiving incoming datagrams over satellite.
     *
     * @param h - Handler to be removed from registrant list.
     * @param h Handler to be removed from registrant list.
     */
    public void unregisterForNewSatelliteDatagram(@NonNull Handler h) {
        //mCi.unregisterForNewSatelliteDatagram(h);
@@ -5476,7 +5475,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    /**
     * Poll pending satellite datagrams over satellite.
     * @param result - message object which informs if the request is successful or not.
     * @param result The Message to send the result of the operation to.
     */
    public void pollPendingSatelliteDatagrams(Message result) {
        //mCi.pollPendingSatelliteDatagrams(result);
@@ -5484,13 +5483,29 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    /**
     * Send datagram over satellite.
     * @param result - message object which informs if the request is successful or not
     * @param datagram - datagram to send over satellite
     * @param result The Message to send the result of the operation to.
     * @param datagram Datagram to send over satellite.
     */
    public void sendSatelliteDatagram(Message result, SatelliteDatagram datagram) {
        //mCi.sendSatelliteDatagram(result, datagram, longitude, latitude);
    }

    /**
     * Check whether satellite communication is allowed for the current location.
     * @param result The Message to send the result of the operation to.
     */
    public void isSatelliteCommunicationAllowedForCurrentLocation(Message result) {
        mCi.isSatelliteCommunicationAllowedForCurrentLocation(result);
    }

    /**
     * Get the time after which the satellite will next be visible.
     * @param result The Message to send the result of the operation to.
     */
    public void requestTimeForNextSatelliteVisibility(Message result) {
        mCi.getTimeForNextSatelliteVisibility(result);
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("Phone: subId=" + getSubId());
        pw.println(" mPhoneId=" + mPhoneId);
+19 −0
Original line number Diff line number Diff line
@@ -6312,6 +6312,25 @@ public class RIL extends BaseCommands implements CommandsInterface {
        }
    }

    /**
     * Get whether satellite communication is allowed for the current location
     *
     * @param result Message that will be sent back to the requester.
     */
    @Override
    public void isSatelliteCommunicationAllowedForCurrentLocation(Message result) {
        // TODO: link to HAL implementation
        if (RILJ_LOGD) {
            Rlog.d(RILJ_LOG_TAG,
                    "stopSendingSatellitePointingInfo: REQUEST_NOT_SUPPORTED");
        }
        if (result != null) {
            AsyncResult.forMessage(result, null,
                    CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
            result.sendToTarget();
        }
    }

    /**
     * Get time for next visibility of satellite.
     *
+1 −41
Original line number Diff line number Diff line
@@ -377,7 +377,6 @@ import android.telephony.ims.stub.ImsRegistrationImplBase.ImsDeregistrationReaso
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;
import android.util.SparseArray;
@@ -5946,35 +5945,8 @@ public class RILUtils {
                supportedRadioTechnologies.add(technology);
            }
        }

        Set<Integer> supportedFeatures = new HashSet<>();
        if (capabilities.supportedFeatures != null
                && capabilities.supportedFeatures.length > 0) {
            for (int feature : capabilities.supportedFeatures) {
                supportedFeatures.add(feature);
            }
        }
        return new SatelliteCapabilities(supportedRadioTechnologies, capabilities.isAlwaysOn,
                capabilities.needsPointingToSatellite, supportedFeatures,
                capabilities.needsSeparateSimProfile);
    }

    /**
     * Convert from android.hardware.radio.satellite.Feature to
     * android.telephony.satellite.stub.SatelliteImplBase.Feature
     */
    public static int convertHalSatelliteFeature(int feature) {
        switch (feature) {
            case android.hardware.radio.satellite.SatelliteFeature.SOS_SMS:
                return SatelliteImplBase.FEATURE_SOS_SMS;
            case android.hardware.radio.satellite.SatelliteFeature.EMERGENCY_SMS:
                return SatelliteImplBase.FEATURE_EMERGENCY_SMS;
            case android.hardware.radio.satellite.SatelliteFeature.SMS:
                return SatelliteImplBase.FEATURE_SMS;
            case android.hardware.radio.satellite.SatelliteFeature.LOCATION_SHARING:
                return SatelliteImplBase.FEATURE_LOCATION_SHARING;
            default: return SatelliteImplBase.FEATURE_UNKNOWN;
        }
                capabilities.needsPointingToSatellite, capabilities.needsSeparateSimProfile);
    }

    /**
@@ -5988,18 +5960,6 @@ public class RILUtils {
                pointingInfo.antennaPitchDegrees, pointingInfo.antennaRollDegrees);
    }

    /**
     * Convert array of android.hardware.radio.satellite.Feature to
     * array of android.telephony.satellite.stub.SatelliteImplBase.Feature
     */
    public static int[] convertHalSatelliteFeatures(int[] features) {
        int[] convertedFeatrures = new int[features.length];
        for (int i = 0; i < features.length; i++) {
            convertedFeatrures[i] = convertHalSatelliteFeature(features[i]);
        }
        return convertedFeatrures;
    }

    /**
     * Convert from android.telephony.satellite.stub.PointingInfo to
     * android.hardware.radio.satellite.PointingInfo
+3 −2
Original line number Diff line number Diff line
@@ -167,13 +167,14 @@ public class SatelliteIndication extends IRadioSatelliteIndication.Stub {
     * @param features List of Feature whose provision state has changed.
     */
    public void onProvisionStateChanged(int indicationType, boolean provisioned, int[] features) {
        // TODO: remove features and update AsyncResult
        mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType);

        if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_PROVISION_STATE_CHANGED);

        if (mRil.mSatelliteProvisionStateChangedRegistrants != null) {
            mRil.mSatelliteProvisionStateChangedRegistrants.notifyRegistrants(new AsyncResult(
                    provisioned, RILUtils.convertHalSatelliteFeatures(features), null));
            mRil.mSatelliteProvisionStateChangedRegistrants.notifyRegistrants(
                    new AsyncResult(provisioned, null, null));
        }
    }
}