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

Commit 11866005 authored by Thomas Nguyen's avatar Thomas Nguyen
Browse files

Add SatelliteProxy

Bug: 260644201
Test: atest VtsHalRadioTargetTest
atest TelephonyManagerTestOnMockModem
MO/MT SMS, MMS, voice calls with live network

Change-Id: I6c8d6c5bb829cf378a17eb013cadf6f0289e747c
parent 44d5f1e0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ java_library {
        "android.hardware.radio.modem-V2-java",
        "android.hardware.radio.network-V2-java",
        "android.hardware.radio.sim-V2-java",
        "android.hardware.radio.satellite-V1-java",
        "android.hardware.radio.voice-V2-java",
        "voip-common",
        "ims-common",
+86 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@

package com.android.internal.telephony;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.AsyncResult;
@@ -118,6 +120,13 @@ public abstract class BaseCommands implements CommandsInterface {
    protected RegistrantList mConnectionSetupFailureRegistrants = new RegistrantList();
    protected RegistrantList mNotifyAnbrRegistrants = new RegistrantList();
    protected RegistrantList mTriggerImsDeregistrationRegistrants = new RegistrantList();
    protected RegistrantList mPendingSatelliteMessageCountRegistrants = new RegistrantList();
    protected RegistrantList mNewSatelliteMessagesRegistrants = new RegistrantList();
    protected RegistrantList mSatelliteMessagesTransferCompleteRegistrants = new RegistrantList();
    protected RegistrantList mSatellitePointingInfoChangedRegistrants = new RegistrantList();
    protected RegistrantList mSatelliteModeChangedRegistrants = new RegistrantList();
    protected RegistrantList mSatelliteRadioTechnologyChangedRegistrants = new RegistrantList();
    protected RegistrantList mSatelliteProvisionStateChangedRegistrants = new RegistrantList();

    @UnsupportedAppUsage
    protected Registrant mGsmSmsRegistrant;
@@ -1188,4 +1197,81 @@ public abstract class BaseCommands implements CommandsInterface {
    public void unregisterForTriggerImsDeregistration(Handler h) {
        mTriggerImsDeregistrationRegistrants.remove(h);
    }

    @Override
    public void registerForPendingSatelliteMessageCount(
            @NonNull Handler h, int what, @Nullable Object obj) {
        mPendingSatelliteMessageCountRegistrants.add(h, what, obj);
    }

    @Override
    public void unregisterForPendingSatelliteMessageCount(@NonNull Handler h) {
        mPendingSatelliteMessageCountRegistrants.remove(h);
    }

    @Override
    public void registerForNewSatelliteMessages(
            @NonNull Handler h, int what, @Nullable Object obj) {
        mNewSatelliteMessagesRegistrants.add(h, what, obj);
    }

    @Override
    public void unregisterForNewSatelliteMessages(@NonNull Handler h) {
        mNewSatelliteMessagesRegistrants.remove(h);
    }

    @Override
    public void registerForSatelliteMessagesTransferComplete(@NonNull Handler h,
            int what, @Nullable Object obj) {
        mSatelliteMessagesTransferCompleteRegistrants.add(h, what, obj);
    }

    @Override
    public void unregisterForSatelliteMessagesTransferComplete(@NonNull Handler h) {
        mSatelliteMessagesTransferCompleteRegistrants.remove(h);
    }

    @Override
    public void registerForSatellitePointingInfoChanged(@NonNull Handler h,
            int what, @Nullable Object obj) {
        mSatellitePointingInfoChangedRegistrants.add(h, what, obj);
    }

    @Override
    public void unregisterForSatellitePointingInfoChanged(@NonNull Handler h) {
        mSatellitePointingInfoChangedRegistrants.remove(h);
    }

    @Override
    public void registerForSatelliteModeChanged(@NonNull Handler h,
            int what, @Nullable Object obj) {
        mSatelliteModeChangedRegistrants.add(h, what, obj);
    }

    @Override
    public void unregisterForSatelliteModeChanged(@NonNull Handler h) {
        mSatelliteModeChangedRegistrants.remove(h);
    }

    @Override
    public void registerForSatelliteRadioTechnologyChanged(@NonNull Handler h,
            int what, @Nullable Object obj) {
        mSatelliteRadioTechnologyChangedRegistrants.add(h, what, obj);
    }

    @Override
    public void unregisterForSatelliteRadioTechnologyChanged(@NonNull Handler h) {
        mSatelliteRadioTechnologyChangedRegistrants.remove(h);
    }

    @Override
    public void registerForSatelliteProvisionStateChanged(@NonNull Handler h,
            int what, @Nullable Object obj) {
        mSatelliteProvisionStateChangedRegistrants.add(h, what, obj);
    }

    @Override
    public void unregisterForSatelliteProvisionStateChanged(@NonNull Handler h) {
        mSatelliteProvisionStateChangedRegistrants.remove(h);
    }
}
+238 −0
Original line number Diff line number Diff line
@@ -3025,4 +3025,242 @@ public interface CommandsInterface {
     * @param result Callback message to receive the result.
     */
    default void isN1ModeEnabled(Message result) {}

    /**
     * Get feature capabilities supported by satellite.
     *
     * @param result Message that will be sent back to the requester
     */
    default void getSatelliteCapabilities(Message result) {}

    /**
     * Turn satellite modem on/off.
     *
     * @param result Message that will be sent back to the requester
     * @param on {@code true} for turning on.
     *           {@code false} for turning off.
     */
    default void setSatellitePower(Message result, boolean on) {}

    /**
     * Get satellite modem state.
     *
     * @param result Message that will be sent back to the requester
     */
    default void getSatellitePowerState(Message result) {}

    /**
     * Provision the subscription with a satellite provider. This is needed to register the
     * subscription if the provider allows dynamic registration.
     *
     * @param result Message that will be sent back to the requester.
     * @param imei IMEI of the SIM associated with the satellite modem.
     * @param msisdn MSISDN of the SIM associated with the satellite modem.
     * @param imsi IMSI of the SIM associated with the satellite modem.
     * @param features List of features to be provisioned.
     */
    default void provisionSatelliteService(
            Message result, String imei, String msisdn, String imsi, int[] features) {}

    /**
     * Add contacts that are allowed to be used for satellite communication. This is applicable for
     * incoming messages as well.
     *
     * @param result Message that will be sent back to the requester.
     * @param contacts List of allowed contacts to be added.
     */
    default void addAllowedSatelliteContacts(Message result, String[] contacts) {}

    /**
     * Remove contacts that are allowed to be used for satellite communication. This is applicable
     * for incoming messages as well.
     *
     * @param result Message that will be sent back to the requester.
     * @param contacts List of allowed contacts to be removed.
     */
    default void removeAllowedSatelliteContacts(Message result, String[] contacts) {}

    /**
     * Send text messages.
     *
     * @param result Message that will be sent back to the requester.
     * @param messages List of messages in text format to be sent.
     * @param destination The recipient of the message.
     * @param latitude The current latitude of the device.
     * @param longitude The current longitude of the device. The location (i.e., latitude and
     *        longitude) of the device will be filled for emergency messages.
     */
    default void sendSatelliteMessages(Message result, String[] messages, String destination,
            double latitude, double longitude) {}

    /**
     * Get pending messages.
     *
     * @param result Message that will be sent back to the requester.
     */
    default void getPendingSatelliteMessages(Message result) {}

    /**
     * Get current satellite registration mode.
     *
     * @param result Message that will be sent back to the requester.
     */
    default void getSatelliteMode(Message result) {}

    /**
     * Set the filter for what type of indication framework want to receive from modem.
     *
     * @param result Message that will be sent back to the requester.
     * @param filterBitmask The filter bitmask identifying what type of indication Telephony
     *                      framework wants to receive from modem.
     */
    default void setSatelliteIndicationFilter(Message result, int filterBitmask) {}

    /**
     * User started pointing to the satellite. Modem should continue to update the ponting input
     * as user moves device.
     *
     * @param result Message that will be sent back to the requester.
     */
    default void startSendingSatellitePointingInfo(Message result) {}

    /**
     * Stop sending satellite pointing info to the framework.
     *
     * @param result Message that will be sent back to the requester.
     */
    default void stopSendingSatellitePointingInfo(Message result) {}

    /**
     * Get max number of characters per text message.
     *
     * @param result Message that will be sent back to the requester.
     */
    default void getMaxCharactersPerSatelliteTextMessage(Message result) {}

    /**
     * Get time for next visibility of satellite.
     *
     * @param result Message that will be sent back to the requester.
     */
    default void getTimeForNextSatelliteVisibility(Message result) {}

    /**
     * Registers for pending message count from satellite modem.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void registerForPendingSatelliteMessageCount(@NonNull Handler h,
            int what, @Nullable Object obj) {}

    /**
     * Unregisters for pending message count from satellite modem.
     *
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForPendingSatelliteMessageCount(@NonNull Handler h) {}

    /**
     * Registers for new messages from satellite modem.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void registerForNewSatelliteMessages(@NonNull Handler h,
            int what, @Nullable Object obj) {}

    /**
     * Unregisters for new messages from satellite modem.
     *
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForNewSatelliteMessages(@NonNull Handler 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.
     */
    default void registerForSatelliteMessagesTransferComplete(@NonNull Handler h,
            int what, @Nullable Object obj) {}

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

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

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

    /**
     * Registers for mode changed from satellite modem.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void registerForSatelliteModeChanged(@NonNull Handler h,
            int what, @Nullable Object obj) {}

    /**
     * Unregisters for mode changed from satellite modem.
     *
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForSatelliteModeChanged(@NonNull Handler h) {}

    /**
     * Registers for radio technology changed from satellite modem.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void registerForSatelliteRadioTechnologyChanged(@NonNull Handler h,
            int what, @Nullable Object obj) {}

    /**
     * Unregisters for radio technology changed from satellite modem.
     *
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForSatelliteRadioTechnologyChanged(@NonNull Handler h) {}

    /**
     * Registers for provision state changed from satellite modem.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    default void registerForSatelliteProvisionStateChanged(@NonNull Handler h,
            int what, @Nullable Object obj) {}

    /**
     * Unregisters for provision state changed from satellite modem.
     *
     * @param h Handler to be removed from the registrant list.
     */
    default void unregisterForSatelliteProvisionStateChanged(@NonNull Handler h) {}
}
+34 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.telephony.TelephonyManager.HAL_SERVICE_IMS;
import static android.telephony.TelephonyManager.HAL_SERVICE_MESSAGING;
import static android.telephony.TelephonyManager.HAL_SERVICE_MODEM;
import static android.telephony.TelephonyManager.HAL_SERVICE_NETWORK;
import static android.telephony.TelephonyManager.HAL_SERVICE_SATELLITE;
import static android.telephony.TelephonyManager.HAL_SERVICE_SIM;
import static android.telephony.TelephonyManager.HAL_SERVICE_VOICE;

@@ -44,6 +45,8 @@ public class MockModem {
    private static final String BIND_IRADIOVOICE = "android.telephony.mockmodem.iradiovoice";
    private static final String BIND_IRADIOIMS = "android.telephony.mockmodem.iradioims";
    private static final String BIND_IRADIOCONFIG = "android.telephony.mockmodem.iradioconfig";
    private static final String BIND_IRADIOSATELLITE =
            "android.telephony.mockmodem.iradiosatellite";
    private static final String PHONE_ID = "phone_id";

    private static final byte DEFAULT_PHONE_ID = 0x00;
@@ -65,6 +68,7 @@ public class MockModem {
    private IBinder mVoiceBinder;
    private IBinder mImsBinder;
    private IBinder mConfigBinder;
    private IBinder mSatelliteBinder;
    private ServiceConnection mModemServiceConnection;
    private ServiceConnection mSimServiceConnection;
    private ServiceConnection mMessagingServiceConnection;
@@ -73,6 +77,7 @@ public class MockModem {
    private ServiceConnection mVoiceServiceConnection;
    private ServiceConnection mImsServiceConnection;
    private ServiceConnection mConfigServiceConnection;
    private ServiceConnection mSatelliteServiceConnection;

    private byte mPhoneId;
    private String mTag;
@@ -115,6 +120,8 @@ public class MockModem {
                mVoiceBinder = binder;
            } else if (mService == HAL_SERVICE_IMS) {
                mImsBinder = binder;
            } else if (mService == HAL_SERVICE_SATELLITE) {
                mSatelliteBinder = binder;
            } else if (mService == RADIOCONFIG_SERVICE) {
                mConfigBinder = binder;
            }
@@ -138,6 +145,8 @@ public class MockModem {
                mVoiceBinder = null;
            } else if (mService == HAL_SERVICE_IMS) {
                mImsBinder = null;
            } else if (mService == HAL_SERVICE_SATELLITE) {
                mSatelliteBinder = null;
            } else if (mService == RADIOCONFIG_SERVICE) {
                mConfigBinder = null;
            }
@@ -179,6 +188,8 @@ public class MockModem {
                return mVoiceBinder;
            case HAL_SERVICE_IMS:
                return mImsBinder;
            case HAL_SERVICE_SATELLITE:
                return mSatelliteBinder;
            case RADIOCONFIG_SERVICE:
                return mConfigBinder;
            default:
@@ -306,6 +317,20 @@ public class MockModem {
            } else {
                Rlog.d(TAG, "IRadio Ims is bound");
            }
        } else if (service == HAL_SERVICE_SATELLITE) {
            if (mSatelliteBinder == null) {
                mSatelliteServiceConnection = new MockModemConnection(HAL_SERVICE_SATELLITE);

                boolean status =
                        bindModuleToMockModemService(
                                mPhoneId, BIND_IRADIOSATELLITE, mSatelliteServiceConnection);
                if (!status) {
                    Rlog.d(TAG, "IRadio Satellite bind fail");
                    mSatelliteServiceConnection = null;
                }
            } else {
                Rlog.d(TAG, "IRadio Satellite is bound");
            }
        }
    }

@@ -368,6 +393,13 @@ public class MockModem {
                mImsBinder = null;
                Rlog.d(TAG, "unbind IRadio Ims");
            }
        } else if (service == HAL_SERVICE_SATELLITE) {
            if (mSatelliteServiceConnection != null) {
                mContext.unbindService(mSatelliteServiceConnection);
                mSatelliteServiceConnection = null;
                mSatelliteBinder = null;
                Rlog.d(TAG, "unbind IRadio Satellite");
            }
        }
    }

@@ -391,6 +423,8 @@ public class MockModem {
                return "voice";
            case HAL_SERVICE_IMS:
                return "ims";
            case HAL_SERVICE_SATELLITE:
                return "satellite";
            case RADIOCONFIG_SERVICE:
                return "config";
            default:
+579 −3

File changed.

Preview size limit exceeded, changes collapsed.

Loading