Refactor the code from using S2LevelRange to using SuffixTableRange

Bug: 349603733
Flag: EXEMPT refactor
Test: manually trigger Satellite service in live network and verified WAI b/349603733#comment5
      atest SatelliteAccessControllerTest, S2RangeSatelliteOnDeviceAccessControllerTest, HeaderBlockTest, SatS2RangeFileFormatTest, Sa2S2RangeFileReaderTest, SuffixTableBlockTest, SuffixTableExtraInfoTest
      atest SatelliteManagerTestOnMockService
Change-Id: Icb419af544f733940c0aa5e3a6cc1f143b19b901
diff --git a/src/com/android/phone/satellite/accesscontrol/S2RangeSatelliteOnDeviceAccessController.java b/src/com/android/phone/satellite/accesscontrol/S2RangeSatelliteOnDeviceAccessController.java
index 4490460..c020fa0 100644
--- a/src/com/android/phone/satellite/accesscontrol/S2RangeSatelliteOnDeviceAccessController.java
+++ b/src/com/android/phone/satellite/accesscontrol/S2RangeSatelliteOnDeviceAccessController.java
@@ -18,8 +18,8 @@
 import android.annotation.NonNull;
 import android.telephony.Rlog;
 
-import com.android.storage.s2.S2LevelRange;
 import com.android.telephony.sats2range.read.SatS2RangeFileReader;
+import com.android.telephony.sats2range.read.SuffixTableRange;
 
 import com.google.common.geometry.S2CellId;
 import com.google.common.geometry.S2LatLng;
