Skip to content

Commit

Permalink
Adds information about cellular terms to an info dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrowlands committed Jan 11, 2024
1 parent e1799e3 commit f6a9f04
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.17](https://github.com/christianrowlands/android-network-survey/releases/tag/v1.17) - 2024-01-12

* Adds Details views for Wi-Fi and Bluetooth that display a chart of the signal strength over time.
* Adds support for setting a custom MQTT topic prefix.
* Fixes a bug where Bluetooth permissions were not being requested correctly.
* Other various bug fixes and improvements.

## [1.16](https://github.com/christianrowlands/android-network-survey/releases/tag/v1.16) - 2023-12-20

* Adds support for Dual/Multi-SIM devices both in the UI as well as the messages (MQTT and file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.ViewModelProvider;
Expand Down Expand Up @@ -111,6 +112,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c

initializeLocationTextView();

initializeUiListeners();

initializeObservers();

return binding.getRoot();
Expand Down Expand Up @@ -199,6 +202,14 @@ public void onLocationChanged(@NonNull Location location)
viewModel.setLocation(location);
}

/**
* Initialize the UI listeners for the various buttons and other UI elements.
*/
private void initializeUiListeners()
{
binding.cellularInfoIcon.setOnClickListener(c -> showCellularInfoDialog());
}

/**
* Initialize the model view observers. These observers look for changes to the model view
* values, and then update the UI based on any changes.
Expand Down Expand Up @@ -1034,4 +1045,57 @@ private void addValueToRow(Context context, TableRow row, int value)
view.setText(cellText);
row.addView(view);
}

/**
* Displays a dialog with some information about cellular terms.
*/
private void showCellularInfoDialog()
{
final Context context = getContext();
if (context == null) return;

CellularProtocol protocol = viewModel.getServingCellProtocol().getValue();

// Default to LTE as a fallback
String cellularInfoTitle = getString(R.string.lte_info_description);
CharSequence cellularInfoBody = getString(R.string.lte_cellular_terms_explanation);

if (protocol == null) protocol = CellularProtocol.LTE;
switch (protocol)
{
case NONE, LTE ->
{
cellularInfoTitle = getString(R.string.lte_info_description);
cellularInfoBody = getText(R.string.lte_cellular_terms_explanation);
}
case GSM ->
{
cellularInfoTitle = getString(R.string.gsm_info_description);
cellularInfoBody = getText(R.string.gsm_cellular_terms_explanation);
}
case CDMA ->
{
cellularInfoTitle = "How did you find CDMA?";
cellularInfoBody = "CDMA is no longer supported. I am impressed you were able to find a CDMA network! Honestly, send me an email at [email protected] and let me know where you found it.";
}
case UMTS ->
{
cellularInfoTitle = getString(R.string.umts_info_description);
cellularInfoBody = getText(R.string.umts_cellular_terms_explanation);
}
case NR ->
{
cellularInfoTitle = getString(R.string.nr_info_description);
cellularInfoBody = getText(R.string.nr_cellular_terms_explanation);
}
}

AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
alertBuilder.setCancelable(true);
alertBuilder.setTitle(cellularInfoTitle);
alertBuilder.setMessage(cellularInfoBody);
alertBuilder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
});
alertBuilder.create().show();
}
}
17 changes: 17 additions & 0 deletions networksurvey/src/main/res/drawable-anydpi/ic_info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF"
android:alpha="0.8">
<group
android:scaleX="1.2"
android:scaleY="1.2"
android:translateX="-2.4"
android:translateY="-2.4">
<path
android:fillColor="@android:color/white"
android:pathData="M11,7h2v2h-2V7zM11,11h2v6h-2V11zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8s8,3.59 8,8S16.41,20 12,20z" />
</group>
</vector>
Binary file added networksurvey/src/main/res/drawable-hdpi/ic_info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added networksurvey/src/main/res/drawable-mdpi/ic_info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions networksurvey/src/main/res/layout/fragment_network_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,19 @@
style="@style/CardTitleStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/card_title_cellular_details_initial" />

<ImageView
android:id="@+id/cellular_info_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_marginStart="@dimen/x_small_margin"
android:layout_marginEnd="@dimen/x_small_margin"
android:contentDescription="@string/cellular_info_description"
android:src="@drawable/ic_info" />

</LinearLayout>

<LinearLayout
Expand Down
51 changes: 51 additions & 0 deletions networksurvey/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,57 @@ but work independently, so you have full control over how you handle your data.<
<string name="card_title_neighbors_nr">NR Neighbors</string>
<string name="neighbors_icon_description">Neighbors Icon</string>

