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

Commit abb30cfa authored by Hakjun Choi's avatar Hakjun Choi
Browse files

new public API/AIDL get and callback report signal strength

new public API/AIDL get and callback report signal strength

Bug: 301511156
Test: SatelliteManagerTest, SatelliteControllerTest
Change-Id: I8d8f6b6b87a5ac629a6a339259677473c8c5f5c3
parent 0f177949
Loading
Loading
Loading
Loading
+225 −3
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ 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.NtnSignalStrength.NTN_SIGNAL_STRENGTH_NONE;
import static android.telephony.satellite.SatelliteManager.KEY_NTN_SIGNAL_STRENGTH;
import static android.telephony.satellite.SatelliteManager.SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS;

@@ -55,10 +57,12 @@ import android.telephony.CarrierConfigManager;
import android.telephony.Rlog;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.satellite.INtnSignalStrengthCallback;
import android.telephony.satellite.ISatelliteDatagramCallback;
import android.telephony.satellite.ISatelliteProvisionStateCallback;
import android.telephony.satellite.ISatelliteStateCallback;
import android.telephony.satellite.ISatelliteTransmissionUpdateCallback;
import android.telephony.satellite.NtnSignalStrength;
import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteDatagram;
import android.telephony.satellite.SatelliteManager;
@@ -138,6 +142,11 @@ public class SatelliteController extends Handler {
    private static final int EVENT_SET_SATELLITE_PLMN_INFO_DONE = 29;
    private static final int CMD_EVALUATE_SATELLITE_ATTACH_RESTRICTION_CHANGE = 30;
    private static final int EVENT_EVALUATE_SATELLITE_ATTACH_RESTRICTION_CHANGE_DONE = 31;
    private static final int CMD_REQUEST_NTN_SIGNAL_STRENGTH = 32;
    private static final int EVENT_REQUEST_NTN_SIGNAL_STRENGTH_DONE = 33;
    private static final int EVENT_NTN_SIGNAL_STRENGTH_CHANGED = 34;
    private static final int CMD_START_SENDING_NTN_SIGNAL_STRENGTH = 35;
    private static final int EVENT_START_SENDING_NTN_SIGNAL_STRENGTH_DONE = 36;

    @NonNull private static SatelliteController sInstance;
    @NonNull private final Context mContext;
@@ -187,6 +196,7 @@ public class SatelliteController extends Handler {
            new AtomicBoolean(false);
    private final AtomicBoolean mRegisteredForSatelliteModemStateChangedWithSatelliteService =
            new AtomicBoolean(false);
    private final AtomicBoolean mRegisteredForNtnSignalStrengthChanged = new AtomicBoolean(false);
    /**
     * Map key: subId, value: callback to get error code of the provision request.
     */
@@ -198,6 +208,12 @@ public class SatelliteController extends Handler {
     */
    private final ConcurrentHashMap<IBinder, ISatelliteProvisionStateCallback>
            mSatelliteProvisionStateChangedListeners = new ConcurrentHashMap<>();
    /**
     * Map key: binder of the callback, value: callback to receive non-terrestrial signal strength
     * state changed events.
     */
    private final ConcurrentHashMap<IBinder, INtnSignalStrengthCallback>
            mNtnSignalStrengthChangedListeners = new ConcurrentHashMap<>();
    private final Object mIsSatelliteSupportedLock = new Object();
    @GuardedBy("mIsSatelliteSupportedLock")
    private Boolean mIsSatelliteSupported = null;
@@ -215,6 +231,10 @@ public class SatelliteController extends Handler {
    private final Object mNeedsSatellitePointingLock = new Object();
    @GuardedBy("mNeedsSatellitePointingLock")
    private boolean mNeedsSatellitePointing = false;
    private final Object mNtnSignalsStrengthLock = new Object();
    @GuardedBy("mNtnSignalsStrengthLock")
    private NtnSignalStrength mNtnSignalStrength =
            new NtnSignalStrength(NTN_SIGNAL_STRENGTH_NONE);
    /** Key: subId, value: (key: PLMN, value: set of
     * {@link android.telephony.NetworkRegistrationInfo.ServiceType})
     */
@@ -1054,6 +1074,88 @@ public class SatelliteController extends Handler {
                break;
            }

            case CMD_REQUEST_NTN_SIGNAL_STRENGTH: {
                logd("CMD_REQUEST_NTN_SIGNAL_STRENGTH");
                request = (SatelliteControllerHandlerRequest) msg.obj;
                onCompleted = obtainMessage(EVENT_REQUEST_NTN_SIGNAL_STRENGTH_DONE, request);
                mSatelliteModemInterface.requestNtnSignalStrength(onCompleted);
                break;
            }

            case EVENT_REQUEST_NTN_SIGNAL_STRENGTH_DONE: {
                ar = (AsyncResult) msg.obj;
                request = (SatelliteControllerHandlerRequest) ar.userObj;
                ResultReceiver result = (ResultReceiver) request.argument;
                int errorCode =  SatelliteServiceUtils.getSatelliteError(ar,
                        "requestNtnSignalStrength");
                if (errorCode == SATELLITE_RESULT_SUCCESS) {
                    NtnSignalStrength ntnSignalStrength = (NtnSignalStrength) ar.result;
                    if (ntnSignalStrength != null) {
                        synchronized (mNtnSignalsStrengthLock) {
                            mNtnSignalStrength = ntnSignalStrength;
                        }
                        Bundle bundle = new Bundle();
                        bundle.putParcelable(KEY_NTN_SIGNAL_STRENGTH, ntnSignalStrength);
                        result.send(SATELLITE_RESULT_SUCCESS, bundle);
                    } else {
                        synchronized (mNtnSignalsStrengthLock) {
                            if (mNtnSignalStrength.getLevel() != NTN_SIGNAL_STRENGTH_NONE) {
                                mNtnSignalStrength = new NtnSignalStrength(
                                        NTN_SIGNAL_STRENGTH_NONE);
                            }
                        }
                        loge("EVENT_REQUEST_NTN_SIGNAL_STRENGTH_DONE: ntnSignalStrength is null");
                        result.send(SatelliteManager.SATELLITE_RESULT_REQUEST_FAILED, null);
                    }
                } else {
                    synchronized (mNtnSignalsStrengthLock) {
                        if (mNtnSignalStrength.getLevel() != NTN_SIGNAL_STRENGTH_NONE) {
                            mNtnSignalStrength = new NtnSignalStrength(NTN_SIGNAL_STRENGTH_NONE);
                        }
                    }
                    result.send(errorCode, null);
                }
                break;
            }

            case EVENT_NTN_SIGNAL_STRENGTH_CHANGED: {
                ar = (AsyncResult) msg.obj;
                if (ar.result == null) {
                    loge("EVENT_NTN_SIGNAL_STRENGTH_CHANGED: result is null");
                } else {
                    handleEventNtnSignalStrengthChanged((NtnSignalStrength) ar.result);
                }
                break;
            }

            case CMD_START_SENDING_NTN_SIGNAL_STRENGTH: {
                logd("CMD_START_SENDING_NTN_SIGNAL_STRENGTH");
                request = (SatelliteControllerHandlerRequest) msg.obj;
                boolean startSendingNtnSignalStrength =  (boolean) request.argument;
                if (mSatelliteModemInterface.isSatelliteServiceSupported()) {
                    onCompleted = obtainMessage(EVENT_START_SENDING_NTN_SIGNAL_STRENGTH_DONE,
                            request);
                    if (startSendingNtnSignalStrength) {
                        mSatelliteModemInterface.startSendingNtnSignalStrength(onCompleted);
                    } else {
                        mSatelliteModemInterface.stopSendingNtnSignalStrength(onCompleted);
                    }
                }
                break;
            }

            case EVENT_START_SENDING_NTN_SIGNAL_STRENGTH_DONE: {
                ar = (AsyncResult) msg.obj;
                request = (SatelliteControllerHandlerRequest) ar.userObj;
                int errorCode =  SatelliteServiceUtils.getSatelliteError(ar,
                        "EVENT_START_SENDING_NTN_SIGNAL_STRENGTH_DONE");
                if (errorCode != SATELLITE_RESULT_SUCCESS) {
                    loge(((boolean) request.argument ? "startSendingNtnSignalStrength"
                            : "stopSendingNtnSignalStrength") + "returns " + errorCode);
                }
                break;
            }

            default:
                Log.w(TAG, "SatelliteControllerHandler: unexpected message code: " +
                        msg.what);
@@ -1686,6 +1788,8 @@ public class SatelliteController extends Handler {
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
            result.accept(SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED);
            logd("addSatelliteAttachRestrictionForCarrier: carrierEnabledSatelliteFlag is "
                    + "disabled");
            return;
        }

@@ -1723,6 +1827,8 @@ public class SatelliteController extends Handler {
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
            result.accept(SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED);
            logd("removeSatelliteAttachRestrictionForCarrier: carrierEnabledSatelliteFlag is "
                    + "disabled");
            return;
        }

@@ -1764,6 +1870,75 @@ public class SatelliteController extends Handler {
        }
    }

    /**
     * Request to get the signal strength of the satellite connection.
     *
     * @param subId The subId of the subscription to request for.
     * @param result Result receiver to get the error code of the request and the current signal
     * strength of the satellite connection.
     */
    public void requestNtnSignalStrength(int subId, @NonNull ResultReceiver result) {
        if (DBG) logd("requestNtnSignalStrength()");

        int error = evaluateOemSatelliteRequestAllowed(true);
        if (error != SATELLITE_RESULT_SUCCESS) {
            result.send(error, null);
            return;
        }

        /* In case cache is available, it is not needed to request non-terrestrial signal strength
        to modem */
        synchronized (mNtnSignalsStrengthLock) {
            if (mNtnSignalStrength.getLevel() != NTN_SIGNAL_STRENGTH_NONE) {
                Bundle bundle = new Bundle();
                bundle.putParcelable(KEY_NTN_SIGNAL_STRENGTH, mNtnSignalStrength);
                result.send(SATELLITE_RESULT_SUCCESS, bundle);
                return;
            }
        }

        Phone phone = SatelliteServiceUtils.getPhone();
        sendRequestAsync(CMD_REQUEST_NTN_SIGNAL_STRENGTH, result, phone);
    }

    /**
     * Registers for NTN signal strength changed from satellite modem.
     *
     * @param subId The subId of the subscription to request for.
     * @param callback The callback to handle the non-terrestrial network signal strength changed
     * event.
     *
     * @return The {@link SatelliteManager.SatelliteResult} result of the operation.
     */
    @SatelliteManager.SatelliteResult public int registerForNtnSignalStrengthChanged(
            int subId, @NonNull INtnSignalStrengthCallback callback) {
        if (DBG) logd("registerForNtnSignalStrengthChanged()");

        int error = evaluateOemSatelliteRequestAllowed(true);
        if (error != SATELLITE_RESULT_SUCCESS) return error;

        mNtnSignalStrengthChangedListeners.put(callback.asBinder(), callback);
        return SATELLITE_RESULT_SUCCESS;
    }

    /**
     * Unregisters for NTN signal strength changed from satellite modem.
     * If callback was not registered before, the request will be ignored.
     *
     * @param subId The subId of the subscription to unregister for provision state changed.
     * @param callback The callback that was passed to
     * {@link #registerForNtnSignalStrengthChanged(int, INtnSignalStrengthCallback)}
     */
    public void unregisterForNtnSignalStrengthChanged(
            int subId, @NonNull INtnSignalStrengthCallback callback) {
        if (DBG) logd("unregisterForNtnSignalStrengthChanged()");

        int error = evaluateOemSatelliteRequestAllowed(true);
        if (error == SATELLITE_RESULT_SUCCESS) {
            mNtnSignalStrengthChangedListeners.remove(callback.asBinder());
        }
    }

    /**
     * This API can be used by only CTS to update satellite vendor service package name.
     *
@@ -1907,6 +2082,7 @@ public class SatelliteController extends Handler {
     */
    public void onCellularRadioPowerOffRequested() {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            logd("onCellularRadioPowerOffRequested: oemEnabledSatelliteFlag is disabled");
            return;
        }

@@ -1987,6 +2163,7 @@ public class SatelliteController extends Handler {
     */
    public boolean isSatelliteAttachRequired() {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            logd("isSatelliteAttachRequired: oemEnabledSatelliteFlag is disabled");
            return false;
        }

@@ -2195,6 +2372,7 @@ public class SatelliteController extends Handler {
            registerForSatelliteProvisionStateChanged();
            registerForPendingDatagramCount();
            registerForSatelliteModemStateChanged();
            registerForNtnSignalStrengthChanged();

            requestIsSatelliteProvisioned(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID,
                    new ResultReceiver(this) {
@@ -2263,6 +2441,21 @@ public class SatelliteController extends Handler {
        }
    }

    private void registerForNtnSignalStrengthChanged() {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            logd("registerForNtnSignalStrengthChanged: oemEnabledSatelliteFlag is disabled");
            return;
        }

        if (mSatelliteModemInterface.isSatelliteServiceSupported()) {
            if (!mRegisteredForNtnSignalStrengthChanged.get()) {
                mSatelliteModemInterface.registerForNtnSignalStrengthChanged(
                        this, EVENT_NTN_SIGNAL_STRENGTH_CHANGED, null);
                mRegisteredForNtnSignalStrengthChanged.set(true);
            }
        }
    }

    private void handleEventSatelliteProvisionStateChanged(boolean provisioned) {
        logd("handleSatelliteProvisionStateChangedEvent: provisioned=" + provisioned);

@@ -2270,16 +2463,16 @@ public class SatelliteController extends Handler {
            mIsSatelliteProvisioned = provisioned;
        }

        List<ISatelliteProvisionStateCallback> toBeRemoved = new ArrayList<>();
        List<ISatelliteProvisionStateCallback> deadCallersList = new ArrayList<>();
        mSatelliteProvisionStateChangedListeners.values().forEach(listener -> {
            try {
                listener.onSatelliteProvisionStateChanged(provisioned);
            } catch (RemoteException e) {
                logd("handleSatelliteProvisionStateChangedEvent RemoteException: " + e);
                toBeRemoved.add(listener);
                deadCallersList.add(listener);
            }
        });
        toBeRemoved.forEach(listener -> {
        deadCallersList.forEach(listener -> {
            mSatelliteProvisionStateChangedListeners.remove(listener.asBinder());
        });
    }
@@ -2320,6 +2513,31 @@ public class SatelliteController extends Handler {
        }
    }

    private void handleEventNtnSignalStrengthChanged(NtnSignalStrength ntnSignalStrength) {
        logd("handleEventNtnSignalStrengthChanged: ntnSignalStrength=" + ntnSignalStrength);
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            logd("handleEventNtnSignalStrengthChanged: oemEnabledSatelliteFlag is disabled");
            return;
        }

        synchronized (mNtnSignalsStrengthLock) {
            mNtnSignalStrength = ntnSignalStrength;
        }

        List<INtnSignalStrengthCallback> deadCallersList = new ArrayList<>();
        mNtnSignalStrengthChangedListeners.values().forEach(listener -> {
            try {
                listener.onNtnSignalStrengthChanged(ntnSignalStrength);
            } catch (RemoteException e) {
                logd("handleEventNtnSignalStrengthChanged RemoteException: " + e);
                deadCallersList.add(listener);
            }
        });
        deadCallersList.forEach(listener -> {
            mNtnSignalStrengthChangedListeners.remove(listener.asBinder());
        });
    }

    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    protected void setSettingsKeyForSatelliteMode(int val) {
        logd("setSettingsKeyForSatelliteMode val: " + val);
@@ -2396,6 +2614,7 @@ public class SatelliteController extends Handler {
    private void configureSatellitePlmnForCarrier(int subId) {
        logd("configureSatellitePlmnForCarrier");
        if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
            logd("configureSatellitePlmnForCarrier: carrierEnabledSatelliteFlag is disabled");
            return;
        }
        synchronized (mSupportedSatelliteServicesLock) {
@@ -2421,6 +2640,8 @@ public class SatelliteController extends Handler {

    private void updateSupportedSatelliteServicesForActiveSubscriptions() {
        if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
            logd("updateSupportedSatelliteServicesForActiveSubscriptions: "
                    + "carrierEnabledSatelliteFlag is disabled");
            return;
        }

@@ -2448,6 +2669,7 @@ public class SatelliteController extends Handler {
    @NonNull
    private List<String> readSatellitePlmnsFromOverlayConfig() {
        if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
            logd("readSatellitePlmnsFromOverlayConfig: carrierEnabledSatelliteFlag is disabled");
            return new ArrayList<>();
        }

+128 −0
Original line number Diff line number Diff line
@@ -31,10 +31,12 @@ import android.os.Message;
import android.os.RegistrantList;
import android.os.RemoteException;
import android.telephony.Rlog;
import android.telephony.satellite.NtnSignalStrength;
import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteDatagram;
import android.telephony.satellite.SatelliteManager;
import android.telephony.satellite.SatelliteManager.SatelliteException;
import android.telephony.satellite.stub.INtnSignalStrengthConsumer;
import android.telephony.satellite.stub.ISatellite;
import android.telephony.satellite.stub.ISatelliteCapabilitiesConsumer;
import android.telephony.satellite.stub.ISatelliteListener;
@@ -87,6 +89,8 @@ public class SatelliteModemInterface {
    @NonNull private final RegistrantList mPendingDatagramsRegistrants = new RegistrantList();
    @NonNull private final RegistrantList mSatelliteDatagramsReceivedRegistrants =
            new RegistrantList();
    @NonNull private final RegistrantList mNtnSignalStrengthChangedRegistrants =
            new RegistrantList();

    @NonNull private final ISatelliteListener mListener = new ISatelliteListener.Stub() {
        @Override
@@ -136,6 +140,13 @@ public class SatelliteModemInterface {
            }
            mDatagramTransferStateChangedRegistrants.notifyResult(datagramTransferState);
        }

        @Override
        public void onNtnSignalStrengthChanged(
                android.telephony.satellite.stub.NtnSignalStrength ntnSignalStrength) {
            mNtnSignalStrengthChangedRegistrants.notifyResult(
                    SatelliteServiceUtils.fromModemInterface(ntnSignalStrength));
        }
    };

    /**
@@ -440,6 +451,27 @@ public class SatelliteModemInterface {
        mSatelliteDatagramsReceivedRegistrants.remove(h);
    }

    /**
     * Registers for non-terrestrial signal strength level changed.
     *
     * @param h Handler for notification message.
     * @param what User-defined message code.
     * @param obj User object.
     */
    public void registerForNtnSignalStrengthChanged(
            @NonNull Handler h, int what, @Nullable Object obj) {
        mNtnSignalStrengthChangedRegistrants.add(h, what, obj);
    }

    /**
     * Unregisters for non-terrestrial signal strength level changed.
     *
     * @param h Handler to be removed from the registrant list.
     */
    public void unregisterForNtnSignalStrengthChanged(@NonNull Handler h) {
        mNtnSignalStrengthChangedRegistrants.remove(h);
    }

    /**
     * Request to enable or disable the satellite service listening mode.
     * Listening mode allows the satellite service to listen for incoming pages.
@@ -1153,6 +1185,102 @@ public class SatelliteModemInterface {
        }
    }

    /**
     * Request to get the signal strength of the satellite connection.
     *
     * @param message The Message to send to result of the operation to.
     */
    public void requestNtnSignalStrength(@NonNull Message message) {
        if (mSatelliteService != null) {
            try {
                mSatelliteService.requestSignalStrength(
                        new IIntegerConsumer.Stub() {
                            @Override
                            public void accept(int result) {
                                int error = SatelliteServiceUtils.fromSatelliteError(result);
                                logd("requestNtnSignalStrength: " + error);
                                Binder.withCleanCallingIdentity(() ->
                                        sendMessageWithResult(message, null, error));
                            }
                        }, new INtnSignalStrengthConsumer.Stub() {
                            @Override
                            public void accept(NtnSignalStrength result) {
                                logd("requestNtnSignalStrength: " + result);
                                Binder.withCleanCallingIdentity(() -> sendMessageWithResult(
                                        message, result,
                                        SatelliteManager.SATELLITE_RESULT_SUCCESS));
                            }
                        });
            } catch (RemoteException e) {
                loge("requestNtnSignalStrength: RemoteException " + e);
                sendMessageWithResult(message, null,
                        SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR);
            }
        } else {
            loge("requestNtnSignalStrength: Satellite service is unavailable.");
            sendMessageWithResult(message, null,
                    SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE);
        }
    }

    /**
     * The satellite service should report the NTN signal strength via
     * ISatelliteListener#onNtnSignalStrengthChanged when the NTN signal strength changes.
     *
     * @param message The Message to send to result of the operation to.
     */
    public void startSendingNtnSignalStrength(@NonNull Message message) {
        if (mSatelliteService != null) {
            try {
                mSatelliteService.startSendingNtnSignalStrength(new IIntegerConsumer.Stub() {
                    @Override
                    public void accept(int result) {
                        int error = SatelliteServiceUtils.fromSatelliteError(result);
                        logd("startSendingNtnSignalStrength: " + error);
                        Binder.withCleanCallingIdentity(() ->
                                sendMessageWithResult(message, null, error));
                    }
                });
            } catch (RemoteException e) {
                loge("startSendingNtnSignalStrength: RemoteException " + e);
                sendMessageWithResult(message, null,
                        SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR);
            }
        } else {
            loge("startSendingNtnSignalStrength: Satellite service is unavailable.");
            sendMessageWithResult(message, null,
                    SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE);
        }
    }

    /**
     * The satellite service should stop reporting NTN signal strength to the framework.
     *
     * @param message The Message to send to result of the operation to.
     */
    public void stopSendingNtnSignalStrength(@NonNull Message message) {
        if (mSatelliteService != null) {
            try {
                mSatelliteService.stopSendingNtnSignalStrength(new IIntegerConsumer.Stub() {
                    @Override
                    public void accept(int result) {
                        int error = SatelliteServiceUtils.fromSatelliteError(result);
                        logd("stopSendingNtnSignalStrength: " + error);
                        Binder.withCleanCallingIdentity(() ->
                                sendMessageWithResult(message, null, error));
                    }
                });
            } catch (RemoteException e) {
                loge("stopSendingNtnSignalStrength: RemoteException " + e);
                sendMessageWithResult(message, null,
                        SatelliteManager.SATELLITE_RESULT_SERVICE_ERROR);
            }
        } else {
            loge("stopSendingNtnSignalStrength: Satellite service is unavailable.");
            sendMessageWithResult(message, null,
                    SatelliteManager.SATELLITE_RESULT_RADIO_NOT_AVAILABLE);
        }
    }

    public boolean isSatelliteServiceSupported() {
        return mIsSatelliteServiceSupported;
+11 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.telephony.NetworkRegistrationInfo;
import android.telephony.Rlog;
import android.telephony.SubscriptionManager;
import android.telephony.satellite.AntennaPosition;
import android.telephony.satellite.NtnSignalStrength;
import android.telephony.satellite.PointingInfo;
import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteDatagram;
@@ -211,6 +212,16 @@ public class SatelliteServiceUtils {
        return new SatelliteDatagram(data);
    }

    /**
     * Convert non-terrestrial signal strength from service definition to framework definition.
     * @param ntnSignalStrength The non-terrestrial signal strength from the satellite service.
     * @return The converted non-terrestrial signal strength for the framework.
     */
    @Nullable public static NtnSignalStrength fromModemInterface(
            android.telephony.satellite.stub.NtnSignalStrength ntnSignalStrength) {
        return new NtnSignalStrength(ntnSignalStrength.signalStrengthLevel);
    }

    /**
     * Convert SatelliteDatagram from framework definition to service definition.
     * @param datagram The SatelliteDatagram from the framework.
+281 −1

File changed.

Preview size limit exceeded, changes collapsed.