diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index 4a9a37d..5f3fc97 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -823,7 +823,12 @@
             configToSend.putAll(config);
         }
 
-        SubscriptionManagerService.getInstance().updateSubscriptionByCarrierConfig(
+        SubscriptionManagerService sm = SubscriptionManagerService.getInstance();
+        if (sm == null) {
+            loge("SubscriptionManagerService missing");
+            return;
+        }
+        sm.updateSubscriptionByCarrierConfig(
                 phoneId, configPackageName, configToSend,
                 () -> mHandler.obtainMessage(EVENT_SUBSCRIPTION_INFO_UPDATED, phoneId, -1)
                         .sendToTarget());
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 0a7fc3e..a3d8baf 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -14478,11 +14478,6 @@
      * @return {@code true} if the operation is successful, {@code false} otherwise.
      */
     public boolean setShouldSendDatagramToModemInDemoMode(boolean shouldSendToModemInDemoMode) {
-        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
-            Log.d(LOG_TAG, "shouldSendDatagramToModemInDemoMode: oemEnabledSatelliteFlag is "
-                    + "disabled");
-            return false;
-        }
         Log.d(LOG_TAG, "setShouldSendDatagramToModemInDemoMode");
         TelephonyPermissions.enforceShellOnly(
                 Binder.getCallingUid(), "setShouldSendDatagramToModemInDemoMode");
@@ -14506,12 +14501,6 @@
      * @return {@code true} if the setting is successful, {@code false} otherwise.
      */
     public boolean setIsSatelliteCommunicationAllowedForCurrentLocationCache(String state) {
-        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
-            Log.d(LOG_TAG, "setIsSatelliteCommunicationAllowedForCurrentLocationCache: "
-                    + "oemEnabledSatelliteFlag is disabled");
-            return false;
-        }
-
         Log.d(LOG_TAG, "setIsSatelliteCommunicationAllowedForCurrentLocationCache: "
                 + "state=" + state);
         TelephonyPermissions.enforceShellOnly(
diff --git a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
index 67d983f..e2a94bf 100644
--- a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
+++ b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
@@ -730,11 +730,6 @@
      */
     public void requestIsCommunicationAllowedForCurrentLocation(
             @NonNull ResultReceiver result, boolean enablingSatellite) {
-        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
-            plogd("oemEnabledSatelliteFlag is disabled");
-            result.send(SATELLITE_RESULT_REQUEST_NOT_SUPPORTED, null);
-            return;
-        }
         plogd("requestIsCommunicationAllowedForCurrentLocation : "
                 + "enablingSatellite is " + enablingSatellite);
         synchronized (mIsAllowedCheckBeforeEnablingSatelliteLock) {
@@ -1520,11 +1515,6 @@
     }
 
     private void registerLocationModeChangedBroadcastReceiver(Context context) {
-        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
-            plogd("registerLocationModeChangedBroadcastReceiver: Flag "
-                    + "oemEnabledSatellite is disabled");
-            return;
-        }
         IntentFilter intentFilter = new IntentFilter();
         intentFilter.addAction(LocationManager.MODE_CHANGED_ACTION);
         intentFilter.addAction(LocationManager.PROVIDERS_CHANGED_ACTION);
@@ -1979,11 +1969,6 @@
     }
 
     private void handleSatelliteAllowedRegionPossiblyChanged(int handleEvent) {
-        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
-            ploge("handleSatelliteAllowedRegionPossiblyChanged: "
-                    + "The feature flag oemEnabledSatelliteFlag() is not enabled");
-            return;
-        }
         synchronized (mPossibleChangeInSatelliteAllowedRegionLock) {
             logd("handleSatelliteAllowedRegionPossiblyChanged");
             setIsSatelliteAllowedRegionPossiblyChanged(true);
@@ -2878,12 +2863,6 @@
     @SatelliteManager.SatelliteResult
     public int registerForCommunicationAccessStateChanged(int subId,
             @NonNull ISatelliteCommunicationAccessStateCallback callback) {
-        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
-            plogd("registerForCommunicationAccessStateChanged: oemEnabledSatelliteFlag is "
-                    + "disabled");
-            return SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED;
-        }
-
         mSatelliteCommunicationAccessStateChangedListeners.put(callback.asBinder(), callback);
 
         this.post(() -> {
@@ -2923,12 +2902,6 @@
      */
     public void unregisterForCommunicationAccessStateChanged(
             int subId, @NonNull ISatelliteCommunicationAccessStateCallback callback) {
-        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
-            plogd("unregisterForCommunicationAccessStateChanged: "
-                    + "oemEnabledSatelliteFlag is disabled");
-            return;
-        }
-
         mSatelliteCommunicationAccessStateChangedListeners.remove(callback.asBinder());
     }
 
@@ -3007,12 +2980,6 @@
      * @return {@code true} if the setting is successful, {@code false} otherwise.
      */
     public boolean setIsSatelliteCommunicationAllowedForCurrentLocationCache(String state) {
-        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
-            logd("setIsSatelliteCommunicationAllowedForCurrentLocationCache: "
-                    + "oemEnabledSatelliteFlag is disabled");
-            return false;
-        }
-
         if (!isMockModemAllowed()) {
             logd("setIsSatelliteCommunicationAllowedForCurrentLocationCache: "
                     + "mock modem not allowed.");
diff --git a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponse.java b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponse.java
index 7d6b5ba..a9e2f39 100644
--- a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponse.java
+++ b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponse.java
@@ -21,7 +21,6 @@
 import android.text.TextUtils;
 import android.util.Log;
 
-import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.satellite.SatelliteNetworkInfo;
 import com.android.libraries.entitlement.ServiceEntitlement;
 
@@ -135,7 +134,7 @@
                 for (int i = 0; i < jsonArray.length(); i++) {
                     String dataPlanType = jsonArray.getJSONObject(i).has(DATA_PLAN_TYPE_KEY)
                             ? jsonArray.getJSONObject(i).getString(DATA_PLAN_TYPE_KEY) : "";
-                    Map<String, String> allowedServicesInfo = new HashMap<>();
+                    Map<String, String> allowedServicesInfo = null;
                     if (jsonArray.getJSONObject(i).has(ALLOWED_SERVICES_INFO_TYPE_KEY)) {
                         allowedServicesInfo = new HashMap<>();
                         JSONArray jsonArray1 = jsonArray.getJSONObject(i)
diff --git a/src/com/android/phone/security/SafetySourceReceiver.java b/src/com/android/phone/security/SafetySourceReceiver.java
index 34edb73..99394c2 100644
--- a/src/com/android/phone/security/SafetySourceReceiver.java
+++ b/src/com/android/phone/security/SafetySourceReceiver.java
@@ -34,13 +34,6 @@
     private static final String TAG = "TelephonySafetySourceReceiver";
     @Override
     public void onReceive(Context context, Intent intent) {
-
-        // If none of the features that depend on this receiver are enabled, there's no reason
-        // to progress.
-        if (!Flags.enableModemCipherTransparencyUnsolEvents()) {
-            return;
-        }
-
         String action = intent.getAction();
         if (!ACTION_REFRESH_SAFETY_SOURCES.equals(action)) {
             return;
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index 42c6f2e..ab7a3bf 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -944,6 +944,7 @@
         mSimulateOutOfServiceSwitch.setOnCheckedChangeListener(mSimulateOosOnChangeListener);
         mMockSatellite.setChecked(mCarrierSatelliteOriginalBundle[mPhoneId] != null);
         mMockSatellite.setOnCheckedChangeListener(mMockSatelliteListener);
+        mMockSatelliteDataSwitch.setChecked(mSatelliteDataOriginalBundle[mPhoneId] != null);
         mMockSatelliteDataSwitch.setOnCheckedChangeListener(mMockSatelliteDataSwitchListener);
         mMockSatelliteData.setOnCheckedChangeListener(mMockSatelliteDataListener);
 
@@ -2237,19 +2238,24 @@
                 overrideBundle.putBoolean(
                         KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, false);
                 log("satData: mMockSatelliteDataListener: new " + overrideBundle);
-                getCarrierConfig().overrideConfig(mSubId, overrideBundle, false);
+                if (SubscriptionManager.isValidSubscriptionId(mSubId)) {
+                    getCarrierConfig().overrideConfig(mSubId, overrideBundle, false);
+                } else {
+                    Log.e(TAG, "SubscriptionId is not valid: " + mSubId);
+                }
             };
 
     private final OnCheckedChangeListener mMockSatelliteDataSwitchListener =
             (buttonView, isChecked) -> {
         log("satData: ServiceData enabling = " + isChecked);
         if (isChecked) {
-            if (!isValidOperator()) {
+            if (isValidOperator(mSubId)) {
+                updateSatelliteDataButton();
+            } else {
                 log("satData: Not a valid Operator");
                 mMockSatelliteDataSwitch.setChecked(false);
                 return;
             }
-            updateSatelliteDataButton();
         } else {
             reloadCarrierConfigDefaults();
         }
@@ -2273,30 +2279,36 @@
         }
     }
 
-    private boolean isValidOperator() {
-        String operatorNumeric = mTelephonyManager
-                .getNetworkOperatorForPhone(mPhoneId);
-        TelephonyManager tm;
-        if (TextUtils.isEmpty(operatorNumeric)
-                && (tm = getSystemService(TelephonyManager.class)) != null) {
-            operatorNumeric = tm.getSimOperatorNumericForPhone(mPhoneId);
+    private boolean isValidOperator(int subId) {
+        String operatorNumeric = null;
+        if (SubscriptionManager.isValidSubscriptionId(subId)) {
+            operatorNumeric = mTelephonyManager
+                    .getNetworkOperatorForPhone(mPhoneId);
+            TelephonyManager tm;
+            if (TextUtils.isEmpty(operatorNumeric)
+                    && (tm = getSystemService(TelephonyManager.class)) != null) {
+                operatorNumeric = tm.getSimOperatorNumericForPhone(mPhoneId);
+            }
         }
         return !TextUtils.isEmpty(operatorNumeric);
     }
 
     private final OnCheckedChangeListener mMockSatelliteListener =
             (buttonView, isChecked) -> {
-                if (SubscriptionManager.isValidPhoneId(mPhoneId)) {
+                int subId = mSubId;
+                int phoneId = mPhoneId;
+                if (SubscriptionManager.isValidPhoneId(phoneId)
+                        && SubscriptionManager.isValidSubscriptionId(subId)) {
                     if (getCarrierConfig() == null) return;
                     if (isChecked) {
-                        if (!isValidOperator()) {
+                        if (!isValidOperator(subId)) {
                             mMockSatellite.setChecked(false);
                             loge("mMockSatelliteListener: Can't mock because no operator for phone "
-                                    + mPhoneId);
+                                    + phoneId);
                             return;
                         }
                         PersistableBundle originalBundle = getCarrierConfig().getConfigForSubId(
-                                mSubId,
+                                subId,
                                 KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
                                 KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL,
                                 KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE
@@ -2307,7 +2319,7 @@
                         overrideBundle.putBoolean(KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, false);
                         PersistableBundle capableProviderBundle = new PersistableBundle();
                         capableProviderBundle.putIntArray(mTelephonyManager
-                                        .getNetworkOperatorForPhone(mPhoneId),
+                                        .getNetworkOperatorForPhone(phoneId),
                                 new int[]{
                                         // Currently satellite only supports below
                                         NetworkRegistrationInfo.SERVICE_TYPE_SMS,
@@ -2318,18 +2330,18 @@
                                 capableProviderBundle);
                         log("mMockSatelliteListener: new " + overrideBundle);
                         log("mMockSatelliteListener: old " + originalBundle);
-                        getCarrierConfig().overrideConfig(mSubId, overrideBundle, false);
-                        mCarrierSatelliteOriginalBundle[mPhoneId] = originalBundle;
+                        getCarrierConfig().overrideConfig(subId, overrideBundle, false);
+                        mCarrierSatelliteOriginalBundle[phoneId] = originalBundle;
                     } else {
                         try {
-                            getCarrierConfig().overrideConfig(mSubId,
-                                    mCarrierSatelliteOriginalBundle[mPhoneId], false);
-                            mCarrierSatelliteOriginalBundle[mPhoneId] = null;
+                            getCarrierConfig().overrideConfig(subId,
+                                    mCarrierSatelliteOriginalBundle[phoneId], false);
+                            mCarrierSatelliteOriginalBundle[phoneId] = null;
                             log("mMockSatelliteListener: Successfully cleared mock for phone "
-                                    + mPhoneId);
+                                    + phoneId);
                         } catch (Exception e) {
                             loge("mMockSatelliteListener: Can't clear mock because invalid sub Id "
-                                    + mSubId
+                                    + subId
                                     + ", insert SIM and use adb shell cmd phone cc clear-values");
                             // Keep show toggle ON if the view is not destroyed. If destroyed, must
                             // use cmd to reset, because upon creation the view doesn't remember the
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 8956266..de4076d 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -1790,7 +1790,7 @@
                         }
 
                         // Skip the sim for satellite as it does not support call for now
-                        if (Flags.oemEnabledSatelliteFlag() && info.isOnlyNonTerrestrialNetwork()) {
+                        if (info.isOnlyNonTerrestrialNetwork()) {
                             Log.d(this, "setupAccounts: skipping satellite sub id "
                                     + subscriptionId);
                             continue;
diff --git a/src/com/android/services/telephony/rcs/SipTransportController.java b/src/com/android/services/telephony/rcs/SipTransportController.java
index 2f090d5..efd3e83 100644
--- a/src/com/android/services/telephony/rcs/SipTransportController.java
+++ b/src/com/android/services/telephony/rcs/SipTransportController.java
@@ -823,7 +823,7 @@
         mEvaluateCompleteFuture = pendingChange
                 .whenComplete((f, ex) -> {
                     if (ex != null) {
-                        logw("reevaluateDelegates: Exception caught: " + ex);
+                        logw("reevaluateDelegates: Exception caught", ex);
                     }
                 }).thenAccept((associatedFeatures) -> {
                     logi("reevaluateDelegates: reevaluate complete, feature tags associated: "
@@ -977,8 +977,9 @@
      */
     private Set<FeatureTagState> updateSupportedTags(Set<String> candidateFeatureTags,
             Set<String> previouslyGrantedTags) {
-        Boolean overrideRes = RcsProvisioningMonitor.getInstance()
-                .getImsFeatureValidationOverride(mSubId);
+        RcsProvisioningMonitor monitor = RcsProvisioningMonitor.getInstance();
+        Boolean overrideRes = monitor == null ? null :
+                monitor.getImsFeatureValidationOverride(mSubId);
         // deny tags already used by other delegates
         Set<FeatureTagState> deniedTags = new ArraySet<>();
 
@@ -1212,4 +1213,9 @@
         Log.w(LOG_TAG, "[" + mSlotId  + "->" + mSubId + "] " + log);
         mLocalLog.log("[W] " + log);
     }
+
+    private void logw(String log, Throwable ex) {
+        Log.w(LOG_TAG, "[" + mSlotId  + "->" + mSubId + "] " + log, ex);
+        mLocalLog.log("[W] " + log + ": " + ex);
+    }
 }
diff --git a/testapps/TestSatelliteApp/AndroidManifest.xml b/testapps/TestSatelliteApp/AndroidManifest.xml
index a1f22fa..1825df2 100644
--- a/testapps/TestSatelliteApp/AndroidManifest.xml
+++ b/testapps/TestSatelliteApp/AndroidManifest.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
   ~ Copyright (C) 2024 The Android Open Source Project
   ~
   ~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,31 +16,19 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.phone.testapps.satellitetestapp">
-    <uses-permission android:name="android.permission.BIND_SATELLITE_SERVICE"/>
-    <uses-permission android:name="android.permission.SATELLITE_COMMUNICATION"/>
-    <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
-    <uses-permission android:name="android.permission.SEND_SMS"/>
+
     <application android:label="SatelliteTestApp">
-        <activity android:name=".SatelliteTestApp"
-             android:label="SatelliteTestApp"
-             android:exported="true">
+        <activity
+            android:name=".SatelliteTestApp"
+            android:exported="true"
+            android:label="SatelliteTestApp">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
-                <category android:name="android.intent.category.DEFAULT"/>
-                <category android:name="android.intent.category.LAUNCHER"/>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-
-        <service android:name=".TestSatelliteService"
-             android:directBootAware="true"
-             android:persistent="true"
-             android:permission="android.permission.BIND_SATELLITE_SERVICE"
-             android:exported="true">
-            <intent-filter>
-                <action android:name="android.telephony.satellite.SatelliteService"/>
-            </intent-filter>
-        </service>
-
         <activity android:name=".SatelliteControl" />
         <activity android:name=".Datagram" />
         <activity android:name=".Provisioning" />
@@ -49,5 +36,29 @@
         <activity android:name=".SendReceive" />
         <activity android:name=".NbIotSatellite" />
         <activity android:name=".TestSatelliteWrapper" />
+
+        <receiver
+            android:name=".SatelliteTestAppReceiver"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="com.android.phone.testapps.satellitetestapp.RECEIVER" />
+            </intent-filter>
+        </receiver>
+
+        <service
+            android:name=".TestSatelliteService"
+            android:directBootAware="true"
+            android:exported="true"
+            android:permission="android.permission.BIND_SATELLITE_SERVICE"
+            android:persistent="true">
+            <intent-filter>
+                <action android:name="android.telephony.satellite.SatelliteService" />
+            </intent-filter>
+        </service>
     </application>
+
+    <uses-permission android:name="android.permission.SATELLITE_COMMUNICATION" />
+    <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE" />
+    <uses-permission android:name="android.permission.SEND_SMS" />
+    <uses-permission android:name="android.permission.BIND_SATELLITE_SERVICE" />
 </manifest>
diff --git a/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestAppReceiver.java b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestAppReceiver.java
new file mode 100644
index 0000000..693ac7a
--- /dev/null
+++ b/testapps/TestSatelliteApp/src/com/android/phone/testapps/satellitetestapp/SatelliteTestAppReceiver.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.phone.testapps.satellitetestapp;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.CancellationSignal;
+import android.telephony.satellite.EnableRequestAttributes;
+import android.telephony.satellite.SatelliteManager;
+import android.telephony.satellite.stub.SatelliteResult;
+import android.util.Log;
+
+import java.util.Objects;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+public class SatelliteTestAppReceiver extends BroadcastReceiver {
+    private static final String TAG = "SatelliteTestAppRcvr";
+
+    private static final long TEST_REQUEST_TIMEOUT = TimeUnit.SECONDS.toMillis(3);
+    private static final String TEST_SATELLITE_TOKEN = "SATELLITE_TOKEN";
+    private static final String ACTION = "com.android.phone.testapps.satellitetestapp.RECEIVER";
+    private static final String ACTION_PROVISION = "provision";
+    private static final String ACTION_DEPROVISION = "deprovision";
+    private static final String ACTION_ENABLE = "enable";
+    private static final String ACTION_DISABLE = "disable";
+    private static final String PARAM_ACTION_KEY = "action_key";
+    private static final String PARAM_DEMO_MODE = "demo_mode";
+
+    private static SatelliteManager mSatelliteManager;
+
+
+    @Override
+    public void onReceive(Context context, Intent intent) {
+        Log.d(TAG, "onReceive: intent: " + intent.toString());
+
+        String action = intent.getAction();
+        if (!Objects.equals(action, ACTION)) {
+            Log.d(TAG, "Unsupported action: " + action + ", exiting.");
+            return;
+        }
+
+        String param = intent.getStringExtra(PARAM_ACTION_KEY);
+        if (param == null) {
+            Log.d(TAG, "No param provided, exiting");
+            return;
+        }
+
+        if (mSatelliteManager == null) {
+            mSatelliteManager = context.getSystemService(SatelliteManager.class);
+        }
+
+        if (mSatelliteManager == null) {
+            Log.d(TAG, "Satellite Manager is not available, exiting.");
+            return;
+        }
+
+        switch (param) {
+            case ACTION_PROVISION -> provisionSatellite();
+            case ACTION_DEPROVISION -> deprovisionSatellite();
+            case ACTION_ENABLE -> {
+                boolean demoMode = intent.getBooleanExtra(PARAM_DEMO_MODE, true);
+                enableSatellite(demoMode);
+            }
+            case ACTION_DISABLE -> disableSatellite();
+            default -> Log.d(TAG, "Unsupported param:" + param);
+        }
+    }
+
+    private void provisionSatellite() {
+        CancellationSignal cancellationSignal = new CancellationSignal();
+        LinkedBlockingQueue<Integer> error = new LinkedBlockingQueue<>(1);
+        String mText = "This is test provision data.";
+        byte[] testProvisionData = mText.getBytes();
+        mSatelliteManager.provisionService(TEST_SATELLITE_TOKEN, testProvisionData,
+                cancellationSignal, Runnable::run, error::offer);
+        try {
+            Integer value = error.poll(TEST_REQUEST_TIMEOUT, TimeUnit.MILLISECONDS);
+            if (value == null) {
+                Log.d(TAG, "Timed out to provision the satellite");
+            } else if (value != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
+                Log.d(TAG, "Failed to provision the satellite, error ="
+                        + SatelliteErrorUtils.mapError(value));
+            } else {
+                Log.d(TAG, "Successfully provisioned the satellite");
+            }
+        } catch (InterruptedException e) {
+            Log.d(TAG, "Provision SatelliteService exception caught =" + e);
+        }
+    }
+
+    private void deprovisionSatellite() {
+        LinkedBlockingQueue<Integer> error = new LinkedBlockingQueue<>(1);
+        mSatelliteManager.deprovisionService(TEST_SATELLITE_TOKEN, Runnable::run,
+                error::offer);
+        try {
+            Integer value = error.poll(TEST_REQUEST_TIMEOUT, TimeUnit.MILLISECONDS);
+            if (value == null) {
+                Log.d(TAG, "Timed out to deprovision the satellite");
+            } else if (value != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
+                Log.d(TAG, "Failed to deprovision the satellite, error ="
+                        + SatelliteErrorUtils.mapError(value));
+            } else {
+                Log.d(TAG, "Successfully deprovisioned the satellite");
+            }
+        } catch (InterruptedException e) {
+            Log.d(TAG, "Deprovision SatelliteService exception caught =" + e);
+        }
+    }
+
+    private void enableSatellite(boolean isDemoMode) {
+        LinkedBlockingQueue<Integer> error = new LinkedBlockingQueue<>(1);
+        mSatelliteManager.requestEnabled(
+                new EnableRequestAttributes.Builder(true)
+                        .setDemoMode(isDemoMode)
+                        .setEmergencyMode(true)
+                        .build(), Runnable::run, error::offer);
+        Log.d(TAG, "enableSatelliteApp: isDemoMode=" + isDemoMode);
+        try {
+            Integer value = error.poll(TEST_REQUEST_TIMEOUT, TimeUnit.MILLISECONDS);
+            if (value == null) {
+                Log.d(TAG, "Timed out to enable the satellite");
+            } else if (value != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
+                Log.d(TAG, "Failed to enable the satellite, error ="
+                        + SatelliteErrorUtils.mapError(value));
+            } else {
+                Log.d(TAG, "Successfully enabled the satellite");
+            }
+        } catch (InterruptedException e) {
+            Log.d(TAG, "Enable SatelliteService exception caught =" + e);
+        }
+    }
+
+    private void disableSatellite() {
+        LinkedBlockingQueue<Integer> error = new LinkedBlockingQueue<>(1);
+        mSatelliteManager.requestEnabled(new EnableRequestAttributes.Builder(false).build(),
+                Runnable::run, error::offer);
+        try {
+            Integer value = error.poll(TEST_REQUEST_TIMEOUT, TimeUnit.MILLISECONDS);
+            if (value == null) {
+                Log.d(TAG, "Timed out to enable the satellite");
+            } else if (value != SatelliteResult.SATELLITE_RESULT_SUCCESS) {
+                Log.d(TAG, "Failed to enable the satellite, error ="
+                        + SatelliteErrorUtils.mapError(value));
+            } else {
+                Log.d(TAG, "Successfully disabled the satellite");
+            }
+        } catch (InterruptedException e) {
+            Log.d(TAG, "Disable SatelliteService exception caught =" + e);
+        }
+    }
+}
diff --git a/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java b/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java
index f61455d..d532289 100644
--- a/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java
+++ b/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java
@@ -126,6 +126,7 @@
 import com.android.internal.telephony.satellite.SatelliteController;
 import com.android.internal.telephony.satellite.SatelliteModemInterface;
 import com.android.internal.telephony.satellite.metrics.ControllerMetricsStats;
+import com.android.internal.telephony.subscription.SubscriptionManagerService;
 
 import org.junit.After;
 import org.junit.Before;
@@ -354,6 +355,8 @@
                 mMockSatelliteController);
         replaceInstance(SatelliteModemInterface.class, "sInstance", null,
                 mMockSatelliteModemInterface);
+        replaceInstance(SubscriptionManagerService.class, "sInstance", null,
+                mock(SubscriptionManagerService.class));
         replaceInstance(TelephonyCountryDetector.class, "sInstance", null,
                 mMockCountryDetector);
         replaceInstance(ControllerMetricsStats.class, "sInstance", null,
@@ -415,7 +418,6 @@
 
         when(mMockFeatureFlags.satellitePersistentLogging()).thenReturn(true);
         when(mMockFeatureFlags.geofenceEnhancementForBetterUx()).thenReturn(true);
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
         when(mMockFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
 
         when(mMockContext.getSystemService(Context.TELEPHONY_SERVICE))
@@ -507,8 +509,6 @@
 
     @Test
     public void testIsSatelliteAccessAllowedForLocation() {
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
-
         // Test disallowList case
         when(mMockResources.getBoolean(
                 com.android.internal.R.bool.config_oem_enabled_satellite_access_allow))
@@ -694,20 +694,9 @@
                 "mSatelliteCommunicationAccessStateChangedListeners", mSatelliteAccessControllerUT,
                 mSatelliteCommunicationAllowedStateCallbackMap);
 
-        doReturn(false).when(mMockFeatureFlags).oemEnabledSatelliteFlag();
         int result = mSatelliteAccessControllerUT.registerForCommunicationAccessStateChanged(
                 DEFAULT_SUBSCRIPTION_ID, mockSatelliteAllowedStateCallback);
         mTestableLooper.processAllMessages();
-        assertEquals(SATELLITE_RESULT_REQUEST_NOT_SUPPORTED, result);
-        verify(mockSatelliteAllowedStateCallback, never())
-                .onAccessAllowedStateChanged(anyBoolean());
-        verify(mockSatelliteAllowedStateCallback, never())
-                .onAccessConfigurationChanged(any(SatelliteAccessConfiguration.class));
-
-        doReturn(true).when(mMockFeatureFlags).oemEnabledSatelliteFlag();
-        result = mSatelliteAccessControllerUT.registerForCommunicationAccessStateChanged(
-                DEFAULT_SUBSCRIPTION_ID, mockSatelliteAllowedStateCallback);
-        mTestableLooper.processAllMessages();
         assertEquals(SATELLITE_RESULT_SUCCESS, result);
         verify(mockSatelliteAllowedStateCallback, times(1))
                 .onAccessAllowedStateChanged(anyBoolean());
@@ -876,8 +865,6 @@
 
     @Test
     public void testIsRegionDisallowed() throws Exception {
-        // setup to make the return value of mQueriedSatelliteAllowed 'true'
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
         when(mMockContext.getResources()).thenReturn(mMockResources);
         when(mMockResources.getBoolean(
                 com.android.internal.R.bool.config_oem_enabled_satellite_access_allow))
@@ -1076,18 +1063,6 @@
 
     @Test
     public void testRequestIsSatelliteCommunicationAllowedForCurrentLocation() throws Exception {
-        // OEM-enabled satellite is not supported
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(false);
-        mSatelliteAccessControllerUT.requestIsCommunicationAllowedForCurrentLocation(
-                mSatelliteAllowedReceiver, false);
-        mTestableLooper.processAllMessages();
-        assertTrue(waitForRequestIsSatelliteAllowedForCurrentLocationResult(
-                mSatelliteAllowedSemaphore, 1));
-        assertEquals(SATELLITE_RESULT_REQUEST_NOT_SUPPORTED, mQueriedSatelliteAllowedResultCode);
-
-        // OEM-enabled satellite is supported
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
-
         // Satellite is not supported
         setUpResponseForRequestIsSatelliteSupported(false, SATELLITE_RESULT_SUCCESS);
         clearAllInvocations();
@@ -1241,15 +1216,12 @@
         long lastKnownLocationElapsedRealtime =
                 firstMccChangedTime + TEST_LOCATION_QUERY_THROTTLE_INTERVAL_NANOS;
 
-        // OEM-enabled satellite is supported
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
-
         verify(mMockCountryDetector).registerForCountryCodeChanged(
                 mCountryDetectorHandlerCaptor.capture(), mCountryDetectorIntCaptor.capture(),
                 mCountryDetectorObjCaptor.capture());
 
         assertSame(mCountryDetectorHandlerCaptor.getValue(), mSatelliteAccessControllerUT);
-        assertSame(mCountryDetectorIntCaptor.getValue(), EVENT_COUNTRY_CODE_CHANGED);
+        assertSame(EVENT_COUNTRY_CODE_CHANGED, mCountryDetectorIntCaptor.getValue());
         assertNull(mCountryDetectorObjCaptor.getValue());
 
         // Setup to invoke GPS query
@@ -1365,9 +1337,6 @@
 
     @Test
     public void testValidatePossibleChangeInSatelliteAllowedRegion() throws Exception {
-        // OEM-enabled satellite is supported
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
-
         verify(mMockCountryDetector).registerForCountryCodeChanged(
                 mCountryDetectorHandlerCaptor.capture(), mCountryDetectorIntCaptor.capture(),
                 mCountryDetectorObjCaptor.capture());
@@ -1419,8 +1388,6 @@
 
     @Test
     public void testRetryValidatePossibleChangeInSatelliteAllowedRegion() throws Exception {
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
-
         verify(mMockCountryDetector).registerForCountryCodeChanged(
                 mCountryDetectorHandlerCaptor.capture(), mCountryDetectorIntCaptor.capture(),
                 mCountryDetectorObjCaptor.capture());
@@ -1453,11 +1420,6 @@
 
     @Test
     public void testLoadSatelliteAccessConfigurationFromDeviceConfig() {
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(false);
-        assertNull(mSatelliteAccessControllerUT
-                .getSatelliteConfigurationFileNameFromOverlayConfig(mMockContext));
-
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
         when(mMockContext.getResources()).thenReturn(mMockResources);
         when(mMockResources
                 .getString(eq(com.android.internal.R.string.satellite_access_config_file)))
@@ -1744,7 +1706,8 @@
         logd("otaSatelliteAccessConfigFileAbsPath: " + otaSatelliteAccessConfigFileAbsPath);
 
         if (onDeviceSats2FileAbsPath.equals(otaSats2FileAbsPath)
-                || onDeviceSatelliteAccessConfigFileAbsPath.equals(otaSatelliteAccessConfigFile)) {
+                || onDeviceSatelliteAccessConfigFileAbsPath.equals(
+                        otaSatelliteAccessConfigFileAbsPath)) {
             return false;
         }
 
@@ -1973,7 +1936,6 @@
     @Test
     public void testLocationModeChanged() throws Exception {
         // setup for querying GPS not to reset mIsSatelliteAllowedRegionPossiblyChanged false.
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
         when(mMockContext.getResources()).thenReturn(mMockResources);
         when(mMockResources.getBoolean(
                 com.android.internal.R.bool.config_oem_enabled_satellite_access_allow))
@@ -2137,7 +2099,6 @@
     @Test
     public void testRequestIsCommunicationAllowedForCurrentLocationWithEnablingSatellite() {
         // Set non-emergency case
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
         setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS);
         setUpResponseForRequestIsSatelliteProvisioned(true, SATELLITE_RESULT_SUCCESS);
         when(mMockCountryDetector.getCurrentNetworkCountryIso()).thenReturn(EMPTY_STRING_LIST);
@@ -2174,7 +2135,6 @@
     @Test
     public void testUpdateSystemSelectionChannels() {
         // Set non-emergency case
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
         when(mMockFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
 
         setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS);
@@ -2334,7 +2294,6 @@
     @Test
     public void testUpdateSystemSelectionChannels_HandleInvalidInput() {
         // Set non-emergency case
-        when(mMockFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(true);
         when(mMockFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
 
         setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS);
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 3497167..2fc2757 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -253,6 +253,7 @@
     @Mock EmergencyCallDomainSelectionConnection mEmergencyCallDomainSelectionConnection;
     @Mock NormalCallDomainSelectionConnection mNormalCallDomainSelectionConnection;
     @Mock ImsPhone mImsPhone;
+    @Mock SubscriptionManagerService mSubscriptionManagerService;
     @Mock private SatelliteSOSMessageRecommender mSatelliteSOSMessageRecommender;
     @Mock private EmergencyStateTracker mEmergencyStateTracker;
     @Mock private Resources mMockResources;
@@ -305,8 +306,8 @@
                 (int) invocation.getArgument(2)))
                 .when(mDisconnectCauseFactory).toTelecomDisconnectCause(anyInt(), any(), anyInt());
         mTestConnectionService.setDisconnectCauseFactory(mDisconnectCauseFactory);
-        mTestConnectionService.onCreate();
-        mTestConnectionService.setTelephonyManagerProxy(mTelephonyManagerProxy);
+        replaceInstance(DomainSelectionResolver.class, "sInstance", null,
+                mDomainSelectionResolver);
         replaceInstance(TelephonyConnectionService.class, "mDomainSelectionResolver",
                 mTestConnectionService, mDomainSelectionResolver);
         replaceInstance(TelephonyConnectionService.class, "mEmergencyStateTracker",
@@ -325,9 +326,15 @@
         doReturn(false).when(mDomainSelectionResolver).isDomainSelectionSupported();
         doReturn(null).when(mDomainSelectionResolver).getDomainSelectionConnection(
                 any(), anyInt(), anyBoolean());
+        replaceInstance(SatelliteController.class, "sInstance", null, mSatelliteController);
         replaceInstance(TelephonyConnectionService.class,
                 "mSatelliteController", mTestConnectionService, mSatelliteController);
         doReturn(mMockResources).when(mContext).getResources();
+        replaceInstance(SubscriptionManagerService.class, "sInstance", null,
+                mSubscriptionManagerService);
+
+        mTestConnectionService.onCreate();
+        mTestConnectionService.setTelephonyManagerProxy(mTelephonyManagerProxy);
 
         mBinderStub = (IConnectionService.Stub) mTestConnectionService.onBind(null);
         mSetFlagsRule.disableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
@@ -1510,10 +1517,8 @@
         // Satellite is for emergency
         doReturn(true).when(mSatelliteController).getRequestIsEmergency();
         doReturn(1).when(mSatelliteController).getSelectedSatelliteSubId();
-        SubscriptionManagerService isub = mock(SubscriptionManagerService.class);
-        replaceInstance(SubscriptionManagerService.class, "sInstance", null, isub);
         SubscriptionInfoInternal info = mock(SubscriptionInfoInternal.class);
-        doReturn(info).when(isub).getSubscriptionInfoInternal(1);
+        doReturn(info).when(mSubscriptionManagerService).getSubscriptionInfoInternal(1);
 
         // Setup outgoing emergency call
         setupConnectionServiceInApm();
@@ -1547,10 +1552,8 @@
         // Satellite is for emergency
         doReturn(true).when(mSatelliteController).getRequestIsEmergency();
         doReturn(1).when(mSatelliteController).getSelectedSatelliteSubId();
-        SubscriptionManagerService isub = mock(SubscriptionManagerService.class);
-        replaceInstance(SubscriptionManagerService.class, "sInstance", null, isub);
         SubscriptionInfoInternal info = mock(SubscriptionInfoInternal.class);
-        doReturn(info).when(isub).getSubscriptionInfoInternal(1);
+        doReturn(info).when(mSubscriptionManagerService).getSubscriptionInfoInternal(1);
 
         // Carrier: shouldTurnOffCarrierSatelliteForEmergencyCall = false
         doReturn(0).when(info).getOnlyNonTerrestrialNetwork();
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionTest.java
index c659d5e..c695374 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionTest.java
@@ -32,6 +32,7 @@
 
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.TelephonyTestBase;
 import com.android.internal.telephony.Call;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.d2d.DtmfTransport;
@@ -43,12 +44,11 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
 
 import java.util.ArrayList;
 
 @RunWith(AndroidJUnit4.class)
-public class TelephonyConnectionTest {
+public class TelephonyConnectionTest extends TelephonyTestBase {
     @Mock
     private ImsPhoneConnection mImsPhoneConnection;
     @Mock
@@ -56,7 +56,8 @@
 
     @Before
     public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
+        super.setUp();
+
         when(mImsPhoneConnection.getState()).thenReturn(Call.State.ACTIVE);
         when(mImsPhoneConnection.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_IMS);
     }
diff --git a/tests/src/com/android/services/telephony/rcs/SipSessionTrackerTest.java b/tests/src/com/android/services/telephony/rcs/SipSessionTrackerTest.java
index 3874321..dfe96ef 100644
--- a/tests/src/com/android/services/telephony/rcs/SipSessionTrackerTest.java
+++ b/tests/src/com/android/services/telephony/rcs/SipSessionTrackerTest.java
@@ -43,6 +43,7 @@
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
+import com.android.TelephonyTestBase;
 import com.android.internal.telephony.ISipDialogStateCallback;
 import com.android.internal.telephony.ITelephony;
 import com.android.internal.telephony.PhoneFactory;
@@ -64,7 +65,7 @@
 import java.util.stream.Collectors;
 
 @RunWith(AndroidJUnit4.class)
-public class SipSessionTrackerTest {
+public class SipSessionTrackerTest extends TelephonyTestBase {
 
     private class DialogAttributes {
         public final String branchId;
@@ -133,6 +134,8 @@
 
     @Before
     public void setUp() throws Exception {
+        super.setUp();
+
         mStringEntryCounter = 0;
         MockitoAnnotations.initMocks(this);
         mTrackerUT = new SipSessionTracker(TEST_SUB_ID, mRcsStats);
diff --git a/tests/src/com/android/services/telephony/rcs/SipTransportControllerTest.java b/tests/src/com/android/services/telephony/rcs/SipTransportControllerTest.java
index df7a37e..4ec5e62 100644
--- a/tests/src/com/android/services/telephony/rcs/SipTransportControllerTest.java
+++ b/tests/src/com/android/services/telephony/rcs/SipTransportControllerTest.java
@@ -21,6 +21,7 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeNotNull;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
@@ -717,7 +718,9 @@
     @SmallTest
     @Test
     public void testFeatureTagsDeniedByOverride() throws Exception {
-        RcsProvisioningMonitor.getInstance().overrideImsFeatureValidation(TEST_SUB_ID, false);
+        RcsProvisioningMonitor monitor = RcsProvisioningMonitor.getInstance();
+        assumeNotNull(monitor);
+        monitor.overrideImsFeatureValidation(TEST_SUB_ID, false);
         SipTransportController controller = setupLiveTransportController(THROTTLE_MS, 0);
 
         ArraySet<String> requestTags = new ArraySet<>(getBaseDelegateRequest().getFeatureTags());
@@ -737,8 +740,10 @@
     @SmallTest
     @Test
     public void testFeatureTagsDeniedByConfigAllowedByOverride() throws Exception {
+        RcsProvisioningMonitor monitor = RcsProvisioningMonitor.getInstance();
+        assumeNotNull(monitor);
         setFeatureAllowedConfig(TEST_SUB_ID, new String[]{});
-        RcsProvisioningMonitor.getInstance().overrideImsFeatureValidation(TEST_SUB_ID, true);
+        monitor.overrideImsFeatureValidation(TEST_SUB_ID, true);
         SipTransportController controller = setupLiveTransportController(THROTTLE_MS, 0);
 
         ArraySet<String> requestTags = new ArraySet<>(getBaseDelegateRequest().getFeatureTags());
diff --git a/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/SatS2LocationLookup.java b/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/SatS2LocationLookup.java
index 4632233..3a0dfd2 100644
--- a/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/SatS2LocationLookup.java
+++ b/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/SatS2LocationLookup.java
@@ -24,10 +24,21 @@
 import com.google.common.geometry.S2CellId;
 import com.google.common.geometry.S2LatLng;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /** A util class for checking if a location is in the input satellite S2 file. */
 public final class SatS2LocationLookup {
+
+    private static final Pattern DMS_PATTERN =
+            Pattern.compile(
+                    "^\"?(\\d+)°(\\d+)'(\\d+)\"+\\s*(N|S)\\s+(\\d+)°(\\d+)'(\\d+)\"+\\s*(E|W)\"?$");
+
     /**
      *  A util method for checking if a location is in the input satellite S2 file.
      */
@@ -38,17 +49,39 @@
                 .build()
                 .parse(args);
 
+        if (arguments.csvFile != null) {
+            processLocationLookupFromCSV(arguments);
+            return;
+        }
+
+        // Make sure either DMS or DD format location is passed
+        if (arguments.dms == null && arguments.latDegrees == null && arguments.lngDegrees == null) {
+            throw new IllegalArgumentException(
+                    "Either --lat-degrees and --lng-degrees or --dms must be specified");
+        }
+
+        double latDegrees, lngDegrees;
+
+        if (arguments.dms != null) {
+            double[] dmsCoords = parseDMS(arguments.dms);
+            latDegrees = dmsCoords[0];
+            lngDegrees = dmsCoords[1];
+        } else {
+            latDegrees = arguments.latDegrees;
+            lngDegrees = arguments.lngDegrees;
+        }
+
         try (SatS2RangeFileReader satS2RangeFileReader =
                      SatS2RangeFileReader.open(new File(arguments.inputFile))) {
             System.out.println(
                     "lat - "
-                            + arguments.latDegrees
+                            + latDegrees
                             + ", long - "
-                            + arguments.lngDegrees
+                            + lngDegrees
                             + ", s2Level - "
                             + satS2RangeFileReader.getS2Level());
-            S2CellId s2CellId = getS2CellId(arguments.latDegrees, arguments.lngDegrees,
-                    satS2RangeFileReader.getS2Level());
+            S2CellId s2CellId =
+                    getS2CellId(latDegrees, lngDegrees, satS2RangeFileReader.getS2Level());
             System.out.println("s2CellId=" + Long.toUnsignedString(s2CellId.id())
                     + ", token=" + s2CellId.toToken());
             SuffixTableRange entry = satS2RangeFileReader.findEntryByCellId(s2CellId.id());
@@ -61,6 +94,84 @@
         }
     }
 
+    private static void processLocationLookupFromCSV(Arguments arguments) throws Exception {
+        File inputFile = new File(arguments.inputFile);
+        File csvFile = new File(arguments.csvFile);
+        File outputFile = new File(arguments.outputFile);
+
+        try (SatS2RangeFileReader satS2RangeFileReader =
+                        SatS2RangeFileReader.open(new File(arguments.inputFile));
+                BufferedReader csvReader = new BufferedReader(new FileReader(arguments.csvFile));
+                FileWriter csvWriter = new FileWriter(arguments.outputFile)) {
+
+            // Write header to output CSV
+            csvWriter.append("Place,Distance,DMS coordinates,Satellite supported\n");
+
+            String row = csvReader.readLine(); // skip first row
+            while ((row = csvReader.readLine()) != null) {
+                String[] data = row.split(",");
+                if (data.length != 3) { // Handle invalid CSV rows
+                    System.err.println("Skipping invalid CSV row: " + row);
+                    continue;
+                }
+
+                String place = data[0].trim();
+                String distance = data[1].trim();
+                String dms = data[2].trim();
+
+                // Remove the outer double quotes if present, but keep inner quotes:
+                String cleanedDMS = dms.replaceAll("^\"", "").replaceAll("\"$", "").trim();
+
+                double[] dmsCoords = parseDMS(cleanedDMS);
+                double latDegrees = dmsCoords[0];
+                double lngDegrees = dmsCoords[1];
+
+                S2CellId s2CellId =
+                        getS2CellId(latDegrees, lngDegrees, satS2RangeFileReader.getS2Level());
+                SuffixTableRange entry = satS2RangeFileReader.findEntryByCellId(s2CellId.id());
+
+                String supported = (entry != null) ? "Yes" : "No";
+
+                // Write data to the output file
+                csvWriter.append(String.format("%s,%s,%s,%s\n", place, distance, dms, supported));
+
+                System.out.println(String.format("%s,%s,%s,%s\n", place, distance, dms, supported));
+            }
+
+        } catch (IOException e) {
+            System.err.println("Error processing CSV file: " + e.getMessage());
+            throw e;
+        }
+
+        System.out.println("Geofence lookup results are at: " + outputFile.getAbsolutePath());
+    }
+
+    private static double[] parseDMS(String dmsString) {
+        Matcher matcher = DMS_PATTERN.matcher(dmsString);
+        if (!matcher.matches()) {
+            System.err.println("Invalid DMS format: " + dmsString);
+            throw new IllegalArgumentException("Invalid DMS format: " + dmsString);
+        }
+
+        double latDegrees =
+                Integer.parseInt(matcher.group(1))
+                        + Integer.parseInt(matcher.group(2)) / 60.0
+                        + Integer.parseInt(matcher.group(3)) / 3600.0;
+        if (matcher.group(4).equals("S")) {
+            latDegrees = -latDegrees;
+        }
+
+        double lngDegrees =
+                Integer.parseInt(matcher.group(5))
+                        + Integer.parseInt(matcher.group(6)) / 60.0
+                        + Integer.parseInt(matcher.group(7)) / 3600.0;
+        if (matcher.group(8).equals("W")) {
+            lngDegrees = -lngDegrees;
+        }
+
+        return new double[] {latDegrees, lngDegrees};
+    }
+
     private static S2CellId getS2CellId(double latDegrees, double lngDegrees, int s2Level) {
         // Create the leaf S2 cell containing the given S2LatLng
         S2CellId cellId = S2CellId.fromLatLng(S2LatLng.fromDegrees(latDegrees, lngDegrees));
@@ -75,14 +186,21 @@
                 required = true)
         public String inputFile;
 
-        @Parameter(names = "--lat-degrees",
-                description = "lat degress of the location",
-                required = true)
-        public double latDegrees;
+        @Parameter(names = "--lat-degrees", description = "latitude in degrees")
+        public Double latDegrees;
 
-        @Parameter(names = "--lng-degrees",
-                description = "lng degress of the location",
-                required = true)
-        public double lngDegrees;
+        @Parameter(names = "--lng-degrees", description = "longitude in degrees")
+        public Double lngDegrees;
+
+        @Parameter(
+                names = "--dms",
+                description = "coordinates in DMS format (e.g., 32°43'19\"N 117°23'40\"W)")
+        public String dms;
+
+        @Parameter(names = "--csv-file", description = "Input CSV file")
+        public String csvFile;
+
+        @Parameter(names = "--output-file", description = "Output CSV file")
+        public String outputFile;
     }
 }