@@ -84,7 +84,7 @@
     }
 
     private boolean isSatCommunicationAllowedAtLocation(long s2CellId) throws IOException {
-        S2LevelRange entry = mSatS2RangeFileReader.findEntryByCellId(s2CellId);
+        SuffixTableRange entry = mSatS2RangeFileReader.findEntryByCellId(s2CellId);
         if (mSatS2RangeFileReader.isAllowedList()) {
             // The file contains an allowed list of S2 cells. Thus, satellite is allowed if an
             // entry is found
diff --git a/tests/src/com/android/phone/satellite/accesscontrol/S2RangeSatelliteOnDeviceAccessControllerTest.java b/tests/src/com/android/phone/satellite/accesscontrol/S2RangeSatelliteOnDeviceAccessControllerTest.java
index 16a256d..8b10f07 100644
--- a/tests/src/com/android/phone/satellite/accesscontrol/S2RangeSatelliteOnDeviceAccessControllerTest.java
+++ b/tests/src/com/android/phone/satellite/accesscontrol/S2RangeSatelliteOnDeviceAccessControllerTest.java
@@ -21,8 +21,8 @@
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
-import com.android.storage.s2.S2LevelRange;
 import com.android.telephony.sats2range.read.SatS2RangeFileFormat;
+import com.android.telephony.sats2range.read.SuffixTableRange;
 import com.android.telephony.sats2range.utils.TestUtils;
 import com.android.telephony.sats2range.write.SatS2RangeFileWriter;
 
@@ -166,24 +166,24 @@
     private SatS2RangeFileFormat createSatS2File(
             File file, boolean isAllowedList) throws Exception {
         SatS2RangeFileFormat fileFormat;
-        S2LevelRange range1, range2, range3;
+        SuffixTableRange range1, range2, range3;
         try (SatS2RangeFileWriter satS2RangeFileWriter = SatS2RangeFileWriter.open(
                 file, TestUtils.createS2RangeFileFormat(isAllowedList))) {
             fileFormat = satS2RangeFileWriter.getFileFormat();
 
             // Two ranges that share a prefix.
-            range1 = new S2LevelRange(
+            range1 = new SuffixTableRange(
                     TestUtils.createCellId(fileFormat, 1, 1000, 1000),
                     TestUtils.createCellId(fileFormat, 1, 1000, 2000));
-            range2 = new S2LevelRange(
+            range2 = new SuffixTableRange(
                     TestUtils.createCellId(fileFormat, 1, 1000, 2001),
                     TestUtils.createCellId(fileFormat, 1, 1000, 3000));
             // This range has a different prefix, so will be in a different suffix table.
-            range3 = new S2LevelRange(
+            range3 = new SuffixTableRange(
                     TestUtils.createCellId(fileFormat, 1, 1001, 1000),
                     TestUtils.createCellId(fileFormat, 1, 1001, 2000));
 
-            List<S2LevelRange> ranges = new ArrayList<>();
+            List<SuffixTableRange> ranges = new ArrayList<>();
             ranges.add(range1);
             ranges.add(range2);
             ranges.add(range3);
diff --git a/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/PopulatedSuffixTableBlock.java b/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/PopulatedSuffixTableBlock.java
index 9aa56b2..2feccbf 100644
--- a/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/PopulatedSuffixTableBlock.java
+++ b/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/PopulatedSuffixTableBlock.java
@@ -20,7 +20,6 @@
 import static com.android.storage.s2.S2Support.cellIdToString;
 import static com.android.storage.util.Conditions.checkStateInRange;
 
-import com.android.storage.s2.S2LevelRange;
 import com.android.storage.table.packed.read.IntValueTypedPackedTable;
 import com.android.storage.table.reader.IntValueTable;
 
@@ -141,7 +140,7 @@
 
         private final IntValueTable.TableEntry mSuffixTableEntry;
 
-        private S2LevelRange mSuffixTableRange;
+        private SuffixTableRange mSuffixTableRange;
 
         Entry(IntValueTable.TableEntry suffixTableEntry) {
             mSuffixTableEntry = Objects.requireNonNull(suffixTableEntry);
@@ -154,7 +153,7 @@
 
         /** Returns the data for this entry. */
         @Override
-        public S2LevelRange getSuffixTableRange() {
+        public SuffixTableRange getSuffixTableRange() {
             // Creating SuffixTableRange is relatively expensive so it is created lazily and
             // memoized.
             if (mSuffixTableRange == null) {
@@ -190,7 +189,7 @@
                     endCellIdSuffix = 0;
                 }
                 long endCellId = mFileFormat.createCellId(endCellPrefixValue, endCellIdSuffix);
-                mSuffixTableRange = new S2LevelRange(startCellId, endCellId);
+                mSuffixTableRange = new SuffixTableRange(startCellId, endCellId);
             }
             return mSuffixTableRange;
         }
diff --git a/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SatS2RangeFileReader.java b/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SatS2RangeFileReader.java
index ecfa0a9..2c6c4af 100644
--- a/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SatS2RangeFileReader.java
+++ b/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SatS2RangeFileReader.java
@@ -19,7 +19,6 @@
 import com.android.storage.block.read.Block;
 import com.android.storage.block.read.BlockFileReader;
 import com.android.storage.block.read.BlockInfo;
-import com.android.storage.s2.S2LevelRange;
 import com.android.storage.s2.S2Support;
 import com.android.storage.util.Conditions;
 import com.android.storage.util.Visitor;
@@ -144,11 +143,11 @@
     }
 
     /**
-     * Finds an {@link S2LevelRange} associated with a range covering {@code cellId}.
+     * Finds an {@link SuffixTableRange} associated with a range covering {@code cellId}.
      * Returns {@code null} if no range exists. Throws {@link IllegalArgumentException} if
      * {@code cellId} is not the correct S2 level for the file. See {@link #getS2Level()}.
      */
-    public S2LevelRange findEntryByCellId(long cellId) throws IOException {
+    public SuffixTableRange findEntryByCellId(long cellId) throws IOException {
         checkNotClosed();
         int dataS2Level = mFileFormat.getS2Level();
         int searchS2Level = S2Support.getS2Level(cellId);
diff --git a/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SuffixTableBlock.java b/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SuffixTableBlock.java
index 90ddd89..ffd28d5 100644
--- a/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SuffixTableBlock.java
+++ b/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SuffixTableBlock.java
@@ -20,7 +20,6 @@
 import static com.android.storage.s2.S2Support.getS2Level;
 
 import com.android.storage.block.read.BlockData;
-import com.android.storage.s2.S2LevelRange;
 import com.android.storage.table.packed.read.IntValueTypedPackedTable;
 import com.android.storage.util.BitwiseUtils;
 import com.android.storage.util.Visitor;
@@ -180,6 +179,6 @@
         public abstract int getIndex();
 
         /** Returns the data for this entry. */
-        public abstract S2LevelRange getSuffixTableRange();
+        public abstract SuffixTableRange getSuffixTableRange();
     }
 }
diff --git a/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SuffixTableRange.java b/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SuffixTableRange.java
new file mode 100644
index 0000000..88f1b2e
--- /dev/null
+++ b/utils/satellite/s2storage/src/readonly/java/com/android/telephony/sats2range/read/SuffixTableRange.java
@@ -0,0 +1,75 @@
+/*
+ * 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.telephony.sats2range.read;
+
+import static com.android.storage.s2.S2Support.cellIdToString;
+
+import com.android.storage.s2.S2LevelRange;
+
+import java.util.Objects;
+
+public final class SuffixTableRange extends S2LevelRange {
+    private static final int DEAFAULT_ENTRY_VALUE = -1;
+    private final int mEntryValue;
+
+    // For backward compatibility
+    public SuffixTableRange(long startCellId, long endCellId) {
+        this(startCellId, endCellId, DEAFAULT_ENTRY_VALUE);
+    }
+
+    public SuffixTableRange(long startCellId, long endCellId, int entryValue) {
+        super(startCellId, endCellId);
+        mEntryValue = entryValue;
+    }
+
+    /** Returns the entry value associated with this range. */
+    public int getEntryValue() {
+        return mEntryValue;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+
+        if (super.equals(o)) {
+            int entryValue = ((SuffixTableRange) o).mEntryValue;
+            return mEntryValue == entryValue;
+        } else {
+            return false;
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(mStartCellId, mEndCellId, mEntryValue);
+    }
+
+    @Override
+    public String toString() {
+        return "SuffixTableRange{"
+                + "mS2Level=" + mS2Level
+                + ", mStartCellId=" + cellIdToString(mStartCellId)
+                + ", mEndCellId=" + cellIdToString(mEndCellId)
+                + ", mEntryValue=" + mEntryValue
+                + '}';
+    }
+}
diff --git a/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SatS2RangeFileReaderTest.java b/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SatS2RangeFileReaderTest.java
index bbfaef7..2797b77 100644
--- a/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SatS2RangeFileReaderTest.java
+++ b/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SatS2RangeFileReaderTest.java
@@ -18,9 +18,9 @@
 
 import static org.junit.Assert.assertEquals;
 
-import com.android.storage.s2.S2LevelRange;
 import com.android.telephony.sats2range.read.SatS2RangeFileFormat;
 import com.android.telephony.sats2range.read.SatS2RangeFileReader;
+import com.android.telephony.sats2range.read.SuffixTableRange;
 import com.android.telephony.sats2range.utils.TestUtils;
 import com.android.telephony.sats2range.write.SatS2RangeFileWriter;
 
@@ -38,24 +38,24 @@
 
         SatS2RangeFileFormat fileFormat;
         boolean isAllowedList = true;
-        S2LevelRange expectedRange1, expectedRange2, expectedRange3;
+        SuffixTableRange expectedRange1, expectedRange2, expectedRange3;
         try (SatS2RangeFileWriter satS2RangeFileWriter = SatS2RangeFileWriter.open(
                 file, TestUtils.createS2RangeFileFormat(isAllowedList))) {
             fileFormat = satS2RangeFileWriter.getFileFormat();
 
             // Two ranges that share a prefix.
-            expectedRange1 = new S2LevelRange(
+            expectedRange1 = new SuffixTableRange(
                     TestUtils.createCellId(fileFormat, 1, 1000, 1000),
                     TestUtils.createCellId(fileFormat, 1, 1000, 2000));
-            expectedRange2 = new S2LevelRange(
+            expectedRange2 = new SuffixTableRange(
                     TestUtils.createCellId(fileFormat, 1, 1000, 2000),
                     TestUtils.createCellId(fileFormat, 1, 1000, 3000));
             // This range has a different prefix, so will be in a different suffix table.
-            expectedRange3 = new S2LevelRange(
+            expectedRange3 = new SuffixTableRange(
                     TestUtils.createCellId(fileFormat, 1, 1001, 1000),
                     TestUtils.createCellId(fileFormat, 1, 1001, 2000));
 
-            List<S2LevelRange> ranges = new ArrayList<>();
+            List<SuffixTableRange> ranges = new ArrayList<>();
             ranges.add(expectedRange1);
             ranges.add(expectedRange2);
             ranges.add(expectedRange3);
@@ -65,15 +65,15 @@
         try (SatS2RangeFileReader satS2RangeFileReader = SatS2RangeFileReader.open(file)) {
             assertEquals(isAllowedList, satS2RangeFileReader.isAllowedList());
 
-            S2LevelRange range1 = satS2RangeFileReader.findEntryByCellId(
+            SuffixTableRange range1 = satS2RangeFileReader.findEntryByCellId(
                     TestUtils.createCellId(fileFormat, 1, 1000, 1500));
             assertEquals(expectedRange1, range1);
 
-            S2LevelRange range2 = satS2RangeFileReader.findEntryByCellId(
+            SuffixTableRange range2 = satS2RangeFileReader.findEntryByCellId(
                     TestUtils.createCellId(fileFormat, 1, 1000, 2500));
             assertEquals(expectedRange2, range2);
 
-            S2LevelRange range3 = satS2RangeFileReader.findEntryByCellId(
+            SuffixTableRange range3 = satS2RangeFileReader.findEntryByCellId(
                     TestUtils.createCellId(fileFormat, 1, 1001, 1500));
             assertEquals(expectedRange3, range3);
         }
diff --git a/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SuffixTableBlockTest.java b/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SuffixTableBlockTest.java
index 04b915b..7b9ce4a 100644
--- a/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SuffixTableBlockTest.java
+++ b/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SuffixTableBlockTest.java
@@ -24,9 +24,9 @@
 import static org.mockito.ArgumentMatchers.argThat;
 
 import com.android.storage.block.write.BlockWriter;
-import com.android.storage.s2.S2LevelRange;
 import com.android.telephony.sats2range.read.SatS2RangeFileFormat;
 import com.android.telephony.sats2range.read.SuffixTableBlock;
+import com.android.telephony.sats2range.read.SuffixTableRange;
 import com.android.telephony.sats2range.read.SuffixTableSharedData;
 import com.android.telephony.sats2range.utils.TestUtils;
 import com.android.telephony.sats2range.write.SuffixTableWriter;
@@ -78,12 +78,14 @@
         long invalidEndCellId = fileFormat.createCellId(tablePrefixValue + 1, maxSuffixValue);
         long validEndCellId = fileFormat.createCellId(tablePrefixValue, maxSuffixValue);
         {
-            S2LevelRange badStartCellId = new S2LevelRange(invalidStartCellId, validEndCellId);
+            SuffixTableRange badStartCellId = new SuffixTableRange(invalidStartCellId,
+                    validEndCellId);
             assertThrows(IllegalArgumentException.class,
                     () -> suffixTableWriter.addRange(badStartCellId));
         }
         {
-            S2LevelRange badEndCellId = new S2LevelRange(validStartCellId, invalidEndCellId);
+            SuffixTableRange badEndCellId = new SuffixTableRange(validStartCellId,
+                    invalidEndCellId);
             assertThrows(IllegalArgumentException.class,
                     () -> suffixTableWriter.addRange(badEndCellId));
         }
@@ -101,13 +103,13 @@
 
         SuffixTableWriter suffixTableWriter =
                 SuffixTableWriter.createPopulated(fileFormat, suffixTableSharedData);
-        S2LevelRange suffixTableRange1 = new S2LevelRange(
+        SuffixTableRange suffixTableRange1 = new SuffixTableRange(
                 fileFormat.createCellId(tablePrefixValue, 1000),
                 fileFormat.createCellId(tablePrefixValue, 1001));
         suffixTableWriter.addRange(suffixTableRange1);
 
         // It's fine to add a range that starts adjacent to the last one.
-        S2LevelRange suffixTableRange2 = new S2LevelRange(
+        SuffixTableRange suffixTableRange2 = new SuffixTableRange(
                 fileFormat.createCellId(tablePrefixValue, 1001),
                 fileFormat.createCellId(tablePrefixValue, 1002));
         suffixTableWriter.addRange(suffixTableRange2);
@@ -117,7 +119,7 @@
                 () -> suffixTableWriter.addRange(suffixTableRange2));
 
         // Try similar checks at the top end of the table.
-        S2LevelRange suffixTableRange3 = new S2LevelRange(
+        SuffixTableRange suffixTableRange3 = new SuffixTableRange(
                 fileFormat.createCellId(tablePrefixValue, maxSuffixValue - 1),
                 fileFormat.createCellId(tablePrefixValue, maxSuffixValue));
         suffixTableWriter.addRange(suffixTableRange3);
@@ -131,7 +133,7 @@
                 () -> suffixTableWriter.addRange(suffixTableRange3));
 
         // Now "complete" the table: there can be no entry after this one.
-        S2LevelRange suffixTableRange4 = new S2LevelRange(
+        SuffixTableRange suffixTableRange4 = new SuffixTableRange(
                 fileFormat.createCellId(tablePrefixValue, maxSuffixValue),
                 fileFormat.createCellId(tablePrefixValue + 1, 0));
         suffixTableWriter.addRange(suffixTableRange4);
@@ -180,23 +182,23 @@
 
         long entry1StartCellId = fileFormat.createCellId(tablePrefix, 1000);
         long entry1EndCellId = fileFormat.createCellId(tablePrefix, 2000);
-        S2LevelRange entry1 = new S2LevelRange(entry1StartCellId, entry1EndCellId);
+        SuffixTableRange entry1 = new SuffixTableRange(entry1StartCellId, entry1EndCellId);
         suffixTableWriter.addRange(entry1);
 
         long entry2StartCellId = fileFormat.createCellId(tablePrefix, 2000);
         long entry2EndCellId = fileFormat.createCellId(tablePrefix, 3000);
-        S2LevelRange entry2 = new S2LevelRange(entry2StartCellId, entry2EndCellId);
+        SuffixTableRange entry2 = new SuffixTableRange(entry2StartCellId, entry2EndCellId);
         suffixTableWriter.addRange(entry2);
 
         // There is a deliberate gap here between entry2 and entry3.
         long entry3StartCellId = fileFormat.createCellId(tablePrefix, 4000);
         long entry3EndCellId = fileFormat.createCellId(tablePrefix, 5000);
-        S2LevelRange entry3 = new S2LevelRange(entry3StartCellId, entry3EndCellId);
+        SuffixTableRange entry3 = new SuffixTableRange(entry3StartCellId, entry3EndCellId);
         suffixTableWriter.addRange(entry3);
 
         long entry4StartCellId = fileFormat.createCellId(tablePrefix, maxSuffix - 999);
         long entry4EndCellId = fileFormat.createCellId(tablePrefix + 1, 0);
-        S2LevelRange entry4 = new S2LevelRange(entry4StartCellId, entry4EndCellId);
+        SuffixTableRange entry4 = new SuffixTableRange(entry4StartCellId, entry4EndCellId);
         suffixTableWriter.addRange(entry4);
 
         BlockWriter.ReadBack blockReadback = suffixTableWriter.close();
@@ -251,7 +253,7 @@
                 SuffixTableWriter.createPopulated(fileFormat, suffixTableSharedData);
         long entry1StartCellId = fileFormat.createCellId(tablePrefix, 1000);
         long entry1EndCellId = fileFormat.createCellId(tablePrefix, 2000);
-        S2LevelRange entry1 = new S2LevelRange(entry1StartCellId, entry1EndCellId);
+        SuffixTableRange entry1 = new SuffixTableRange(entry1StartCellId, entry1EndCellId);
         suffixTableWriter.addRange(entry1);
         BlockWriter.ReadBack blockReadback = suffixTableWriter.close();
 
@@ -276,12 +278,12 @@
         SuffixTableWriter suffixTableWriter =
                 SuffixTableWriter.createPopulated(fileFormat, sharedData);
 
-        S2LevelRange entry1 = new S2LevelRange(
+        SuffixTableRange entry1 = new SuffixTableRange(
                 fileFormat.createCellId(tablePrefix, 1001),
                 fileFormat.createCellId(tablePrefix, 1101));
         suffixTableWriter.addRange(entry1);
 
-        S2LevelRange entry2 = new S2LevelRange(
+        SuffixTableRange entry2 = new SuffixTableRange(
                 fileFormat.createCellId(tablePrefix, 2001),
                 fileFormat.createCellId(tablePrefix, 2101));
         suffixTableWriter.addRange(entry2);
@@ -302,7 +304,7 @@
         inOrder.verify(mockVisitor).end();
     }
 
-    private S2LevelRange findEntryByCellId(SatS2RangeFileFormat fileFormat,
+    private SuffixTableRange findEntryByCellId(SatS2RangeFileFormat fileFormat,
             SuffixTableBlock suffixTableBlock, int prefix, int suffix) {
         long cellId = fileFormat.createCellId(prefix, suffix);
         SuffixTableBlock.Entry entry = suffixTableBlock.findEntryByCellId(cellId);
diff --git a/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SuffixTableExtraInfoTest.java b/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SuffixTableExtraInfoTest.java
index f992ae7..f978bd5 100644
--- a/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SuffixTableExtraInfoTest.java
+++ b/utils/satellite/s2storage/src/test/java/com/android/telephony/sats2range/SuffixTableExtraInfoTest.java
@@ -20,9 +20,9 @@
 
 import com.android.storage.block.read.BlockInfo;
 import com.android.storage.block.write.BlockWriter;
-import com.android.storage.s2.S2LevelRange;
 import com.android.telephony.sats2range.read.SatS2RangeFileFormat;
 import com.android.telephony.sats2range.read.SuffixTableExtraInfo;
+import com.android.telephony.sats2range.read.SuffixTableRange;
 import com.android.telephony.sats2range.read.SuffixTableSharedData;
 import com.android.telephony.sats2range.utils.TestUtils;
 import com.android.telephony.sats2range.write.SuffixTableWriter;
@@ -54,13 +54,13 @@
                 SuffixTableWriter.createPopulated(fileFormat, suffixTableSharedData);
 
         int tablePrefix = suffixTableSharedData.getTablePrefix();
-        S2LevelRange range1 = new S2LevelRange(
+        SuffixTableRange range1 = new SuffixTableRange(
                 fileFormat.createCellId(tablePrefix, 1000),
                 fileFormat.createCellId(tablePrefix, 1001));
-        S2LevelRange range2 = new S2LevelRange(
+        SuffixTableRange range2 = new SuffixTableRange(
                 fileFormat.createCellId(tablePrefix, 1002),
                 fileFormat.createCellId(tablePrefix, 1003));
-        S2LevelRange range3 = new S2LevelRange(
+        SuffixTableRange range3 = new SuffixTableRange(
                 fileFormat.createCellId(tablePrefix, 1004),
                 fileFormat.createCellId(tablePrefix, 1005));
 
diff --git a/utils/satellite/s2storage/src/write/java/com/android/telephony/sats2range/write/SatS2RangeFileWriter.java b/utils/satellite/s2storage/src/write/java/com/android/telephony/sats2range/write/SatS2RangeFileWriter.java
index 9b3c20e..3018aec 100644
--- a/utils/satellite/s2storage/src/write/java/com/android/telephony/sats2range/write/SatS2RangeFileWriter.java
+++ b/utils/satellite/s2storage/src/write/java/com/android/telephony/sats2range/write/SatS2RangeFileWriter.java
@@ -19,9 +19,9 @@
 import com.android.storage.block.write.BlockFileWriter;
 import com.android.storage.block.write.BlockWriter;
 import com.android.storage.block.write.EmptyBlockWriter;
-import com.android.storage.s2.S2LevelRange;
 import com.android.storage.s2.S2Support;
 import com.android.telephony.sats2range.read.SatS2RangeFileFormat;
+import com.android.telephony.sats2range.read.SuffixTableRange;
 import com.android.telephony.sats2range.read.SuffixTableSharedData;
 
 import java.io.File;
@@ -64,8 +64,8 @@
      * needed to fit them into suffix blocks. The ranges must be of the expected S2 level
      * and ordered by cell ID.
      */
-    public void createSortedSuffixBlocks(Iterator<S2LevelRange> ranges) throws IOException {
-        PushBackIterator<S2LevelRange> pushBackIterator = new PushBackIterator<>(ranges);
+    public void createSortedSuffixBlocks(Iterator<SuffixTableRange> ranges) throws IOException {
+        PushBackIterator<SuffixTableRange> pushBackIterator = new PushBackIterator<>(ranges);
 
         // For each prefix value, collect all the ranges that match.
         for (int currentPrefix = 0;
@@ -74,7 +74,7 @@
 
             // Step 1:
             // populate samePrefixRanges, which holds ranges that have a prefix of currentPrefix.
-            List<S2LevelRange> samePrefixRanges =
+            List<SuffixTableRange> samePrefixRanges =
                     collectSamePrefixRanges(pushBackIterator, currentPrefix);
 
             // Step 2: Write samePrefixRanges to a suffix table.
@@ -88,11 +88,11 @@
         }
     }
 
-    private List<S2LevelRange> collectSamePrefixRanges(
-            PushBackIterator<S2LevelRange> pushBackIterator, int currentPrefix) {
-        List<S2LevelRange> samePrefixRanges = new ArrayList<>();
+    private List<SuffixTableRange> collectSamePrefixRanges(
+            PushBackIterator<SuffixTableRange> pushBackIterator, int currentPrefix) {
+        List<SuffixTableRange> samePrefixRanges = new ArrayList<>();
         while (pushBackIterator.hasNext()) {
-            S2LevelRange currentRange = pushBackIterator.next();
+            SuffixTableRange currentRange = pushBackIterator.next();
 
             long startCellId = currentRange.getStartCellId();
             if (mFileFormat.getS2Level() != S2Support.getS2Level(startCellId)) {
@@ -123,17 +123,18 @@
                 // Create a range for the current prefix.
                 {
                     long newEndCellId = mFileFormat.createCellId(startCellPrefix + 1, 0);
-                    S2LevelRange satS2Range = new S2LevelRange(startCellId, newEndCellId);
+                    SuffixTableRange satS2Range = new SuffixTableRange(startCellId, newEndCellId);
                     samePrefixRanges.add(satS2Range);
                 }
 
-                Deque<S2LevelRange> otherRanges = new ArrayDeque<>();
+                Deque<SuffixTableRange> otherRanges = new ArrayDeque<>();
                 // Intermediate prefixes.
                 startCellPrefix = startCellPrefix + 1;
                 while (startCellPrefix != endCellPrefixValue) {
                     long newStartCellId = mFileFormat.createCellId(startCellPrefix, 0);
                     long newEndCellId = mFileFormat.createCellId(startCellPrefix + 1, 0);
-                    S2LevelRange satS2Range = new S2LevelRange(newStartCellId, newEndCellId);
+                    SuffixTableRange satS2Range = new SuffixTableRange(newStartCellId,
+                            newEndCellId);
                     otherRanges.add(satS2Range);
                     startCellPrefix++;
                 }
@@ -142,7 +143,8 @@
                 {
                     long newStartCellId = mFileFormat.createCellId(endCellPrefixValue, 0);
                     if (newStartCellId != endCellId) {
-                        S2LevelRange satS2Range = new S2LevelRange(newStartCellId, endCellId);
+                        SuffixTableRange satS2Range = new SuffixTableRange(newStartCellId,
+                                endCellId);
                         otherRanges.add(satS2Range);
                     }
                 }
@@ -160,7 +162,7 @@
     }
 
     private BlockWriter writeSamePrefixRanges(
-            int currentPrefix, List<S2LevelRange> samePrefixRanges) throws IOException {
+            int currentPrefix, List<SuffixTableRange> samePrefixRanges) throws IOException {
         BlockWriter blockWriter;
         if (samePrefixRanges.size() == 0) {
             // Add an empty block.
@@ -170,8 +172,8 @@
             SuffixTableSharedData sharedData = new SuffixTableSharedData(currentPrefix);
             SuffixTableWriter suffixTableWriter =
                     SuffixTableWriter.createPopulated(mFileFormat, sharedData);
-            S2LevelRange lastRange = null;
-            for (S2LevelRange currentRange : samePrefixRanges) {
+            SuffixTableRange lastRange = null;
+            for (SuffixTableRange currentRange : samePrefixRanges) {
                 // Validate ranges don't overlap.
                 if (lastRange != null) {
                     if (lastRange.overlaps(currentRange)) {
@@ -188,12 +190,13 @@
                 int rangeLength = mFileFormat.calculateRangeLength(startCellId, endCellId);
                 while (rangeLength > maxRangeLength) {
                     long newEndCellId = S2Support.offsetCellId(startCellId, maxRangeLength);
-                    S2LevelRange suffixTableRange = new S2LevelRange(startCellId, newEndCellId);
+                    SuffixTableRange suffixTableRange = new SuffixTableRange(startCellId,
+                            newEndCellId);
                     suffixTableWriter.addRange(suffixTableRange);
                     startCellId = newEndCellId;
                     rangeLength = mFileFormat.calculateRangeLength(startCellId, endCellId);
                 }
-                S2LevelRange suffixTableRange = new S2LevelRange(startCellId, endCellId);
+                SuffixTableRange suffixTableRange = new SuffixTableRange(startCellId, endCellId);
                 suffixTableWriter.addRange(suffixTableRange);
             }
             blockWriter = suffixTableWriter;
diff --git a/utils/satellite/s2storage/src/write/java/com/android/telephony/sats2range/write/SuffixTableWriter.java b/utils/satellite/s2storage/src/write/java/com/android/telephony/sats2range/write/SuffixTableWriter.java
index dc265d5..31b35eb 100644
--- a/utils/satellite/s2storage/src/write/java/com/android/telephony/sats2range/write/SuffixTableWriter.java
+++ b/utils/satellite/s2storage/src/write/java/com/android/telephony/sats2range/write/SuffixTableWriter.java
@@ -22,11 +22,11 @@
 import com.android.storage.block.write.BlockWriter;
 import com.android.storage.block.write.EmptyBlockWriter;
 import com.android.storage.io.write.TypedOutputStream;
-import com.android.storage.s2.S2LevelRange;
 import com.android.storage.s2.S2Support;
 import com.android.storage.table.packed.write.PackedTableWriter;
 import com.android.telephony.sats2range.read.SatS2RangeFileFormat;
 import com.android.telephony.sats2range.read.SuffixTableExtraInfo;
+import com.android.telephony.sats2range.read.SuffixTableRange;
 import com.android.telephony.sats2range.read.SuffixTableSharedData;
 
 import java.io.ByteArrayOutputStream;
@@ -42,7 +42,7 @@
  * To write empty tables use {@link #createEmptyBlockWriter()}.
  * To write populated tables use {@link
  * #createPopulated(SatS2RangeFileFormat, SuffixTableSharedData)} and add entries with
- * {@link #addRange(S2LevelRange)}
+ * {@link #addRange(SuffixTableRange)}
  */
 public final class SuffixTableWriter implements BlockWriter {
 
@@ -54,7 +54,7 @@
 
     private final File mFile;
 
-    private S2LevelRange mLastRangeAdded;
+    private SuffixTableRange mLastRangeAdded;
 
     private SuffixTableWriter(SatS2RangeFileFormat fileFormat, SuffixTableSharedData sharedData)
             throws IOException {
@@ -90,7 +90,7 @@
      * called at least once. See {@link SuffixTableWriter#createEmptyBlockWriter()} for empty
      * tables.
      */
-    public void addRange(S2LevelRange suffixTableRange) throws IOException {
+    public void addRange(SuffixTableRange suffixTableRange) throws IOException {
         checkIsOpen();
 
         long rangeStartCellId = suffixTableRange.getStartCellId();
diff --git a/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/CreateTestSatS2File.java b/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/CreateTestSatS2File.java
index f9a9347..41ce416 100644
--- a/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/CreateTestSatS2File.java
+++ b/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/CreateTestSatS2File.java
@@ -16,8 +16,8 @@
 
 package com.android.telephony.tools.sats2;
 
-import com.android.storage.s2.S2LevelRange;
 import com.android.telephony.sats2range.read.SatS2RangeFileFormat;
+import com.android.telephony.sats2range.read.SuffixTableRange;
 import com.android.telephony.sats2range.write.SatS2RangeFileWriter;
 
 import java.io.File;
@@ -42,18 +42,18 @@
         try (SatS2RangeFileWriter satS2RangeFileWriter =
                      SatS2RangeFileWriter.open(file, fileFormat)) {
             // Two ranges that share a prefix.
-            S2LevelRange range1 = new S2LevelRange(
+            SuffixTableRange range1 = new SuffixTableRange(
                     fileFormat.createCellId(0b100_11111111, 1000),
                     fileFormat.createCellId(0b100_11111111, 2000));
-            S2LevelRange range2 = new S2LevelRange(
+            SuffixTableRange range2 = new SuffixTableRange(
                     fileFormat.createCellId(0b100_11111111, 2000),
                     fileFormat.createCellId(0b100_11111111, 3000));
             // This range has a different face, so a different prefix, and will be in a different
             // suffix table.
-            S2LevelRange range3 = new S2LevelRange(
+            SuffixTableRange range3 = new SuffixTableRange(
                     fileFormat.createCellId(0b101_11111111, 1000),
                     fileFormat.createCellId(0b101_11111111, 2000));
-            List<S2LevelRange> allRanges = listOf(range1, range2, range3);
+            List<SuffixTableRange> allRanges = listOf(range1, range2, range3);
             satS2RangeFileWriter.createSortedSuffixBlocks(allRanges.iterator());
         }
     }
diff --git a/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/SatS2FileCreator.java b/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/SatS2FileCreator.java
index dd7d8c0..1ed9680 100644
--- a/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/SatS2FileCreator.java
+++ b/utils/satellite/tools/src/main/java/com/android/telephony/tools/sats2/SatS2FileCreator.java
@@ -16,9 +16,9 @@
 
 package com.android.telephony.tools.sats2;
 
-import com.android.storage.s2.S2LevelRange;
 import com.android.telephony.sats2range.read.SatS2RangeFileFormat;
 import com.android.telephony.sats2range.read.SatS2RangeFileReader;
+import com.android.telephony.sats2range.read.SuffixTableRange;
 import com.android.telephony.sats2range.write.SatS2RangeFileWriter;
 
 import com.google.common.base.Stopwatch;
@@ -73,15 +73,15 @@
                 FileFormats.getFileFormatForLevel(s2Level, isAllowedList);
         try (SatS2RangeFileWriter satS2RangeFileWriter =
                      SatS2RangeFileWriter.open(new File(outputFile), fileFormat)) {
-            Iterator<S2LevelRange> s2LevelRangeIterator = satS2Ranges
+            Iterator<SuffixTableRange> suffixTableRangeIterator = satS2Ranges
                     .stream()
-                    .map(x -> new S2LevelRange(x.rangeStart.id(), x.rangeEnd.id()))
+                    .map(x -> new SuffixTableRange(x.rangeStart.id(), x.rangeEnd.id()))
                     .iterator();
             /*
              * Group the sorted ranges into contiguous suffix blocks. Big ranges might get split as
              * needed to fit them into suffix blocks.
              */
-            satS2RangeFileWriter.createSortedSuffixBlocks(s2LevelRangeIterator);
+            satS2RangeFileWriter.createSortedSuffixBlocks(suffixTableRangeIterator);
         }
 
         // Validate the output block file