<string name="cellular_info_description">Cellular Information Icon</string>
<string name="gsm_info_description">GSM Terms Info</string>
<string name="gsm_cellular_terms_explanation">
<b>MCC</b> (Mobile Country Code): Unique country identifier for mobile networks.\n\n
<b>MNC</b> (Mobile Network Code): Unique network identifier within the country. Together the MCC and MNC represent a specific service provider (e.g. T-Mobile).\n\n
<b>LAC</b> (Location Area Code): Identifier for a group of cell towers that is used for paging.\n\n
<b>CID</b> (Cell Identity): Identifier for a specific cell tower. Together the MCC, MNC, LAC and CID uniquely identifies a specific GSM cell panel from all others in the world.\n\n
<b>ARFCN</b> (Absolute Radio Frequency Channel Number): Number representing the GSM carrier frequency.\n\n
<b>BSIC</b> (Base Station Identity Code): A physical layer cell identifier that helps a mobile device differentiate two cells during cell selection/reselection that are using the same frequency.\n\n
<b>RSSI</b> (Received Signal Strength Indicator): Received power of the downlink signal in dBm as received by the mobile device.\n\n
</string>
<string name="umts_info_description">UMTS Terms Info</string>
<string name="umts_cellular_terms_explanation">
<b>MCC</b> (Mobile Country Code): Unique country identifier for mobile networks.\n\n
<b>MNC</b> (Mobile Network Code): Unique network identifier within the country. Together the MCC and MNC represent a specific service provider (e.g. T-Mobile).\n\n
<b>LAC</b> (Location Area Code): Identifier for a group of cell towers that is used for paging.\n\n
<b>CID</b> (Cell Identity): Identifier for a specific cell tower. Together the MCC, MNC, LAC, and CID uniquely identifies a specific UMTS cell panel from all others in the world.\n\n
<b>UARFCN</b> (UTRA Absolute Radio Frequency Channel Number): Number representing UMTS carrier frequency.\n\n
<b>PSC</b> (Primary Scrambling Code): A physical layer cell identifier that helps a mobile device differentiate two cells that are using the same frequency.\n\n
<b>RSSI</b> (Received Signal Strength Indicator): Received power of the downlink signal in dBm as received by the mobile device.\n\n
<b>RSCP</b> (Reference Signal Code Power): Power of the reference signal in dBm as received by the mobile device.\n\n
</string>
<string name="lte_info_description">LTE Terms Info</string>
<string name="lte_cellular_terms_explanation">
<b>MCC</b> (Mobile Country Code): Unique country identifier for mobile networks.\n\n
<b>MNC</b> (Mobile Network Code): Unique network identifier within the country. Together the MCC and MNC represent a specific service provider (e.g. T-Mobile).\n\n
<b>TAC</b> (Tracking Area Code): Identifier for a group of cell towers that is used for paging.\n\n
<b>CID</b> (Cell Identity): Identifier for a specific cell tower. Together the MCC, MNC, and CID uniquely identifies a specific LTE cell panel from all others in the world.\n\n
<b>eNB ID</b> (eNodeB Identifier): The cell tower identifier, which will contain one or more cell panels. This is the first 20 bites of the CID.\n\n
<b>Sector ID</b>: Identifies a sector (aka panel) within a cell tower. This is the last 8 bits of the CID.\n\n
<b>EARFCN</b> (E-UTRA Absolute Radio Frequency Channel Number): Number representing LTE carrier frequency.\n\n
<b>Band</b>: That band number representing the frequency range the EARFCN falls in.\n\n
<b>PCI</b> (Physical Cell ID): A physical layer cell identifier that helps a mobile device differentiate two cells during cell selection/reselection that are using the same frequency. Valid range 0-503. The numbers in parenthesis represent the Primary Sync Sequence (PSS) and Secondary Sync Sequence (SSS).\n\n
<b>Bandwidth</b>: Width of the signal.\n\n
<b>TA</b> (Timing Advance): The timing offset a mobile device uses to keep its transmissions in sync with the tower. Represents RF distance from the tower, which can be loosely translated to physical distance. Larger numbers indicate the device is further away from the tower.\n\n
<b>RSRP</b> (Reference Signal Received Power): Power of the reference signal in dBm as received by the mobile device. Valid range -44 to -140.\n\n
<b>RSRQ</b> (Reference Signal Received Quality): Measures the quality of the received reference signal. Valid range -3 to -19.5 with -3 being the best.\n
</string>
<string name="nr_info_description">NR Terms Info</string>
<string name="nr_cellular_terms_explanation">
<b>MCC</b> (Mobile Country Code): Unique country identifier for mobile networks.\n\n
<b>MNC</b> (Mobile Network Code): Unique network identifier within the country. Together the MCC and MNC represent a specific service provider (e.g. T-Mobile).\n\n
<b>TAC</b> (Tracking Area Code): Identifier for a group of cell towers that is used for paging.\n\n
<b>CID</b> (Cell Identity): Identifier for a specific cell tower. Together the MCC, MNC, and CID uniquely identifies a specific NR cell panel from all others in the world.\n\n
<b>NARFCN</b> (New radio Absolute Radio Frequency Channel Number): Number representing NR carrier frequency.\n\n
<b>PCI</b> (Physical Cell ID): A physical layer cell identifier that helps a mobile device differentiate two cells during cell selection/reselection that are using the same frequency. Valid range 0-1007. The numbers in parenthesis represent the Primary Sync Sequence (PSS) and Secondary Sync Sequence (SSS).\n\n
<b>TA</b> (Timing Advance): The timing offset a mobile device uses to keep its transmissions in sync with the tower. Represents RF distance from the tower, which can be loosely translated to physical distance. Larger numbers indicate the device is further away from the tower.\n\n
<b>SS_RSRP</b> (Secondary Synchronization Reference Signal Received Power): Power of the reference signal in dBm as received by the mobile device. Valid range -31 to -156.\n\n
<b>SS_RSRQ</b> (Secondary Synchronization Reference Signal Received Quality): Measures the quality of the received reference signal. Valid range 20 to -43 with 20 being the best.\n
</string>

<string name="missing_location_permission">Missing Location Permission</string>
<string name="no_gps_device">No GPS detected in device!</string>
<string name="turn_on_gps">Please turn on GPS</string>
Expand Down

0 comments on commit f6a9f04

Please sign in to comment.