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

Commit 46599f82 authored by Megha Patil's avatar Megha Patil
Browse files

Allow cellular modem scanning while satellite mode is on.

- Adding a new Api to allow cellular modem while satellite mode is on
BUG: b/276291624

Test: Test: Call/SMS with live network. atest QcomSatelliteServiceTest
atest SatelliteSessionControllerTest
atest android.telephony.cts.SatelliteManagerTest

Change-Id: I5e26165a90c28988518939a193796684cd83ec70
parent 289999e7
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -471,6 +471,44 @@ public class SatelliteModemInterface {
        }
    }

    /**
     * Allow cellular modem scanning while satellite mode is on.
     * @param enabled  {@code true} to enable cellular modem while satellite mode is on
     * and {@code false} to disable
     * @param message The Message to send to result of the operation to.
     */
    public void enableCellularModemWhileSatelliteModeIsOn(boolean enabled,
            @Nullable Message message) {
        if (mSatelliteService != null) {
            try {
                mSatelliteService.enableCellularModemWhileSatelliteModeIsOn(enabled,
                        new IIntegerConsumer.Stub() {
                            @Override
                            public void accept(int result) {
                                int error = SatelliteServiceUtils.fromSatelliteError(result);
                                logd("enableCellularModemWhileSatelliteModeIsOn: " + error);
                                Binder.withCleanCallingIdentity(() -> {
                                        if (message != null) {
                                            sendMessageWithResult(message, null, error);
                                        }
                                });
                            }
                        });
            } catch (RemoteException e) {
                loge("enableCellularModemWhileSatelliteModeIsOn: RemoteException " + e);
                if (message != null) {
                    sendMessageWithResult(
                            message, null, SatelliteManager.SATELLITE_SERVICE_ERROR);
                }
            }
        } else {
            loge("enableCellularModemWhileSatelliteModeIsOn: Satellite service is unavailable.");
            if (message != null) {
                sendMessageWithResult(message, null,
                        SatelliteManager.SATELLITE_RADIO_NOT_AVAILABLE);
            }
        }
    }
    /**
     * Request to enable or disable the satellite modem and demo mode. If the satellite modem
     * is enabled, this may also disable the cellular modem, and if the satellite modem is disabled,
+10 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static android.telephony.satellite.SatelliteManager.SATELLITE_DATAGRAM_TR

import android.annotation.NonNull;
import android.content.Context;
import android.os.AsyncResult;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
@@ -265,6 +266,8 @@ public class SatelliteSessionController extends StateMachine {
            if (DBG) logd("Entering IdleState");
            mIsSendingTriggeredDuringTransferringState.set(false);
            notifyStateChangedEvent(SatelliteManager.SATELLITE_MODEM_STATE_IDLE);
            //Disable Cellular Modem
            mSatelliteModemInterface.enableCellularModemWhileSatelliteModeIsOn(false, null);
        }

        @Override
@@ -290,6 +293,13 @@ public class SatelliteSessionController extends StateMachine {
                transitionTo(mTransferringState);
            }
        }

        @Override
        public void exit() {
            if (DBG) logd("Exiting IdleState");
            //Enable Cellular Modem
            mSatelliteModemInterface.enableCellularModemWhileSatelliteModeIsOn(true, null);
        }
    }

    private class TransferringState extends State {