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


@@ -224,6 +227,10 @@ public class SatelliteSessionController extends StateMachine {
                Log.d(TAG, "make() existingListeners: " + existingListeners.size());
                Log.d(TAG, "make() existingListeners: " + existingListeners.size());
                sInstance.mListeners.putAll(existingListeners);
                sInstance.mListeners.putAll(existingListeners);
            }
            }
            if (existIgnoreCellularServiceState) {
                Log.d(TAG, "make() existIgnoreCellularServiceState is true");
                sInstance.mIgnoreCellularServiceState = true;
            }
        }
        }
        return sInstance;
        return sInstance;
    }
    }
@@ -467,6 +474,23 @@ public class SatelliteSessionController extends StateMachine {
        return true;
        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.
     * 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);
                    handleSatelliteModemStateChanged(msg);
                    break;
                    break;
                case EVENT_ENABLE_CELLULAR_MODEM_WHILE_SATELLITE_MODE_IS_ON_DONE:
                case EVENT_ENABLE_CELLULAR_MODEM_WHILE_SATELLITE_MODE_IS_ON_DONE:
                    if (!mIgnoreCellularServiceState) {
                        handleEventEnableCellularModemWhileSatelliteModeIsOnDone();
                        handleEventEnableCellularModemWhileSatelliteModeIsOnDone();
                    } else {
                        plogd("IdleState: processing: ignore "
                                + "EVENT_ENABLE_CELLULAR_MODEM_WHILE_SATELLITE_MODE_IS_ON_DONE");
                    }
                    break;
                    break;
                case EVENT_SERVICE_STATE_CHANGED:
                case EVENT_SERVICE_STATE_CHANGED:
                    if (!mIgnoreCellularServiceState) {
                        AsyncResult ar = (msg.obj != null) ? (AsyncResult) msg.obj : null;
                        AsyncResult ar = (msg.obj != null) ? (AsyncResult) msg.obj : null;
                        if (ar == null || ar.result == null) {
                        if (ar == null || ar.result == null) {
                            plogd("IdleState: processing: can't access ServiceState");
                            plogd("IdleState: processing: can't access ServiceState");
@@ -877,6 +907,9 @@ public class SatelliteSessionController extends StateMachine {
                            ServiceState newServiceState = (ServiceState) ar.result;
                            ServiceState newServiceState = (ServiceState) ar.result;
                            handleEventServiceStateChanged(newServiceState);
                            handleEventServiceStateChanged(newServiceState);
                        }
                        }
                    } else {
                        plogd("IdleState: processing: ignore EVENT_SERVICE_STATE_CHANGED");
                    }
                    break;
                    break;
            }
            }
            // Ignore all unexpected events.
            // Ignore all unexpected events.