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

Commit 11d15503 authored by Thomas Nguyen's avatar Thomas Nguyen
Browse files

Guard satellite code with feature flags

Bug: 301713420
Test: SMS, MMS, call with live network
atest SatelliteControllerTest SatelliteSOSMessageRecommenderTest
atest SatelliteManagerTestOnMockService SatelliteManagerTest
atest android.telephony.ims.cts.ImsCallingTest

Change-Id: I02df4475d781b72b6dab82c24481462966be21ae
parent 3c81fa92
Loading
Loading
Loading
Loading
+110 −1
Original line number Original line Diff line number Diff line
@@ -1194,8 +1194,11 @@ public class SatelliteController extends Handler {
            @NonNull IIntegerConsumer callback) {
            @NonNull IIntegerConsumer callback) {
        logd("requestSatelliteEnabled subId: " + subId + " enableSatellite: " + enableSatellite
        logd("requestSatelliteEnabled subId: " + subId + " enableSatellite: " + enableSatellite
                + " enableDemoMode: " + enableDemoMode);
                + " enableDemoMode: " + enableDemoMode);

        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED);
            return;
        }


        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
@@ -1286,6 +1289,10 @@ public class SatelliteController extends Handler {
     *               if the request is successful or an error code if the request failed.
     *               if the request is successful or an error code if the request failed.
     */
     */
    public void requestIsSatelliteEnabled(int subId, @NonNull ResultReceiver result) {
    public void requestIsSatelliteEnabled(int subId, @NonNull ResultReceiver result) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null);
            return;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
@@ -1316,6 +1323,9 @@ public class SatelliteController extends Handler {
     * @return {@code true} if the satellite modem is enabled and {@code false} otherwise.
     * @return {@code true} if the satellite modem is enabled and {@code false} otherwise.
     */
     */
    public boolean isSatelliteEnabled() {
    public boolean isSatelliteEnabled() {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return false;
        }
        if (mIsSatelliteEnabled == null) return false;
        if (mIsSatelliteEnabled == null) return false;
        return mIsSatelliteEnabled;
        return mIsSatelliteEnabled;
    }
    }
@@ -1329,6 +1339,10 @@ public class SatelliteController extends Handler {
     *               if the request is successful or an error code if the request failed.
     *               if the request is successful or an error code if the request failed.
     */
     */
    public void requestIsDemoModeEnabled(int subId, @NonNull ResultReceiver result) {
    public void requestIsDemoModeEnabled(int subId, @NonNull ResultReceiver result) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null);
            return;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
@@ -1360,6 +1374,9 @@ public class SatelliteController extends Handler {
     * @return {@code true} if the satellite demo mode is enabled and {@code false} otherwise.
     * @return {@code true} if the satellite demo mode is enabled and {@code false} otherwise.
     */
     */
    public boolean isDemoModeEnabled() {
    public boolean isDemoModeEnabled() {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return false;
        }
        return mIsDemoModeEnabled;
        return mIsDemoModeEnabled;
    }
    }


@@ -1371,6 +1388,10 @@ public class SatelliteController extends Handler {
     *               the device if the request is successful or an error code if the request failed.
     *               the device if the request is successful or an error code if the request failed.
     */
     */
    public void requestIsSatelliteSupported(int subId, @NonNull ResultReceiver result) {
    public void requestIsSatelliteSupported(int subId, @NonNull ResultReceiver result) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null);
            return;
        }
        synchronized (mIsSatelliteSupportedLock) {
        synchronized (mIsSatelliteSupportedLock) {
            if (mIsSatelliteSupported != null) {
            if (mIsSatelliteSupported != null) {
                /* We have already successfully queried the satellite modem. */
                /* We have already successfully queried the satellite modem. */
@@ -1392,6 +1413,10 @@ public class SatelliteController extends Handler {
     *               if the request is successful or an error code if the request failed.
     *               if the request is successful or an error code if the request failed.
     */
     */
    public void requestSatelliteCapabilities(int subId, @NonNull ResultReceiver result) {
    public void requestSatelliteCapabilities(int subId, @NonNull ResultReceiver result) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null);
            return;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
@@ -1428,6 +1453,10 @@ public class SatelliteController extends Handler {
            @NonNull IIntegerConsumer errorCallback,
            @NonNull IIntegerConsumer errorCallback,
            @NonNull ISatelliteTransmissionUpdateCallback callback) {
            @NonNull ISatelliteTransmissionUpdateCallback callback) {
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(errorCallback::accept);
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(errorCallback::accept);
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED);
            return;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
            result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
@@ -1467,6 +1496,10 @@ public class SatelliteController extends Handler {
    public void stopSatelliteTransmissionUpdates(int subId, @NonNull IIntegerConsumer errorCallback,
    public void stopSatelliteTransmissionUpdates(int subId, @NonNull IIntegerConsumer errorCallback,
            @NonNull ISatelliteTransmissionUpdateCallback callback) {
            @NonNull ISatelliteTransmissionUpdateCallback callback) {
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(errorCallback::accept);
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(errorCallback::accept);
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED);
            return;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
            result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
@@ -1515,6 +1548,10 @@ public class SatelliteController extends Handler {
            @NonNull String token, @NonNull byte[] provisionData,
            @NonNull String token, @NonNull byte[] provisionData,
            @NonNull IIntegerConsumer callback) {
            @NonNull IIntegerConsumer callback) {
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED);
            return null;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
            result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
@@ -1566,6 +1603,10 @@ public class SatelliteController extends Handler {
    public void deprovisionSatelliteService(int subId,
    public void deprovisionSatelliteService(int subId,
            @NonNull String token, @NonNull IIntegerConsumer callback) {
            @NonNull String token, @NonNull IIntegerConsumer callback) {
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED);
            return;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
            result.accept(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE);
@@ -1603,6 +1644,9 @@ public class SatelliteController extends Handler {
     */
     */
    @SatelliteManager.SatelliteResult public int registerForSatelliteProvisionStateChanged(
    @SatelliteManager.SatelliteResult public int registerForSatelliteProvisionStateChanged(
            int subId, @NonNull ISatelliteProvisionStateCallback callback) {
            int subId, @NonNull ISatelliteProvisionStateCallback callback) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            return SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE;
            return SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE;
@@ -1625,6 +1669,9 @@ public class SatelliteController extends Handler {
     */
     */
    public void unregisterForSatelliteProvisionStateChanged(
    public void unregisterForSatelliteProvisionStateChanged(
            int subId, @NonNull ISatelliteProvisionStateCallback callback) {
            int subId, @NonNull ISatelliteProvisionStateCallback callback) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return;
        }
        mSatelliteProvisionStateChangedListeners.remove(callback.asBinder());
        mSatelliteProvisionStateChangedListeners.remove(callback.asBinder());
    }
    }


@@ -1637,6 +1684,10 @@ public class SatelliteController extends Handler {
     *               request failed.
     *               request failed.
     */
     */
    public void requestIsSatelliteProvisioned(int subId, @NonNull ResultReceiver result) {
    public void requestIsSatelliteProvisioned(int subId, @NonNull ResultReceiver result) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null);
            return;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
@@ -1670,6 +1721,9 @@ public class SatelliteController extends Handler {
     */
     */
    @SatelliteManager.SatelliteResult public int registerForSatelliteModemStateChanged(int subId,
    @SatelliteManager.SatelliteResult public int registerForSatelliteModemStateChanged(int subId,
            @NonNull ISatelliteStateCallback callback) {
            @NonNull ISatelliteStateCallback callback) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED;
        }
        if (mSatelliteSessionController != null) {
        if (mSatelliteSessionController != null) {
            mSatelliteSessionController.registerForSatelliteModemStateChanged(callback);
            mSatelliteSessionController.registerForSatelliteModemStateChanged(callback);
        } else {
        } else {
@@ -1690,6 +1744,9 @@ public class SatelliteController extends Handler {
     */
     */
    public void unregisterForSatelliteModemStateChanged(int subId,
    public void unregisterForSatelliteModemStateChanged(int subId,
            @NonNull ISatelliteStateCallback callback) {
            @NonNull ISatelliteStateCallback callback) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return;
        }
        if (mSatelliteSessionController != null) {
        if (mSatelliteSessionController != null) {
            mSatelliteSessionController.unregisterForSatelliteModemStateChanged(callback);
            mSatelliteSessionController.unregisterForSatelliteModemStateChanged(callback);
        } else {
        } else {
@@ -1708,6 +1765,9 @@ public class SatelliteController extends Handler {
     */
     */
    @SatelliteManager.SatelliteResult public int registerForSatelliteDatagram(int subId,
    @SatelliteManager.SatelliteResult public int registerForSatelliteDatagram(int subId,
            @NonNull ISatelliteDatagramCallback callback) {
            @NonNull ISatelliteDatagramCallback callback) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED;
        }
        return mDatagramController.registerForSatelliteDatagram(subId, callback);
        return mDatagramController.registerForSatelliteDatagram(subId, callback);
    }
    }


@@ -1721,6 +1781,9 @@ public class SatelliteController extends Handler {
     */
     */
    public void unregisterForSatelliteDatagram(int subId,
    public void unregisterForSatelliteDatagram(int subId,
            @NonNull ISatelliteDatagramCallback callback) {
            @NonNull ISatelliteDatagramCallback callback) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return;
        }
        mDatagramController.unregisterForSatelliteDatagram(subId, callback);
        mDatagramController.unregisterForSatelliteDatagram(subId, callback);
    }
    }


@@ -1737,6 +1800,10 @@ public class SatelliteController extends Handler {
     */
     */
    public void pollPendingSatelliteDatagrams(int subId, @NonNull IIntegerConsumer callback) {
    public void pollPendingSatelliteDatagrams(int subId, @NonNull IIntegerConsumer callback) {
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED);
            return;
        }


        Boolean satelliteProvisioned = isSatelliteProvisioned();
        Boolean satelliteProvisioned = isSatelliteProvisioned();
        if (satelliteProvisioned == null) {
        if (satelliteProvisioned == null) {
@@ -1772,6 +1839,10 @@ public class SatelliteController extends Handler {
            SatelliteDatagram datagram, boolean needFullScreenPointingUI,
            SatelliteDatagram datagram, boolean needFullScreenPointingUI,
            @NonNull IIntegerConsumer callback) {
            @NonNull IIntegerConsumer callback) {
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        Consumer<Integer> result = FunctionalUtils.ignoreRemoteException(callback::accept);
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.accept(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED);
            return;
        }


        Boolean satelliteProvisioned = isSatelliteProvisioned();
        Boolean satelliteProvisioned = isSatelliteProvisioned();
        if (satelliteProvisioned == null) {
        if (satelliteProvisioned == null) {
@@ -1806,6 +1877,10 @@ public class SatelliteController extends Handler {
     */
     */
    public void requestIsSatelliteCommunicationAllowedForCurrentLocation(int subId,
    public void requestIsSatelliteCommunicationAllowedForCurrentLocation(int subId,
            @NonNull ResultReceiver result) {
            @NonNull ResultReceiver result) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null);
            return;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
@@ -1828,6 +1903,10 @@ public class SatelliteController extends Handler {
     *               be visible if the request is successful or an error code if the request failed.
     *               be visible if the request is successful or an error code if the request failed.
     */
     */
    public void requestTimeForNextSatelliteVisibility(int subId, @NonNull ResultReceiver result) {
    public void requestTimeForNextSatelliteVisibility(int subId, @NonNull ResultReceiver result) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            result.send(SatelliteManager.SATELLITE_RESULT_NOT_SUPPORTED, null);
            return;
        }
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        Boolean satelliteSupported = isSatelliteSupportedInternal();
        if (satelliteSupported == null) {
        if (satelliteSupported == null) {
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
            result.send(SatelliteManager.SATELLITE_RESULT_INVALID_TELEPHONY_STATE, null);
@@ -1859,6 +1938,9 @@ public class SatelliteController extends Handler {
     * @param isAligned {@true} means device is aligned with the satellite, otherwise {@false}.
     * @param isAligned {@true} means device is aligned with the satellite, otherwise {@false}.
     */
     */
    public void setDeviceAlignedWithSatellite(@NonNull int subId, @NonNull boolean isAligned) {
    public void setDeviceAlignedWithSatellite(@NonNull int subId, @NonNull boolean isAligned) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return;
        }
        mDatagramController.setDeviceAlignedWithSatellite(isAligned);
        mDatagramController.setDeviceAlignedWithSatellite(isAligned);
    }
    }


@@ -1965,6 +2047,9 @@ public class SatelliteController extends Handler {
     * {@code false} otherwise.
     * {@code false} otherwise.
     */
     */
    public boolean setSatelliteServicePackageName(@Nullable String servicePackageName) {
    public boolean setSatelliteServicePackageName(@Nullable String servicePackageName) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return false;
        }
        if (!isMockModemAllowed()) return false;
        if (!isMockModemAllowed()) return false;


        // Cached states need to be cleared whenever switching satellite vendor services.
        // Cached states need to be cleared whenever switching satellite vendor services.
@@ -1994,6 +2079,9 @@ public class SatelliteController extends Handler {
     * @return {@code true} if the timeout duration is set successfully, {@code false} otherwise.
     * @return {@code true} if the timeout duration is set successfully, {@code false} otherwise.
     */
     */
    public boolean setSatelliteListeningTimeoutDuration(long timeoutMillis) {
    public boolean setSatelliteListeningTimeoutDuration(long timeoutMillis) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return false;
        }
        if (mSatelliteSessionController == null) {
        if (mSatelliteSessionController == null) {
            loge("mSatelliteSessionController is not initialized yet");
            loge("mSatelliteSessionController is not initialized yet");
            return false;
            return false;
@@ -2009,6 +2097,9 @@ public class SatelliteController extends Handler {
     * @return {@code true} if the timeout duration is set successfully, {@code false} otherwise.
     * @return {@code true} if the timeout duration is set successfully, {@code false} otherwise.
     */
     */
    public boolean setSatelliteDeviceAlignedTimeoutDuration(long timeoutMillis) {
    public boolean setSatelliteDeviceAlignedTimeoutDuration(long timeoutMillis) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return false;
        }
        return mDatagramController.setSatelliteDeviceAlignedTimeoutDuration(timeoutMillis);
        return mDatagramController.setSatelliteDeviceAlignedTimeoutDuration(timeoutMillis);
    }
    }


@@ -2020,6 +2111,9 @@ public class SatelliteController extends Handler {
     * {@code false} otherwise.
     * {@code false} otherwise.
     */
     */
    public boolean setSatelliteGatewayServicePackageName(@Nullable String servicePackageName) {
    public boolean setSatelliteGatewayServicePackageName(@Nullable String servicePackageName) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return false;
        }
        if (mSatelliteSessionController == null) {
        if (mSatelliteSessionController == null) {
            loge("mSatelliteSessionController is not initialized yet");
            loge("mSatelliteSessionController is not initialized yet");
            return false;
            return false;
@@ -2038,6 +2132,9 @@ public class SatelliteController extends Handler {
     */
     */
    public boolean setSatellitePointingUiClassName(
    public boolean setSatellitePointingUiClassName(
            @Nullable String packageName, @Nullable String className) {
            @Nullable String packageName, @Nullable String className) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return false;
        }
        return mPointingAppController.setSatellitePointingUiClassName(packageName, className);
        return mPointingAppController.setSatellitePointingUiClassName(packageName, className);
    }
    }


@@ -2054,6 +2151,9 @@ public class SatelliteController extends Handler {
     */
     */
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
    public void onSatelliteServiceConnected() {
    public void onSatelliteServiceConnected() {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return;
        }
        if (mSatelliteModemInterface.isSatelliteServiceSupported()) {
        if (mSatelliteModemInterface.isSatelliteServiceSupported()) {
            synchronized (mIsSatelliteSupportedLock) {
            synchronized (mIsSatelliteSupportedLock) {
                if (mIsSatelliteSupported == null) {
                if (mIsSatelliteSupported == null) {
@@ -2100,6 +2200,9 @@ public class SatelliteController extends Handler {
     * @return {@code true} is satellite is supported on the device, {@code  false} otherwise.
     * @return {@code true} is satellite is supported on the device, {@code  false} otherwise.
     */
     */
    public boolean isSatelliteSupported() {
    public boolean isSatelliteSupported() {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return false;
        }
        Boolean supported = isSatelliteSupportedInternal();
        Boolean supported = isSatelliteSupportedInternal();
        return (supported != null ? supported : false);
        return (supported != null ? supported : false);
    }
    }
@@ -2110,6 +2213,9 @@ public class SatelliteController extends Handler {
     */
     */
    @NonNull
    @NonNull
    public List<String> getSatellitePlmnList(int subId) {
    public List<String> getSatellitePlmnList(int subId) {
        if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
            return new ArrayList<>();
        }
        synchronized (mSupportedSatelliteServicesLock) {
        synchronized (mSupportedSatelliteServicesLock) {
            if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {
            if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {
                return new ArrayList<>(mSatelliteServicesSupportedByCarriers.get(subId).keySet());
                return new ArrayList<>(mSatelliteServicesSupportedByCarriers.get(subId).keySet());
@@ -2127,6 +2233,9 @@ public class SatelliteController extends Handler {
     */
     */
    @NonNull
    @NonNull
    public List<Integer> getSupportedSatelliteServices(int subId, String plmn) {
    public List<Integer> getSupportedSatelliteServices(int subId, String plmn) {
        if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
            return new ArrayList<>();
        }
        synchronized (mSupportedSatelliteServicesLock) {
        synchronized (mSupportedSatelliteServicesLock) {
            if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {
            if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {
                Map<String, Set<Integer>> supportedServices =
                Map<String, Set<Integer>> supportedServices =
+4 −0
Original line number Original line Diff line number Diff line
@@ -225,6 +225,10 @@ public class SatelliteSOSMessageRecommender extends Handler {
     */
     */
    public void onEmergencyCallConnectionStateChanged(
    public void onEmergencyCallConnectionStateChanged(
            String callId, @Connection.ConnectionState int state) {
            String callId, @Connection.ConnectionState int state) {
        if (!mSatelliteController.isSatelliteSupported()) {
            logd("onEmergencyCallConnectionStateChanged: satellite is not supported");
            return;
        }
        Pair<String, Integer> argument = new Pair<>(callId, state);
        Pair<String, Integer> argument = new Pair<>(callId, state);
        sendMessage(obtainMessage(EVENT_EMERGENCY_CALL_CONNECTION_STATE_CHANGED, argument));
        sendMessage(obtainMessage(EVENT_EMERGENCY_CALL_CONNECTION_STATE_CHANGED, argument));
    }
    }
+1 −0
Original line number Original line Diff line number Diff line
@@ -855,6 +855,7 @@ public class SatelliteControllerTest extends TelephonyTest {
        processAllMessages();
        processAllMessages();
        // Satellite should not be powered off since the feature flag oemEnabledSatelliteFlag is
        // Satellite should not be powered off since the feature flag oemEnabledSatelliteFlag is
        // disabled
        // disabled
        when(mFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
        verifySatelliteEnabled(true, SATELLITE_RESULT_SUCCESS);
        verifySatelliteEnabled(true, SATELLITE_RESULT_SUCCESS);
    }
    }