diff options
author | 2023-10-13 00:00:52 +0000 | |
---|---|---|
committer | 2023-10-16 12:55:42 -0700 | |
commit | ce66edbc0c3ecdfbe3ae40ba906107514c4c29f9 (patch) | |
tree | 1a7d9f78d5908223a31e1cd16f37051d0e0721f9 | |
parent | 3536e8523e613e20776fb5dc37fff7629a4036e3 (diff) |
Revert "Add SatelliteProxy"
Revert submission 20583557-Satellite APIs
Reason for revert: Radio HAL for satellite APIs are not needed.
Reverted changes: /q/submissionid:20583557-Satellite+APIs
Bug: 304622222
Test: SMS, MMS, call with live network.
SatelliteManagerTestOnMockService SatelliteManagerTest SatelliteControllerTest
DatagramDispatcherTest DatagramReceiverTest SatelliteSOSMessageRecommenderTest
NtnCapabilityResolverTest ServiceStateTrackerTest VtsHalRadioTargetTest
Change-Id: I20bd848c0cc1417d73a777303ad989cb5c1871f6
20 files changed, 342 insertions, 3104 deletions
diff --git a/Android.bp b/Android.bp index 66cca32a1a..301343cb32 100644 --- a/Android.bp +++ b/Android.bp @@ -90,7 +90,6 @@ java_library { "android.hardware.radio.modem-V3-java", "android.hardware.radio.network-V3-java", "android.hardware.radio.sim-V3-java", - "android.hardware.radio.satellite-V1-java", "android.hardware.radio.voice-V3-java", "voip-common", "ims-common", diff --git a/src/java/com/android/internal/telephony/BaseCommands.java b/src/java/com/android/internal/telephony/BaseCommands.java index f461e68678..4ec1f7151c 100644 --- a/src/java/com/android/internal/telephony/BaseCommands.java +++ b/src/java/com/android/internal/telephony/BaseCommands.java @@ -18,7 +18,6 @@ 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; @@ -119,13 +118,6 @@ 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; @@ -1182,81 +1174,4 @@ 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); - } } diff --git a/src/java/com/android/internal/telephony/CommandException.java b/src/java/com/android/internal/telephony/CommandException.java index 6b6d84f0e8..6b80e9f1d3 100644 --- a/src/java/com/android/internal/telephony/CommandException.java +++ b/src/java/com/android/internal/telephony/CommandException.java @@ -352,28 +352,6 @@ public class CommandException extends RuntimeException { return new CommandException(Error.RF_HARDWARE_ISSUE); case RILConstants.NO_RF_CALIBRATION_INFO: return new CommandException(Error.NO_RF_CALIBRATION_INFO); - case RILConstants.ENCODING_NOT_SUPPORTED: - return new CommandException(Error.ENCODING_NOT_SUPPORTED); - case RILConstants.FEATURE_NOT_SUPPORTED: - return new CommandException(Error.FEATURE_NOT_SUPPORTED); - case RILConstants.INVALID_CONTACT: - return new CommandException(Error.INVALID_CONTACT); - case RILConstants.MODEM_INCOMPATIBLE: - return new CommandException(Error.MODEM_INCOMPATIBLE); - case RILConstants.NETWORK_TIMEOUT: - return new CommandException(Error.NETWORK_TIMEOUT); - case RILConstants.NO_SATELLITE_SIGNAL: - return new CommandException(Error.NO_SATELLITE_SIGNAL); - case RILConstants.NOT_SUFFICIENT_ACCOUNT_BALANCE: - return new CommandException(Error.NOT_SUFFICIENT_ACCOUNT_BALANCE); - case RILConstants.RADIO_TECHNOLOGY_NOT_SUPPORTED: - return new CommandException(Error.RADIO_TECHNOLOGY_NOT_SUPPORTED); - case RILConstants.SUBSCRIBER_NOT_AUTHORIZED: - return new CommandException(Error.SUBSCRIBER_NOT_AUTHORIZED); - case RILConstants.SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL: - return new CommandException(Error.SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL); - case RILConstants.UNIDENTIFIED_SUBSCRIBER: - return new CommandException(Error.UNIDENTIFIED_SUBSCRIBER); default: Rlog.e("GSM", "Unrecognized RIL errno " + ril_errno); return new CommandException(Error.INVALID_RESPONSE); diff --git a/src/java/com/android/internal/telephony/CommandsInterface.java b/src/java/com/android/internal/telephony/CommandsInterface.java index 006a4213b0..71c200153f 100644 --- a/src/java/com/android/internal/telephony/CommandsInterface.java +++ b/src/java/com/android/internal/telephony/CommandsInterface.java @@ -74,7 +74,6 @@ public interface CommandsInterface { // Used as parameters for call forward methods below static final int CF_ACTION_DISABLE = 0; static final int CF_ACTION_ENABLE = 1; -// static final int CF_ACTION_UNUSED = 2; static final int CF_ACTION_REGISTRATION = 3; static final int CF_ACTION_ERASURE = 4; @@ -628,85 +627,85 @@ public interface CommandsInterface { @UnsupportedAppUsage void setEmergencyCallbackMode(Handler h, int what, Object obj); - /** - * Fires on any CDMA OTA provision status change - */ - @UnsupportedAppUsage - void registerForCdmaOtaProvision(Handler h,int what, Object obj); - @UnsupportedAppUsage - void unregisterForCdmaOtaProvision(Handler h); - - /** - * Registers the handler when out-band ringback tone is needed.<p> - * - * Messages received from this: - * Message.obj will be an AsyncResult - * AsyncResult.userObj = obj - * AsyncResult.result = boolean. <p> - */ - void registerForRingbackTone(Handler h, int what, Object obj); - void unregisterForRingbackTone(Handler h); - - /** - * Registers the handler when mute/unmute need to be resent to get - * uplink audio during a call.<p> - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - * - */ - void registerForResendIncallMute(Handler h, int what, Object obj); - void unregisterForResendIncallMute(Handler h); - - /** - * Registers the handler for when Cdma subscription changed events - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - * - */ - void registerForCdmaSubscriptionChanged(Handler h, int what, Object obj); - void unregisterForCdmaSubscriptionChanged(Handler h); - - /** - * Registers the handler for when Cdma prl changed events - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - * - */ - void registerForCdmaPrlChanged(Handler h, int what, Object obj); - void unregisterForCdmaPrlChanged(Handler h); - - /** - * Registers the handler for when Cdma prl changed events - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - * - */ - void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj); - void unregisterForExitEmergencyCallbackMode(Handler h); - - /** - * Registers the handler for RIL_UNSOL_RIL_CONNECT events. - * - * When ril connects or disconnects a message is sent to the registrant - * which contains an AsyncResult, ar, in msg.obj. The ar.result is an - * Integer which is the version of the ril or -1 if the ril disconnected. - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - */ - @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - void registerForRilConnected(Handler h, int what, Object obj); - @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - void unregisterForRilConnected(Handler h); + /** + * Fires on any CDMA OTA provision status change + */ + @UnsupportedAppUsage + void registerForCdmaOtaProvision(Handler h, int what, Object obj); + @UnsupportedAppUsage + void unregisterForCdmaOtaProvision(Handler h); + + /** + * Registers the handler when out-band ringback tone is needed.<p> + * + * Messages received from this: + * Message.obj will be an AsyncResult + * AsyncResult.userObj = obj + * AsyncResult.result = boolean. <p> + */ + void registerForRingbackTone(Handler h, int what, Object obj); + void unregisterForRingbackTone(Handler h); + + /** + * Registers the handler when mute/unmute need to be resent to get + * uplink audio during a call.<p> + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + * + */ + void registerForResendIncallMute(Handler h, int what, Object obj); + void unregisterForResendIncallMute(Handler h); + + /** + * Registers the handler for when Cdma subscription changed events + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + * + */ + void registerForCdmaSubscriptionChanged(Handler h, int what, Object obj); + void unregisterForCdmaSubscriptionChanged(Handler h); + + /** + * Registers the handler for when Cdma prl changed events + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + * + */ + void registerForCdmaPrlChanged(Handler h, int what, Object obj); + void unregisterForCdmaPrlChanged(Handler h); + + /** + * Registers the handler for when Cdma prl changed events + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + * + */ + void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj); + void unregisterForExitEmergencyCallbackMode(Handler h); + + /** + * Registers the handler for RIL_UNSOL_RIL_CONNECT events. + * + * When ril connects or disconnects a message is sent to the registrant + * which contains an AsyncResult, ar, in msg.obj. The ar.result is an + * Integer which is the version of the ril or -1 if the ril disconnected. + * + * @param h Handler for notification message. + * @param what User-defined message code. + * @param obj User object. + */ + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) + void registerForRilConnected(Handler h, int what, Object obj); + @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) + void unregisterForRilConnected(Handler h); /** * Registers the handler for RIL_UNSOL_SIM_DETACH_FROM_NETWORK_CONFIG_CHANGED events. @@ -921,7 +920,7 @@ public interface CommandsInterface { * CLIR_INVOCATION == on "CLIR invocation" (restrict CLI presentation) */ void dial(String address, boolean isEmergencyCall, EmergencyNumber emergencyNumberInfo, - boolean hasKnownUserIntentEmergency, int clirMode, Message result); + boolean hasKnownUserIntentEmergency, int clirMode, Message result); /** * returned message @@ -935,7 +934,7 @@ public interface CommandsInterface { * CLIR_INVOCATION == on "CLIR invocation" (restrict CLI presentation) */ void dial(String address, boolean isEmergencyCall, EmergencyNumber emergencyNumberInfo, - boolean hasKnownUserIntentEmergency, int clirMode, UUSInfo uusInfo, Message result); + boolean hasKnownUserIntentEmergency, int clirMode, UUSInfo uusInfo, Message result); /** * returned message @@ -1372,7 +1371,7 @@ public interface CommandsInterface { */ @UnsupportedAppUsage void setCallForward(int action, int cfReason, int serviceClass, - String number, int timeSeconds, Message response); + String number, int timeSeconds, Message response); /** * cfReason is one of CF_REASON_* @@ -1450,7 +1449,7 @@ public interface CommandsInterface { @UnsupportedAppUsage void queryFacilityLock (String facility, String password, int serviceClass, - Message response); + Message response); /** * (AsyncResult)response.obj).result will be an Integer representing @@ -1465,7 +1464,7 @@ public interface CommandsInterface { */ void queryFacilityLockForApp(String facility, String password, int serviceClass, String appId, - Message response); + Message response); /** * @param facility one of CB_FACILTY_* @@ -1476,7 +1475,7 @@ public interface CommandsInterface { */ @UnsupportedAppUsage void setFacilityLock (String facility, boolean lockState, String password, - int serviceClass, Message response); + int serviceClass, Message response); /** * Set the facility lock for the app with this AID on the ICC card. @@ -1489,7 +1488,7 @@ public interface CommandsInterface { * @param response is callback message */ void setFacilityLockForApp(String facility, boolean lockState, String password, - int serviceClass, String appId, Message response); + int serviceClass, String appId, Message response); void sendUSSD (String ussdString, Message response); @@ -1526,7 +1525,7 @@ public interface CommandsInterface { @UnsupportedAppUsage void setPreferredNetworkType(int networkType , Message response); - /** + /** * Query the preferred network type setting * * @param response is callback message to report one of NT_*_TYPE @@ -1543,7 +1542,7 @@ public interface CommandsInterface { void setAllowedNetworkTypesBitmap( @TelephonyManager.NetworkTypeBitMask int networkTypeBitmask, Message response); - /** + /** * Query the allowed network types setting. * * @param response is callback message to report allowed network types bitmask @@ -2148,7 +2147,7 @@ public interface CommandsInterface { return HalVersion.UNKNOWN; } - /** + /** * Sets user selected subscription at Modem. * * @param slotId @@ -2613,7 +2612,7 @@ public interface CommandsInterface { return true; }; - /** + /** * Return the class name of the currently bound modem service. * * @return the class name of the modem service. @@ -2622,18 +2621,18 @@ public interface CommandsInterface { return "default"; }; - /** + /** * Request the SIM phonebook records of all activated UICC applications * * @param result Callback message containing the count of ADN valid record. */ - public void getSimPhonebookRecords(Message result); + void getSimPhonebookRecords(Message result); - /** + /** * Request the SIM phonebook Capacity of all activated UICC applications * */ - public void getSimPhonebookCapacity(Message result); + void getSimPhonebookCapacity(Message result); /** * Request to insert/delete/update the SIM phonebook record @@ -2641,7 +2640,7 @@ public interface CommandsInterface { * @param phonebookRecordInfo adn record information to be updated * @param result Callback message containing the SIM phonebook record index. */ - public void updateSimPhonebookRecord(SimPhonebookRecord phonebookRecordInfo, Message result); + void updateSimPhonebookRecord(SimPhonebookRecord phonebookRecordInfo, Message result); /** * Registers the handler when the SIM phonebook is changed. @@ -2650,14 +2649,14 @@ public interface CommandsInterface { * @param what User-defined message code. * @param obj User object . */ - public void registerForSimPhonebookChanged(Handler h, int what, Object obj); + void registerForSimPhonebookChanged(Handler h, int what, Object obj); /** * Unregister for notifications when SIM phonebook has already init done. * * @param h Handler to be removed from the registrant list. */ - public void unregisterForSimPhonebookChanged(Handler h); + void unregisterForSimPhonebookChanged(Handler h); /** * Registers the handler when a group of SIM phonebook records received. @@ -2666,14 +2665,14 @@ public interface CommandsInterface { * @param what User-defined message code. * @param obj User object. */ - public void registerForSimPhonebookRecordsReceived(Handler h, int what, Object obj); + void registerForSimPhonebookRecordsReceived(Handler h, int what, Object obj); /** * Unregister for notifications when a group of SIM phonebook records received. * * @param h Handler to be removed from the registrant list. */ - public void unregisterForSimPhonebookRecordsReceived(Handler h); + void unregisterForSimPhonebookRecordsReceived(Handler h); /** * Registers for notifications of connection setup failure. @@ -2892,263 +2891,4 @@ 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) {} - - /** - * Get satellite provision state. - * - * @param result Message that will be sent back to the requester - */ - default void getSatelliteProvisionState(Message result) {} - - /** - * Check whether satellite modem is supported by the device. - * - * @param result Message that will be sent back to the requester - */ - default void isSatelliteSupported(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 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 be visible. - * - * @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) {} -} +}
\ No newline at end of file diff --git a/src/java/com/android/internal/telephony/MockModem.java b/src/java/com/android/internal/telephony/MockModem.java index 83417c53a5..a20e74818f 100644 --- a/src/java/com/android/internal/telephony/MockModem.java +++ b/src/java/com/android/internal/telephony/MockModem.java @@ -21,7 +21,6 @@ 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; @@ -45,8 +44,6 @@ 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; @@ -68,7 +65,6 @@ public class MockModem { private IBinder mVoiceBinder; private IBinder mImsBinder; private IBinder mConfigBinder; - private IBinder mSatelliteBinder; private ServiceConnection mModemServiceConnection; private ServiceConnection mSimServiceConnection; private ServiceConnection mMessagingServiceConnection; @@ -77,7 +73,6 @@ public class MockModem { private ServiceConnection mVoiceServiceConnection; private ServiceConnection mImsServiceConnection; private ServiceConnection mConfigServiceConnection; - private ServiceConnection mSatelliteServiceConnection; private byte mPhoneId; private String mTag; @@ -120,8 +115,6 @@ 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; } @@ -145,8 +138,6 @@ 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; } @@ -188,8 +179,6 @@ public class MockModem { return mVoiceBinder; case HAL_SERVICE_IMS: return mImsBinder; - case HAL_SERVICE_SATELLITE: - return mSatelliteBinder; case RADIOCONFIG_SERVICE: return mConfigBinder; default: @@ -317,20 +306,6 @@ 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"); - } } } @@ -393,13 +368,6 @@ 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"); - } } } @@ -423,8 +391,6 @@ public class MockModem { return "voice"; case HAL_SERVICE_IMS: return "ims"; - case HAL_SERVICE_SATELLITE: - return "satellite"; case RADIOCONFIG_SERVICE: return "config"; default: diff --git a/src/java/com/android/internal/telephony/Phone.java b/src/java/com/android/internal/telephony/Phone.java index f4f756f265..6b5b266458 100644 --- a/src/java/com/android/internal/telephony/Phone.java +++ b/src/java/com/android/internal/telephony/Phone.java @@ -72,7 +72,6 @@ import android.telephony.emergency.EmergencyNumber; import android.telephony.ims.RegistrationManager; import android.telephony.ims.feature.MmTelFeature; import android.telephony.ims.stub.ImsRegistrationImplBase; -import android.telephony.satellite.SatelliteDatagram; import android.text.TextUtils; import android.util.LocalLog; import android.util.Log; @@ -5175,279 +5174,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { } /** - * 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); - } - - /** - * Get maximum number of characters per text message on satellite. - * @param result The Message to send the result of the operation to. - */ - public void getMaxCharactersPerSatelliteTextMessage(Message result) { - mCi.getMaxCharactersPerSatelliteTextMessage(result); - } - - /** - * Power on or off the satellite modem. - * @param result The Message to send the result of the operation to. - * @param powerOn {@code true} to power on the satellite modem and {@code false} to power off. - */ - public void setSatellitePower(Message result, boolean powerOn) { - mCi.setSatellitePower(result, powerOn); - } - - /** - * Check whether the satellite modem is powered on. - * @param result The Message to send the result of the operation to. - */ - public void isSatellitePowerOn(Message result) { - mCi.getSatellitePowerState(result); - } - - /** - * Check whether the satellite service is supported on the device. - * @param result The Message to send the result of the operation to. - */ - public void isSatelliteSupported(Message result) { - mCi.isSatelliteSupported(result); - } - - /** - * Check whether the satellite modem is provisioned. - * @param result The Message to send the result of the operation to. - */ - public void isSatelliteProvisioned(Message result) { - mCi.getSatelliteProvisionState(result); - } - - /** - * Get the satellite capabilities. - * @param result The Message to send the result of the operation to. - */ - public void getSatelliteCapabilities(Message result) { - mCi.getSatelliteCapabilities(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 registerForSatellitePositionInfoChanged(@NonNull Handler h, - int what, @Nullable Object obj) { - //TODO: Rename CommandsInterface and other modules when updating HAL APIs. - 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 unregisterForSatellitePositionInfoChanged(@NonNull Handler h) { - //TODO: Rename CommandsInterface and other modules when updating HAL APIs. - mCi.unregisterForSatellitePointingInfoChanged(h); - } - - /** - * Registers for datagrams delivered events from satellite modem. - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - */ - public void registerForSatelliteDatagramsDelivered(@NonNull Handler h, - int what, @Nullable Object obj) { - //TODO: Remove. - mCi.registerForSatelliteMessagesTransferComplete(h, what, obj); - } - - /** - * Unregisters for datagrams delivered events from satellite modem. - * - * @param h Handler to be removed from the registrant list. - */ - public void unregisterForSatelliteDatagramsDelivered(@NonNull Handler h) { - //TODO: Remove. - mCi.unregisterForSatelliteMessagesTransferComplete(h); - } - - /** - * Provision the subscription with a satellite provider. - * This is needed to register the device/subscription if the provider allows dynamic - * registration. - * - * @param result Callback message to receive the result. - * @param token The token of the device/subscription to be provisioned. - */ - public void provisionSatelliteService(Message result, String token) { - // TODO: update parameters in HAL - // mCi.provisionSatelliteService(result, token); - } - - /** - * Deprovision the device/subscription with a satellite provider. - * This is needed to unregister the device/subscription if the provider allows dynamic - * registration. - * If provisioning is in progress for the given SIM, cancel the request. - * If there is no request in progress, deprovision the given SIM. - * - * @param result Callback message to receive the result. - * @param token The token of the device/subscription to be deprovisioned. - */ - public void deprovisionSatelliteService(Message result, String token) { - //TODO (b/266126070): add implementation. - } - - /** - * Register for a satellite provision state changed event. - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - */ - public void registerForSatelliteProvisionStateChanged(Handler h, int what, Object obj) { - mCi.registerForSatelliteProvisionStateChanged(h, what, obj); - } - - /** - * Unregister for a satellite provision state changed event. - * - * @param h Handler to be removed from the registrant list. - */ - public void unregisterForSatelliteProvisionStateChanged(Handler h) { - mCi.unregisterForSatelliteProvisionStateChanged(h); - } - - /** - * Get the list of provisioned satellite features. - * - * @param result Callback message to receive the result. - */ - public void getProvisionedSatelliteFeatures(Message result) { - //TODO (b/266126070): add implementation. - } - - /** - * Registers for satellite state changed from satellite modem. - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - */ - public void registerForSatelliteModemStateChanged(@NonNull Handler h, int what, - @Nullable Object obj) { - mCi.registerForSatelliteModeChanged(h, what, obj); - } - - /** - * Unregisters for satellite state changed from satellite modem. - * - * @param h Handler to be removed from registrant list. - */ - public void unregisterForSatelliteModemStateChanged(@NonNull Handler h) { - mCi.unregisterForSatelliteModeChanged(h); - } - - /** - * Registers for pending datagram count info from satellite modem. - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - */ - public void registerForPendingDatagramCount(@NonNull Handler h, int what, - @Nullable Object obj) { - mCi.registerForPendingSatelliteMessageCount(h, what, obj); - } - - /** - * Unregisters for pending datagram count info from satellite modem. - * - * @param h Handler to be removed from registrant list. - */ - public void unregisterForPendingDatagramCount(@NonNull Handler h) { - mCi.unregisterForPendingSatelliteMessageCount(h); - } - - /** - * Register to receive incoming datagrams over satellite. - * - * @param h Handler for notification message. - * @param what User-defined message code. - * @param obj User object. - */ - public void registerForSatelliteDatagramsReceived(@NonNull Handler h, int what, - @Nullable Object obj) { - // TODO: rename - mCi.registerForNewSatelliteMessages(h, what, obj); - } - - /** - * Unregister to stop receiving incoming datagrams over satellite. - * - * @param h Handler to be removed from registrant list. - */ - public void unregisterForSatelliteDatagramsReceived(@NonNull Handler h) { - // TODO: rename - mCi.unregisterForNewSatelliteMessages(h); - } - - /** - * Poll pending datagrams over satellite. - * @param result The Message to send the result of the operation to. - */ - public void pollPendingSatelliteDatagrams(Message result) { - //mCi.pollPendingSatelliteDatagrams(result); - } - - /** - * Send datagram over satellite. - * @param result The Message to send the result of the operation to. - * @param datagram Datagram to send over satellite. - * @param needFullScreenPointingUI this is used to indicate pointingUI app to open in - * full screen mode. - */ - public void sendSatelliteDatagram(Message result, SatelliteDatagram datagram, - boolean needFullScreenPointingUI) { - //mCi.sendSatelliteDatagram(result, datagram); - } - - /** - * 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 be visible. - * @param result The Message to send the result of the operation to. - */ - public void requestTimeForNextSatelliteVisibility(Message result) { - mCi.getTimeForNextSatelliteVisibility(result); - } - - /** * Start callback mode * @param type for callback mode entry. */ diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java index 3c8c5f387d..7e8bfe8249 100644 --- a/src/java/com/android/internal/telephony/RIL.java +++ b/src/java/com/android/internal/telephony/RIL.java @@ -22,7 +22,6 @@ 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_RADIO; -import static android.telephony.TelephonyManager.HAL_SERVICE_SATELLITE; import static android.telephony.TelephonyManager.HAL_SERVICE_SIM; import static android.telephony.TelephonyManager.HAL_SERVICE_VOICE; @@ -207,7 +206,7 @@ public class RIL extends BaseCommands implements CommandsInterface { public static final int MIN_SERVICE_IDX = HAL_SERVICE_RADIO; - public static final int MAX_SERVICE_IDX = HAL_SERVICE_SATELLITE; + public static final int MAX_SERVICE_IDX = HAL_SERVICE_IMS; /** * An array of sets that records if services are disabled in the HAL for a specific phone ID @@ -242,8 +241,6 @@ public class RIL extends BaseCommands implements CommandsInterface { private ModemIndication mModemIndication; private NetworkResponse mNetworkResponse; private NetworkIndication mNetworkIndication; - private SatelliteResponse mSatelliteResponse; - private SatelliteIndication mSatelliteIndication; private SimResponse mSimResponse; private SimIndication mSimIndication; private VoiceResponse mVoiceResponse; @@ -682,7 +679,7 @@ public class RIL extends BaseCommands implements CommandsInterface { /** * Returns a {@link RadioDataProxy}, {@link RadioMessagingProxy}, {@link RadioModemProxy}, * {@link RadioNetworkProxy}, {@link RadioSimProxy}, {@link RadioVoiceProxy}, - * {@link RadioImsProxy}, {@link RadioSatelliteProxy}, or null if the service is not available. + * {@link RadioImsProxy}, or null if the service is not available. */ @NonNull public <T extends RadioServiceProxy> T getRadioServiceProxy(Class<T> serviceClass) { @@ -707,9 +704,6 @@ public class RIL extends BaseCommands implements CommandsInterface { if (serviceClass == RadioImsProxy.class) { return (T) getRadioServiceProxy(HAL_SERVICE_IMS); } - if (serviceClass == RadioSatelliteProxy.class) { - return (T) getRadioServiceProxy(HAL_SERVICE_SATELLITE); - } riljLoge("getRadioServiceProxy: unrecognized " + serviceClass); return null; } @@ -847,21 +841,6 @@ public class RIL extends BaseCommands implements CommandsInterface { .asInterface(binder))); } break; - case HAL_SERVICE_SATELLITE: - if (mMockModem == null) { - binder = ServiceManager.waitForDeclaredService( - android.hardware.radio.satellite.IRadioSatellite.DESCRIPTOR - + "/" + HIDL_SERVICE_NAME[mPhoneId]); - } else { - binder = mMockModem.getServiceBinder(HAL_SERVICE_SATELLITE); - } - if (binder != null) { - mHalVersion.put(service, ((RadioSatelliteProxy) serviceProxy).setAidl( - mHalVersion.get(service), - android.hardware.radio.satellite.IRadioSatellite.Stub - .asInterface(binder))); - } - break; } if (serviceProxy.isEmpty() @@ -947,12 +926,6 @@ public class RIL extends BaseCommands implements CommandsInterface { ((RadioImsProxy) serviceProxy).getAidl().setResponseFunctions( mImsResponse, mImsIndication); break; - case HAL_SERVICE_SATELLITE: - mDeathRecipients.get(service).linkToDeath( - ((RadioSatelliteProxy) serviceProxy).getAidl().asBinder()); - ((RadioSatelliteProxy) serviceProxy).getAidl().setResponseFunctions( - mSatelliteResponse, mSatelliteIndication); - break; } } else { if (mHalVersion.get(service).greaterOrEqual(RADIO_HAL_VERSION_2_0)) { @@ -1061,8 +1034,6 @@ public class RIL extends BaseCommands implements CommandsInterface { mModemIndication = new ModemIndication(this); mNetworkResponse = new NetworkResponse(this); mNetworkIndication = new NetworkIndication(this); - mSatelliteResponse = new SatelliteResponse(this); - mSatelliteIndication = new SatelliteIndication(this); mSimResponse = new SimResponse(this); mSimIndication = new SimIndication(this); mVoiceResponse = new VoiceResponse(this); @@ -1079,9 +1050,9 @@ public class RIL extends BaseCommands implements CommandsInterface { } } catch (SecurityException ex) { /* TODO(b/211920208): instead of the following workaround (guessing if - * we're in a test based on proxies being populated), mock ServiceManager - * to not throw SecurityException and return correct value based on what - * HAL we're testing. */ + * we're in a test based on proxies being populated), mock ServiceManager + * to not throw SecurityException and return correct value based on what + * HAL we're testing. */ if (proxies == null) throw ex; } mDeathRecipients.put(service, new BinderServiceDeathRecipient(service)); @@ -1097,7 +1068,6 @@ public class RIL extends BaseCommands implements CommandsInterface { mServiceProxies.put(HAL_SERVICE_SIM, new RadioSimProxy()); mServiceProxies.put(HAL_SERVICE_VOICE, new RadioVoiceProxy()); mServiceProxies.put(HAL_SERVICE_IMS, new RadioImsProxy()); - mServiceProxies.put(HAL_SERVICE_SATELLITE, new RadioSatelliteProxy()); } else { mServiceProxies = proxies; } @@ -1180,9 +1150,6 @@ public class RIL extends BaseCommands implements CommandsInterface { case HAL_SERVICE_IMS: serviceName = android.hardware.radio.ims.IRadioIms.DESCRIPTOR; break; - case HAL_SERVICE_SATELLITE: - serviceName = android.hardware.radio.satellite.IRadioSatellite.DESCRIPTOR; - break; } if (!serviceName.equals("") @@ -1270,8 +1237,6 @@ public class RIL extends BaseCommands implements CommandsInterface { service = HAL_SERVICE_VOICE; } else if (proxy instanceof RadioImsProxy) { service = HAL_SERVICE_IMS; - } else if (proxy instanceof RadioSatelliteProxy) { - service = HAL_SERVICE_SATELLITE; } if (mHalVersion.get(service).less(version)) { @@ -5113,442 +5078,6 @@ public class RIL extends BaseCommands implements CommandsInterface { }); } - /** - * Get feature capabilities supported by satellite. - * - * @param result Message that will be sent back to the requester - */ - @Override - public void getSatelliteCapabilities(Message result) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("getSatelliteCapabilities", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_GET_SATELLITE_CAPABILITIES, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "getSatelliteCapabilities", () -> { - satelliteProxy.getCapabilities(rr.mSerial); - }); - } - - /** - * Turn satellite modem on/off. - * - * @param result Message that will be sent back to the requester - * @param on True for turning on. - * False for turning off. - */ - @Override - public void setSatellitePower(Message result, boolean on) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("setSatellitePower", satelliteProxy, result, RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_SET_SATELLITE_POWER, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "setSatellitePower", () -> { - satelliteProxy.setPower(rr.mSerial, on); - }); - } - - /** - * Get satellite modem state. - * - * @param result Message that will be sent back to the requester - */ - @Override - public void getSatellitePowerState(Message result) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("getSatellitePowerState", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_GET_SATELLITE_POWER, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "getSatellitePowerState", () -> { - satelliteProxy.getPowerState(rr.mSerial); - }); - } - - /** - * Get satellite provision state. - * - * @param result Message that will be sent back to the requester - */ - @Override - public void getSatelliteProvisionState(Message result) { - // Satellite HAL APIs are not supported before Android V. - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("getSatelliteProvisionState", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - } - - /** - * 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. - */ - @Override - public void provisionSatelliteService( - Message result, String imei, String msisdn, String imsi, int[] features) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("provisionSatelliteService", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_PROVISION_SATELLITE_SERVICE, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "provisionSatelliteService", () -> { - satelliteProxy.provisionService(rr.mSerial, imei, msisdn, imsi, 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. - */ - @Override - public void addAllowedSatelliteContacts(Message result, String[] contacts) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("addAllowedSatelliteContacts", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_ADD_ALLOWED_SATELLITE_CONTACTS, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "addAllowedSatelliteContacts", () -> { - satelliteProxy.addAllowedSatelliteContacts(rr.mSerial, 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. - */ - @Override - public void removeAllowedSatelliteContacts(Message result, String[] contacts) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("removeAllowedSatelliteContacts", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_REMOVE_ALLOWED_SATELLITE_CONTACTS, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "removeAllowedSatelliteContacts", - () -> { - satelliteProxy.removeAllowedSatelliteContacts(rr.mSerial, 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. - */ - @Override - public void sendSatelliteMessages(Message result, String[] messages, String destination, - double latitude, double longitude) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("sendSatelliteMessages", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_SEND_SATELLITE_MESSAGES, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "sendSatelliteMessages", () -> { - satelliteProxy.sendMessages(rr.mSerial, messages, destination, latitude, longitude); - }); - } - - /** - * Get pending messages. - * - * @param result Message that will be sent back to the requester. - */ - @Override - public void getPendingSatelliteMessages(Message result) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("getPendingSatelliteMessages", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_GET_PENDING_SATELLITE_MESSAGES, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "getPendingSatelliteMessages", () -> { - satelliteProxy.getPendingMessages(rr.mSerial); - }); - } - - /** - * Get current satellite registration mode. - * - * @param result Message that will be sent back to the requester. - */ - @Override - public void getSatelliteMode(Message result) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("getSatelliteMode", satelliteProxy, result, RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_GET_SATELLITE_MODE, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "getSatelliteMode", () -> { - satelliteProxy.getSatelliteMode(rr.mSerial); - }); - } - - /** - * 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 framework want to - * receive from modem. - */ - @Override - public void setSatelliteIndicationFilter(Message result, int filterBitmask) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("setSatelliteIndicationFilter", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_SET_SATELLITE_INDICATION_FILTER, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "setSatelliteIndicationFilter", () -> { - satelliteProxy.setIndicationFilter(rr.mSerial, filterBitmask); - }); - } - - /** - * Check whether satellite modem is supported by the device. - * - * @param result Message that will be sent back to the requester. - */ - @Override - public void isSatelliteSupported(Message result) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("isSatelliteSupported", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - /** - * TODO: when adding implementation of this method, we need to return successful result - * with satellite support set to false if radioSatelliteProxy.isEmpty() is true or - * mHalVersion.get(HAL_SERVICE_SATELLITE).greaterOrEqual(RADIO_HAL_VERSION_2_0) is false. - */ - } - - /** - * 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. - */ - @Override - public void startSendingSatellitePointingInfo(Message result) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("startSendingSatellitePointingInfo", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_START_SENDING_SATELLITE_POINTING_INFO, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "startSendingSatellitePointingInfo", - () -> { - satelliteProxy.startSendingSatellitePointingInfo(rr.mSerial); - }); - } - - /** - * Stop pointing to satellite indications. - * - * @param result Message that will be sent back to the requester. - */ - @Override - public void stopSendingSatellitePointingInfo(Message result) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("stopSendingSatellitePointingInfo", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_STOP_SENDING_SATELLITE_POINTING_INFO, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "stopSendingSatellitePointingInfo", - () -> { - satelliteProxy.stopSendingSatellitePointingInfo(rr.mSerial); - }); - } - - /** - * Get max text limit for messaging per message. - * - * @param result Message that will be sent back to the requester. - */ - @Override - public void getMaxCharactersPerSatelliteTextMessage(Message result) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("getMaxCharactersPerSatelliteTextMessage", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_GET_MAX_CHARACTERS_PER_SATELLITE_TEXT_MESSAGE, - result, mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, - "getMaxCharactersPerSatelliteTextMessage", () -> { - satelliteProxy.getMaxCharactersPerTextMessage(rr.mSerial); - }); - } - - /** - * 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 - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("isSatelliteCommunicationAllowedForCurrentLocation", satelliteProxy, - result, RADIO_HAL_VERSION_2_0)) { - return; - } - } - - /** - * Get time for next visibility of satellite. - * - * @param result Message that will be sent back to the requester. - */ - @Override - public void getTimeForNextSatelliteVisibility(Message result) { - RadioSatelliteProxy satelliteProxy = getRadioServiceProxy(RadioSatelliteProxy.class); - if (!canMakeRequest("getTimeForNextSatelliteVisibility", satelliteProxy, result, - RADIO_HAL_VERSION_2_0)) { - return; - } - - RILRequest rr = obtainRequest(RIL_REQUEST_GET_TIME_FOR_NEXT_SATELLITE_VISIBILITY, result, - mRILDefaultWorkSource); - - if (RILJ_LOGD) { - // Do not log function arg for privacy - riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)); - } - - radioServiceInvokeHelper(HAL_SERVICE_SATELLITE, rr, "getTimeForNextSatelliteVisibility", - () -> { - satelliteProxy.getTimeForNextSatelliteVisibility(rr.mSerial); - }); - } - //***** Private Methods /** * This is a helper function to be called when an indication callback is called for any radio @@ -5707,12 +5236,12 @@ public class RIL extends BaseCommands implements CommandsInterface { } else { switch (rr.mRequest) { case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: - if (mTestingEmergencyCall.getAndSet(false)) { - if (mEmergencyCallbackModeRegistrant != null) { - riljLog("testing emergency call, notify ECM Registrants"); - mEmergencyCallbackModeRegistrant.notifyRegistrant(); + if (mTestingEmergencyCall.getAndSet(false)) { + if (mEmergencyCallbackModeRegistrant != null) { + riljLog("testing emergency call, notify ECM Registrants"); + mEmergencyCallbackModeRegistrant.notifyRegistrant(); + } } - } } } return rr; @@ -6341,7 +5870,6 @@ public class RIL extends BaseCommands implements CommandsInterface { pw.println(" " + mServiceProxies.get(HAL_SERVICE_SIM)); pw.println(" " + mServiceProxies.get(HAL_SERVICE_VOICE)); pw.println(" " + mServiceProxies.get(HAL_SERVICE_IMS)); - pw.println(" " + mServiceProxies.get(HAL_SERVICE_SATELLITE)); pw.println(" mWakeLock=" + mWakeLock); pw.println(" mWakeLockTimeout=" + mWakeLockTimeout); synchronized (mRequestList) { @@ -6420,10 +5948,8 @@ public class RIL extends BaseCommands implements CommandsInterface { return "VOICE"; case HAL_SERVICE_IMS: return "IMS"; - case HAL_SERVICE_SATELLITE: - return "SATELLITE"; default: return "UNKNOWN:" + service; } } -} +}
\ No newline at end of file diff --git a/src/java/com/android/internal/telephony/RILUtils.java b/src/java/com/android/internal/telephony/RILUtils.java index d41b7258c4..2816e2b104 100644 --- a/src/java/com/android/internal/telephony/RILUtils.java +++ b/src/java/com/android/internal/telephony/RILUtils.java @@ -25,7 +25,6 @@ import static android.telephony.TelephonyManager.CAPABILITY_THERMAL_MITIGATION_D import static android.telephony.TelephonyManager.CAPABILITY_USES_ALLOWED_NETWORK_TYPES_BITMASK; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ADD_ALLOWED_SATELLITE_CONTACTS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ALLOCATE_PDU_SESSION_ID; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ALLOW_DATA; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ANSWER; @@ -93,17 +92,12 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_IMEI; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_IMEISV; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_IMSI; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_LOCATION_PRIVACY_SETTING; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_MAX_CHARACTERS_PER_SATELLITE_TEXT_MESSAGE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_MODEM_STATUS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_MUTE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_NEIGHBORING_CELL_IDS; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_PENDING_SATELLITE_MESSAGES; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_PHONE_CAPABILITY; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_RADIO_CAPABILITY; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SATELLITE_CAPABILITIES; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SATELLITE_MODE; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SATELLITE_POWER; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SIM_PHONEBOOK_CAPACITY; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SIM_PHONEBOOK_RECORDS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SIM_STATUS; @@ -111,7 +105,6 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SLICIN import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SLOT_STATUS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SMSC_ADDRESS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_SYSTEM_SELECTION_CHANNELS; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_TIME_FOR_NEXT_SATELLITE_VISIBILITY; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_USAGE_SETTING; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GSM_BROADCAST_ACTIVATION; @@ -136,7 +129,6 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_NV_WRITE_I import static com.android.internal.telephony.RILConstants.RIL_REQUEST_OEM_HOOK_RAW; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_OEM_HOOK_STRINGS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_OPERATOR; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_PROVISION_SATELLITE_SERVICE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_PULL_LCEDATA; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_QUERY_AVAILABLE_NETWORKS; @@ -148,14 +140,12 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_QUERY_NETW import static com.android.internal.telephony.RILConstants.RIL_REQUEST_QUERY_TTY_MODE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_RADIO_POWER; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_RELEASE_PDU_SESSION_ID; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_REMOVE_ALLOWED_SATELLITE_CONTACTS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_REPORT_SMS_MEMORY_STATUS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_RESET_RADIO; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SCREEN_STATE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_ANBR_QUERY; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_DEVICE_STATE; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_SATELLITE_MESSAGES; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_SMS; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_SMS_EXPECT_MORE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SEND_USSD; @@ -186,8 +176,6 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_NULL_C import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_DATA_MODEM; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_RADIO_CAPABILITY; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_INDICATION_FILTER; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_POWER; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIM_CARD_POWER; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SMSC_ADDRESS; @@ -213,7 +201,6 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_START_IMS_ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_START_KEEPALIVE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_START_LCE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_START_NETWORK_SCAN; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_START_SENDING_SATELLITE_POINTING_INFO; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STK_GET_PROFILE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND; @@ -224,7 +211,6 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_IMS_T import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_KEEPALIVE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_LCE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_NETWORK_SCAN; -import static com.android.internal.telephony.RILConstants.RIL_REQUEST_STOP_SENDING_SATELLITE_POINTING_INFO; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SWITCH_DUAL_SIM_CONFIG; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE; import static com.android.internal.telephony.RILConstants.RIL_REQUEST_TRIGGER_EMERGENCY_NETWORK_SCAN; @@ -259,7 +245,6 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_KEEPALIVE_ST import static com.android.internal.telephony.RILConstants.RIL_UNSOL_LCEDATA_RECV; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_MODEM_RESTART; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NETWORK_SCAN_RESULT; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NEW_SATELLITE_MESSAGES; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NITZ_TIME_RECEIVED; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NOTIFY_ANBR; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_OEM_HOOK_RAW; @@ -267,7 +252,6 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_SS; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_USSD; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_USSD_REQUEST; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PCO_DATA; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PENDING_SATELLITE_MESSAGE_COUNT; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PHYSICAL_CHANNEL_CONFIG; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RADIO_CAPABILITY; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_REGISTRATION_FAILED; @@ -287,11 +271,6 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_SIM import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESTRICTED_STATE_CHANGED; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RIL_CONNECTED; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RINGBACK_TONE; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_MODE_CHANGED; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_POINTING_INFO_CHANGED; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_PROVISION_STATE_CHANGED; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIGNAL_STRENGTH; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIM_REFRESH; import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIM_SMS_STORAGE_FULL; @@ -380,9 +359,6 @@ import android.telephony.ims.feature.ConnectionFailureInfo; import android.telephony.ims.feature.MmTelFeature; 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.text.TextUtils; import android.util.ArraySet; import android.util.SparseArray; @@ -980,8 +956,8 @@ public class RILUtils { * @param dp Data profile * @return The converted DataProfileInfo */ - public static android.hardware.radio.data.DataProfileInfo convertToHalDataProfile(@Nullable - DataProfile dp) { + public static android.hardware.radio.data.DataProfileInfo convertToHalDataProfile( + @Nullable DataProfile dp) { if (dp == null) return null; android.hardware.radio.data.DataProfileInfo dpi = new android.hardware.radio.data.DataProfileInfo(); @@ -3286,7 +3262,7 @@ public class RILUtils { protocolType = result.type; ifname = result.ifname; laList = result.addresses.stream().map(la -> convertToLinkAddress( - la.address, la.properties, la.deprecationTime, la.expirationTime)) + la.address, la.properties, la.deprecationTime, la.expirationTime)) .collect(Collectors.toList()); dnses = result.dnses.toArray(new String[0]); gateways = result.gateways.toArray(new String[0]); @@ -3304,7 +3280,7 @@ public class RILUtils { protocolType = result.type; ifname = result.ifname; laList = result.addresses.stream().map(la -> convertToLinkAddress( - la.address, la.properties, la.deprecationTime, la.expirationTime)) + la.address, la.properties, la.deprecationTime, la.expirationTime)) .collect(Collectors.toList()); dnses = result.dnses.toArray(new String[0]); gateways = result.gateways.toArray(new String[0]); @@ -3572,23 +3548,24 @@ public class RILUtils { public static NetworkSlicingConfig convertHalSlicingConfig( android.hardware.radio.V1_6.SlicingConfig sc) { List<UrspRule> urspRules = sc.urspRules.stream().map(ur -> new UrspRule(ur.precedence, - ur.trafficDescriptors.stream() - .map(td -> { - try { - return convertHalTrafficDescriptor(td); - } catch (IllegalArgumentException e) { - loge("convertHalSlicingConfig: Failed to convert traffic descriptor" - + ". e=" + e); - return null; - } - }) - .filter(Objects::nonNull) - .collect(Collectors.toList()), - ur.routeSelectionDescriptor.stream().map(rsd -> new RouteSelectionDescriptor( - rsd.precedence, rsd.sessionType.value(), rsd.sscMode.value(), - rsd.sliceInfo.stream().map(RILUtils::convertHalSliceInfo) + ur.trafficDescriptors.stream() + .map(td -> { + try { + return convertHalTrafficDescriptor(td); + } catch (IllegalArgumentException e) { + loge("convertHalSlicingConfig: Failed to convert traffic " + + "descriptor. e=" + e); + return null; + } + }) + .filter(Objects::nonNull) .collect(Collectors.toList()), - rsd.dnn)).collect(Collectors.toList()))) + ur.routeSelectionDescriptor.stream().map( + rsd -> new RouteSelectionDescriptor(rsd.precedence, + rsd.sessionType.value(), rsd.sscMode.value(), + rsd.sliceInfo.stream().map(RILUtils::convertHalSliceInfo) + .collect(Collectors.toList()), + rsd.dnn)).collect(Collectors.toList()))) .collect(Collectors.toList()); return new NetworkSlicingConfig(urspRules, sc.sliceInfo.stream() .map(RILUtils::convertHalSliceInfo).collect(Collectors.toList())); @@ -5145,34 +5122,6 @@ public class RILUtils { return "SET_LOCATION_PRIVACY_SETTING"; case RIL_REQUEST_GET_LOCATION_PRIVACY_SETTING: return "GET_LOCATION_PRIVACY_SETTING"; - case RIL_REQUEST_GET_SATELLITE_CAPABILITIES: - return "GET_SATELLITE_CAPABILITIES"; - case RIL_REQUEST_SET_SATELLITE_POWER: - return "SET_SATELLITE_POWER"; - case RIL_REQUEST_GET_SATELLITE_POWER: - return "GET_SATELLITE_POWER"; - case RIL_REQUEST_PROVISION_SATELLITE_SERVICE: - return "PROVISION_SATELLITE_SERVICE"; - case RIL_REQUEST_ADD_ALLOWED_SATELLITE_CONTACTS: - return "ADD_ALLOWED_SATELLITE_CONTACTS"; - case RIL_REQUEST_REMOVE_ALLOWED_SATELLITE_CONTACTS: - return "REMOVE_ALLOWED_SATELLITE_CONTACTS"; - case RIL_REQUEST_SEND_SATELLITE_MESSAGES: - return "SEND_SATELLITE_MESSAGES"; - case RIL_REQUEST_GET_PENDING_SATELLITE_MESSAGES: - return "GET_PENDING_SATELLITE_MESSAGES"; - case RIL_REQUEST_GET_SATELLITE_MODE: - return "GET_SATELLITE_MODE"; - case RIL_REQUEST_SET_SATELLITE_INDICATION_FILTER: - return "SET_SATELLITE_INDICATION_FILTER"; - case RIL_REQUEST_START_SENDING_SATELLITE_POINTING_INFO: - return "START_SENDING_SATELLITE_POINTING_INFO"; - case RIL_REQUEST_STOP_SENDING_SATELLITE_POINTING_INFO: - return "STOP_SENDING_SATELLITE_POINTING_INFO"; - case RIL_REQUEST_GET_MAX_CHARACTERS_PER_SATELLITE_TEXT_MESSAGE: - return "GET_MAX_CHARACTERS_PER_SATELLITE_TEXT_MESSAGE"; - case RIL_REQUEST_GET_TIME_FOR_NEXT_SATELLITE_VISIBILITY: - return "GET_TIME_FOR_NEXT_SATELLITE_VISIBILITY"; default: return "<unknown request " + request + ">"; } @@ -5295,20 +5244,6 @@ public class RILUtils { return "UNSOL_RESPONSE_SIM_PHONEBOOK_RECORDS_RECEIVED"; case RIL_UNSOL_SLICING_CONFIG_CHANGED: return "UNSOL_SLICING_CONFIG_CHANGED"; - case RIL_UNSOL_PENDING_SATELLITE_MESSAGE_COUNT: - return "UNSOL_PENDING_SATELLITE_MESSAGE_COUNT"; - case RIL_UNSOL_NEW_SATELLITE_MESSAGES: - return "UNSOL_NEW_SATELLITE_MESSAGES"; - case RIL_UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE: - return "UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE"; - case RIL_UNSOL_SATELLITE_POINTING_INFO_CHANGED: - return "UNSOL_SATELLITE_POINTING_INFO_CHANGED"; - case RIL_UNSOL_SATELLITE_MODE_CHANGED: - return "UNSOL_SATELLITE_MODE_CHANGED"; - case RIL_UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED: - return "UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED"; - case RIL_UNSOL_SATELLITE_PROVISION_STATE_CHANGED: - return "UNSOL_SATELLITE_PROVISION_STATE_CHANGED"; /* The follow unsols are not defined in RIL.h */ case RIL_UNSOL_ICC_SLOT_STATUS: return "UNSOL_ICC_SLOT_STATUS"; @@ -5324,12 +5259,12 @@ public class RILUtils { return "UNSOL_BARRING_INFO_CHANGED"; case RIL_UNSOL_EMERGENCY_NETWORK_SCAN_RESULT: return "UNSOL_EMERGENCY_NETWORK_SCAN_RESULT"; - case RIL_UNSOL_TRIGGER_IMS_DEREGISTRATION: - return "UNSOL_TRIGGER_IMS_DEREGISTRATION"; case RIL_UNSOL_CONNECTION_SETUP_FAILURE: return "UNSOL_CONNECTION_SETUP_FAILURE"; case RIL_UNSOL_NOTIFY_ANBR: return "UNSOL_NOTIFY_ANBR"; + case RIL_UNSOL_TRIGGER_IMS_DEREGISTRATION: + return "UNSOL_TRIGGER_IMS_DEREGISTRATION"; default: return "<unknown response " + response + ">"; } @@ -5446,7 +5381,7 @@ public class RILUtils { try { val = o.getClass().getDeclaredMethod(getTagMethod).invoke(o); } catch (NoSuchMethodException | IllegalAccessException - | InvocationTargetException e) { + | InvocationTargetException e) { loge(e.toString()); } if (val != null) { @@ -5715,93 +5650,6 @@ public class RILUtils { } /** - * Convert android.hardware.radio.satellite.SatelliteCapabilities to - * android.telephony.satellite.SatelliteCapabilities - */ - public static SatelliteCapabilities convertHalSatelliteCapabilities( - android.hardware.radio.satellite.SatelliteCapabilities capabilities) { - Set<Integer> supportedRadioTechnologies = new HashSet<>(); - if (capabilities.supportedRadioTechnologies != null - && capabilities.supportedRadioTechnologies.length > 0) { - for (int technology : capabilities.supportedRadioTechnologies) { - supportedRadioTechnologies.add(technology); - } - } - return new SatelliteCapabilities(supportedRadioTechnologies, - capabilities.needsPointingToSatellite, 0, null); - } - - /** - * Convert from android.hardware.radio.satellite.PointingInfo to - * android.telephony.satellite.stub.PointingInfo - */ - public static PointingInfo convertHalSatellitePointingInfo( - android.hardware.radio.satellite.PointingInfo pointingInfo) { - return new PointingInfo(pointingInfo.satelliteAzimuthDegrees, - pointingInfo.satelliteElevationDegrees); - } - - /** - * Convert from android.telephony.satellite.stub.PointingInfo to - * android.hardware.radio.satellite.PointingInfo - */ - public static android.hardware.radio.satellite.PointingInfo convertToHalSatellitePointingInfo( - PointingInfo pointingInfo) { - android.hardware.radio.satellite.PointingInfo halPointingInfo = - new android.hardware.radio.satellite.PointingInfo(); - halPointingInfo.satelliteAzimuthDegrees = pointingInfo.getSatelliteAzimuthDegrees(); - halPointingInfo.satelliteElevationDegrees = pointingInfo.getSatelliteElevationDegrees(); - return halPointingInfo; - } - - /** - * Convert satellite-related errors from CommandException.Error to - * SatelliteManager.SatelliteServiceResult. - * @param error The satellite error. - * @return The converted SatelliteServiceResult. - */ - @SatelliteManager.SatelliteResult - public static int convertToSatelliteError( - CommandException.Error error) { - switch (error) { - case INTERNAL_ERR: - //fallthrough to SYSTEM_ERR - case MODEM_ERR: - //fallthrough to SYSTEM_ERR - case SYSTEM_ERR: - return SatelliteManager.SATELLITE_RESULT_MODEM_ERROR; - case INVALID_ARGUMENTS: - return SatelliteManager.SATELLITE_RESULT_INVALID_ARGUMENTS; - case INVALID_MODEM_STATE: - return SatelliteManager.SATELLITE_RESULT_INVALID_MODEM_STATE; - case RADIO_NOT_AVAILABLE: - return SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE; - case REQUEST_NOT_SUPPORTED: - return SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED; - case NO_MEMORY: - //fallthrough to NO_RESOURCES - case NO_RESOURCES: - return SatelliteManager.SATELLITE_RESULT_NO_RESOURCES; - case NETWORK_ERR: - return SatelliteManager.SATELLITE_RESULT_NETWORK_ERROR; - case NETWORK_TIMEOUT: - return SatelliteManager.SATELLITE_RESULT_NETWORK_TIMEOUT; - case NO_NETWORK_FOUND: - //fallthrough to NO_SATELLITE_SIGNAL - case NO_SATELLITE_SIGNAL: - return SatelliteManager.SATELLITE_RESULT_NOT_REACHABLE; - case ABORTED: - return SatelliteManager.SATELLITE_RESULT_REQUEST_ABORTED; - case ACCESS_BARRED: - return SatelliteManager.SATELLITE_RESULT_ACCESS_BARRED; - case SUBSCRIBER_NOT_AUTHORIZED: - return SatelliteManager.SATELLITE_RESULT_NOT_AUTHORIZED; - default: - return SatelliteManager.SATELLITE_RESULT_ERROR; - } - } - - /** * Converts the call state to HAL IMS call state. * * @param state The {@link Call.State}. diff --git a/src/java/com/android/internal/telephony/RadioSatelliteProxy.java b/src/java/com/android/internal/telephony/RadioSatelliteProxy.java deleted file mode 100644 index ec334b6fbe..0000000000 --- a/src/java/com/android/internal/telephony/RadioSatelliteProxy.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.telephony; - -import android.os.RemoteException; -import android.telephony.Rlog; - -/** - * A holder for IRadioSatellite. - * Use getAidl to get IRadioSatellite and call the AIDL implementations of the HAL APIs. - */ -public class RadioSatelliteProxy extends RadioServiceProxy { - private static final String TAG = "RadioSatelliteProxy"; - private volatile android.hardware.radio.satellite.IRadioSatellite mSatelliteProxy = null; - - /** - * Sets IRadioSatellite as the AIDL implementation for RadioServiceProxy. - * @param halVersion Radio HAL version. - * @param satellite IRadioSatellite implementation. - * - * @return updated HAL version. - */ - public HalVersion setAidl(HalVersion halVersion, - android.hardware.radio.satellite.IRadioSatellite satellite) { - HalVersion version = halVersion; - try { - version = RIL.getServiceHalVersion(satellite.getInterfaceVersion()); - } catch (RemoteException e) { - Rlog.e(TAG, "setAidl: " + e); - } - mHalVersion = version; - mSatelliteProxy = satellite; - mIsAidl = true; - - Rlog.d(TAG, "AIDL initialized mHalVersion=" + mHalVersion); - return mHalVersion; - } - - /** - * Gets the AIDL implementation of RadioSatelliteProxy. - * @return IRadioSatellite implementation. - */ - public android.hardware.radio.satellite.IRadioSatellite getAidl() { - return mSatelliteProxy; - } - - /** - * Resets RadioSatelliteProxy. - */ - @Override - public void clear() { - super.clear(); - mSatelliteProxy = null; - } - - /** - * Checks whether a IRadioSatellite implementation exists. - * @return true if there is neither a HIDL nor AIDL implementation. - */ - @Override - public boolean isEmpty() { - return mRadioProxy == null && mSatelliteProxy == null; - } - - /** - * Call IRadioSatellite#responseAcknowledgement - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - @Override - public void responseAcknowledgement() throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.responseAcknowledgement(); - } - } - - /** - * Call IRadioSatellite#getCapabilities - * @param serial Serial number of request. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void getCapabilities(int serial) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.getCapabilities(serial); - } - } - - /** - * Call IRadioSatellite#setPower - * @param serial Serial number of request. - * @param on True for turning on. - * False for turning off. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void setPower(int serial, boolean on) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.setPower(serial, on); - } - } - - /** - * Call IRadioSatellite#getPowerState - * @param serial Serial number of request. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void getPowerState(int serial) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.getPowerState(serial); - } - } - - /** - * Call IRadioSatellite#provisionService - * @param serial Serial number of request. - * @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. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void provisionService(int serial, String imei, String msisdn, String imsi, - int[] features) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.provisionService(serial, imei, msisdn, imsi, features); - } - } - - /** - * Call IRadioSatellite#addAllowedSatelliteContacts - * @param serial Serial number of request. - * @param contacts List of allowed contacts to be added. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void addAllowedSatelliteContacts(int serial, String[] contacts) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.addAllowedSatelliteContacts(serial, contacts); - } - } - - /** - * Call IRadioSatellite#removeAllowedSatelliteContacts - * @param serial Serial number of request. - * @param contacts List of allowed contacts to be removed. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void removeAllowedSatelliteContacts(int serial, String[] contacts) - throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.removeAllowedSatelliteContacts(serial, contacts); - } - } - - /** - * Call IRadioSatellite#sendMessages - * @param serial Serial number of request. - * @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 - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void sendMessages(int serial, String[] messages, String destination, double latitude, - double longitude) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.sendMessages(serial, messages, destination, latitude, longitude); - } - } - - /** - * Call IRadioSatellite#getPendingMessages - * @param serial Serial number of request. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void getPendingMessages(int serial) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.getPendingMessages(serial); - } - } - - /** - * Call IRadioSatellite#getSatelliteMode - * @param serial Serial number of request. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void getSatelliteMode(int serial) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.getSatelliteMode(serial); - } - } - - /** - * Call IRadioSatellite#setIndicationFilter - * @param serial Serial number of request. - * @param filterBitmask The filter identifying what type of indication framework want to - * receive from modem. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void setIndicationFilter(int serial, int filterBitmask) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.setIndicationFilter(serial, filterBitmask); - } - } - - /** - * Call IRadioSatellite#startSendingSatellitePointingInfo - * @param serial Serial number of request. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void startSendingSatellitePointingInfo(int serial) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.startSendingSatellitePointingInfo(serial); - } - } - - /** - * Call IRadioSatellite#stopSendingSatellitePointingInfo - * @param serial Serial number of request. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void stopSendingSatellitePointingInfo(int serial) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.stopSendingSatellitePointingInfo(serial); - } - } - - /** - * Call IRadioSatellite#getMaxCharactersPerTextMessage - * @param serial Serial number of request. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void getMaxCharactersPerTextMessage(int serial) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.getMaxCharactersPerTextMessage(serial); - } - } - - /** - * Call IRadioSatellite#getTimeForNextSatelliteVisibility - * @param serial Serial number of request. - * @throws RemoteException Throws RemoteException when RadioSatellite service is not available. - */ - public void getTimeForNextSatelliteVisibility(int serial) throws RemoteException { - if (isEmpty()) return; - if (isAidl()) { - mSatelliteProxy.getTimeForNextSatelliteVisibility(serial); - } - } -} diff --git a/src/java/com/android/internal/telephony/SatelliteIndication.java b/src/java/com/android/internal/telephony/SatelliteIndication.java deleted file mode 100644 index 2e561c3dac..0000000000 --- a/src/java/com/android/internal/telephony/SatelliteIndication.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.telephony; - -import static android.telephony.TelephonyManager.HAL_SERVICE_SATELLITE; - -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NEW_SATELLITE_MESSAGES; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PENDING_SATELLITE_MESSAGE_COUNT; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_MODE_CHANGED; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_POINTING_INFO_CHANGED; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_PROVISION_STATE_CHANGED; -import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED; - -import android.hardware.radio.satellite.IRadioSatelliteIndication; -import android.os.AsyncResult; -import android.telephony.satellite.SatelliteDatagram; -import android.util.Pair; - -/** - * Interface declaring unsolicited radio indications for Satellite APIs. - */ -public class SatelliteIndication extends IRadioSatelliteIndication.Stub { - private final RIL mRil; - - public SatelliteIndication(RIL ril) { - mRil = ril; - } - - @Override - public String getInterfaceHash() { - return IRadioSatelliteIndication.HASH; - } - - @Override - public int getInterfaceVersion() { - return IRadioSatelliteIndication.VERSION; - } - - /** - * Indicates that satellite has pending messages for the device to be pulled. - * - * @param indicationType Type of radio indication - * @param count Number of pending messages. - */ - public void onPendingMessageCount(int indicationType, int count) { - mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType); - - if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_PENDING_SATELLITE_MESSAGE_COUNT); - - if (mRil.mPendingSatelliteMessageCountRegistrants != null) { - mRil.mPendingSatelliteMessageCountRegistrants.notifyRegistrants( - new AsyncResult(null, count, null)); - } - } - - /** - * Indicates new message received on device. - * - * @param indicationType Type of radio indication - * @param messages List of new messages received. - */ - public void onNewMessages(int indicationType, String[] messages) { - mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType); - - if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_NEW_SATELLITE_MESSAGES); - - if (mRil.mNewSatelliteMessagesRegistrants != null) { - for (int i = 0; i < messages.length; i++) { - SatelliteDatagram datagram = new SatelliteDatagram(messages[i].getBytes()); - mRil.mNewSatelliteMessagesRegistrants.notifyRegistrants( - new AsyncResult(null, new Pair<>(datagram, messages.length - i - 1), null)); - } - } - } - - /** - * Confirms that ongoing message transfer is complete. - * - * @param indicationType Type of radio indication - * @param complete True mean the transfer is complete. - * False means the transfer is not complete. - */ - public void onMessagesTransferComplete(int indicationType, boolean complete) { - mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType); - - if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_MESSAGES_TRANSFER_COMPLETE); - - if (mRil.mSatelliteMessagesTransferCompleteRegistrants != null) { - mRil.mSatelliteMessagesTransferCompleteRegistrants.notifyRegistrants( - new AsyncResult(null, complete, null)); - } - } - - /** - * Indicate that satellite Pointing input has changed. - * - * @param indicationType Type of radio indication - * @param pointingInfo The current pointing info. - */ - public void onSatellitePointingInfoChanged(int indicationType, - android.hardware.radio.satellite.PointingInfo pointingInfo) { - mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType); - - if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_POINTING_INFO_CHANGED); - - if (mRil.mSatellitePointingInfoChangedRegistrants != null) { - mRil.mSatellitePointingInfoChangedRegistrants.notifyRegistrants( - new AsyncResult( - null, - RILUtils.convertHalSatellitePointingInfo(pointingInfo), - null)); - } - } - - /** - * Indicate that satellite mode has changed. - * - * @param indicationType Type of radio indication - * @param mode The current mode of the satellite modem. - */ - public void onSatelliteModeChanged(int indicationType, int mode) { - mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType); - - if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_MODE_CHANGED); - - if (mRil.mSatelliteModeChangedRegistrants != null) { - mRil.mSatelliteModeChangedRegistrants.notifyRegistrants( - new AsyncResult(null, mode, null)); - } - } - - /** - * Indicate that satellite radio technology has changed. - * - * @param indicationType Type of radio indication - * @param technology The current technology of the satellite modem. - */ - public void onSatelliteRadioTechnologyChanged(int indicationType, int technology) { - mRil.processIndication(HAL_SERVICE_SATELLITE, indicationType); - - if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_SATELLITE_RADIO_TECHNOLOGY_CHANGED); - - if (mRil.mSatelliteRadioTechnologyChangedRegistrants != null) { - mRil.mSatelliteRadioTechnologyChangedRegistrants.notifyRegistrants( - new AsyncResult(null, technology, null)); - } - } - - /** - * Indicate that satellite provision state has changed. - * - * @param indicationType Type of radio indication - * @param provisioned True means the service is provisioned. - * False means the service is not provisioned. - * @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, null, null)); - } - } -} diff --git a/src/java/com/android/internal/telephony/SatelliteResponse.java b/src/java/com/android/internal/telephony/SatelliteResponse.java deleted file mode 100644 index 559691b9d9..0000000000 --- a/src/java/com/android/internal/telephony/SatelliteResponse.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.internal.telephony; - -import static android.telephony.TelephonyManager.HAL_SERVICE_SATELLITE; - -import android.hardware.radio.RadioError; -import android.hardware.radio.RadioResponseInfo; -import android.hardware.radio.satellite.IRadioSatelliteResponse; -import android.telephony.satellite.SatelliteCapabilities; - -/** - * Interface declaring response functions to solicited radio requests for Satellite APIs. - */ -public class SatelliteResponse extends IRadioSatelliteResponse.Stub { - private final RIL mRil; - - public SatelliteResponse(RIL ril) { - mRil = ril; - } - - /** - * Acknowledge the receipt of radio request sent to the vendor. This must be sent only for - * radio request which take long time to respond. - * For more details, refer https://source.android.com/devices/tech/connect/ril.html - * @param serial Serial no. of the request whose acknowledgement is sent. - */ - public void acknowledgeRequest(int serial) { - mRil.processRequestAck(serial); - } - /** - * Response of the request getCapabilities. - * - * @param responseInfo Response info struct containing serial no. and error - * @param capabilities List of capabilities that the satellite modem supports. - */ - public void getCapabilitiesResponse(RadioResponseInfo responseInfo, - android.hardware.radio.satellite.SatelliteCapabilities capabilities) { - RILRequest rr = mRil.processResponse(HAL_SERVICE_SATELLITE, responseInfo); - - if (rr != null) { - SatelliteCapabilities convertedSatelliteCapabilities = - RILUtils.convertHalSatelliteCapabilities(capabilities); - if (responseInfo.error == RadioError.NONE) { - RadioResponse.sendMessageResponse(rr.mResult, convertedSatelliteCapabilities); - } - mRil.processResponseDone(rr, responseInfo, convertedSatelliteCapabilities); - } - } - - /** - * Response of the request setPower. - * - * @param responseInfo Response info struct containing serial no. and error - */ - public void setPowerResponse(RadioResponseInfo responseInfo) { - RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo); - } - - /** - * Response of the request getPowerState. - * - * @param responseInfo Response info struct containing serial no. and error - * @param on True means the modem is ON. - * False means the modem is OFF. - */ - public void getPowerStateResponse(RadioResponseInfo responseInfo, boolean on) { - RadioResponse.responseInts(HAL_SERVICE_SATELLITE, mRil, responseInfo, on ? 1 : 0); - } - - /** - * Response of the request provisionService. - * - * @param responseInfo Response info struct containing serial no. and error - * @param provisioned True means the service is provisioned. - * False means the service is not provisioned. - */ - public void provisionServiceResponse(RadioResponseInfo responseInfo, boolean provisioned) { - RadioResponse.responseInts(HAL_SERVICE_SATELLITE, mRil, responseInfo, provisioned ? 1 : 0); - } - - /** - * Response of the request addAllowedSatelliteContacts. - * - * @param responseInfo Response info struct containing serial no. and error - */ - public void addAllowedSatelliteContactsResponse(RadioResponseInfo responseInfo) { - RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo); - } - - /** - * Response of the request removeAllowedSatelliteContacts. - * - * @param responseInfo Response info struct containing serial no. and error - */ - public void removeAllowedSatelliteContactsResponse(RadioResponseInfo responseInfo) { - RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo); - } - - /** - * Response of the request sendMessages. - * - * @param responseInfo Response info struct containing serial no. and error - */ - public void sendMessagesResponse(RadioResponseInfo responseInfo) { - RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo); - } - - /** - * Response of the request getPendingMessages. - * - * @param responseInfo Response info struct containing serial no. and error - * @param messages List of pending messages received. - */ - public void getPendingMessagesResponse(RadioResponseInfo responseInfo, String[] messages) { - RILRequest rr = mRil.processResponse(HAL_SERVICE_SATELLITE, responseInfo); - - if (rr != null) { - if (responseInfo.error == RadioError.NONE) { - RadioResponse.sendMessageResponse(rr.mResult, messages); - } - mRil.processResponseDone(rr, responseInfo, messages); - } - } - - /** - * Response of the request getSatelliteMode. - * - * @param responseInfo Response info struct containing serial no. and error - * @param mode Current Mode of the satellite modem. - * @param technology The current technology of the satellite modem. - */ - public void getSatelliteModeResponse(RadioResponseInfo responseInfo, int mode, int technology) { - RILRequest rr = mRil.processResponse(HAL_SERVICE_SATELLITE, responseInfo); - - if (rr != null) { - int[] ret = new int[]{mode, technology}; - if (responseInfo.error == RadioError.NONE) { - RadioResponse.sendMessageResponse(rr.mResult, ret); - } - mRil.processResponseDone(rr, responseInfo, ret); - } - } - - /** - * Response of the request setIndicationFilter. - * - * @param responseInfo Response info struct containing serial no. and error - */ - public void setIndicationFilterResponse(RadioResponseInfo responseInfo) { - RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo); - } - - /** - * Response of the request startSendingSatellitePointingInfo. - * - * @param responseInfo Response info struct containing serial no. and error - */ - public void startSendingSatellitePointingInfoResponse(RadioResponseInfo responseInfo) { - RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo); - } - - /** - * Response of the request stopSendingSatellitePointingInfo. - * - * @param responseInfo Response info struct containing serial no. and error - */ - public void stopSendingSatellitePointingInfoResponse(RadioResponseInfo responseInfo) { - RadioResponse.responseVoid(HAL_SERVICE_SATELLITE, mRil, responseInfo); - } - - /** - * Response of the request getMaxCharactersPerTextMessage. - * - * @param responseInfo Response info struct containing serial no. and error - * @param charLimit Maximum number of characters in a text message that can be sent. - */ - public void getMaxCharactersPerTextMessageResponse( - RadioResponseInfo responseInfo, int charLimit) { - RadioResponse.responseInts(HAL_SERVICE_SATELLITE, mRil, responseInfo, charLimit); - } - - /** - * Response of the request getTimeForNextSatelliteVisibility. - * - * @param responseInfo Response info struct containing serial no. and error - * @param timeInSeconds The duration in seconds after which the satellite will be visible. - */ - public void getTimeForNextSatelliteVisibilityResponse( - RadioResponseInfo responseInfo, int timeInSeconds) { - RadioResponse.responseInts(HAL_SERVICE_SATELLITE, mRil, responseInfo, timeInSeconds); - } - - @Override - public String getInterfaceHash() { - return IRadioSatelliteResponse.HASH; - } - - @Override - public int getInterfaceVersion() { - return IRadioSatelliteResponse.VERSION; - } -} diff --git a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java index 591114b600..6ccc3e6aa9 100644 --- a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java +++ b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java @@ -190,50 +190,11 @@ public class DatagramDispatcher extends Handler { (SendSatelliteDatagramArgument) request.argument; onCompleted = obtainMessage(EVENT_SEND_SATELLITE_DATAGRAM_DONE, request); - if (SatelliteModemInterface.getInstance().isSatelliteServiceSupported()) { - SatelliteModemInterface.getInstance().sendSatelliteDatagram(argument.datagram, - argument.datagramType == SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE, - argument.needFullScreenPointingUI, onCompleted); - break; - } - - Phone phone = request.phone; - if (phone != null) { - phone.sendSatelliteDatagram(onCompleted, argument.datagram, - argument.needFullScreenPointingUI); - } else { - loge("sendSatelliteDatagram: No phone object"); - synchronized (mLock) { - // Remove current datagram from pending map - if (argument.datagramType == SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE) { - mPendingEmergencyDatagramsMap.remove(argument.datagramId); - } else { - mPendingNonEmergencyDatagramsMap.remove(argument.datagramId); - } - - // Update send status - mDatagramController.updateSendStatus(argument.subId, - SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_SEND_FAILED, - getPendingDatagramCount(), - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - mDatagramController.updateSendStatus(argument.subId, - SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE, - 0, SatelliteManager.SATELLITE_RESULT_SUCCESS); - - // report phone == null case - reportSendDatagramCompleted(argument, - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - argument.callback.accept( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - - // Abort sending all the pending datagrams - abortSendingPendingDatagrams(argument.subId, - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - } - } + SatelliteModemInterface.getInstance().sendSatelliteDatagram(argument.datagram, + argument.datagramType == SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE, + argument.needFullScreenPointingUI, onCompleted); break; } - case EVENT_SEND_SATELLITE_DATAGRAM_DONE: { ar = (AsyncResult) msg.obj; request = (DatagramDispatcherHandlerRequest) ar.userObj; diff --git a/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java b/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java index 35c78ebbd3..fd04779f0e 100644 --- a/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java +++ b/src/java/com/android/internal/telephony/satellite/DatagramReceiver.java @@ -424,35 +424,7 @@ public class DatagramReceiver extends Handler { request = (DatagramReceiverHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_POLL_PENDING_SATELLITE_DATAGRAMS_DONE, request); - - if (SatelliteModemInterface.getInstance().isSatelliteServiceSupported()) { - SatelliteModemInterface.getInstance() - .pollPendingSatelliteDatagrams(onCompleted); - break; - } - - Phone phone = request.phone; - if (phone != null) { - phone.pollPendingSatelliteDatagrams(onCompleted); - } else { - loge("pollPendingSatelliteDatagrams: No phone object"); - mDatagramController.updateReceiveStatus(request.subId, - SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVE_FAILED, - mDatagramController.getReceivePendingCount(), - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - - mDatagramController.updateReceiveStatus(request.subId, - SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE, - mDatagramController.getReceivePendingCount(), - SatelliteManager.SATELLITE_RESULT_SUCCESS); - - reportMetrics(null, SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - mControllerMetricsStats.reportIncomingDatagramCount( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - // Send response for current request - ((Consumer<Integer>) request.argument) - .accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - } + SatelliteModemInterface.getInstance().pollPendingSatelliteDatagrams(onCompleted); break; } @@ -534,15 +506,9 @@ public class DatagramReceiver extends Handler { if (satelliteDatagramListenerHandler == null) { satelliteDatagramListenerHandler = new SatelliteDatagramListenerHandler( mLooper, validSubId); - if (SatelliteModemInterface.getInstance().isSatelliteServiceSupported()) { - SatelliteModemInterface.getInstance().registerForSatelliteDatagramsReceived( - satelliteDatagramListenerHandler, - SatelliteDatagramListenerHandler.EVENT_SATELLITE_DATAGRAM_RECEIVED, null); - } else { - Phone phone = SatelliteServiceUtils.getPhone(); - phone.registerForSatelliteDatagramsReceived(satelliteDatagramListenerHandler, - SatelliteDatagramListenerHandler.EVENT_SATELLITE_DATAGRAM_RECEIVED, null); - } + SatelliteModemInterface.getInstance().registerForSatelliteDatagramsReceived( + satelliteDatagramListenerHandler, + SatelliteDatagramListenerHandler.EVENT_SATELLITE_DATAGRAM_RECEIVED, null); } satelliteDatagramListenerHandler.addListener(callback); @@ -568,15 +534,8 @@ public class DatagramReceiver extends Handler { if (!handler.hasListeners()) { mSatelliteDatagramListenerHandlers.remove(validSubId); - if (SatelliteModemInterface.getInstance().isSatelliteServiceSupported()) { - SatelliteModemInterface.getInstance() - .unregisterForSatelliteDatagramsReceived(handler); - } else { - Phone phone = SatelliteServiceUtils.getPhone(); - if (phone != null) { - phone.unregisterForSatelliteDatagramsReceived(handler); - } - } + SatelliteModemInterface.getInstance().unregisterForSatelliteDatagramsReceived( + handler); } } } diff --git a/src/java/com/android/internal/telephony/satellite/PointingAppController.java b/src/java/com/android/internal/telephony/satellite/PointingAppController.java index 70d432ebf2..9a6bd695b1 100644 --- a/src/java/com/android/internal/telephony/satellite/PointingAppController.java +++ b/src/java/com/android/internal/telephony/satellite/PointingAppController.java @@ -42,7 +42,6 @@ import android.text.TextUtils; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.telephony.Phone; import java.util.ArrayList; import java.util.Arrays; @@ -276,31 +275,24 @@ public class PointingAppController { * Register to start receiving updates for satellite position and datagram transfer state * @param subId The subId of the subscription to register for receiving the updates. * @param callback The callback to notify of satellite transmission updates. - * @param phone The Phone object to unregister for receiving the updates. */ public void registerForSatelliteTransmissionUpdates(int subId, - ISatelliteTransmissionUpdateCallback callback, Phone phone) { + ISatelliteTransmissionUpdateCallback callback) { SatelliteTransmissionUpdateHandler handler = mSatelliteTransmissionUpdateHandlers.get(subId); if (handler != null) { handler.addListener(callback); - return; } else { handler = new SatelliteTransmissionUpdateHandler(Looper.getMainLooper()); handler.addListener(callback); mSatelliteTransmissionUpdateHandlers.put(subId, handler); - if (SatelliteModemInterface.getInstance().isSatelliteServiceSupported()) { - SatelliteModemInterface.getInstance().registerForSatellitePositionInfoChanged( - handler, SatelliteTransmissionUpdateHandler.EVENT_POSITION_INFO_CHANGED, - null); - SatelliteModemInterface.getInstance().registerForDatagramTransferStateChanged( - handler, - SatelliteTransmissionUpdateHandler.EVENT_DATAGRAM_TRANSFER_STATE_CHANGED, - null); - } else { - phone.registerForSatellitePositionInfoChanged(handler, - SatelliteTransmissionUpdateHandler.EVENT_POSITION_INFO_CHANGED, null); - } + SatelliteModemInterface.getInstance().registerForSatellitePositionInfoChanged( + handler, SatelliteTransmissionUpdateHandler.EVENT_POSITION_INFO_CHANGED, + null); + SatelliteModemInterface.getInstance().registerForDatagramTransferStateChanged( + handler, + SatelliteTransmissionUpdateHandler.EVENT_DATAGRAM_TRANSFER_STATE_CHANGED, + null); } } @@ -310,11 +302,10 @@ public class PointingAppController { * @param subId The subId of the subscription to unregister for receiving the updates. * @param result The callback to get the error code in case of failure * @param callback The callback that was passed to {@link - * #registerForSatelliteTransmissionUpdates(int, ISatelliteTransmissionUpdateCallback, Phone)}. - * @param phone The Phone object to unregister for receiving the updates + * #registerForSatelliteTransmissionUpdates(int, ISatelliteTransmissionUpdateCallback)}. */ public void unregisterForSatelliteTransmissionUpdates(int subId, Consumer<Integer> result, - ISatelliteTransmissionUpdateCallback callback, Phone phone) { + ISatelliteTransmissionUpdateCallback callback) { SatelliteTransmissionUpdateHandler handler = mSatelliteTransmissionUpdateHandlers.get(subId); if (handler != null) { @@ -323,20 +314,11 @@ public class PointingAppController { result.accept(SatelliteManager.SATELLITE_RESULT_SUCCESS); return; } - mSatelliteTransmissionUpdateHandlers.remove(subId); - if (SatelliteModemInterface.getInstance().isSatelliteServiceSupported()) { - SatelliteModemInterface.getInstance().unregisterForSatellitePositionInfoChanged( - handler); - SatelliteModemInterface.getInstance().unregisterForDatagramTransferStateChanged( - handler); - } else { - if (phone == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - phone.unregisterForSatellitePositionInfoChanged(handler); - } + + SatelliteModemInterface satelliteModemInterface = SatelliteModemInterface.getInstance(); + satelliteModemInterface.unregisterForSatellitePositionInfoChanged(handler); + satelliteModemInterface.unregisterForDatagramTransferStateChanged(handler); } } @@ -348,7 +330,7 @@ public class PointingAppController { * {@link android.telephony.satellite.SatelliteTransmissionUpdateCallback * #onSatellitePositionChanged(pointingInfo)}. */ - public void startSatelliteTransmissionUpdates(@NonNull Message message, @Nullable Phone phone) { + public void startSatelliteTransmissionUpdates(@NonNull Message message) { if (mStartedSatelliteTransmissionUpdates) { logd("startSatelliteTransmissionUpdates: already started"); AsyncResult.forMessage(message, null, new SatelliteManager.SatelliteException( @@ -356,20 +338,8 @@ public class PointingAppController { message.sendToTarget(); return; } - if (SatelliteModemInterface.getInstance().isSatelliteServiceSupported()) { - SatelliteModemInterface.getInstance().startSendingSatellitePointingInfo(message); - mStartedSatelliteTransmissionUpdates = true; - return; - } - if (phone != null) { - phone.startSatellitePositionUpdates(message); - mStartedSatelliteTransmissionUpdates = true; - } else { - loge("startSatelliteTransmissionUpdates: No phone object"); - AsyncResult.forMessage(message, null, new SatelliteManager.SatelliteException( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE)); - message.sendToTarget(); - } + SatelliteModemInterface.getInstance().startSendingSatellitePointingInfo(message); + mStartedSatelliteTransmissionUpdates = true; } /** @@ -377,20 +347,9 @@ public class PointingAppController { * Reset the flag mStartedSatelliteTransmissionUpdates * This can be called by the pointing UI when the user stops pointing to the satellite. */ - public void stopSatelliteTransmissionUpdates(@NonNull Message message, @Nullable Phone phone) { + public void stopSatelliteTransmissionUpdates(@NonNull Message message) { setStartedSatelliteTransmissionUpdates(false); - if (SatelliteModemInterface.getInstance().isSatelliteServiceSupported()) { - SatelliteModemInterface.getInstance().stopSendingSatellitePointingInfo(message); - return; - } - if (phone != null) { - phone.stopSatellitePositionUpdates(message); - } else { - loge("startSatelliteTransmissionUpdates: No phone object"); - AsyncResult.forMessage(message, null, new SatelliteManager.SatelliteException( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE)); - message.sendToTarget(); - } + SatelliteModemInterface.getInstance().stopSendingSatellitePointingInfo(message); } /** diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteController.java b/src/java/com/android/internal/telephony/satellite/SatelliteController.java index cb68fcbe03..3099eb8fba 100644 --- a/src/java/com/android/internal/telephony/satellite/SatelliteController.java +++ b/src/java/com/android/internal/telephony/satellite/SatelliteController.java @@ -19,6 +19,7 @@ package com.android.internal.telephony.satellite; import static android.telephony.SubscriptionManager.SATELLITE_ATTACH_ENABLED_FOR_CARRIER; import static android.telephony.SubscriptionManager.isValidSubscriptionId; import static android.telephony.satellite.SatelliteManager.SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER; +import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS; import android.annotation.ArrayRes; import android.annotation.NonNull; @@ -182,16 +183,10 @@ public class SatelliteController extends Handler { private final AtomicBoolean mRegisteredForProvisionStateChangedWithSatelliteService = new AtomicBoolean(false); - private final AtomicBoolean mRegisteredForProvisionStateChangedWithPhone = - new AtomicBoolean(false); private final AtomicBoolean mRegisteredForPendingDatagramCountWithSatelliteService = new AtomicBoolean(false); - private final AtomicBoolean mRegisteredForPendingDatagramCountWithPhone = - new AtomicBoolean(false); private final AtomicBoolean mRegisteredForSatelliteModemStateChangedWithSatelliteService = new AtomicBoolean(false); - private final AtomicBoolean mRegisteredForSatelliteModemStateChangedWithPhone = - new AtomicBoolean(false); /** * Map key: subId, value: callback to get error code of the provision request. */ @@ -611,8 +606,7 @@ public class SatelliteController extends Handler { request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_START_SATELLITE_TRANSMISSION_UPDATES_DONE, request); - mPointingAppController.startSatelliteTransmissionUpdates(onCompleted, - request.phone); + mPointingAppController.startSatelliteTransmissionUpdates(onCompleted); break; } @@ -625,7 +619,7 @@ public class SatelliteController extends Handler { request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_STOP_SATELLITE_TRANSMISSION_UPDATES_DONE, request); - mPointingAppController.stopSatelliteTransmissionUpdates(onCompleted, request.phone); + mPointingAppController.stopSatelliteTransmissionUpdates(onCompleted); break; } @@ -652,26 +646,8 @@ public class SatelliteController extends Handler { onCompleted = obtainMessage(EVENT_PROVISION_SATELLITE_SERVICE_DONE, request); // Log the current time for provision triggered mProvisionMetricsStats.setProvisioningStartTime(); - if (mSatelliteModemInterface.isSatelliteServiceSupported()) { - mSatelliteModemInterface.provisionSatelliteService(argument.token, - argument.provisionData, onCompleted); - break; - } - Phone phone = request.phone; - if (phone != null) { - phone.provisionSatelliteService(onCompleted, argument.token); - } else { - loge("provisionSatelliteService: No phone object"); - argument.callback.accept( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - notifyRequester(request); - mProvisionMetricsStats - .setResultCode( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE) - .reportProvisionMetrics(); - mControllerMetricsStats.reportProvisionCount( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - } + mSatelliteModemInterface.provisionSatelliteService(argument.token, + argument.provisionData, onCompleted); break; } @@ -694,26 +670,7 @@ public class SatelliteController extends Handler { if (argument.callback != null) { mProvisionMetricsStats.setProvisioningStartTime(); } - if (mSatelliteModemInterface.isSatelliteServiceSupported()) { - mSatelliteModemInterface - .deprovisionSatelliteService(argument.token, onCompleted); - break; - } - Phone phone = request.phone; - if (phone != null) { - phone.deprovisionSatelliteService(onCompleted, argument.token); - } else { - loge("deprovisionSatelliteService: No phone object"); - if (argument.callback != null) { - argument.callback.accept( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - mProvisionMetricsStats.setResultCode( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE) - .reportProvisionMetrics(); - mControllerMetricsStats.reportDeprovisionCount( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - } - } + mSatelliteModemInterface.deprovisionSatelliteService(argument.token, onCompleted); break; } @@ -741,7 +698,7 @@ public class SatelliteController extends Handler { int error = SatelliteServiceUtils.getSatelliteError(ar, "setSatelliteEnabled"); logd("EVENT_SET_SATELLITE_ENABLED_DONE = " + error); - if (error == SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (error == SATELLITE_RESULT_SUCCESS) { if (argument.enableSatellite) { synchronized (mSatelliteEnabledRequestLock) { mWaitingForRadioDisabled = true; @@ -770,14 +727,14 @@ public class SatelliteController extends Handler { // Previous mSatelliteEnabledRequest is successful but waiting for // all radios to be turned off. mSatelliteEnabledRequest.callback.accept( - SatelliteManager.SATELLITE_RESULT_SUCCESS); + SATELLITE_RESULT_SUCCESS); } } synchronized (mIsSatelliteEnabledLock) { if (!mWaitingForSatelliteModemOff) { moveSatelliteToOffStateAndCleanUpResources( - SatelliteManager.SATELLITE_RESULT_SUCCESS, + SATELLITE_RESULT_SUCCESS, argument.callback); } else { logd("Wait for satellite modem off before updating satellite" @@ -794,7 +751,7 @@ public class SatelliteController extends Handler { // Previous mSatelliteEnabledRequest is successful but waiting for // all radios to be turned off. mSatelliteEnabledRequest.callback.accept( - SatelliteManager.SATELLITE_RESULT_SUCCESS); + SATELLITE_RESULT_SUCCESS); } } resetSatelliteEnabledRequest(); @@ -804,7 +761,7 @@ public class SatelliteController extends Handler { } if (argument.enableSatellite) { - if (error == SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (error == SATELLITE_RESULT_SUCCESS) { mControllerMetricsStats.onSatelliteEnabled(); mControllerMetricsStats.reportServiceEnablementSuccessCount(); } else { @@ -826,18 +783,7 @@ public class SatelliteController extends Handler { case CMD_IS_SATELLITE_ENABLED: { request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_IS_SATELLITE_ENABLED_DONE, request); - if (mSatelliteModemInterface.isSatelliteServiceSupported()) { - mSatelliteModemInterface.requestIsSatelliteEnabled(onCompleted); - break; - } - Phone phone = request.phone; - if (phone != null) { - phone.isSatellitePowerOn(onCompleted); - } else { - loge("isSatelliteEnabled: No phone object"); - ((ResultReceiver) request.argument).send( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - } + mSatelliteModemInterface.requestIsSatelliteEnabled(onCompleted); break; } @@ -847,7 +793,7 @@ public class SatelliteController extends Handler { int error = SatelliteServiceUtils.getSatelliteError(ar, "isSatelliteEnabled"); Bundle bundle = new Bundle(); - if (error == SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (error == SATELLITE_RESULT_SUCCESS) { if (ar.result == null) { loge("isSatelliteEnabled: result is null"); error = SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; @@ -867,19 +813,7 @@ public class SatelliteController extends Handler { case CMD_IS_SATELLITE_SUPPORTED: { request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_IS_SATELLITE_SUPPORTED_DONE, request); - - if (mSatelliteModemInterface.isSatelliteServiceSupported()) { - mSatelliteModemInterface.requestIsSatelliteSupported(onCompleted); - break; - } - Phone phone = request.phone; - if (phone != null) { - phone.isSatelliteSupported(onCompleted); - } else { - loge("isSatelliteSupported: No phone object"); - ((ResultReceiver) request.argument).send( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - } + mSatelliteModemInterface.requestIsSatelliteSupported(onCompleted); break; } @@ -888,7 +822,7 @@ public class SatelliteController extends Handler { request = (SatelliteControllerHandlerRequest) ar.userObj; int error = SatelliteServiceUtils.getSatelliteError(ar, "isSatelliteSupported"); Bundle bundle = new Bundle(); - if (error == SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (error == SATELLITE_RESULT_SUCCESS) { if (ar.result == null) { loge("isSatelliteSupported: result is null"); error = SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; @@ -906,18 +840,7 @@ public class SatelliteController extends Handler { case CMD_GET_SATELLITE_CAPABILITIES: { request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_GET_SATELLITE_CAPABILITIES_DONE, request); - if (mSatelliteModemInterface.isSatelliteServiceSupported()) { - mSatelliteModemInterface.requestSatelliteCapabilities(onCompleted); - break; - } - Phone phone = request.phone; - if (phone != null) { - phone.getSatelliteCapabilities(onCompleted); - } else { - loge("getSatelliteCapabilities: No phone object"); - ((ResultReceiver) request.argument).send( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - } + mSatelliteModemInterface.requestSatelliteCapabilities(onCompleted); break; } @@ -927,7 +850,7 @@ public class SatelliteController extends Handler { int error = SatelliteServiceUtils.getSatelliteError(ar, "getSatelliteCapabilities"); Bundle bundle = new Bundle(); - if (error == SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (error == SATELLITE_RESULT_SUCCESS) { if (ar.result == null) { loge("getSatelliteCapabilities: result is null"); error = SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; @@ -952,20 +875,8 @@ public class SatelliteController extends Handler { request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_IS_SATELLITE_COMMUNICATION_ALLOWED_DONE, request); - if (mSatelliteModemInterface.isSatelliteServiceSupported()) { - mSatelliteModemInterface - .requestIsSatelliteCommunicationAllowedForCurrentLocation( - onCompleted); - break; - } - Phone phone = request.phone; - if (phone != null) { - phone.isSatelliteCommunicationAllowedForCurrentLocation(onCompleted); - } else { - loge("isSatelliteCommunicationAllowedForCurrentLocation: No phone object"); - ((ResultReceiver) request.argument).send( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - } + mSatelliteModemInterface + .requestIsSatelliteCommunicationAllowedForCurrentLocation(onCompleted); break; } @@ -975,7 +886,7 @@ public class SatelliteController extends Handler { int error = SatelliteServiceUtils.getSatelliteError(ar, "isSatelliteCommunicationAllowedForCurrentLocation"); Bundle bundle = new Bundle(); - if (error == SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (error == SATELLITE_RESULT_SUCCESS) { if (ar.result == null) { loge("isSatelliteCommunicationAllowedForCurrentLocation: result is null"); error = SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; @@ -997,19 +908,7 @@ public class SatelliteController extends Handler { request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_GET_TIME_SATELLITE_NEXT_VISIBLE_DONE, request); - if (mSatelliteModemInterface.isSatelliteServiceSupported()) { - mSatelliteModemInterface - .requestTimeForNextSatelliteVisibility(onCompleted); - break; - } - Phone phone = request.phone; - if (phone != null) { - phone.requestTimeForNextSatelliteVisibility(onCompleted); - } else { - loge("requestTimeForNextSatelliteVisibility: No phone object"); - ((ResultReceiver) request.argument).send( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - } + mSatelliteModemInterface.requestTimeForNextSatelliteVisibility(onCompleted); break; } @@ -1019,7 +918,7 @@ public class SatelliteController extends Handler { int error = SatelliteServiceUtils.getSatelliteError(ar, "requestTimeForNextSatelliteVisibility"); Bundle bundle = new Bundle(); - if (error == SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (error == SATELLITE_RESULT_SUCCESS) { if (ar.result == null) { loge("requestTimeForNextSatelliteVisibility: result is null"); error = SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; @@ -1063,18 +962,7 @@ public class SatelliteController extends Handler { case CMD_IS_SATELLITE_PROVISIONED: { request = (SatelliteControllerHandlerRequest) msg.obj; onCompleted = obtainMessage(EVENT_IS_SATELLITE_PROVISIONED_DONE, request); - if (mSatelliteModemInterface.isSatelliteServiceSupported()) { - mSatelliteModemInterface.requestIsSatelliteProvisioned(onCompleted); - break; - } - Phone phone = request.phone; - if (phone != null) { - phone.isSatelliteProvisioned(onCompleted); - } else { - loge("isSatelliteProvisioned: No phone object"); - ((ResultReceiver) request.argument).send( - SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - } + mSatelliteModemInterface.requestIsSatelliteProvisioned(onCompleted); break; } @@ -1084,7 +972,7 @@ public class SatelliteController extends Handler { int error = SatelliteServiceUtils.getSatelliteError(ar, "isSatelliteProvisioned"); Bundle bundle = new Bundle(); - if (error == SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (error == SATELLITE_RESULT_SUCCESS) { if (ar.result == null) { loge("isSatelliteProvisioned: result is null"); error = SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; @@ -1153,7 +1041,7 @@ public class SatelliteController extends Handler { "requestSetSatelliteEnabledForCarrier"); synchronized (mIsSatelliteEnabledLock) { - if (error == SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (error == SATELLITE_RESULT_SUCCESS) { boolean enableSatellite = mSatelliteAttachRestrictionForCarrierArray .getOrDefault(argument.subId, Collections.emptySet()).isEmpty(); mIsSatelliteAttachEnabledForCarrierArrayPerSub.put(subId, enableSatellite); @@ -1195,28 +1083,9 @@ public class SatelliteController extends Handler { logd("requestSatelliteEnabled subId: " + subId + " enableSatellite: " + enableSatellite + " enableDemoMode: " + enableDemoMode); Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept); - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); - return; - } - - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - if (!satelliteSupported) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); - return; - } - - Boolean satelliteProvisioned = isSatelliteProvisioned(); - if (satelliteProvisioned == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - if (!satelliteProvisioned) { - result.accept(SatelliteManager.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED); + int error = evaluateOemSatelliteRequestAllowed(true); + if (error != SATELLITE_RESULT_SUCCESS) { + result.accept(error); return; } @@ -1242,7 +1111,7 @@ public class SatelliteController extends Handler { } else { logd("Enable request matches with current state" + " enableSatellite = " + enableSatellite); - result.accept(SatelliteManager.SATELLITE_RESULT_SUCCESS); + result.accept(SATELLITE_RESULT_SUCCESS); return; } } @@ -1278,7 +1147,7 @@ public class SatelliteController extends Handler { } } - sendRequestAsync(CMD_SET_SATELLITE_ENABLED, request, SatelliteServiceUtils.getPhone()); + sendRequestAsync(CMD_SET_SATELLITE_ENABLED, request, null); } /** @@ -1289,17 +1158,9 @@ public class SatelliteController extends Handler { * if the request is successful or an error code if the request failed. */ public void requestIsSatelliteEnabled(int subId, @NonNull ResultReceiver result) { - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); - return; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - return; - } - if (!satelliteSupported) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); + int error = evaluateOemSatelliteRequestAllowed(false); + if (error != SATELLITE_RESULT_SUCCESS) { + result.send(error, null); return; } @@ -1308,12 +1169,12 @@ public class SatelliteController extends Handler { /* We have already successfully queried the satellite modem. */ Bundle bundle = new Bundle(); bundle.putBoolean(SatelliteManager.KEY_SATELLITE_ENABLED, mIsSatelliteEnabled); - result.send(SatelliteManager.SATELLITE_RESULT_SUCCESS, bundle); + result.send(SATELLITE_RESULT_SUCCESS, bundle); return; } } - sendRequestAsync(CMD_IS_SATELLITE_ENABLED, result, SatelliteServiceUtils.getPhone()); + sendRequestAsync(CMD_IS_SATELLITE_ENABLED, result, null); } /** @@ -1339,33 +1200,15 @@ public class SatelliteController extends Handler { * if the request is successful or an error code if the request failed. */ public void requestIsDemoModeEnabled(int subId, @NonNull ResultReceiver result) { - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); - return; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - return; - } - if (!satelliteSupported) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); - return; - } - - Boolean satelliteProvisioned = isSatelliteProvisioned(); - if (satelliteProvisioned == null) { - result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - return; - } - if (!satelliteProvisioned) { - result.send(SatelliteManager.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED, null); + int error = evaluateOemSatelliteRequestAllowed(true); + if (error != SATELLITE_RESULT_SUCCESS) { + result.send(error, null); return; } final Bundle bundle = new Bundle(); bundle.putBoolean(SatelliteManager.KEY_DEMO_MODE_ENABLED, mIsDemoModeEnabled); - result.send(SatelliteManager.SATELLITE_RESULT_SUCCESS, bundle); + result.send(SATELLITE_RESULT_SUCCESS, bundle); } /** @@ -1397,12 +1240,12 @@ public class SatelliteController extends Handler { /* We have already successfully queried the satellite modem. */ Bundle bundle = new Bundle(); bundle.putBoolean(SatelliteManager.KEY_SATELLITE_SUPPORTED, mIsSatelliteSupported); - result.send(SatelliteManager.SATELLITE_RESULT_SUCCESS, bundle); + result.send(SATELLITE_RESULT_SUCCESS, bundle); return; } } - sendRequestAsync(CMD_IS_SATELLITE_SUPPORTED, result, SatelliteServiceUtils.getPhone()); + sendRequestAsync(CMD_IS_SATELLITE_SUPPORTED, result, null); } /** @@ -1413,17 +1256,9 @@ public class SatelliteController extends Handler { * if the request is successful or an error code if the request failed. */ public void requestSatelliteCapabilities(int subId, @NonNull ResultReceiver result) { - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); - return; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - return; - } - if (!satelliteSupported) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); + int error = evaluateOemSatelliteRequestAllowed(false); + if (error != SATELLITE_RESULT_SUCCESS) { + result.send(error, null); return; } @@ -1432,12 +1267,12 @@ public class SatelliteController extends Handler { Bundle bundle = new Bundle(); bundle.putParcelable(SatelliteManager.KEY_SATELLITE_CAPABILITIES, mSatelliteCapabilities); - result.send(SatelliteManager.SATELLITE_RESULT_SUCCESS, bundle); + result.send(SATELLITE_RESULT_SUCCESS, bundle); return; } } - sendRequestAsync(CMD_GET_SATELLITE_CAPABILITIES, result, SatelliteServiceUtils.getPhone()); + sendRequestAsync(CMD_GET_SATELLITE_CAPABILITIES, result, null); } /** @@ -1453,35 +1288,16 @@ public class SatelliteController extends Handler { @NonNull IIntegerConsumer errorCallback, @NonNull ISatelliteTransmissionUpdateCallback callback) { Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(errorCallback::accept); - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); - return; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - if (!satelliteSupported) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); - return; - } - - Boolean satelliteProvisioned = isSatelliteProvisioned(); - if (satelliteProvisioned == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - if (!satelliteProvisioned) { - result.accept(SatelliteManager.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED); + int error = evaluateOemSatelliteRequestAllowed(true); + if (error != SATELLITE_RESULT_SUCCESS) { + result.accept(error); return; } - Phone phone = SatelliteServiceUtils.getPhone(); final int validSubId = SatelliteServiceUtils.getValidSatelliteSubId(subId, mContext); - mPointingAppController.registerForSatelliteTransmissionUpdates(validSubId, callback, phone); + mPointingAppController.registerForSatelliteTransmissionUpdates(validSubId, callback); sendRequestAsync(CMD_START_SATELLITE_TRANSMISSION_UPDATES, - new SatelliteTransmissionUpdateArgument(result, callback, validSubId), phone); + new SatelliteTransmissionUpdateArgument(result, callback, validSubId), null); } /** @@ -1496,39 +1312,20 @@ public class SatelliteController extends Handler { public void stopSatelliteTransmissionUpdates(int subId, @NonNull IIntegerConsumer errorCallback, @NonNull ISatelliteTransmissionUpdateCallback callback) { Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(errorCallback::accept); - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); - return; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - if (!satelliteSupported) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); + int error = evaluateOemSatelliteRequestAllowed(true); + if (error != SATELLITE_RESULT_SUCCESS) { + result.accept(error); return; } - Boolean satelliteProvisioned = isSatelliteProvisioned(); - if (satelliteProvisioned == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - if (!satelliteProvisioned) { - result.accept(SatelliteManager.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED); - return; - } - - Phone phone = SatelliteServiceUtils.getPhone(); final int validSubId = SatelliteServiceUtils.getValidSatelliteSubId(subId, mContext); mPointingAppController.unregisterForSatelliteTransmissionUpdates( - validSubId, result, callback, phone); + validSubId, result, callback); // Even if handler is null - which means there are no listeners, the modem command to stop // satellite transmission updates might have failed. The callers might want to retry // sending the command. Thus, we always need to send this command to the modem. - sendRequestAsync(CMD_STOP_SATELLITE_TRANSMISSION_UPDATES, result, phone); + sendRequestAsync(CMD_STOP_SATELLITE_TRANSMISSION_UPDATES, result, null); } /** @@ -1548,17 +1345,9 @@ public class SatelliteController extends Handler { @NonNull String token, @NonNull byte[] provisionData, @NonNull IIntegerConsumer callback) { Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept); - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); - return null; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return null; - } - if (!satelliteSupported) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); + int error = evaluateOemSatelliteRequestAllowed(false); + if (error != SATELLITE_RESULT_SUCCESS) { + result.accept(error); return null; } @@ -1570,20 +1359,19 @@ public class SatelliteController extends Handler { Boolean satelliteProvisioned = isSatelliteProvisioned(); if (satelliteProvisioned != null && satelliteProvisioned) { - result.accept(SatelliteManager.SATELLITE_RESULT_SUCCESS); + result.accept(SATELLITE_RESULT_SUCCESS); return null; } - Phone phone = SatelliteServiceUtils.getPhone(); sendRequestAsync(CMD_PROVISION_SATELLITE_SERVICE, new ProvisionSatelliteServiceArgument(token, provisionData, result, validSubId), - phone); + null); ICancellationSignal cancelTransport = CancellationSignal.createTransport(); CancellationSignal.fromTransport(cancelTransport).setOnCancelListener(() -> { sendRequestAsync(CMD_DEPROVISION_SATELLITE_SERVICE, new ProvisionSatelliteServiceArgument(token, provisionData, null, - validSubId), phone); + validSubId), null); mProvisionMetricsStats.setIsCanceled(true); }); return cancelTransport; @@ -1603,17 +1391,9 @@ public class SatelliteController extends Handler { public void deprovisionSatelliteService(int subId, @NonNull String token, @NonNull IIntegerConsumer callback) { Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept); - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); - return; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - if (!satelliteSupported) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); + int error = evaluateOemSatelliteRequestAllowed(false); + if (error != SATELLITE_RESULT_SUCCESS) { + result.accept(error); return; } @@ -1623,15 +1403,14 @@ public class SatelliteController extends Handler { return; } if (!satelliteProvisioned) { - result.accept(SatelliteManager.SATELLITE_RESULT_SUCCESS); + result.accept(SATELLITE_RESULT_SUCCESS); return; } - Phone phone = SatelliteServiceUtils.getPhone(); final int validSubId = SatelliteServiceUtils.getValidSatelliteSubId(subId, mContext); sendRequestAsync(CMD_DEPROVISION_SATELLITE_SERVICE, new ProvisionSatelliteServiceArgument(token, null, result, validSubId), - phone); + null); } /** @@ -1644,19 +1423,13 @@ public class SatelliteController extends Handler { */ @SatelliteManager.SatelliteResult public int registerForSatelliteProvisionStateChanged( int subId, @NonNull ISatelliteProvisionStateCallback callback) { - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - return SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; - } - if (!satelliteSupported) { - return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED; + int error = evaluateOemSatelliteRequestAllowed(false); + if (error != SATELLITE_RESULT_SUCCESS) { + return error; } mSatelliteProvisionStateChangedListeners.put(callback.asBinder(), callback); - return SatelliteManager.SATELLITE_RESULT_SUCCESS; + return SATELLITE_RESULT_SUCCESS; } /** @@ -1684,17 +1457,9 @@ public class SatelliteController extends Handler { * request failed. */ public void requestIsSatelliteProvisioned(int subId, @NonNull ResultReceiver result) { - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); - return; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - return; - } - if (!satelliteSupported) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); + int error = evaluateOemSatelliteRequestAllowed(false); + if (error != SATELLITE_RESULT_SUCCESS) { + result.send(error, null); return; } @@ -1703,12 +1468,12 @@ public class SatelliteController extends Handler { Bundle bundle = new Bundle(); bundle.putBoolean(SatelliteManager.KEY_SATELLITE_PROVISIONED, mIsSatelliteProvisioned); - result.send(SatelliteManager.SATELLITE_RESULT_SUCCESS, bundle); + result.send(SATELLITE_RESULT_SUCCESS, bundle); return; } } - sendRequestAsync(CMD_IS_SATELLITE_PROVISIONED, result, SatelliteServiceUtils.getPhone()); + sendRequestAsync(CMD_IS_SATELLITE_PROVISIONED, result, null); } /** @@ -1731,7 +1496,7 @@ public class SatelliteController extends Handler { + " is not initialized yet"); return SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; } - return SatelliteManager.SATELLITE_RESULT_SUCCESS; + return SATELLITE_RESULT_SUCCESS; } /** @@ -1768,6 +1533,9 @@ public class SatelliteController extends Handler { if (!mFeatureFlags.oemEnabledSatelliteFlag()) { return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED; } + if (!mSatelliteModemInterface.isSatelliteServiceSupported()) { + return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED; + } return mDatagramController.registerForSatelliteDatagram(subId, callback); } @@ -1784,6 +1552,9 @@ public class SatelliteController extends Handler { if (!mFeatureFlags.oemEnabledSatelliteFlag()) { return; } + if (!mSatelliteModemInterface.isSatelliteServiceSupported()) { + return; + } mDatagramController.unregisterForSatelliteDatagram(subId, callback); } @@ -1800,18 +1571,9 @@ public class SatelliteController extends Handler { */ public void pollPendingSatelliteDatagrams(int subId, @NonNull IIntegerConsumer callback) { Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept); - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); - return; - } - - Boolean satelliteProvisioned = isSatelliteProvisioned(); - if (satelliteProvisioned == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - if (!satelliteProvisioned) { - result.accept(SatelliteManager.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED); + int error = evaluateOemSatelliteRequestAllowed(true); + if (error != SATELLITE_RESULT_SUCCESS) { + result.accept(error); return; } @@ -1839,18 +1601,9 @@ public class SatelliteController extends Handler { SatelliteDatagram datagram, boolean needFullScreenPointingUI, @NonNull IIntegerConsumer callback) { Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept); - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED); - return; - } - - Boolean satelliteProvisioned = isSatelliteProvisioned(); - if (satelliteProvisioned == null) { - result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - return; - } - if (!satelliteProvisioned) { - result.accept(SatelliteManager.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED); + int error = evaluateOemSatelliteRequestAllowed(true); + if (error != SATELLITE_RESULT_SUCCESS) { + result.accept(error); return; } @@ -1877,22 +1630,13 @@ public class SatelliteController extends Handler { */ public void requestIsSatelliteCommunicationAllowedForCurrentLocation(int subId, @NonNull ResultReceiver result) { - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); - return; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - return; - } - if (!satelliteSupported) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); + int error = evaluateOemSatelliteRequestAllowed(false); + if (error != SATELLITE_RESULT_SUCCESS) { + result.send(error, null); return; } - sendRequestAsync( - CMD_IS_SATELLITE_COMMUNICATION_ALLOWED, result, SatelliteServiceUtils.getPhone()); + sendRequestAsync(CMD_IS_SATELLITE_COMMUNICATION_ALLOWED, result, null); } /** @@ -1903,32 +1647,13 @@ public class SatelliteController extends Handler { * be visible if the request is successful or an error code if the request failed. */ public void requestTimeForNextSatelliteVisibility(int subId, @NonNull ResultReceiver result) { - if (!mFeatureFlags.oemEnabledSatelliteFlag()) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); - return; - } - Boolean satelliteSupported = isSatelliteSupportedInternal(); - if (satelliteSupported == null) { - result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - return; - } - if (!satelliteSupported) { - result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null); - return; - } - - Boolean satelliteProvisioned = isSatelliteProvisioned(); - if (satelliteProvisioned == null) { - result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null); - return; - } - if (!satelliteProvisioned) { - result.send(SatelliteManager.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED, null); + int error = evaluateOemSatelliteRequestAllowed(true); + if (error != SATELLITE_RESULT_SUCCESS) { + result.send(error, null); return; } - Phone phone = SatelliteServiceUtils.getPhone(); - sendRequestAsync(CMD_GET_TIME_SATELLITE_NEXT_VISIBLE, result, phone); + sendRequestAsync(CMD_GET_TIME_SATELLITE_NEXT_VISIBLE, result, null); } /** @@ -1969,7 +1694,7 @@ public class SatelliteController extends Handler { subId, Collections.emptySet()).isEmpty()) { mSatelliteAttachRestrictionForCarrierArray.put(subId, new HashSet<>()); } else if (mSatelliteAttachRestrictionForCarrierArray.get(subId).contains(reason)) { - result.accept(SatelliteManager.SATELLITE_RESULT_SUCCESS); + result.accept(SATELLITE_RESULT_SUCCESS); return; } mSatelliteAttachRestrictionForCarrierArray.get(subId).add(reason); @@ -2005,7 +1730,7 @@ public class SatelliteController extends Handler { if (mSatelliteAttachRestrictionForCarrierArray.getOrDefault( subId, Collections.emptySet()).isEmpty() || !mSatelliteAttachRestrictionForCarrierArray.get(subId).contains(reason)) { - result.accept(SatelliteManager.SATELLITE_RESULT_SUCCESS); + result.accept(SATELLITE_RESULT_SUCCESS); return; } mSatelliteAttachRestrictionForCarrierArray.get(subId).remove(reason); @@ -2351,12 +2076,12 @@ public class SatelliteController extends Handler { "handleStartSatelliteTransmissionUpdatesDone"); arg.errorCallback.accept(errorCode); - if (errorCode != SatelliteManager.SATELLITE_RESULT_SUCCESS) { + if (errorCode != SATELLITE_RESULT_SUCCESS) { mPointingAppController.setStartedSatelliteTransmissionUpdates(false); // We need to remove the callback from our listener list since the caller might not call // stopSatelliteTransmissionUpdates to unregister the callback in case of failure. mPointingAppController.unregisterForSatelliteTransmissionUpdates(arg.subId, - arg.errorCallback, arg.callback, request.phone); + arg.errorCallback, arg.callback); } else { mPointingAppController.setStartedSatelliteTransmissionUpdates(true); } @@ -2433,10 +2158,7 @@ public class SatelliteController extends Handler { private void handleSatelliteEnabled(SatelliteControllerHandlerRequest request) { RequestSatelliteEnabledArgument argument = (RequestSatelliteEnabledArgument) request.argument; - Phone phone = request.phone; - - if (!argument.enableSatellite && (mSatelliteModemInterface.isSatelliteServiceSupported() - || phone != null)) { + if (!argument.enableSatellite && mSatelliteModemInterface.isSatelliteServiceSupported()) { synchronized (mIsSatelliteEnabledLock) { mWaitingForDisableSatelliteModemResponse = true; mWaitingForSatelliteModemOff = true; @@ -2444,18 +2166,8 @@ public class SatelliteController extends Handler { } Message onCompleted = obtainMessage(EVENT_SET_SATELLITE_ENABLED_DONE, request); - if (mSatelliteModemInterface.isSatelliteServiceSupported()) { - mSatelliteModemInterface.requestSatelliteEnabled(argument.enableSatellite, - argument.enableDemoMode, onCompleted); - return; - } - - if (phone != null) { - phone.setSatellitePower(onCompleted, argument.enableSatellite); - } else { - loge("requestSatelliteEnabled: No phone object"); - argument.callback.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - } + mSatelliteModemInterface.requestSatelliteEnabled(argument.enableSatellite, + argument.enableDemoMode, onCompleted); } private void handleRequestSatelliteAttachRestrictionForCarrierCmd( @@ -2528,15 +2240,6 @@ public class SatelliteController extends Handler { this, EVENT_SATELLITE_PROVISION_STATE_CHANGED, null); mRegisteredForProvisionStateChangedWithSatelliteService.set(true); } - } else { - Phone phone = SatelliteServiceUtils.getPhone(); - if (phone == null) { - loge("registerForSatelliteProvisionStateChanged: phone is null"); - } else if (!mRegisteredForProvisionStateChangedWithPhone.get()) { - phone.registerForSatelliteProvisionStateChanged( - this, EVENT_SATELLITE_PROVISION_STATE_CHANGED, null); - mRegisteredForProvisionStateChangedWithPhone.set(true); - } } } @@ -2547,15 +2250,6 @@ public class SatelliteController extends Handler { this, EVENT_PENDING_DATAGRAMS, null); mRegisteredForPendingDatagramCountWithSatelliteService.set(true); } - } else { - Phone phone = SatelliteServiceUtils.getPhone(); - if (phone == null) { - loge("registerForPendingDatagramCount: satellite phone is " - + "not initialized yet"); - } else if (!mRegisteredForPendingDatagramCountWithPhone.get()) { - phone.registerForPendingDatagramCount(this, EVENT_PENDING_DATAGRAMS, null); - mRegisteredForPendingDatagramCountWithPhone.set(true); - } } } @@ -2566,16 +2260,6 @@ public class SatelliteController extends Handler { this, EVENT_SATELLITE_MODEM_STATE_CHANGED, null); mRegisteredForSatelliteModemStateChangedWithSatelliteService.set(true); } - } else { - Phone phone = SatelliteServiceUtils.getPhone(); - if (phone == null) { - loge("registerForSatelliteModemStateChanged: satellite phone is " - + "not initialized yet"); - } else if (!mRegisteredForSatelliteModemStateChangedWithPhone.get()) { - phone.registerForSatelliteModemStateChanged( - this, EVENT_SATELLITE_MODEM_STATE_CHANGED, null); - mRegisteredForSatelliteModemStateChangedWithPhone.set(true); - } } } @@ -2610,7 +2294,7 @@ public class SatelliteController extends Handler { || ((mIsSatelliteEnabled == null || isSatelliteEnabled()) && !mWaitingForDisableSatelliteModemResponse)) { int error = (state == SatelliteManager.SATELLITE_MODEM_STATE_OFF) - ? SatelliteManager.SATELLITE_RESULT_SUCCESS + ? SATELLITE_RESULT_SUCCESS : SatelliteManager.SATELLITE_RESULT_INVALID_MODEM_STATE; Consumer<Integer> callback = null; synchronized (mSatelliteEnabledRequestLock) { @@ -2668,7 +2352,7 @@ public class SatelliteController extends Handler { synchronized (mIsSatelliteEnabledLock) { mIsSatelliteEnabled = mSatelliteEnabledRequest.enableSatellite; } - mSatelliteEnabledRequest.callback.accept(SatelliteManager.SATELLITE_RESULT_SUCCESS); + mSatelliteEnabledRequest.callback.accept(SATELLITE_RESULT_SUCCESS); updateSatelliteEnabledState( mSatelliteEnabledRequest.enableSatellite, "EVENT_SET_SATELLITE_ENABLED_DONE"); @@ -3010,7 +2694,7 @@ public class SatelliteController extends Handler { if (!isSatelliteSupportedForCarrier(subId)) { logd("Satellite for carrier is not supported. Only user setting is stored"); - callback.accept(SatelliteManager.SATELLITE_RESULT_SUCCESS); + callback.accept(SATELLITE_RESULT_SUCCESS); return; } @@ -3034,8 +2718,39 @@ public class SatelliteController extends Handler { callback.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); } } else { - callback.accept(SatelliteManager.SATELLITE_RESULT_SUCCESS); + callback.accept(SATELLITE_RESULT_SUCCESS); + } + } + + @SatelliteManager.SatelliteResult private int evaluateOemSatelliteRequestAllowed( + boolean isProvisionRequired) { + if (!mFeatureFlags.oemEnabledSatelliteFlag()) { + logd("oemEnabledSatelliteFlag is disabled"); + return SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED; + } + if (!mSatelliteModemInterface.isSatelliteServiceSupported()) { + return SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED; + } + + Boolean satelliteSupported = isSatelliteSupportedInternal(); + if (satelliteSupported == null) { + return SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; } + if (!satelliteSupported) { + return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED; + } + + if (isProvisionRequired) { + Boolean satelliteProvisioned = isSatelliteProvisioned(); + if (satelliteProvisioned == null) { + return SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE; + } + if (!satelliteProvisioned) { + return SatelliteManager.SATELLITE_RESULT_SERVICE_NOT_PROVISIONED; + } + } + + return SATELLITE_RESULT_SUCCESS; } private static void logd(@NonNull String log) { diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java b/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java index cad9bfbb9a..fc461fda62 100644 --- a/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java +++ b/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java @@ -39,10 +39,8 @@ import android.telephony.satellite.stub.NTRadioTechnology; import android.telephony.satellite.stub.SatelliteModemState; import android.telephony.satellite.stub.SatelliteResult; -import com.android.internal.telephony.CommandException; import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneFactory; -import com.android.internal.telephony.RILUtils; import com.android.internal.telephony.subscription.SubscriptionManagerService; import java.util.Arrays; @@ -241,11 +239,7 @@ public class SatelliteServiceUtils { errorCode = SatelliteManager.SATELLITE_RESULT_SUCCESS; } else { errorCode = SatelliteManager.SATELLITE_RESULT_ERROR; - if (ar.exception instanceof CommandException) { - CommandException.Error error = ((CommandException) ar.exception).getCommandError(); - errorCode = RILUtils.convertToSatelliteError(error); - loge(caller + " CommandException: " + ar.exception); - } else if (ar.exception instanceof SatelliteManager.SatelliteException) { + if (ar.exception instanceof SatelliteManager.SatelliteException) { errorCode = ((SatelliteManager.SatelliteException) ar.exception).getErrorCode(); loge(caller + " SatelliteException: " + ar.exception); } else { diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java index e80978d934..0b8d6580d1 100644 --- a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java +++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java @@ -130,7 +130,6 @@ public class DatagramDispatcherTest extends TelephonyTest { @Test public void testSendSatelliteDatagram_usingSatelliteModemInterface_success() throws Exception { - doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); doAnswer(invocation -> { Message message = (Message) invocation.getArguments()[3]; @@ -243,7 +242,6 @@ public class DatagramDispatcherTest extends TelephonyTest { @Test public void testSendSatelliteDatagram_usingSatelliteModemInterface_failure() throws Exception { - doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); doAnswer(invocation -> { Message message = (Message) invocation.getArguments()[3]; @@ -282,129 +280,17 @@ public class DatagramDispatcherTest extends TelephonyTest { } @Test - public void testSendSatelliteDatagram_usingCommandsInterface_phoneNull() throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {null}); - - mDatagramDispatcherUT.sendSatelliteDatagram(SUB_ID, DATAGRAM_TYPE1, mDatagram, - true, mResultListener::offer); - - processAllMessages(); - - mInOrder.verify(mMockDatagramController).needsWaitingForSatelliteConnected(); - mInOrder.verify(mMockDatagramController).isPollingInIdleState(); - mInOrder.verify(mMockDatagramController) - .updateSendStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_SENDING), eq(1), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - mInOrder.verify(mMockDatagramController) - .updateSendStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_SEND_FAILED), eq(0), - eq(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE)); - mInOrder.verify(mMockDatagramController) - .updateSendStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE), eq(0), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - verifyNoMoreInteractions(mMockDatagramController); - - assertThat(mResultListener.peek()) - .isEqualTo(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - } - - @Test - public void testSendSatelliteDatagram_usingCommandsInterface_success() throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {mPhone}); + public void testSendSatelliteDatagram_DemoMode_Align_Success() throws Exception { doAnswer(invocation -> { - Message message = (Message) invocation.getArguments()[0]; - - mDatagramDispatcherUT.obtainMessage(2 /*EVENT_SEND_SATELLITE_DATAGRAM_DONE*/, + Message message = (Message) invocation.getArguments()[3]; + mTestDemoModeDatagramDispatcher.obtainMessage(2 /*EVENT_SEND_SATELLITE_DATAGRAM_DONE*/, new AsyncResult(message.obj, null, null)) .sendToTarget(); return null; - }).when(mPhone).sendSatelliteDatagram(any(Message.class), any(SatelliteDatagram.class), - anyBoolean()); - - mDatagramDispatcherUT.sendSatelliteDatagram(SUB_ID, DATAGRAM_TYPE2, mDatagram, - true, mResultListener::offer); - - processAllMessages(); - - mInOrder.verify(mMockDatagramController).needsWaitingForSatelliteConnected(); - mInOrder.verify(mMockDatagramController).isPollingInIdleState(); - mInOrder.verify(mMockDatagramController) - .updateSendStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_SENDING), eq(1), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - mInOrder.verify(mMockDatagramController) - .updateSendStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_SEND_SUCCESS), eq(0), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - mInOrder.verify(mMockDatagramController) - .updateSendStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE), eq(0), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - verifyNoMoreInteractions(mMockDatagramController); - - assertThat(mResultListener.peek()).isEqualTo(SatelliteManager.SATELLITE_RESULT_SUCCESS); - } - - @Test - public void testSendSatelliteDatagram_usingCommandsInterface_failure() throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {mPhone}); - doAnswer(invocation -> { - Message message = (Message) invocation.getArguments()[0]; - - mDatagramDispatcherUT.obtainMessage(2 /*EVENT_SEND_SATELLITE_DATAGRAM_DONE*/, - new AsyncResult(message.obj, null, - new SatelliteManager.SatelliteException( - SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR))) - .sendToTarget(); - return null; - }).when(mPhone).sendSatelliteDatagram(any(Message.class), any(SatelliteDatagram.class), - anyBoolean()); - - mDatagramDispatcherUT.sendSatelliteDatagram(SUB_ID, DATAGRAM_TYPE1, mDatagram, - true, mResultListener::offer); - - processAllMessages(); - - mInOrder.verify(mMockDatagramController).needsWaitingForSatelliteConnected(); - mInOrder.verify(mMockDatagramController).isPollingInIdleState(); - mInOrder.verify(mMockDatagramController) - .updateSendStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_SENDING), eq(1), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - mInOrder.verify(mMockDatagramController) - .updateSendStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_SEND_FAILED), eq(0), - eq(SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR)); - mInOrder.verify(mMockDatagramController) - .updateSendStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE), eq(0), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - verifyNoMoreInteractions(mMockDatagramController); - - assertThat(mResultListener.peek()).isEqualTo( - SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR); - } - - @Test - public void testSendSatelliteDatagram_DemoMode_Align_Success() throws Exception { + }).when(mMockSatelliteModemInterface).sendSatelliteDatagram(any(SatelliteDatagram.class), + anyBoolean(), anyBoolean(), any(Message.class)); mTestDemoModeDatagramDispatcher.setDemoMode(true); mTestDemoModeDatagramDispatcher.setDeviceAlignedWithSatellite(true); - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {mPhone}); - doAnswer(invocation -> { - Message message = (Message) invocation.getArguments()[0]; - - mDatagramDispatcherUT.obtainMessage(2 /*EVENT_SEND_SATELLITE_DATAGRAM_DONE*/, - new AsyncResult(message.obj, null, null)) - .sendToTarget(); - return null; - }).when(mPhone).sendSatelliteDatagram(any(Message.class), any(SatelliteDatagram.class), - anyBoolean()); mTestDemoModeDatagramDispatcher.sendSatelliteDatagram(SUB_ID, DATAGRAM_TYPE1, mDatagram, true, mResultListener::offer); @@ -430,22 +316,19 @@ public class DatagramDispatcherTest extends TelephonyTest { @Test public void testSendSatelliteDatagram_DemoMode_Align_failed() throws Exception { - long previousTimer = mTestDemoModeDatagramDispatcher.getSatelliteAlignedTimeoutDuration(); - mTestDemoModeDatagramDispatcher.setDemoMode(true); - mTestDemoModeDatagramDispatcher.setDuration(TEST_EXPIRE_TIMER_SATELLITE_ALIGN); - mTestDemoModeDatagramDispatcher.setDeviceAlignedWithSatellite(false); - - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {mPhone}); doAnswer(invocation -> { - Message message = (Message) invocation.getArguments()[0]; - + Message message = (Message) invocation.getArguments()[3]; mTestDemoModeDatagramDispatcher.obtainMessage(2 /*EVENT_SEND_SATELLITE_DATAGRAM_DONE*/, new AsyncResult(message.obj, null, null)) .sendToTarget(); return null; - }).when(mPhone).sendSatelliteDatagram(any(Message.class), any(SatelliteDatagram.class), - anyBoolean()); + }).when(mMockSatelliteModemInterface).sendSatelliteDatagram(any(SatelliteDatagram.class), + anyBoolean(), anyBoolean(), any(Message.class)); + + long previousTimer = mTestDemoModeDatagramDispatcher.getSatelliteAlignedTimeoutDuration(); + mTestDemoModeDatagramDispatcher.setDemoMode(true); + mTestDemoModeDatagramDispatcher.setDuration(TEST_EXPIRE_TIMER_SATELLITE_ALIGN); + mTestDemoModeDatagramDispatcher.setDeviceAlignedWithSatellite(false); mTestDemoModeDatagramDispatcher.sendSatelliteDatagram(SUB_ID, DATAGRAM_TYPE1, mDatagram, true, mResultListener::offer); @@ -472,18 +355,16 @@ public class DatagramDispatcherTest extends TelephonyTest { @Test public void testSendSatelliteDatagram_DemoMode_data_type_location_sharing() throws Exception { - mTestDemoModeDatagramDispatcher.setDemoMode(true); - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {mPhone}); doAnswer(invocation -> { - Message message = (Message) invocation.getArguments()[0]; - + Message message = (Message) invocation.getArguments()[3]; mDatagramDispatcherUT.obtainMessage(2 /*EVENT_SEND_SATELLITE_DATAGRAM_DONE*/, new AsyncResult(message.obj, null, null)) .sendToTarget(); return null; - }).when(mPhone).sendSatelliteDatagram(any(Message.class), any(SatelliteDatagram.class), - anyBoolean()); + }).when(mMockSatelliteModemInterface).sendSatelliteDatagram(any(SatelliteDatagram.class), + anyBoolean(), anyBoolean(), any(Message.class)); + mTestDemoModeDatagramDispatcher.setDemoMode(true); + replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {mPhone}); mTestDemoModeDatagramDispatcher.sendSatelliteDatagram(SUB_ID, DATAGRAM_TYPE2, mDatagram, true, mResultListener::offer); diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramReceiverTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramReceiverTest.java index 9fe85ef40c..3578707d88 100644 --- a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramReceiverTest.java +++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramReceiverTest.java @@ -54,8 +54,6 @@ import android.testing.TestableLooper; import android.util.Pair; import com.android.internal.telephony.IVoidConsumer; -import com.android.internal.telephony.Phone; -import com.android.internal.telephony.PhoneFactory; import com.android.internal.telephony.TelephonyTest; import com.android.internal.telephony.satellite.metrics.ControllerMetricsStats; @@ -255,92 +253,6 @@ public class DatagramReceiverTest extends TelephonyTest { } @Test - public void testPollPendingSatelliteDatagrams_usingCommandsInterface_phoneNull() - throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {null}); - - mDatagramReceiverUT.pollPendingSatelliteDatagrams(SUB_ID, mResultListener::offer); - - processAllMessages(); - - mInOrder.verify(mMockDatagramController) - .updateReceiveStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVING), eq(0), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - mInOrder.verify(mMockDatagramController) - .updateReceiveStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVE_FAILED), - eq(0), eq(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE)); - mInOrder.verify(mMockDatagramController) - .updateReceiveStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE), - eq(0), eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - - assertThat(mResultListener.peek()) - .isEqualTo(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - } - - @Test - public void testPollPendingSatelliteDatagrams_usingCommandsInterface_success() - throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {mPhone}); - doAnswer(invocation -> { - Message message = (Message) invocation.getArguments()[0]; - - mDatagramReceiverUT.obtainMessage(2 /*EVENT_POLL_PENDING_SATELLITE_DATAGRAMS_DONE*/, - new AsyncResult(message.obj, null, null)) - .sendToTarget(); - return null; - }).when(mPhone).pollPendingSatelliteDatagrams(any(Message.class)); - - mDatagramReceiverUT.pollPendingSatelliteDatagrams(SUB_ID, mResultListener::offer); - - processAllMessages(); - - mInOrder.verify(mMockDatagramController) - .updateReceiveStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVING), eq(0), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - - assertThat(mResultListener.peek()).isEqualTo(SatelliteManager.SATELLITE_RESULT_SUCCESS); - } - - @Test - public void testPollPendingSatelliteDatagrams_usingCommandsInterface_failure() - throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - replaceInstance(PhoneFactory.class, "sPhones", null, new Phone[] {mPhone}); - doAnswer(invocation -> { - Message message = (Message) invocation.getArguments()[0]; - - mDatagramReceiverUT.obtainMessage(2 /*EVENT_POLL_PENDING_SATELLITE_DATAGRAMS_DONE*/, - new AsyncResult(message.obj, null, - new SatelliteManager.SatelliteException( - SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR))) - .sendToTarget(); - return null; - }).when(mPhone).pollPendingSatelliteDatagrams(any(Message.class)); - - mDatagramReceiverUT.pollPendingSatelliteDatagrams(SUB_ID, mResultListener::offer); - - processAllMessages(); - - mInOrder.verify(mMockDatagramController) - .updateReceiveStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVING), eq(0), - eq(SatelliteManager.SATELLITE_RESULT_SUCCESS)); - mInOrder.verify(mMockDatagramController) - .updateReceiveStatus(eq(SUB_ID), - eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVE_FAILED), - eq(0), eq(SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR)); - - assertThat(mResultListener.peek()).isEqualTo( - SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR); - } - - @Test public void testSatelliteDatagramReceived_receiveNone() { mSatelliteDatagramListenerHandler.obtainMessage(1 /*EVENT_SATELLITE_DATAGRAM_RECEIVED*/, new AsyncResult(null, new Pair<>(null, 0), null)) diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/PointingAppControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/PointingAppControllerTest.java index 96dcd85046..3917a32d52 100644 --- a/tests/telephonytests/src/com/android/internal/telephony/satellite/PointingAppControllerTest.java +++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/PointingAppControllerTest.java @@ -251,13 +251,6 @@ public class PointingAppControllerTest extends TelephonyTest { AsyncResult.forMessage(message, null, exception); message.sendToTarget(); return null; - }).when(mPhone).startSatellitePositionUpdates(any(Message.class)); - - doAnswer(invocation -> { - Message message = (Message) invocation.getArguments()[0]; - AsyncResult.forMessage(message, null, exception); - message.sendToTarget(); - return null; }).when(mMockSatelliteModemInterface).startSendingSatellitePointingInfo(any(Message.class)); } @@ -270,54 +263,21 @@ public class PointingAppControllerTest extends TelephonyTest { AsyncResult.forMessage(message, null, exception); message.sendToTarget(); return null; - }).when(mPhone).stopSatellitePositionUpdates(any(Message.class)); - - doAnswer(invocation -> { - Message message = (Message) invocation.getArguments()[0]; - AsyncResult.forMessage(message, null, exception); - message.sendToTarget(); - return null; }).when(mMockSatelliteModemInterface).stopSendingSatellitePointingInfo(any(Message.class)); } @Test - public void testStartSatelliteTransmissionUpdates_CommandInterface() - throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - Message testMessage = mTestSatelliteControllerHandler - .obtainMessage(EVENT_START_SATELLITE_TRANSMISSION_UPDATES_DONE, null); - setUpResponseForStartTransmissionUpdates(SatelliteManager.SATELLITE_RESULT_SUCCESS); - mPointingAppController.startSatelliteTransmissionUpdates(testMessage, mPhone); - - processAllMessages(); - - verify(mMockSatelliteModemInterface, never()) - .startSendingSatellitePointingInfo(eq(testMessage)); - - verify(mPhone) - .startSatellitePositionUpdates(eq(testMessage)); - - assertEquals(SatelliteManager.SATELLITE_RESULT_SUCCESS, mResultCode); - - assertTrue(mPointingAppController.getStartedSatelliteTransmissionUpdates()); - } - - @Test public void testStartSatelliteTransmissionUpdates_success() throws Exception { - doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); mPointingAppController.setStartedSatelliteTransmissionUpdates(false); Message testMessage = mTestSatelliteControllerHandler .obtainMessage(EVENT_START_SATELLITE_TRANSMISSION_UPDATES_DONE, null); setUpResponseForStartTransmissionUpdates(SatelliteManager.SATELLITE_RESULT_SUCCESS); - mPointingAppController.startSatelliteTransmissionUpdates(testMessage, mPhone); + mPointingAppController.startSatelliteTransmissionUpdates(testMessage); verify(mMockSatelliteModemInterface) .startSendingSatellitePointingInfo(eq(testMessage)); - verify(mPhone, never()) - .startSatellitePositionUpdates(eq(testMessage)); - processAllMessages(); @@ -326,90 +286,24 @@ public class PointingAppControllerTest extends TelephonyTest { } @Test - public void testStartSatelliteTransmissionUpdates_phoneNull() - throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - mPointingAppController.setStartedSatelliteTransmissionUpdates(false); - Message testMessage = mTestSatelliteControllerHandler - .obtainMessage(EVENT_START_SATELLITE_TRANSMISSION_UPDATES_DONE, null); - - mPointingAppController.startSatelliteTransmissionUpdates(testMessage, null); - processAllMessages(); - verify(mMockSatelliteModemInterface, never()) - .startSendingSatellitePointingInfo(eq(testMessage)); - - verify(mPhone, never()) - .startSatellitePositionUpdates(eq(testMessage)); - - assertFalse(mPointingAppController.getStartedSatelliteTransmissionUpdates()); - - assertEquals(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, mResultCode); - } - - @Test - public void testStopSatelliteTransmissionUpdates_CommandInterface() - throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - setUpResponseForStopTransmissionUpdates(SatelliteManager.SATELLITE_RESULT_SUCCESS); - Message testMessage = mTestSatelliteControllerHandler - .obtainMessage(EVENT_STOP_SATELLITE_TRANSMISSION_UPDATES_DONE, null); - mPointingAppController.stopSatelliteTransmissionUpdates(testMessage, mPhone); - - processAllMessages(); - - verify(mMockSatelliteModemInterface, never()) - .stopSendingSatellitePointingInfo(eq(testMessage)); - - verify(mPhone) - .stopSatellitePositionUpdates(eq(testMessage)); - - assertFalse(mPointingAppController.getStartedSatelliteTransmissionUpdates()); - - assertEquals(SatelliteManager.SATELLITE_RESULT_SUCCESS, mResultCode); - } - - @Test public void testStopSatelliteTransmissionUpdates_success() throws Exception { doReturn(true).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); setUpResponseForStopTransmissionUpdates(SatelliteManager.SATELLITE_RESULT_SUCCESS); Message testMessage = mTestSatelliteControllerHandler .obtainMessage(EVENT_STOP_SATELLITE_TRANSMISSION_UPDATES_DONE, null); - mPointingAppController.stopSatelliteTransmissionUpdates(testMessage, mPhone); + mPointingAppController.stopSatelliteTransmissionUpdates(testMessage); processAllMessages(); verify(mMockSatelliteModemInterface) .stopSendingSatellitePointingInfo(eq(testMessage)); - verify(mPhone, never()) - .stopSatellitePositionUpdates(eq(testMessage)); - assertFalse(mPointingAppController.getStartedSatelliteTransmissionUpdates()); assertEquals(SatelliteManager.SATELLITE_RESULT_SUCCESS, mResultCode); } @Test - public void testStopSatellitePointingInfo_phoneNull() - throws Exception { - doReturn(false).when(mMockSatelliteModemInterface).isSatelliteServiceSupported(); - Message testMessage = mTestSatelliteControllerHandler - .obtainMessage(EVENT_STOP_SATELLITE_TRANSMISSION_UPDATES_DONE, null); - mPointingAppController.stopSatelliteTransmissionUpdates(testMessage, null); - - processAllMessages(); - - verify(mMockSatelliteModemInterface, never()) - .stopSendingSatellitePointingInfo(eq(testMessage)); - - verify(mPhone, never()) - .stopSatellitePositionUpdates(eq(testMessage)); - - assertEquals(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, mResultCode); - - } - - @Test public void testStartPointingUI() throws Exception { ArgumentCaptor<Intent> startedIntentCaptor = ArgumentCaptor.forClass(Intent.class); mPointingAppController.startPointingUI(true); @@ -451,7 +345,7 @@ public class PointingAppControllerTest extends TelephonyTest { @Test public void testUpdateSendDatagramTransferState() throws Exception { mPointingAppController.registerForSatelliteTransmissionUpdates(SUB_ID, - mSatelliteTransmissionUpdateCallback, mPhone); + mSatelliteTransmissionUpdateCallback); mPointingAppController.updateSendDatagramTransferState(SUB_ID, SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_SEND_SUCCESS, 1, SatelliteManager.SATELLITE_RESULT_SUCCESS); @@ -463,14 +357,14 @@ public class PointingAppControllerTest extends TelephonyTest { mSatelliteTransmissionUpdateCallback.getErrorCode()); assertTrue(mSatelliteTransmissionUpdateCallback.inSendDatagramStateCallback); mPointingAppController.unregisterForSatelliteTransmissionUpdates(SUB_ID, - mResultListener::offer, mSatelliteTransmissionUpdateCallback, mPhone); + mResultListener::offer, mSatelliteTransmissionUpdateCallback); mResultListener.clear(); } @Test public void testUpdateReceiveDatagramTransferState() throws Exception { mPointingAppController.registerForSatelliteTransmissionUpdates(SUB_ID, - mSatelliteTransmissionUpdateCallback, mPhone); + mSatelliteTransmissionUpdateCallback); mPointingAppController.updateReceiveDatagramTransferState(SUB_ID, SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_RECEIVE_SUCCESS, 2, SatelliteManager.SATELLITE_RESULT_SUCCESS); @@ -482,59 +376,8 @@ public class PointingAppControllerTest extends TelephonyTest { mSatelliteTransmissionUpdateCallback.getErrorCode()); assertTrue(mSatelliteTransmissionUpdateCallback.inReceiveDatagramStateCallback); mPointingAppController.unregisterForSatelliteTransmissionUpdates(SUB_ID, - mResultListener::offer, mSatelliteTransmissionUpdateCallback, mPhone); - mResultListener.clear(); - } - - @Test - public void testRegisterForSatelliteTransmissionUpdates_CommandInterface() throws Exception { + mResultListener::offer, mSatelliteTransmissionUpdateCallback); mResultListener.clear(); - mInOrder = inOrder(mPhone); - TestSatelliteTransmissionUpdateCallback callback1 = new - TestSatelliteTransmissionUpdateCallback(); - TestSatelliteTransmissionUpdateCallback callback2 = new - TestSatelliteTransmissionUpdateCallback(); - int subId1 = 1; - int subId2 = 2; - mPointingAppController.registerForSatelliteTransmissionUpdates(subId1, - callback1, mPhone); - mInOrder.verify(mPhone).registerForSatellitePositionInfoChanged(any(), - eq(1), eq(null)); - mPointingAppController.registerForSatelliteTransmissionUpdates(subId1, - callback2, mPhone); - mInOrder.verify(mPhone, never()).registerForSatellitePositionInfoChanged(any(), - eq(1), eq(null)); - mPointingAppController.registerForSatelliteTransmissionUpdates(subId2, - callback1, mPhone); - mInOrder.verify(mPhone).registerForSatellitePositionInfoChanged(any(), - eq(1), eq(null)); - mPointingAppController.registerForSatelliteTransmissionUpdates(subId2, - callback2, mPhone); - mInOrder.verify(mPhone, never()).registerForSatellitePositionInfoChanged(any(), - eq(1), eq(null)); - mPointingAppController.unregisterForSatelliteTransmissionUpdates(subId1, - mResultListener::offer, callback1, mPhone); - processAllMessages(); - //since there are 2 callbacks registered for this sub_id, Handler is not unregistered - assertThat(mResultListener.peek()).isEqualTo(SatelliteManager.SATELLITE_RESULT_SUCCESS); - mResultListener.remove(); - mPointingAppController.unregisterForSatelliteTransmissionUpdates(subId1, - mResultListener::offer, callback2, mPhone); - mInOrder.verify(mPhone).unregisterForSatellitePositionInfoChanged(any(Handler.class)); - mPointingAppController.unregisterForSatelliteTransmissionUpdates(subId2, - mResultListener::offer, callback1, mPhone); - processAllMessages(); - assertThat(mResultListener.peek()).isEqualTo(SatelliteManager.SATELLITE_RESULT_SUCCESS); - mResultListener.remove(); - mInOrder.verify(mPhone, never()).unregisterForSatellitePositionInfoChanged( - any(Handler.class)); - mPointingAppController.unregisterForSatelliteTransmissionUpdates(subId2, - mResultListener::offer, callback2, null); - processAllMessages(); - assertThat(mResultListener.peek()) - .isEqualTo(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE); - mResultListener.remove(); - mInOrder = null; } @Test @@ -548,44 +391,40 @@ public class PointingAppControllerTest extends TelephonyTest { TestSatelliteTransmissionUpdateCallback(); int subId1 = 3; int subId2 = 4; - mPointingAppController.registerForSatelliteTransmissionUpdates(subId1, - callback1, mPhone); + mPointingAppController.registerForSatelliteTransmissionUpdates(subId1, callback1); mInOrder.verify(mMockSatelliteModemInterface).registerForSatellitePositionInfoChanged(any(), eq(1), eq(null)); mInOrder.verify(mMockSatelliteModemInterface).registerForDatagramTransferStateChanged(any(), eq(4), eq(null)); - mPointingAppController.registerForSatelliteTransmissionUpdates(subId1, - callback2, mPhone); + mPointingAppController.registerForSatelliteTransmissionUpdates(subId1, callback2); mInOrder.verify(mMockSatelliteModemInterface, never()) .registerForSatellitePositionInfoChanged(any(), eq(1), eq(null)); mInOrder.verify(mMockSatelliteModemInterface, never()) .registerForDatagramTransferStateChanged(any(), eq(4), eq(null)); - mPointingAppController.registerForSatelliteTransmissionUpdates(subId2, - callback1, mPhone); + mPointingAppController.registerForSatelliteTransmissionUpdates(subId2, callback1); mInOrder.verify(mMockSatelliteModemInterface).registerForSatellitePositionInfoChanged(any(), eq(1), eq(null)); mInOrder.verify(mMockSatelliteModemInterface).registerForDatagramTransferStateChanged(any(), eq(4), eq(null)); - mPointingAppController.registerForSatelliteTransmissionUpdates(subId2, - callback2, mPhone); + mPointingAppController.registerForSatelliteTransmissionUpdates(subId2, callback2); mInOrder.verify(mMockSatelliteModemInterface, never()) .registerForSatellitePositionInfoChanged(any(), eq(1), eq(null)); mInOrder.verify(mMockSatelliteModemInterface, never()) .registerForDatagramTransferStateChanged(any(), eq(4), eq(null)); mPointingAppController.unregisterForSatelliteTransmissionUpdates(subId1, - mResultListener::offer, callback1, mPhone); + mResultListener::offer, callback1); processAllMessages(); //since there are 2 callbacks registered for this sub_id, Handler is not unregistered assertThat(mResultListener.peek()).isEqualTo(SatelliteManager.SATELLITE_RESULT_SUCCESS); mResultListener.remove(); mPointingAppController.unregisterForSatelliteTransmissionUpdates(subId1, - mResultListener::offer, callback2, mPhone); + mResultListener::offer, callback2); mInOrder.verify(mMockSatelliteModemInterface).unregisterForSatellitePositionInfoChanged( any(Handler.class)); mInOrder.verify(mMockSatelliteModemInterface).unregisterForDatagramTransferStateChanged( any(Handler.class)); mPointingAppController.unregisterForSatelliteTransmissionUpdates(subId2, - mResultListener::offer, callback1, mPhone); + mResultListener::offer, callback1); processAllMessages(); assertThat(mResultListener.peek()).isEqualTo(SatelliteManager.SATELLITE_RESULT_SUCCESS); mResultListener.remove(); @@ -594,7 +433,7 @@ public class PointingAppControllerTest extends TelephonyTest { mInOrder.verify(mMockSatelliteModemInterface, never()) .unregisterForDatagramTransferStateChanged(any(Handler.class)); mPointingAppController.unregisterForSatelliteTransmissionUpdates(subId2, - mResultListener::offer, callback2, null); + mResultListener::offer, callback2); processAllMessages(); mInOrder.verify(mMockSatelliteModemInterface).unregisterForSatellitePositionInfoChanged( any(Handler.class)); diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java index 3fc935e57c..a84ca3254f 100644 --- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java +++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java @@ -102,7 +102,6 @@ import android.util.Pair; import com.android.internal.R; import com.android.internal.telephony.IIntegerConsumer; import com.android.internal.telephony.IVoidConsumer; -import com.android.internal.telephony.Phone; import com.android.internal.telephony.TelephonyTest; import com.android.internal.telephony.flags.FeatureFlags; import com.android.internal.telephony.satellite.metrics.ControllerMetricsStats; @@ -961,12 +960,11 @@ public class SatelliteControllerTest extends TelephonyTest { mSatelliteControllerUT.startSatelliteTransmissionUpdates(SUB_ID, mIIntegerConsumer, mStartTransmissionUpdateCallback); verify(mMockPointingAppController).registerForSatelliteTransmissionUpdates(anyInt(), - eq(mStartTransmissionUpdateCallback), any()); + eq(mStartTransmissionUpdateCallback)); processAllMessages(); assertTrue(waitForIIntegerConsumerResult(1)); assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0)); - verify(mMockPointingAppController).startSatelliteTransmissionUpdates(any(Message.class), - any(Phone.class)); + verify(mMockPointingAppController).startSatelliteTransmissionUpdates(any(Message.class)); verify(mMockPointingAppController).setStartedSatelliteTransmissionUpdates(eq(true)); resetSatelliteControllerUT(); @@ -983,7 +981,7 @@ public class SatelliteControllerTest extends TelephonyTest { assertEquals(SATELLITE_RESULT_INVALID_TELEPHONY_STATE, (long) mIIntegerConsumerResults.get(0)); verify(mMockPointingAppController).unregisterForSatelliteTransmissionUpdates(anyInt(), - any(), eq(mStartTransmissionUpdateCallback), any(Phone.class)); + any(), eq(mStartTransmissionUpdateCallback)); verify(mMockPointingAppController).setStartedSatelliteTransmissionUpdates(eq(false)); } @@ -1042,12 +1040,11 @@ public class SatelliteControllerTest extends TelephonyTest { mSatelliteControllerUT.stopSatelliteTransmissionUpdates(SUB_ID, mIIntegerConsumer, mStopTransmissionUpdateCallback); verify(mMockPointingAppController).unregisterForSatelliteTransmissionUpdates(anyInt(), - any(), eq(mStopTransmissionUpdateCallback), any(Phone.class)); + any(), eq(mStopTransmissionUpdateCallback)); processAllMessages(); assertTrue(waitForIIntegerConsumerResult(1)); assertEquals(SATELLITE_RESULT_SUCCESS, (long) mIIntegerConsumerResults.get(0)); - verify(mMockPointingAppController).stopSatelliteTransmissionUpdates(any(Message.class), - any(Phone.class)); + verify(mMockPointingAppController).stopSatelliteTransmissionUpdates(any(Message.class)); resetSatelliteControllerUT(); mIIntegerConsumerResults.clear(); @@ -2269,8 +2266,7 @@ public class SatelliteControllerTest extends TelephonyTest { AsyncResult.forMessage(message, null, exception); message.sendToTarget(); return null; - }).when(mMockPointingAppController).startSatelliteTransmissionUpdates(any(Message.class), - any()); + }).when(mMockPointingAppController).startSatelliteTransmissionUpdates(any(Message.class)); } private void setUpResponseForStopSatelliteTransmissionUpdates( @@ -2282,8 +2278,7 @@ public class SatelliteControllerTest extends TelephonyTest { AsyncResult.forMessage(message, null, exception); message.sendToTarget(); return null; - }).when(mMockPointingAppController).stopSatelliteTransmissionUpdates(any(Message.class), - any()); + }).when(mMockPointingAppController).stopSatelliteTransmissionUpdates(any(Message.class)); } private boolean waitForRequestIsSatelliteSupportedResult(int expectedNumberOfEvents) { |