From 1441b5b445e87ae1b4bebb284e3d469aa34a263a Mon Sep 17 00:00:00 2001 From: christianrowlands Date: Fri, 10 Nov 2023 12:20:10 -0500 Subject: [PATCH] Displays the band number next to the EARFCN on the cellular details screen --- .github/workflows/android-release.yaml | 1 + CHANGELOG.md | 11 +- networksurvey/build.gradle | 2 +- .../fragments/NetworkDetailsFragment.java | 14 ++- .../networksurvey/util/CellularUtils.java | 101 ++++++++++++++++++ .../res/layout/fragment_network_details.xml | 2 +- networksurvey/src/main/res/values/strings.xml | 1 + 7 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 networksurvey/src/main/java/com/craxiom/networksurvey/util/CellularUtils.java diff --git a/.github/workflows/android-release.yaml b/.github/workflows/android-release.yaml index d7d9ce06..6be97b4a 100644 --- a/.github/workflows/android-release.yaml +++ b/.github/workflows/android-release.yaml @@ -189,6 +189,7 @@ jobs: commit: ${{ github.sha }} body: "The regular-release apk is the same as what can be found on the Google Play Store. The cdr-release apk is the same as the regular-release apk, but with the full CDR support (See README.md for more details) and it also does not contain any tracking libraries such as Google Analytics." generateReleaseNotes: true + draft: true - name: Release app to internal track uses: r0adkll/upload-google-play@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 639622d3..9634070b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.14](https://github.com/christianrowlands/android-network-survey/releases/tag/v1.14) - 2023-11-09 + +* Added support for logging Cellular, Wi-Fi, Bluetooth, and GNSS surveys to CSV files. +* Added a help dialog explaining the difference between file logging and MQTT. +* Added links to the user manual and NS Messaging API docs in the Nav menu. +* Allow for horizontal display (landscape mode). +* Updates for Android 14. + ## [1.13](https://github.com/christianrowlands/android-network-survey/releases/tag/v1.13) - 2023-06-29 * The speed (in meters per second) is now included in all messages. @@ -24,7 +32,8 @@ * Adds support for logging Call Detail Record (CDR) events to a CSV file. * Caches the Bluetooth UI results so the results are still visible when switching between tabs. -* Adds a connection toggle switch and direct link to the MQTT Connection Fragment from the Dashboard. +* Adds a connection toggle switch and direct link to the MQTT Connection Fragment from the + Dashboard. * Changes the default location provider to Fused, which should improve battery life. ## [1.10.0](https://github.com/christianrowlands/android-network-survey/releases/tag/v1.10.0) - 2023-01-24 diff --git a/networksurvey/build.gradle b/networksurvey/build.gradle index ea6402ce..63fe20ef 100644 --- a/networksurvey/build.gradle +++ b/networksurvey/build.gradle @@ -18,7 +18,7 @@ android { minSdkVersion 26 targetSdkVersion 34 versionCode 52 - versionName "1.14" + versionName "1.15-SNAPSHOT" setProperty("archivesBaseName", "$applicationName-$versionName") testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments clearPackageData: 'true' diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/fragments/NetworkDetailsFragment.java b/networksurvey/src/main/java/com/craxiom/networksurvey/fragments/NetworkDetailsFragment.java index 52e618a9..962686a8 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/fragments/NetworkDetailsFragment.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/fragments/NetworkDetailsFragment.java @@ -47,6 +47,7 @@ import com.craxiom.networksurvey.model.CellularProtocol; import com.craxiom.networksurvey.model.CellularRecordWrapper; import com.craxiom.networksurvey.services.NetworkSurveyService; +import com.craxiom.networksurvey.util.CellularUtils; import com.craxiom.networksurvey.util.ColorUtils; import com.craxiom.networksurvey.util.MathUtils; import com.craxiom.networksurvey.util.ParserUtils; @@ -442,7 +443,7 @@ private void updateServingCellProtocol(CellularProtocol protocol) binding.tacLabel.setText(R.string.tac_label); binding.enbIdGroup.setVisibility(View.VISIBLE); binding.sectorIdGroup.setVisibility(View.VISIBLE); - binding.earfcnLabel.setText(R.string.earfcn_label); + binding.earfcnLabel.setText(R.string.earfcn_band_label); binding.pciLabel.setText(R.string.pci_label); binding.bandwidthGroup.setVisibility(View.VISIBLE); binding.taGroup.setVisibility(View.VISIBLE); @@ -612,7 +613,16 @@ private void processLteServingCell(LteRecordData data) viewModel.setMnc(data.hasMnc() ? String.valueOf(data.getMnc().getValue()) : ""); viewModel.setAreaCode(data.hasTac() ? String.valueOf(data.getTac().getValue()) : ""); viewModel.setCellId(data.hasEci() ? (long) data.getEci().getValue() : null); - viewModel.setChannelNumber(data.hasEarfcn() ? String.valueOf(data.getEarfcn().getValue()) : ""); + + if (data.hasEarfcn()) + { + int earfcn = data.getEarfcn().getValue(); + int band = CellularUtils.downlinkEarfcnToBand(earfcn); + viewModel.setChannelNumber(earfcn + " / " + (band == -1 ? "?" : band)); + } else + { + viewModel.setChannelNumber(""); + } if (data.hasPci()) { diff --git a/networksurvey/src/main/java/com/craxiom/networksurvey/util/CellularUtils.java b/networksurvey/src/main/java/com/craxiom/networksurvey/util/CellularUtils.java new file mode 100644 index 00000000..9c21a9f7 --- /dev/null +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/util/CellularUtils.java @@ -0,0 +1,101 @@ +package com.craxiom.networksurvey.util; + +/** + * Helper methods for working with cellular networks. + */ +public class CellularUtils +{ + /** + * From 3GPP TS 36.101, Table E-UTRA Operating Bands + */ + private static final int[][] DOWNLINK_LTE_BANDS = { + // Band, Lower bound of EARFCN, Upper bound of EARFCN + {1, 0, 599}, + {2, 600, 1199}, + {3, 1200, 1949}, + {4, 1950, 2399}, + {5, 2400, 2649}, + {6, 2650, 2749}, + {7, 2750, 3449}, + {8, 3450, 3799}, + {9, 3800, 4149}, + {10, 4150, 4749}, + {11, 4750, 4949}, + {12, 5010, 5179}, + {13, 5180, 5279}, + {14, 5280, 5379}, + {17, 5730, 5849}, + {18, 5850, 5999}, + {19, 6000, 6149}, + {20, 6150, 6449}, + {21, 6450, 6599}, + {22, 6600, 7399}, + {23, 7500, 7699}, + {24, 7700, 8039}, + {25, 8040, 8689}, + {26, 8690, 9039}, + {27, 9040, 9209}, + {28, 9210, 9659}, + {29, 9660, 9769}, + {30, 9770, 9869}, + {31, 9870, 9919}, + {32, 9920, 10359}, + {33, 36000, 36199}, + {34, 36200, 36349}, + {35, 36350, 36949}, + {36, 36950, 37549}, + {37, 37550, 37749}, + {38, 37750, 38249}, + {39, 38250, 38649}, + {40, 38650, 39649}, + {41, 39650, 41589}, + {42, 41590, 43589}, + {43, 43590, 45589}, + {44, 45590, 46589}, + {45, 46590, 46789}, + {46, 46790, 54539}, + {47, 54540, 55239}, + {48, 55240, 56739}, + {49, 56740, 58239}, + {50, 58240, 59089}, + {51, 59090, 59139}, + {52, 59140, 60139}, + {64, -1, -1}, // Reserved band + {65, 65536, 66435}, + {66, 66436, 67335}, + {67, 67336, 67535}, + {68, 67536, 67835}, + {69, 67836, 68335}, + {70, 68336, 68585}, + {71, 68586, 68935}, + {72, 68936, 68985}, + {73, 68986, 69035}, + {74, 69036, 69465}, + {75, 69466, 70315}, + {76, 70316, 70365}, + {85, 70366, 70545}, + {87, 70546, 70595}, + {88, 70596, 70645}, + {103, 70646, 70655}, + {106, 70656, 70705}, + }; + + /** + * Returns the LTE band for a given EARFCN. + * + * @param earfcn The EARFCN to get the band for. + * @return The LTE band for the given EARFCN, or -1 if the EARFCN is not in a known band. + */ + public static int downlinkEarfcnToBand(int earfcn) + { + for (int[] band : DOWNLINK_LTE_BANDS) + { + if (earfcn >= band[1] && earfcn <= band[2]) + { + return band[0]; + } + } + + return -1; + } +} \ No newline at end of file diff --git a/networksurvey/src/main/res/layout/fragment_network_details.xml b/networksurvey/src/main/res/layout/fragment_network_details.xml index b0ac7648..3a2998f7 100644 --- a/networksurvey/src/main/res/layout/fragment_network_details.xml +++ b/networksurvey/src/main/res/layout/fragment_network_details.xml @@ -398,7 +398,7 @@ style="@style/SmallLabelText" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/earfcn_label" + android:text="@string/earfcn_band_label" app:layout_constraintBottom_toBottomOf="@id/earfcn_group" /> diff --git a/networksurvey/src/main/res/values/strings.xml b/networksurvey/src/main/res/values/strings.xml index e3ff6d7e..105b1481 100644 --- a/networksurvey/src/main/res/values/strings.xml +++ b/networksurvey/src/main/res/values/strings.xml @@ -104,6 +104,7 @@ but work independently, so you have full control over how you handle your data.< CID eNB ID Sector ID + EARFCN/Band EARFCN PCI Bandwidth