Loading src/java/com/android/internal/telephony/Phone.java +16 −13 Original line number Diff line number Diff line Loading @@ -5319,8 +5319,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * @param what User-defined message code. * @param obj User object. */ public void registerForSatellitePointingInfoChanged(@NonNull Handler h, 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); } Loading @@ -5329,7 +5330,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * * @param h Handler to be removed from the registrant list. */ public void unregisterForSatellitePointingInfoChanged(@NonNull Handler h) { public void unregisterForSatellitePositionInfoChanged(@NonNull Handler h) { //TODO: Rename CommandsInterface and other modules when updating HAL APIs. mCi.unregisterForSatellitePointingInfoChanged(h); } Loading @@ -5342,7 +5344,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { */ public void registerForSatelliteDatagramsDelivered(@NonNull Handler h, int what, @Nullable Object obj) { //TODO: Rename CommandsInterface and other modules when updating HAL APIs. //TODO: Remove. mCi.registerForSatelliteMessagesTransferComplete(h, what, obj); } Loading @@ -5352,7 +5354,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * @param h Handler to be removed from the registrant list. */ public void unregisterForSatelliteDatagramsDelivered(@NonNull Handler h) { //TODO: Rename CommandsInterface and other modules when updating HAL APIs. //TODO: Remove. mCi.unregisterForSatelliteMessagesTransferComplete(h); } Loading Loading @@ -5413,23 +5415,23 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { } /** * Registers for satellite state change from satellite modem. * 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 registerForSatelliteModemStateChange(@NonNull Handler h, int what, public void registerForSatelliteModemStateChanged(@NonNull Handler h, int what, @Nullable Object obj) { mCi.registerForSatelliteModeChanged(h, what, obj); } /** * Unregisters for satellite state changes from satellite modem. * Unregisters for satellite state changed from satellite modem. * * @param h Handler to be removed from registrant list. */ public void unregisterForSatelliteModemStateChange(@NonNull Handler h) { public void unregisterForSatelliteModemStateChanged(@NonNull Handler h) { mCi.unregisterForSatelliteModeChanged(h); } Loading Loading @@ -5461,19 +5463,20 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * @param what User-defined message code. * @param obj User object. */ public void registerForNewSatelliteDatagram(@NonNull Handler h, int what, public void registerForSatelliteDatagramsReceived(@NonNull Handler h, int what, @Nullable Object obj) { //mCi.registerForNewSatelliteDatagram(h, what, 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 unregisterForNewSatelliteDatagram(@NonNull Handler h) { //mCi.unregisterForNewSatelliteDatagram(h); public void unregisterForSatelliteDatagramsReceived(@NonNull Handler h) { // TODO: rename mCi.unregisterForNewSatelliteMessages(h); } /** Loading src/java/com/android/internal/telephony/SatelliteIndication.java +8 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_RA 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. Loading Loading @@ -78,8 +80,13 @@ public class SatelliteIndication extends IRadioSatelliteIndication.Stub { if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_NEW_SATELLITE_MESSAGES); if (mRil.mNewSatelliteMessagesRegistrants != null) { SatelliteDatagram[] datagrams = new SatelliteDatagram[messages.length]; for (int i = 0; i < messages.length; i++) { datagrams[i] = new SatelliteDatagram(messages[i].getBytes()); } // TODO: support pendingCount properly mRil.mNewSatelliteMessagesRegistrants.notifyRegistrants( new AsyncResult(null, messages, null)); new AsyncResult(null, new Pair<>(datagrams, messages.length), null)); } } Loading src/java/com/android/internal/telephony/satellite/SatelliteServiceController.java +313 −137 File changed.Preview size limit exceeded, changes collapsed. Show changes src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java 0 → 100644 +210 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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.satellite; import android.annotation.NonNull; import android.annotation.Nullable; import android.telephony.Rlog; import android.telephony.satellite.PointingInfo; import android.telephony.satellite.SatelliteCapabilities; import android.telephony.satellite.SatelliteDatagram; import android.telephony.satellite.SatelliteManager; import android.telephony.satellite.stub.NTRadioTechnology; import android.telephony.satellite.stub.SatelliteError; import android.telephony.satellite.stub.SatelliteModemState; import java.util.Arrays; import java.util.stream.Collectors; /** * Utils class for satellite service <-> framework conversions */ public class SatelliteServiceUtils { private static final String TAG = "SatelliteServiceUtils"; /** * Convert radio technology from service definition to framework definition. * @param radioTechnology The NTRadioTechnology from the satellite service. * @return The converted NTRadioTechnology for the framework. */ @SatelliteManager.NTRadioTechnology public static int fromSatelliteRadioTechnology(int radioTechnology) { switch (radioTechnology) { case NTRadioTechnology.NB_IOT_NTN: return SatelliteManager.NT_RADIO_TECHNOLOGY_NB_IOT_NTN; case NTRadioTechnology.NR_NTN: return SatelliteManager.NT_RADIO_TECHNOLOGY_NR_NTN; case NTRadioTechnology.EMTC_NTN: return SatelliteManager.NT_RADIO_TECHNOLOGY_EMTC_NTN; case NTRadioTechnology.PROPRIETARY: return SatelliteManager.NT_RADIO_TECHNOLOGY_PROPRIETARY; default: loge("Received invalid radio technology: " + radioTechnology); return SatelliteManager.NT_RADIO_TECHNOLOGY_UNKNOWN; } } /** * Convert satellite error from service definition to framework definition. * @param error The SatelliteError from the satellite service. * @return The converted SatelliteError for the framework. */ @SatelliteManager.SatelliteError public static int fromSatelliteError(int error) { switch (error) { case SatelliteError.ERROR_NONE: return SatelliteManager.SATELLITE_ERROR_NONE; case SatelliteError.SATELLITE_ERROR: return SatelliteManager.SATELLITE_ERROR; case SatelliteError.SERVER_ERROR: return SatelliteManager.SATELLITE_SERVER_ERROR; case SatelliteError.SERVICE_ERROR: return SatelliteManager.SATELLITE_SERVICE_ERROR; case SatelliteError.MODEM_ERROR: return SatelliteManager.SATELLITE_MODEM_ERROR; case SatelliteError.NETWORK_ERROR: return SatelliteManager.SATELLITE_NETWORK_ERROR; case SatelliteError.INVALID_TELEPHONY_STATE: return SatelliteManager.SATELLITE_INVALID_TELEPHONY_STATE; case SatelliteError.INVALID_MODEM_STATE: return SatelliteManager.SATELLITE_INVALID_MODEM_STATE; case SatelliteError.INVALID_ARGUMENTS: return SatelliteManager.SATELLITE_INVALID_ARGUMENTS; case SatelliteError.REQUEST_FAILED: return SatelliteManager.SATELLITE_REQUEST_FAILED; case SatelliteError.RADIO_NOT_AVAILABLE: return SatelliteManager.SATELLITE_RADIO_NOT_AVAILABLE; case SatelliteError.REQUEST_NOT_SUPPORTED: return SatelliteManager.SATELLITE_REQUEST_NOT_SUPPORTED; case SatelliteError.NO_RESOURCES: return SatelliteManager.SATELLITE_NO_RESOURCES; case SatelliteError.SERVICE_NOT_PROVISIONED: return SatelliteManager.SATELLITE_SERVICE_NOT_PROVISIONED; case SatelliteError.SERVICE_PROVISION_IN_PROGRESS: return SatelliteManager.SATELLITE_SERVICE_PROVISION_IN_PROGRESS; case SatelliteError.REQUEST_ABORTED: return SatelliteManager.SATELLITE_REQUEST_ABORTED; case SatelliteError.SATELLITE_ACCESS_BARRED: return SatelliteManager.SATELLITE_ACCESS_BARRED; case SatelliteError.NETWORK_TIMEOUT: return SatelliteManager.SATELLITE_NETWORK_TIMEOUT; case SatelliteError.SATELLITE_NOT_REACHABLE: return SatelliteManager.SATELLITE_NOT_REACHABLE; case SatelliteError.NOT_AUTHORIZED: return SatelliteManager.SATELLITE_NOT_AUTHORIZED; } loge("Received invalid satellite service error: " + error); return SatelliteManager.SATELLITE_SERVICE_ERROR; } /** * Convert satellite modem state from service definition to framework definition. * @param modemState The SatelliteModemState from the satellite service. * @return The converted SatelliteModemState for the framework. */ @SatelliteManager.SatelliteModemState public static int fromSatelliteModemState(int modemState) { switch (modemState) { case SatelliteModemState.SATELLITE_MODEM_STATE_IDLE: return SatelliteManager.SATELLITE_MODEM_STATE_IDLE; case SatelliteModemState.SATELLITE_MODEM_STATE_LISTENING: return SatelliteManager.SATELLITE_MODEM_STATE_LISTENING; case SatelliteModemState.SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING: return SatelliteManager.SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING; case SatelliteModemState.SATELLITE_MODEM_STATE_DATAGRAM_RETRYING: return SatelliteManager.SATELLITE_MODEM_STATE_DATAGRAM_RETRYING; case SatelliteModemState.SATELLITE_MODEM_STATE_OFF: return SatelliteManager.SATELLITE_MODEM_STATE_OFF; default: loge("Received invalid modem state: " + modemState); return SatelliteManager.SATELLITE_MODEM_STATE_UNKNOWN; } } /** * Convert SatelliteCapabilities from service definition to framework definition. * @param capabilities The SatelliteCapabilities from the satellite service. * @return The converted SatelliteCapabilities for the framework. */ @Nullable public static SatelliteCapabilities fromSatelliteCapabilities( @Nullable android.telephony.satellite.stub.SatelliteCapabilities capabilities) { if (capabilities == null) return null; int[] radioTechnologies = capabilities.supportedRadioTechnologies == null ? new int[0] : capabilities.supportedRadioTechnologies; return new SatelliteCapabilities( Arrays.stream(radioTechnologies) .map(SatelliteServiceUtils::fromSatelliteRadioTechnology) .boxed().collect(Collectors.toSet()), capabilities.isAlwaysOn, capabilities.needsPointingToSatellite, capabilities.needsSeparateSimProfile); } /** * Convert PointingInfo from service definition to framework definition. * @param pointingInfo The PointingInfo from the satellite service. * @return The converted PointingInfo for the framework. */ @Nullable public static PointingInfo fromPointingInfo( android.telephony.satellite.stub.PointingInfo pointingInfo) { if (pointingInfo == null) return null; return new PointingInfo(pointingInfo.satelliteAzimuth, pointingInfo.satelliteElevation, pointingInfo.antennaAzimuth, pointingInfo.antennaPitch, pointingInfo.antennaRoll); } /** * Convert SatelliteDatagram from service definition to framework definition. * @param datagram The SatelliteDatagram from the satellite service. * @return The converted SatelliteDatagram for the framework. */ @Nullable public static SatelliteDatagram fromSatelliteDatagram( android.telephony.satellite.stub.SatelliteDatagram datagram) { if (datagram == null) return null; byte[] data = datagram.data == null ? new byte[0] : datagram.data; return new SatelliteDatagram(data); } /** * Convert SatelliteDatagram[] from service definition to framework definition. * @param datagrams The SatelliteDatagram[] from the satellite service. * @return The converted SatelliteDatagram[] for the framework. */ @Nullable public static SatelliteDatagram[] fromSatelliteDatagrams( android.telephony.satellite.stub.SatelliteDatagram[] datagrams) { SatelliteDatagram[] array = new SatelliteDatagram[datagrams.length]; for (int i = 0; i < datagrams.length; i++) { array[i] = fromSatelliteDatagram(datagrams[i]); } return array; } /** * Convert SatelliteDatagram from framework definition to service definition. * @param datagram The SatelliteDatagram from the framework. * @return The converted SatelliteDatagram for the satellite service. */ @Nullable public static android.telephony.satellite.stub.SatelliteDatagram toSatelliteDatagram( @Nullable SatelliteDatagram datagram) { android.telephony.satellite.stub.SatelliteDatagram converted = new android.telephony.satellite.stub.SatelliteDatagram(); converted.data = datagram.getSatelliteDatagram(); return converted; } private static void loge(@NonNull String log) { Rlog.e(TAG, log); } } Loading
src/java/com/android/internal/telephony/Phone.java +16 −13 Original line number Diff line number Diff line Loading @@ -5319,8 +5319,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * @param what User-defined message code. * @param obj User object. */ public void registerForSatellitePointingInfoChanged(@NonNull Handler h, 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); } Loading @@ -5329,7 +5330,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * * @param h Handler to be removed from the registrant list. */ public void unregisterForSatellitePointingInfoChanged(@NonNull Handler h) { public void unregisterForSatellitePositionInfoChanged(@NonNull Handler h) { //TODO: Rename CommandsInterface and other modules when updating HAL APIs. mCi.unregisterForSatellitePointingInfoChanged(h); } Loading @@ -5342,7 +5344,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { */ public void registerForSatelliteDatagramsDelivered(@NonNull Handler h, int what, @Nullable Object obj) { //TODO: Rename CommandsInterface and other modules when updating HAL APIs. //TODO: Remove. mCi.registerForSatelliteMessagesTransferComplete(h, what, obj); } Loading @@ -5352,7 +5354,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * @param h Handler to be removed from the registrant list. */ public void unregisterForSatelliteDatagramsDelivered(@NonNull Handler h) { //TODO: Rename CommandsInterface and other modules when updating HAL APIs. //TODO: Remove. mCi.unregisterForSatelliteMessagesTransferComplete(h); } Loading Loading @@ -5413,23 +5415,23 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { } /** * Registers for satellite state change from satellite modem. * 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 registerForSatelliteModemStateChange(@NonNull Handler h, int what, public void registerForSatelliteModemStateChanged(@NonNull Handler h, int what, @Nullable Object obj) { mCi.registerForSatelliteModeChanged(h, what, obj); } /** * Unregisters for satellite state changes from satellite modem. * Unregisters for satellite state changed from satellite modem. * * @param h Handler to be removed from registrant list. */ public void unregisterForSatelliteModemStateChange(@NonNull Handler h) { public void unregisterForSatelliteModemStateChanged(@NonNull Handler h) { mCi.unregisterForSatelliteModeChanged(h); } Loading Loading @@ -5461,19 +5463,20 @@ public abstract class Phone extends Handler implements PhoneInternalInterface { * @param what User-defined message code. * @param obj User object. */ public void registerForNewSatelliteDatagram(@NonNull Handler h, int what, public void registerForSatelliteDatagramsReceived(@NonNull Handler h, int what, @Nullable Object obj) { //mCi.registerForNewSatelliteDatagram(h, what, 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 unregisterForNewSatelliteDatagram(@NonNull Handler h) { //mCi.unregisterForNewSatelliteDatagram(h); public void unregisterForSatelliteDatagramsReceived(@NonNull Handler h) { // TODO: rename mCi.unregisterForNewSatelliteMessages(h); } /** Loading
src/java/com/android/internal/telephony/SatelliteIndication.java +8 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SATELLITE_RA 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. Loading Loading @@ -78,8 +80,13 @@ public class SatelliteIndication extends IRadioSatelliteIndication.Stub { if (mRil.isLogOrTrace()) mRil.unsljLog(RIL_UNSOL_NEW_SATELLITE_MESSAGES); if (mRil.mNewSatelliteMessagesRegistrants != null) { SatelliteDatagram[] datagrams = new SatelliteDatagram[messages.length]; for (int i = 0; i < messages.length; i++) { datagrams[i] = new SatelliteDatagram(messages[i].getBytes()); } // TODO: support pendingCount properly mRil.mNewSatelliteMessagesRegistrants.notifyRegistrants( new AsyncResult(null, messages, null)); new AsyncResult(null, new Pair<>(datagrams, messages.length), null)); } } Loading
src/java/com/android/internal/telephony/satellite/SatelliteServiceController.java +313 −137 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java 0 → 100644 +210 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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.satellite; import android.annotation.NonNull; import android.annotation.Nullable; import android.telephony.Rlog; import android.telephony.satellite.PointingInfo; import android.telephony.satellite.SatelliteCapabilities; import android.telephony.satellite.SatelliteDatagram; import android.telephony.satellite.SatelliteManager; import android.telephony.satellite.stub.NTRadioTechnology; import android.telephony.satellite.stub.SatelliteError; import android.telephony.satellite.stub.SatelliteModemState; import java.util.Arrays; import java.util.stream.Collectors; /** * Utils class for satellite service <-> framework conversions */ public class SatelliteServiceUtils { private static final String TAG = "SatelliteServiceUtils"; /** * Convert radio technology from service definition to framework definition. * @param radioTechnology The NTRadioTechnology from the satellite service. * @return The converted NTRadioTechnology for the framework. */ @SatelliteManager.NTRadioTechnology public static int fromSatelliteRadioTechnology(int radioTechnology) { switch (radioTechnology) { case NTRadioTechnology.NB_IOT_NTN: return SatelliteManager.NT_RADIO_TECHNOLOGY_NB_IOT_NTN; case NTRadioTechnology.NR_NTN: return SatelliteManager.NT_RADIO_TECHNOLOGY_NR_NTN; case NTRadioTechnology.EMTC_NTN: return SatelliteManager.NT_RADIO_TECHNOLOGY_EMTC_NTN; case NTRadioTechnology.PROPRIETARY: return SatelliteManager.NT_RADIO_TECHNOLOGY_PROPRIETARY; default: loge("Received invalid radio technology: " + radioTechnology); return SatelliteManager.NT_RADIO_TECHNOLOGY_UNKNOWN; } } /** * Convert satellite error from service definition to framework definition. * @param error The SatelliteError from the satellite service. * @return The converted SatelliteError for the framework. */ @SatelliteManager.SatelliteError public static int fromSatelliteError(int error) { switch (error) { case SatelliteError.ERROR_NONE: return SatelliteManager.SATELLITE_ERROR_NONE; case SatelliteError.SATELLITE_ERROR: return SatelliteManager.SATELLITE_ERROR; case SatelliteError.SERVER_ERROR: return SatelliteManager.SATELLITE_SERVER_ERROR; case SatelliteError.SERVICE_ERROR: return SatelliteManager.SATELLITE_SERVICE_ERROR; case SatelliteError.MODEM_ERROR: return SatelliteManager.SATELLITE_MODEM_ERROR; case SatelliteError.NETWORK_ERROR: return SatelliteManager.SATELLITE_NETWORK_ERROR; case SatelliteError.INVALID_TELEPHONY_STATE: return SatelliteManager.SATELLITE_INVALID_TELEPHONY_STATE; case SatelliteError.INVALID_MODEM_STATE: return SatelliteManager.SATELLITE_INVALID_MODEM_STATE; case SatelliteError.INVALID_ARGUMENTS: return SatelliteManager.SATELLITE_INVALID_ARGUMENTS; case SatelliteError.REQUEST_FAILED: return SatelliteManager.SATELLITE_REQUEST_FAILED; case SatelliteError.RADIO_NOT_AVAILABLE: return SatelliteManager.SATELLITE_RADIO_NOT_AVAILABLE; case SatelliteError.REQUEST_NOT_SUPPORTED: return SatelliteManager.SATELLITE_REQUEST_NOT_SUPPORTED; case SatelliteError.NO_RESOURCES: return SatelliteManager.SATELLITE_NO_RESOURCES; case SatelliteError.SERVICE_NOT_PROVISIONED: return SatelliteManager.SATELLITE_SERVICE_NOT_PROVISIONED; case SatelliteError.SERVICE_PROVISION_IN_PROGRESS: return SatelliteManager.SATELLITE_SERVICE_PROVISION_IN_PROGRESS; case SatelliteError.REQUEST_ABORTED: return SatelliteManager.SATELLITE_REQUEST_ABORTED; case SatelliteError.SATELLITE_ACCESS_BARRED: return SatelliteManager.SATELLITE_ACCESS_BARRED; case SatelliteError.NETWORK_TIMEOUT: return SatelliteManager.SATELLITE_NETWORK_TIMEOUT; case SatelliteError.SATELLITE_NOT_REACHABLE: return SatelliteManager.SATELLITE_NOT_REACHABLE; case SatelliteError.NOT_AUTHORIZED: return SatelliteManager.SATELLITE_NOT_AUTHORIZED; } loge("Received invalid satellite service error: " + error); return SatelliteManager.SATELLITE_SERVICE_ERROR; } /** * Convert satellite modem state from service definition to framework definition. * @param modemState The SatelliteModemState from the satellite service. * @return The converted SatelliteModemState for the framework. */ @SatelliteManager.SatelliteModemState public static int fromSatelliteModemState(int modemState) { switch (modemState) { case SatelliteModemState.SATELLITE_MODEM_STATE_IDLE: return SatelliteManager.SATELLITE_MODEM_STATE_IDLE; case SatelliteModemState.SATELLITE_MODEM_STATE_LISTENING: return SatelliteManager.SATELLITE_MODEM_STATE_LISTENING; case SatelliteModemState.SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING: return SatelliteManager.SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING; case SatelliteModemState.SATELLITE_MODEM_STATE_DATAGRAM_RETRYING: return SatelliteManager.SATELLITE_MODEM_STATE_DATAGRAM_RETRYING; case SatelliteModemState.SATELLITE_MODEM_STATE_OFF: return SatelliteManager.SATELLITE_MODEM_STATE_OFF; default: loge("Received invalid modem state: " + modemState); return SatelliteManager.SATELLITE_MODEM_STATE_UNKNOWN; } } /** * Convert SatelliteCapabilities from service definition to framework definition. * @param capabilities The SatelliteCapabilities from the satellite service. * @return The converted SatelliteCapabilities for the framework. */ @Nullable public static SatelliteCapabilities fromSatelliteCapabilities( @Nullable android.telephony.satellite.stub.SatelliteCapabilities capabilities) { if (capabilities == null) return null; int[] radioTechnologies = capabilities.supportedRadioTechnologies == null ? new int[0] : capabilities.supportedRadioTechnologies; return new SatelliteCapabilities( Arrays.stream(radioTechnologies) .map(SatelliteServiceUtils::fromSatelliteRadioTechnology) .boxed().collect(Collectors.toSet()), capabilities.isAlwaysOn, capabilities.needsPointingToSatellite, capabilities.needsSeparateSimProfile); } /** * Convert PointingInfo from service definition to framework definition. * @param pointingInfo The PointingInfo from the satellite service. * @return The converted PointingInfo for the framework. */ @Nullable public static PointingInfo fromPointingInfo( android.telephony.satellite.stub.PointingInfo pointingInfo) { if (pointingInfo == null) return null; return new PointingInfo(pointingInfo.satelliteAzimuth, pointingInfo.satelliteElevation, pointingInfo.antennaAzimuth, pointingInfo.antennaPitch, pointingInfo.antennaRoll); } /** * Convert SatelliteDatagram from service definition to framework definition. * @param datagram The SatelliteDatagram from the satellite service. * @return The converted SatelliteDatagram for the framework. */ @Nullable public static SatelliteDatagram fromSatelliteDatagram( android.telephony.satellite.stub.SatelliteDatagram datagram) { if (datagram == null) return null; byte[] data = datagram.data == null ? new byte[0] : datagram.data; return new SatelliteDatagram(data); } /** * Convert SatelliteDatagram[] from service definition to framework definition. * @param datagrams The SatelliteDatagram[] from the satellite service. * @return The converted SatelliteDatagram[] for the framework. */ @Nullable public static SatelliteDatagram[] fromSatelliteDatagrams( android.telephony.satellite.stub.SatelliteDatagram[] datagrams) { SatelliteDatagram[] array = new SatelliteDatagram[datagrams.length]; for (int i = 0; i < datagrams.length; i++) { array[i] = fromSatelliteDatagram(datagrams[i]); } return array; } /** * Convert SatelliteDatagram from framework definition to service definition. * @param datagram The SatelliteDatagram from the framework. * @return The converted SatelliteDatagram for the satellite service. */ @Nullable public static android.telephony.satellite.stub.SatelliteDatagram toSatelliteDatagram( @Nullable SatelliteDatagram datagram) { android.telephony.satellite.stub.SatelliteDatagram converted = new android.telephony.satellite.stub.SatelliteDatagram(); converted.data = datagram.getSatelliteDatagram(); return converted; } private static void loge(@NonNull String log) { Rlog.e(TAG, log); } }