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

Commit 72d8e961 authored by Joonhun Shin's avatar Joonhun Shin Committed by Android (Google) Code Review
Browse files

Merge "Add interface for CTS test to ignore cellular service state" into main

parents bb4fb8ee 9417c468
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2929,6 +2929,21 @@ public class SatelliteController extends Handler {
        return mSatelliteSessionController.setSatelliteListeningTimeoutDuration(timeoutMillis);
    }

    /**
     * This API can be used by only CTS to control ingoring cellular service state event.
     *
     * @param enabled Whether to enable boolean config.
     * @return {@code true} if the value is set successfully, {@code false} otherwise.
     */
    public boolean setSatelliteIgnoreCellularServiceState(boolean enabled) {
        plogd("setSatelliteIgnoreCellularServiceState - " + enabled);
        if (mSatelliteSessionController == null) {
            ploge("setSatelliteIgnoreCellularServiceState is not initialized yet");
            return false;
        }
        return mSatelliteSessionController.setSatelliteIgnoreCellularServiceState(enabled);
    }

    /**
     * This API can be used by only CTS to override timeout durations used by DatagramController
     * module.
+39 −6
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ public class SatelliteSessionController extends StateMachine {
    private long mSatelliteStayAtListeningFromSendingMillis;
    private long mSatelliteStayAtListeningFromReceivingMillis;
    private long mSatelliteNbIotInactivityTimeoutMillis;
    private boolean mIgnoreCellularServiceState = false;
    private final ConcurrentHashMap<IBinder, ISatelliteModemStateCallback> mListeners;
    @SatelliteManager.SatelliteModemState private int mCurrentState;
    @SatelliteManager.SatelliteModemState private int mPreviousState;
@@ -209,8 +210,10 @@ public class SatelliteSessionController extends StateMachine {
            boolean isSatelliteSupported) {
        if (sInstance == null || isSatelliteSupported != sInstance.mIsSatelliteSupported) {
            ConcurrentHashMap<IBinder, ISatelliteModemStateCallback> existingListeners = null;
            boolean existIgnoreCellularServiceState = false;
            if (sInstance != null) {
                existingListeners = sInstance.mListeners;
                existIgnoreCellularServiceState = sInstance.mIgnoreCellularServiceState;
                sInstance.cleanUpResource();
            }

@@ -224,6 +227,10 @@ public class SatelliteSessionController extends StateMachine {
                Log.d(TAG, "make() existingListeners: " + existingListeners.size());
                sInstance.mListeners.putAll(existingListeners);
            }
            if (existIgnoreCellularServiceState) {
                Log.d(TAG, "make() existIgnoreCellularServiceState is true");
                sInstance.mIgnoreCellularServiceState = true;
            }
        }
        return sInstance;
    }
@@ -467,6 +474,23 @@ public class SatelliteSessionController extends StateMachine {
        return true;
    }

    /**
     * This API can be used by only CTS to control ingoring cellular service state event.
     *
     * @param enabled Whether to enable boolean config.
     * @return {@code true} if the value is set successfully, {@code false} otherwise.
     */
    public boolean setSatelliteIgnoreCellularServiceState(boolean enabled) {
        plogd("setSatelliteIgnoreCellularServiceState : "
                + "old = " + mIgnoreCellularServiceState + " new : " + enabled);
        if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
            return false;
        }

        mIgnoreCellularServiceState = enabled;
        return true;
    }

    /**
     * This API can be used by only CTS to update satellite gateway service package name.
     *
@@ -867,9 +891,15 @@ public class SatelliteSessionController extends StateMachine {
                    handleSatelliteModemStateChanged(msg);
                    break;
                case EVENT_ENABLE_CELLULAR_MODEM_WHILE_SATELLITE_MODE_IS_ON_DONE:
                    if (!mIgnoreCellularServiceState) {
                        handleEventEnableCellularModemWhileSatelliteModeIsOnDone();
                    } else {
                        plogd("IdleState: processing: ignore "
                                + "EVENT_ENABLE_CELLULAR_MODEM_WHILE_SATELLITE_MODE_IS_ON_DONE");
                    }
                    break;
                case EVENT_SERVICE_STATE_CHANGED:
                    if (!mIgnoreCellularServiceState) {
                        AsyncResult ar = (msg.obj != null) ? (AsyncResult) msg.obj : null;
                        if (ar == null || ar.result == null) {
                            plogd("IdleState: processing: can't access ServiceState");
@@ -877,6 +907,9 @@ public class SatelliteSessionController extends StateMachine {
                            ServiceState newServiceState = (ServiceState) ar.result;
                            handleEventServiceStateChanged(newServiceState);
                        }
                    } else {
                        plogd("IdleState: processing: ignore EVENT_SERVICE_STATE_CHANGED");
                    }
                    break;
            }
            // Ignore all unexpected events.