Merge "Skeleton implementation for satellite service"

This commit is contained in:
Sarah Chin
2023-02-15 03:06:01 +00:00
committed by Android (Google) Code Review
15 changed files with 1486 additions and 80 deletions

View File

@@ -106,6 +106,10 @@
<string name="config_qualified_networks_service_class" translatable="false"></string>
<java-symbol type="string" name="config_qualified_networks_service_class" />
<!-- Telephony satellite service package name to bind to by default. -->
<string name="config_satellite_service_package" translatable="false"></string>
<java-symbol type="string" name="config_satellite_service_package" />
<!-- Whether enhanced IWLAN handover check is enabled. If enabled, telephony frameworks
will not perform handover if the target transport is out of service, or VoPS not
supported. The network will be torn down on the source transport, and will be

View File

@@ -321,7 +321,7 @@ public class SatelliteManager {
* @param callback The callback object to which the result will be delivered.
* If the request is successful, {@link OutcomeReceiver#onResult(Object)}
* will return a {@code boolean} with value {@code true} if the satellite modem
* is powered on and {@code false} otherwise.
* is enabled and {@code false} otherwise.
* If the request is not successful, {@link OutcomeReceiver#onError(Throwable)}
* will return a {@link SatelliteException} with the {@link SatelliteError}.
*
@@ -526,7 +526,7 @@ public class SatelliteManager {
/* Satellite modem is sending and/or receiving messages. */
public static final int SATELLITE_MODEM_STATE_MESSAGE_TRANSFERRING = 2;
/* Satellite modem is powered off */
/* Satellite modem is powered off. */
public static final int SATELLITE_MODEM_STATE_OFF = 3;
/** @hide */
@@ -1204,14 +1204,14 @@ public class SatelliteManager {
}
/**
* Request to get the time after which the satellite will next be visible. This is an
* Request to get the time after which the satellite will be visible. This is an
* {@code int} representing the duration in seconds after which the satellite will be visible.
* This will return {@code 0} if the satellite is currently visible.
*
* @param executor The executor on which the callback will be called.
* @param callback The callback object to which the result will be delivered.
* If the request is successful, {@link OutcomeReceiver#onResult(Object)}
* will return the time after which the satellite will next be visible.
* will return the time after which the satellite will be visible.
* If the request is not successful, {@link OutcomeReceiver#onError(Throwable)}
* will return a {@link SatelliteException} with the {@link SatelliteError}.
*

View File

@@ -0,0 +1,370 @@
/*
* 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 android.telephony.satellite.stub;
import android.telephony.satellite.stub.ISatelliteCapabilitiesConsumer;
import android.telephony.satellite.stub.ISatelliteListener;
import android.telephony.satellite.stub.ISatelliteModemStateConsumer;
import android.telephony.satellite.stub.SatelliteDatagram;
import com.android.internal.telephony.IBooleanConsumer;
import com.android.internal.telephony.IIntegerConsumer;
/**
* {@hide}
*/
oneway interface ISatellite {
/**
* Register the callback interface with satellite service.
*
* @param listener The callback interface to handle satellite service indications.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void setSatelliteListener(in ISatelliteListener listener, in IIntegerConsumer errorCallback);
/**
* Enable or disable the satellite service listening mode.
* Listening mode allows the satellite service to listen for incoming pages.
*
* @param enable True to enable satellite listening mode and false to disable.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void setSatelliteListeningEnabled(in boolean enable, in IIntegerConsumer errorCallback);
/**
* Enable or disable the satellite modem. If the satellite modem is enabled, this will also
* disable the cellular modem, and if the satellite modem is disabled, this will also re-enable
* the cellular modem.
*
* @param enable True to enable the satellite modem and false to disable.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void setSatelliteEnabled(in boolean enabled, in IIntegerConsumer errorCallback);
/**
* Request to get whether the satellite modem is enabled.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* whether the satellite modem is enabled.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void requestIsSatelliteEnabled(in IIntegerConsumer errorCallback, in IBooleanConsumer callback);
/**
* Request to get whether the satellite service is supported on the device.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* whether the satellite service is supported on the device.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void requestIsSatelliteSupported(in IIntegerConsumer errorCallback,
in IBooleanConsumer callback);
/**
* Request to get the SatelliteCapabilities of the satellite service.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* the SatelliteCapabilities of the satellite service.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void requestSatelliteCapabilities(in IIntegerConsumer errorCallback,
in ISatelliteCapabilitiesConsumer callback);
/**
* User started pointing to the satellite.
* The satellite service should report the satellite pointing info via
* ISatelliteListener#onSatellitePointingInfoChanged as the user device/satellite moves.
*
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void startSendingSatellitePointingInfo(in IIntegerConsumer errorCallback);
/**
* User stopped pointing to the satellite.
* The satellite service should stop reporting satellite pointing info to the framework.
*
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void stopSendingSatellitePointingInfo(in IIntegerConsumer errorCallback);
/**
* Request to get the maximum number of characters per MO text message on satellite.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* the maximum number of characters per MO text message on satellite.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void requestMaxCharactersPerMOTextMessage(in IIntegerConsumer errorCallback,
in IIntegerConsumer callback);
/**
* Provision the device with a satellite provider.
* This is needed if the provider allows dynamic registration.
* Once provisioned, ISatelliteListener#onSatelliteProvisionStateChanged should report true.
*
* @param token The token to be used as a unique identifier for provisioning with satellite
* gateway.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:NETWORK_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
* SatelliteError:REQUEST_ABORTED
* SatelliteError:NETWORK_TIMEOUT
*/
void provisionSatelliteService(in String token, in IIntegerConsumer errorCallback);
/**
* Deprovision the device with the satellite provider.
* This is needed if the provider allows dynamic registration.
* Once deprovisioned, ISatelliteListener#onSatelliteProvisionStateChanged should report false.
*
* @param token The token of the device/subscription to be deprovisioned.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:NETWORK_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
* SatelliteError:REQUEST_ABORTED
* SatelliteError:NETWORK_TIMEOUT
*/
void deprovisionSatelliteService(in String token, in IIntegerConsumer errorCallback);
/**
* Request to get whether this device is provisioned with a satellite provider.
*
* @param token The token of the device/subscription to be deprovisioned.
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* whether this device is provisioned with a satellite provider.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void requestIsSatelliteProvisioned(in String token, in IIntegerConsumer errorCallback,
in IBooleanConsumer callback);
/**
* Poll the pending datagrams to be received over satellite.
* The satellite service should check if there are any pending datagrams to be received over
* satellitea and report them via ISatelliteListener#onNewDatagrams.
*
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:NETWORK_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
* SatelliteError:SATELLITE_ACCESS_BARRED
* SatelliteError:NETWORK_TIMEOUT
* SatelliteError:SATELLITE_NOT_REACHABLE
* SatelliteError:NOT_AUTHORIZED
*/
void pollPendingSatelliteDatagrams(in IIntegerConsumer errorCallback);
/**
* Send datagram over satellite.
* Once sent, the satellite service should report whether the operation was successful via
* SatelliteListener#onDatagramsDelivered.
*
* @param datagram Datagram to send in byte format.
* @param isEmergency Whether this is an emergency datagram.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:NETWORK_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
* SatelliteError:REQUEST_ABORTED
* SatelliteError:SATELLITE_ACCESS_BARRED
* SatelliteError:NETWORK_TIMEOUT
* SatelliteError:SATELLITE_NOT_REACHABLE
* SatelliteError:NOT_AUTHORIZED
*/
void sendSatelliteDatagram(in SatelliteDatagram datagram, in boolean isEmergency,
in IIntegerConsumer errorCallback);
/**
* Request the current satellite modem state.
* The satellite service should report the current satellite modem state via
* ISatelliteListener#onSatelliteModemStateChanged.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* the current satellite modem state.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void requestSatelliteModemState(in IIntegerConsumer errorCallback,
in ISatelliteModemStateConsumer callback);
/**
* Request to get whether satellite communication is allowed for the current location.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* whether satellite communication is allowed for the current location.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void requestIsSatelliteCommunicationAllowedForCurrentLocation(
in IIntegerConsumer errorCallback, in IBooleanConsumer callback);
/**
* Request to get the time after which the satellite will be visible. This is an int
* representing the duration in seconds after which the satellite will be visible.
* This will return 0 if the satellite is currently visible.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* the time after which the satellite will be visible.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
void requestTimeForNextSatelliteVisibility(in IIntegerConsumer errorCallback,
in IIntegerConsumer callback);
}

View File

@@ -0,0 +1,27 @@
/*
* 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 android.telephony.satellite.stub;
import android.telephony.satellite.stub.SatelliteCapabilities;
/**
* Consumer pattern for a request that receives a SatelliteCapabilities from the SatelliteService.
* @hide
*/
oneway interface ISatelliteCapabilitiesConsumer {
void accept(in SatelliteCapabilities result);
}

View File

@@ -0,0 +1,78 @@
/*
* 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 android.telephony.satellite.stub;
import android.telephony.satellite.stub.NTRadioTechnology;
import android.telephony.satellite.stub.PointingInfo;
import android.telephony.satellite.stub.SatelliteDatagram;
import android.telephony.satellite.stub.SatelliteModemState;
/**
* {@hide}
*/
oneway interface ISatelliteListener {
/**
* Indicates that the satellite provision state has changed.
*
* @param provisioned True means the service is provisioned and false means it is not.
*/
void onSatelliteProvisionStateChanged(in boolean provisioned);
/**
* Indicates that new datagrams have been received on the device.
*
* @param datagrams New datagrams received.
* @param pendingCount The number of datagrams that are pending.
*/
void onNewDatagrams(in SatelliteDatagram[] datagrams, in int pendingCount);
/**
* Indicates that the satellite has pending datagrams for the device to be pulled.
*
* @param count Number of pending datagrams.
*/
void onPendingDatagramCount(in int count);
/**
* Indicates that the satellite pointing input has changed.
*
* @param pointingInfo The current pointing info.
*/
void onSatellitePointingInfoChanged(in PointingInfo pointingInfo);
/**
* Indicates that the satellite modem state has changed.
*
* @param mode The current satellite modem state.
*/
void onSatelliteModemStateChanged(in SatelliteModemState mode);
/**
* Indicates that the satellite radio technology has changed.
*
* @param technology The current satellite service mode.
*/
void onSatelliteRadioTechnologyChanged(in NTRadioTechnology technology);
/**
* Indicates that datagram transfer is complete and all datagrams have been delivered.
*
* @param delivered True means all datagrams have been delivered and false means there was an
* error in delivering all datagrams.
*/
void onDatagramsDelivered(in boolean delivered);
}

View File

@@ -0,0 +1,27 @@
/*
* 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 android.telephony.satellite.stub;
import android.telephony.satellite.stub.SatelliteModemState;
/**
* Consumer pattern for a request that receives a SatelliteModemState from the SatelliteService.
* @hide
*/
oneway interface ISatelliteModemStateConsumer {
void accept(in SatelliteModemState result);
}

View File

@@ -0,0 +1,32 @@
/*
* 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 android.telephony.satellite.stub;
/**
* {@hide}
*/
@Backing(type="int")
enum NTRadioTechnology {
/* 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology. */
NB_IOT_NTN,
/* 3GPP 5G NR over Non-Terrestrial-Networks technology. */
NR_NTN,
/* 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology. */
EMTC_NTN,
/* Proprietary technology. */
PROPRIETARY,
}

View File

@@ -0,0 +1,47 @@
/*
* 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 android.telephony.satellite.stub;
/**
* @hide
*/
parcelable PointingInfo {
/**
* Satellite azimuth in degrees.
*/
float satelliteAzimuth;
/**
* Satellite elevation in degrees.
*/
float satelliteElevation;
/** Antenna azimuth in degrees */
float mAntennaAzimuthDegrees;
/**
* Angle of rotation about the x axis. This value represents the angle between a plane
* parallel to the device's screen and a plane parallel to the ground.
*/
float mAntennaPitchDegrees;
/**
* Angle of rotation about the y axis. This value represents the angle between a plane
* perpendicular to the device's screen and a plane parallel to the ground.
*/
float mAntennaRollDegrees;
}

View File

@@ -0,0 +1,45 @@
/*
* 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 android.telephony.satellite.stub;
import android.telephony.satellite.stub.NTRadioTechnology;
/**
* {@hide}
*/
parcelable SatelliteCapabilities {
/**
* List of technologies supported by the satellite modem.
*/
NTRadioTechnology[] supportedRadioTechnologies;
/**
* Whether satellite modem is always on.
* This indicates the power impact of keeping it on is very minimal.
*/
boolean isAlwaysOn;
/**
* Whether UE needs to point to a satellite to send and receive data.
*/
boolean needsPointingToSatellite;
/**
* Whether UE needs a separate SIM profile to communicate with the satellite network.
*/
boolean needsSeparateSimProfile;
}

View File

@@ -0,0 +1,27 @@
/*
* 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 android.telephony.satellite.stub;
/**
* @hide
*/
parcelable SatelliteDatagram {
/**
* The contents of this datagram as a byte array.
*/
byte[] data;
}

View File

@@ -0,0 +1,110 @@
/*
* 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 android.telephony.satellite.stub;
/**
* {@hide}
*/
@Backing(type="int")
enum SatelliteError {
/**
* The request was successfully processed.
*/
ERROR_NONE = 0,
/**
* A generic error which should be used only when other specific errors cannot be used.
*/
SATELLITE_ERROR = 1,
/**
* Error received from the satellite server.
*/
SATELLITE_SERVER_ERROR = 2,
/**
* Error received from the vendor service. This generic error code should be used
* only when the error cannot be mapped to other specific service error codes.
*/
SATELLITE_SERVICE_ERROR = 3,
/**
* Error received from satellite modem. This generic error code should be used only when
* the error cannot be mapped to other specific modem error codes.
*/
SATELLITE_MODEM_ERROR = 4,
/**
* Error received from the satellite network. This generic error code should be used only when
* the error cannot be mapped to other specific network error codes.
*/
SATELLITE_NETWORK_ERROR = 5,
/**
* Telephony is not in a valid state to receive requests from clients.
*/
SATELLITE_INVALID_TELEPHONY_STATE = 6,
/**
* Satellite modem is not in a valid state to receive requests from clients.
*/
SATELLITE_INVALID_MODEM_STATE = 7,
/**
* Either vendor service, or modem, or Telephony framework has received a request with
* invalid arguments from its clients.
*/
SATELLITE_INVALID_ARGUMENTS = 8,
/**
* Telephony framework failed to send a request or receive a response from the vendor service
* or satellite modem due to internal error.
*/
SATELLITE_REQUEST_FAILED = 9,
/**
* Radio did not start or is resetting.
*/
SATELLITE_RADIO_NOT_AVAILABLE = 10,
/**
* The request is not supported by either the satellite modem or the network.
*/
SATELLITE_REQUEST_NOT_SUPPORTED = 11,
/**
* Satellite modem or network has no resources available to handle requests from clients.
*/
SATELLITE_NO_RESOURCES = 12,
/**
* Satellite service is not provisioned yet.
*/
SATELLITE_SERVICE_NOT_PROVISIONED = 13,
/**
* Satellite service provision is already in progress.
*/
SATELLITE_SERVICE_PROVISION_IN_PROGRESS = 14,
/**
* The ongoing request was aborted by either the satellite modem or the network.
*/
REQUEST_ABORTED = 15,
/**
* The device/subscriber is barred from accessing the satellite service.
*/
SATELLITE_ACCESS_BARRED = 16,
/**
* Satellite modem timeout to receive ACK or response from the satellite network after
* sending a request to the network.
*/
SATELLITE_NETWORK_TIMEOUT = 17,
/**
* Satellite network is not reachable from the modem.
*/
SATELLITE_NOT_REACHABLE = 18,
/**
* The device/subscriber is not authorized to register with the satellite service provider.
*/
NOT_AUTHORIZED = 19
}

View File

@@ -17,94 +17,638 @@
package android.telephony.satellite.stub;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import com.android.internal.telephony.IBooleanConsumer;
import com.android.internal.telephony.IIntegerConsumer;
import com.android.internal.telephony.util.TelephonyUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
/**
* Base implementation of satellite service.
* Any service wishing to provide satellite services should extend this class and implement all
* methods that the service supports.
* @hide
*/
public class SatelliteImplBase {
public class SatelliteImplBase extends SatelliteService {
private static final String TAG = "SatelliteImplBase";
/**@hide*/
@IntDef(
prefix = "TECHNOLOGY_",
value = {
TECHNOLOGY_NB_IOT_NTN,
TECHNOLOGY_NR_NTN,
TECHNOLOGY_EMTC_NTN,
TECHNOLOGY_PROPRIETARY
})
/** @hide */
@IntDef(prefix = "NT_RADIO_TECHNOLOGY_", value = {
NT_RADIO_TECHNOLOGY_NB_IOT_NTN,
NT_RADIO_TECHNOLOGY_NR_NTN,
NT_RADIO_TECHNOLOGY_EMTC_NTN,
NT_RADIO_TECHNOLOGY_PROPRIETARY
})
@Retention(RetentionPolicy.SOURCE)
public @interface NTRadioTechnology {}
/** 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology */
public static final int TECHNOLOGY_NB_IOT_NTN =
android.hardware.radio.satellite.NTRadioTechnology.NB_IOT_NTN;
/** 3GPP 5G NR over Non-Terrestrial-Networks technology */
public static final int TECHNOLOGY_NR_NTN =
android.hardware.radio.satellite.NTRadioTechnology.NR_NTN;
/** 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology */
public static final int TECHNOLOGY_EMTC_NTN =
android.hardware.radio.satellite.NTRadioTechnology.EMTC_NTN;
/** Proprietary technology like Iridium or Bullitt */
public static final int TECHNOLOGY_PROPRIETARY =
android.hardware.radio.satellite.NTRadioTechnology.PROPRIETARY;
/** 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology. */
public static final int NT_RADIO_TECHNOLOGY_NB_IOT_NTN =
android.telephony.satellite.stub.NTRadioTechnology.NB_IOT_NTN;
/** 3GPP 5G NR over Non-Terrestrial-Networks technology. */
public static final int NT_RADIO_TECHNOLOGY_NR_NTN =
android.telephony.satellite.stub.NTRadioTechnology.NR_NTN;
/** 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology. */
public static final int NT_RADIO_TECHNOLOGY_EMTC_NTN =
android.telephony.satellite.stub.NTRadioTechnology.EMTC_NTN;
/** Proprietary technology. */
public static final int NT_RADIO_TECHNOLOGY_PROPRIETARY =
android.telephony.satellite.stub.NTRadioTechnology.PROPRIETARY;
/**@hide*/
@IntDef(
prefix = "FEATURE_",
value = {
FEATURE_SOS_SMS,
FEATURE_EMERGENCY_SMS,
FEATURE_SMS,
FEATURE_LOCATION_SHARING,
FEATURE_UNKNOWN
})
/** @hide */
@IntDef(prefix = "SATELLITE_MODEM_STATE_", value = {
SATELLITE_MODEM_STATE_IDLE,
SATELLITE_MODEM_STATE_LISTENING,
SATELLITE_MODEM_STATE_MESSAGE_TRANSFERRING,
SATELLITE_MODEM_STATE_OFF
})
@Retention(RetentionPolicy.SOURCE)
public @interface Feature {}
public @interface SatelliteModemState {}
/** Able to send and receive SMS messages to/from SOS numbers like call/service centers */
public static final int FEATURE_SOS_SMS =
android.hardware.radio.satellite.SatelliteFeature.SOS_SMS;
/** Able to send and receive SMS messages to/from emergency numbers like 911 */
public static final int FEATURE_EMERGENCY_SMS =
android.hardware.radio.satellite.SatelliteFeature.EMERGENCY_SMS;
/** Able to send and receive SMS messages to/from any allowed contacts */
public static final int FEATURE_SMS = android.hardware.radio.satellite.SatelliteFeature.SMS;
/** Able to send device location to allowed contacts */
public static final int FEATURE_LOCATION_SHARING =
android.hardware.radio.satellite.SatelliteFeature.LOCATION_SHARING;
/** This feature is not defined in satellite HAL APIs */
public static final int FEATURE_UNKNOWN = 0xFFFF;
/** Satellite modem is in idle state. */
public static final int SATELLITE_MODEM_STATE_IDLE =
android.telephony.satellite.stub.SatelliteModemState.SATELLITE_MODEM_STATE_IDLE;
/** Satellite modem is listening for incoming messages. */
public static final int SATELLITE_MODEM_STATE_LISTENING =
android.telephony.satellite.stub.SatelliteModemState.SATELLITE_MODEM_STATE_LISTENING;
/** Satellite modem is sending and/or receiving messages. */
public static final int SATELLITE_MODEM_STATE_MESSAGE_TRANSFERRING =
android.telephony.satellite.stub.SatelliteModemState
.SATELLITE_MODEM_STATE_MESSAGE_TRANSFERRING;
/** Satellite modem is powered off. */
public static final int SATELLITE_MODEM_STATE_OFF =
android.telephony.satellite.stub.SatelliteModemState.SATELLITE_MODEM_STATE_OFF;
/**@hide*/
@IntDef(
prefix = "MODE_",
value = {
MODE_POWERED_OFF,
MODE_OUT_OF_SERVICE_NOT_SEARCHING,
MODE_OUT_OF_SERVICE_SEARCHING,
MODE_ACQUIRED,
MODE_MESSAGE_TRANSFERRING
})
@Retention(RetentionPolicy.SOURCE)
public @interface Mode {}
protected final Executor mExecutor;
/** Satellite modem is powered off */
public static final int MODE_POWERED_OFF =
android.hardware.radio.satellite.SatelliteMode.POWERED_OFF;
/** Satellite modem is in out of service state and not searching for satellite signal */
public static final int MODE_OUT_OF_SERVICE_NOT_SEARCHING =
android.hardware.radio.satellite.SatelliteMode.OUT_OF_SERVICE_NOT_SEARCHING;
/** Satellite modem is in out of service state and searching for satellite signal */
public static final int MODE_OUT_OF_SERVICE_SEARCHING =
android.hardware.radio.satellite.SatelliteMode.OUT_OF_SERVICE_SEARCHING;
/** Satellite modem has found satellite signal and gets connected to the satellite network */
public static final int MODE_ACQUIRED = android.hardware.radio.satellite.SatelliteMode.ACQUIRED;
/** Satellite modem is sending and/or receiving messages */
public static final int MODE_MESSAGE_TRANSFERRING =
android.hardware.radio.satellite.SatelliteMode.MESSAGE_TRANSFERRING;
/**
* Create SatelliteImplBase using the Executor specified for methods being called from the
* framework.
* @param executor The executor for the framework to use when executing the methods overridden
* by the implementation of Satellite.
* @hide
*/
public SatelliteImplBase(@NonNull Executor executor) {
super();
mExecutor = executor;
}
/**
* @return The binder for the Satellite implementation.
* @hide
*/
public final IBinder getBinder() {
return mBinder;
}
private final IBinder mBinder = new ISatellite.Stub() {
@Override
public void setSatelliteListener(ISatelliteListener listener,
IIntegerConsumer errorCallback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this.setSatelliteListener(listener, errorCallback),
"setSatelliteListener");
}
@Override
public void setSatelliteListeningEnabled(boolean enable, IIntegerConsumer errorCallback)
throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.setSatelliteListeningEnabled(enable, errorCallback),
"setSatelliteListeningEnabled");
}
@Override
public void setSatelliteEnabled(boolean enable, IIntegerConsumer errorCallback)
throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this.setSatelliteEnabled(enable, errorCallback),
"setSatelliteEnabled");
}
@Override
public void requestIsSatelliteEnabled(IIntegerConsumer errorCallback,
IBooleanConsumer callback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.requestIsSatelliteEnabled(errorCallback, callback),
"requestIsSatelliteEnabled");
}
@Override
public void requestIsSatelliteSupported(IIntegerConsumer errorCallback,
IBooleanConsumer callback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.requestIsSatelliteSupported(errorCallback, callback),
"requestIsSatelliteSupported");
}
@Override
public void requestSatelliteCapabilities(IIntegerConsumer errorCallback,
ISatelliteCapabilitiesConsumer callback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.requestSatelliteCapabilities(errorCallback, callback),
"requestSatelliteCapabilities");
}
@Override
public void startSendingSatellitePointingInfo(IIntegerConsumer errorCallback)
throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this.startSendingSatellitePointingInfo(errorCallback),
"startSendingSatellitePointingInfo");
}
@Override
public void stopSendingSatellitePointingInfo(IIntegerConsumer errorCallback)
throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this.stopSendingSatellitePointingInfo(errorCallback),
"stopSendingSatellitePointingInfo");
}
@Override
public void requestMaxCharactersPerMOTextMessage(IIntegerConsumer errorCallback,
IIntegerConsumer callback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.requestMaxCharactersPerMOTextMessage(errorCallback, callback),
"requestMaxCharactersPerMOTextMessage");
}
@Override
public void provisionSatelliteService(String token, IIntegerConsumer errorCallback)
throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this.provisionSatelliteService(token, errorCallback),
"provisionSatelliteService");
}
@Override
public void deprovisionSatelliteService(String token, IIntegerConsumer errorCallback)
throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this.deprovisionSatelliteService(token, errorCallback),
"deprovisionSatelliteService");
}
@Override
public void requestIsSatelliteProvisioned(String token, IIntegerConsumer errorCallback,
IBooleanConsumer callback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.requestIsSatelliteProvisioned(token, errorCallback, callback),
"requestIsSatelliteProvisioned");
}
@Override
public void pollPendingSatelliteDatagrams(IIntegerConsumer errorCallback)
throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this.pollPendingSatelliteDatagrams(errorCallback),
"pollPendingSatelliteDatagrams");
}
@Override
public void sendSatelliteDatagram(SatelliteDatagram datagram, boolean isEmergency,
IIntegerConsumer errorCallback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.sendSatelliteDatagram(datagram, isEmergency, errorCallback),
"sendSatelliteDatagram");
}
@Override
public void requestSatelliteModemState(IIntegerConsumer errorCallback,
ISatelliteModemStateConsumer callback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.requestSatelliteModemState(errorCallback, callback),
"requestSatelliteModemState");
}
@Override
public void requestIsSatelliteCommunicationAllowedForCurrentLocation(
IIntegerConsumer errorCallback, IBooleanConsumer callback)
throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.requestIsSatelliteCommunicationAllowedForCurrentLocation(
errorCallback, callback),
"requestIsSatelliteCommunicationAllowedForCurrentLocation");
}
@Override
public void requestTimeForNextSatelliteVisibility(IIntegerConsumer errorCallback,
IIntegerConsumer callback) throws RemoteException {
executeMethodAsync(
() -> SatelliteImplBase.this
.requestTimeForNextSatelliteVisibility(errorCallback, errorCallback),
"requestTimeForNextSatelliteVisibility");
}
// Call the methods with a clean calling identity on the executor and wait indefinitely for
// the future to return.
private void executeMethodAsync(Runnable r, String errorLogName) throws RemoteException {
try {
CompletableFuture.runAsync(
() -> TelephonyUtils.runWithCleanCallingIdentity(r), mExecutor).join();
} catch (CancellationException | CompletionException e) {
Log.w(TAG, "SatelliteImplBase Binder - " + errorLogName + " exception: "
+ e.getMessage());
throw new RemoteException(e.getMessage());
}
}
};
/**
* Register the callback interface with satellite service.
*
* @param listener The callback interface to handle satellite service indications.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void setSatelliteListener(@NonNull ISatelliteListener listener,
@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
/**
* Enable or disable the satellite service listening mode.
* Listening mode allows the satellite service to listen for incoming pages.
*
* @param enable True to enable satellite listening mode and false to disable.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void setSatelliteListeningEnabled(boolean enable,
@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
/**
* Enable or disable the satellite modem. If the satellite modem is enabled, this will also
* disable the cellular modem, and if the satellite modem is disabled, this will also re-enable
* the cellular modem.
*
* @param enable True to enable the satellite modem and false to disable.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void setSatelliteEnabled(boolean enable, @NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
/**
* Request to get whether the satellite modem is enabled.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* whether the satellite modem is enabled.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void requestIsSatelliteEnabled(@NonNull IIntegerConsumer errorCallback,
@NonNull IBooleanConsumer callback) {
// stub implementation
}
/**
* Request to get whether the satellite service is supported on the device.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* whether the satellite service is supported on the device.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void requestIsSatelliteSupported(@NonNull IIntegerConsumer errorCallback,
@NonNull IBooleanConsumer callback) {
// stub implementation
}
/**
* Request to get the SatelliteCapabilities of the satellite service.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* the SatelliteCapabilities of the satellite service.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void requestSatelliteCapabilities(@NonNull IIntegerConsumer errorCallback,
@NonNull ISatelliteCapabilitiesConsumer callback) {
// stub implementation
}
/**
* User started pointing to the satellite.
* The satellite service should report the satellite pointing info via
* ISatelliteListener#onSatellitePointingInfoChanged as the user device/satellite moves.
*
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void startSendingSatellitePointingInfo(@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
/**
* User stopped pointing to the satellite.
* The satellite service should stop reporting satellite pointing info to the framework.
*
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void stopSendingSatellitePointingInfo(@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
/**
* Request to get the maximum number of characters per MO text message on satellite.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* the maximum number of characters per MO text message on satellite.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void requestMaxCharactersPerMOTextMessage(@NonNull IIntegerConsumer errorCallback,
@NonNull IIntegerConsumer callback) {
// stub implementation
}
/**
* Provision the device with a satellite provider.
* This is needed if the provider allows dynamic registration.
* Once provisioned, ISatelliteListener#onSatelliteProvisionStateChanged should report true.
*
* @param token The token to be used as a unique identifier for provisioning with satellite
* gateway.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:NETWORK_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
* SatelliteError:REQUEST_ABORTED
* SatelliteError:NETWORK_TIMEOUT
*/
public void provisionSatelliteService(@NonNull String token,
@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
/**
* Deprovision the device with the satellite provider.
* This is needed if the provider allows dynamic registration.
* Once deprovisioned, ISatelliteListener#onSatelliteProvisionStateChanged should report false.
*
* @param token The token of the device/subscription to be deprovisioned.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:NETWORK_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
* SatelliteError:REQUEST_ABORTED
* SatelliteError:NETWORK_TIMEOUT
*/
public void deprovisionSatelliteService(@NonNull String token,
@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
/**
* Request to get whether this device is provisioned with a satellite provider.
*
* @param token The token of the device/subscription to be deprovisioned.
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* whether this device is provisioned with a satellite provider.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void requestIsSatelliteProvisioned(@NonNull String token,
@NonNull IIntegerConsumer errorCallback, @NonNull IBooleanConsumer callback) {
// stub implementation
}
/**
* Poll the pending datagrams.
* The satellite service should report the new datagrams via ISatelliteListener#onNewDatagrams.
*
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:NETWORK_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
* SatelliteError:SATELLITE_ACCESS_BARRED
* SatelliteError:NETWORK_TIMEOUT
* SatelliteError:SATELLITE_NOT_REACHABLE
* SatelliteError:NOT_AUTHORIZED
*/
public void pollPendingSatelliteDatagrams(@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
/**
* Send datagram over satellite.
* Once sent, the satellite service should report whether the operation was successful via
* SatelliteListener#onDatagramsDelivered.
*
* @param datagram Datagram to send in byte format.
* @param isEmergency Whether this is an emergency datagram.
* @param errorCallback The callback to receive the error code result of the operation.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:NETWORK_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
* SatelliteError:REQUEST_ABORTED
* SatelliteError:SATELLITE_ACCESS_BARRED
* SatelliteError:NETWORK_TIMEOUT
* SatelliteError:SATELLITE_NOT_REACHABLE
* SatelliteError:NOT_AUTHORIZED
*/
public void sendSatelliteDatagram(@NonNull SatelliteDatagram datagram, boolean isEmergency,
@NonNull IIntegerConsumer errorCallback) {
// stub implementation
}
/**
* Request the current satellite modem state.
* The satellite service should report the current satellite modem state via
* ISatelliteListener#onSatelliteModemStateChanged.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* the current satellite modem state.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void requestSatelliteModemState(@NonNull IIntegerConsumer errorCallback,
@NonNull ISatelliteModemStateConsumer callback) {
// stub implementation
}
/**
* Request to get whether satellite communication is allowed for the current location.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* whether satellite communication is allowed for the current location.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void requestIsSatelliteCommunicationAllowedForCurrentLocation(
@NonNull IIntegerConsumer errorCallback, @NonNull IBooleanConsumer callback) {
// stub implementation
}
/**
* Request to get the time after which the satellite will be visible. This is an int
* representing the duration in seconds after which the satellite will be visible.
* This will return 0 if the satellite is currently visible.
*
* @param errorCallback The callback to receive the error code result of the operation.
* @param callback If the result is SatelliteError#ERROR_NONE, the callback to receive
* the time after which the satellite will be visible.
*
* Valid error codes returned:
* SatelliteError:ERROR_NONE
* SatelliteError:MODEM_ERROR
* SatelliteError:INVALID_MODEM_STATE
* SatelliteError:INVALID_ARGUMENTS
* SatelliteError:RADIO_NOT_AVAILABLE
* SatelliteError:REQUEST_NOT_SUPPORTED
* SatelliteError:NO_RESOURCES
*/
public void requestTimeForNextSatelliteVisibility(@NonNull IIntegerConsumer errorCallback,
@NonNull IIntegerConsumer callback) {
// stub implementation
}
}

View File

@@ -0,0 +1,32 @@
/*
* 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 android.telephony.satellite.stub;
/**
* {@hide}
*/
@Backing(type="int")
enum SatelliteModemState {
/* Satellite modem is in idle state. */
SATELLITE_MODEM_STATE_IDLE = 0,
/* Satellite modem is listening for incoming messages. */
SATELLITE_MODEM_STATE_LISTENING = 1,
/* Satellite modem is sending and/or receiving messages. */
SATELLITE_MODEM_STATE_MESSAGE_TRANSFERRING = 2,
/* Satellite modem is powered off. */
SATELLITE_MODEM_STATE_OFF = 3,
}

View File

@@ -0,0 +1,63 @@
/*
* 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 android.telephony.satellite.stub;
import android.annotation.SdkConstant;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
/**
* Main SatelliteService implementation, which binds via the Telephony SatelliteServiceController.
* Services that extend SatelliteService must register the service in their AndroidManifest to be
* detected by the framework. First, the application must declare that they use the
* "android.permission.BIND_SATELLITE_SERVICE" permission. Then, the SatelliteService definition in
* the manifest must follow the following format:
*
* ...
* <service android:name=".EgSatelliteService"
* android:permission="android.permission.BIND_SATELLITE_SERVICE" >
* ...
* <intent-filter>
* <action android:name="android.telephony.satellite.SatelliteService" />
* </intent-filter>
* </service>
* ...
*
* The telephony framework will then bind to the SatelliteService defined in the manifest if it is
* the default SatelliteService defined in the device overlay "config_satellite_service_package".
* @hide
*/
public class SatelliteService extends Service {
public static final String TAG = "SatelliteService";
@SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
public static final String SERVICE_INTERFACE = "android.telephony.satellite.SatelliteService";
/**
* @hide
*/
@Override
public IBinder onBind(Intent intent) {
if (SERVICE_INTERFACE.equals(intent.getAction())) {
Log.e(TAG, "SatelliteService bound");
return new SatelliteImplBase(Runnable::run).getBinder();
}
return null;
}
}

View File

@@ -2932,11 +2932,11 @@ interface ITelephony {
in ResultReceiver receiver);
/**
* Request to get the time after which the satellite will next be visible.
* Request to get the time after which the satellite will be visible.
*
* @param subId The subId to get the time after which the satellite will next be visible for.
* @param subId The subId to get the time after which the satellite will be visible for.
* @param receiver Result receiver to get the error code of the request and the requested
* time after which the satellite will next be visible.
* time after which the satellite will be visible.
*/
@JavaPassthrough(annotation="@android.annotation.RequiresPermission("
+ "android.Manifest.permission.SATELLITE_COMMUNICATION)")