From f6a9f04d3bccac345b07cea2f3911fdc5b8de0ab Mon Sep 17 00:00:00 2001 From: christianrowlands Date: Thu, 11 Jan 2024 09:22:12 -0500 Subject: [PATCH] Adds information about cellular terms to an info dialog --- CHANGELOG.md | 7 ++ .../fragments/NetworkDetailsFragment.java | 64 ++++++++++++++++++ .../src/main/res/drawable-anydpi/ic_info.xml | 17 +++++ .../src/main/res/drawable-hdpi/ic_info.png | Bin 0 -> 639 bytes .../src/main/res/drawable-mdpi/ic_info.png | Bin 0 -> 404 bytes .../src/main/res/drawable-xhdpi/ic_info.png | Bin 0 -> 1040 bytes .../src/main/res/drawable-xxhdpi/ic_info.png | Bin 0 -> 1619 bytes .../res/layout/fragment_network_details.xml | 11 +++ networksurvey/src/main/res/values/strings.xml | 51 ++++++++++++++ 9 files changed, 150 insertions(+) create mode 100644 networksurvey/src/main/res/drawable-anydpi/ic_info.xml create mode 100644 networksurvey/src/main/res/drawable-hdpi/ic_info.png create mode 100644 networksurvey/src/main/res/drawable-mdpi/ic_info.png create mode 100644 networksurvey/src/main/res/drawable-xhdpi/ic_info.png create mode 100644 networksurvey/src/main/res/drawable-xxhdpi/ic_info.png diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ff9d67b..9cfc3c56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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 218407df..1578c1f7 100644 --- a/networksurvey/src/main/java/com/craxiom/networksurvey/fragments/NetworkDetailsFragment.java +++ b/networksurvey/src/main/java/com/craxiom/networksurvey/fragments/NetworkDetailsFragment.java @@ -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; @@ -111,6 +112,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c initializeLocationTextView(); + initializeUiListeners(); + initializeObservers(); return binding.getRoot(); @@ -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. @@ -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 craxiomdev@gmail.com 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(); + } } diff --git a/networksurvey/src/main/res/drawable-anydpi/ic_info.xml b/networksurvey/src/main/res/drawable-anydpi/ic_info.xml new file mode 100644 index 00000000..a10c606d --- /dev/null +++ b/networksurvey/src/main/res/drawable-anydpi/ic_info.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/networksurvey/src/main/res/drawable-hdpi/ic_info.png b/networksurvey/src/main/res/drawable-hdpi/ic_info.png new file mode 100644 index 0000000000000000000000000000000000000000..24404c4b309fba0b968f97810bda20f4139f103c GIT binary patch literal 639 zcmV-_0)YLAP)@b-m)J8CjsWFH zp^y;pEQ0Tjya{Wafbfou;34aZ0vQL6+&=4KkmQ>A0XJFa3uLW@nYKoYbyG<2H1RK} zteFVN+;G&Xu}+2jXy>|39M1DDK-VDOhy}XoS;0q4kOH5E6wtnsw{9o-5zqZJm1t;* zynhRvCc4I#3Ft2@c|Hx$U)$Qz;4w8+-FqhksI^74n>wg(?ZSWZsz41r>VO^>=B1&5 z4%qWdj}2L%z`{RB;&2D`@C6=AXxg=I)l2TGSOZWc@=O&;xl@fo1(qI#6n3 zEYpy?x?@@N_HS?5@v1qq%eUceETSw9n!JZDF2%YT1LM}Vp22xHz#@Wxi^ zHP18C*Gv`=P?O}A;6q)^?x)EI2&+qSN6$lDd+|-LYDn;p16`;C@XHj}>!Ac|KS?#Hb~_H-Lpo_Vs63>2DWe~j~}%M=S`p~pC>(uIPckQoHUF^ zcOW8TWux3HkIJ(VzY%NLQv@|mmER#@A9wI@o-9;Yk@=)NC|hN1+*k~AQCo4o1S(jO zVXd67&Vf18M9+$K7od6&{U|?Ka|_U#C;ukWt$9rTkq8O^4;8ugMAC+4pIqbfpqcYL z0B_K2J&3L7!8LjQP*MOu4%c}A`y2u6hKaP)7|l$3C>s!pqA;QdOK6}%vU=!2G8&1Xh@c*Vf+qR{6;wt8L=-`fL2ub$gPEk3 z*kJXazSi=1>fGgbuV(>Dr2-Q7J7zHl!4;a574TYR(PN`^vJC2Q3usctGD=dt6%M`^ZdDSqIHM^u*v zR@?yUELsSv*LfArbwp%qg)k-9tm73t00MbC9IxLhI<5k+w?Y&EE9efyF#kKEGb!L& zT?K6kk07vF$1l$Syu0usDbQf$Et&z){{Hre51kqSyCr|xfu4GtK3f=g>I4?6!E^&X zt#$gm!oYhcP<2T>T`+&9>|tP3E{eP46@@6eSMeqj>({MXoK97yC3Z6eSLzPdvxGcVI{pLs8-YhQ)K#yO{e+ zjLoViucw`g-#MKj??y{>=A%c_mU+pK}BhzoM$FSO`GhBjaKABNiwC_{x z(IvwUIAS1ik7Jf3Hw4yeURqc*$JaV%=3hQr^D!*_A>Vay8Q7>EF)Z3ySPkBD@|Aq% zo7E!|V6@QuFO*u;V^)pVB9{*Hw2$0?=>?})k>pnTVXa#zEc#c2J5KSuJZZYVDHAAG zZ_zQ(kkd?BegM0yglRb#XrkSsBcV6u|GUj+i{1yG1ZAGN6n_9YI)=B4^gS^E0000< KMNUMnLSTZ@*51Sb literal 0 HcmV?d00001 diff --git a/networksurvey/src/main/res/drawable-xxhdpi/ic_info.png b/networksurvey/src/main/res/drawable-xxhdpi/ic_info.png new file mode 100644 index 0000000000000000000000000000000000000000..7eeec1932b9101a19242dfb0dccb404308911f12 GIT binary patch literal 1619 zcmV-Z2CVssP)x&mv7{@IQwKP-HDAY*1fsk(`s1UkfMQA0K1@$KBO;90ppdWzFy=12r3Oj_)j3(6Ou<(Fz5$BsVlH#uy#*Cdy%^6`G z=kKkg*cZ@EV;DUppW%9XBe*ewi_XD0;W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Q;?uDny(;wXbb~vs{xs@k>YoX4FYLx1=sbG= zlx*N`DpVVg75&0u0s9Xn#3!{ww4kl*-?gNMhX=KAeHN?Pzm_oE3w1hmvV>!_Ey=k; z_`#^Bh?_Y^BT2y9jU+|rC%Bhmv?a;)j!{F5^&BIKP<|81==k-Lu#{sp72FZ?I;x*e zo{bzUsU*SX8bv8Okn7J^)Slypo8;2Ty($+DMsI$XbIevGi7rF=J6JLF>hY8CA>7a0 ztcP1GsXwKo=o9y~a0BjP;b+uqibofTHM?5X5!@lp#q^E5zX${OGZp_Dh2`cnhJAc! zQ*fsW7nuV+eQ)LZdLt=rFUn^o+h7!l=c-y0+?0vVao4%p4U3*it*@nQO;Y?)VHbw~ zeT^8O2;0!7F(#GZ)&xE%d=57ip+5yU3b!0tPfbPtJ_UDqJ}SH@Y~om5=zo^ID%0I; RM?wGq002ovPDHLkV1i^}4zB + + NR Neighbors Neighbors Icon + Cellular Information Icon + GSM Terms Info + + MCC (Mobile Country Code): Unique country identifier for mobile networks.\n\n + MNC (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 + LAC (Location Area Code): Identifier for a group of cell towers that is used for paging.\n\n + CID (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 + ARFCN (Absolute Radio Frequency Channel Number): Number representing the GSM carrier frequency.\n\n + BSIC (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 + RSSI (Received Signal Strength Indicator): Received power of the downlink signal in dBm as received by the mobile device.\n\n + + UMTS Terms Info + + MCC (Mobile Country Code): Unique country identifier for mobile networks.\n\n + MNC (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 + LAC (Location Area Code): Identifier for a group of cell towers that is used for paging.\n\n + CID (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 + UARFCN (UTRA Absolute Radio Frequency Channel Number): Number representing UMTS carrier frequency.\n\n + PSC (Primary Scrambling Code): A physical layer cell identifier that helps a mobile device differentiate two cells that are using the same frequency.\n\n + RSSI (Received Signal Strength Indicator): Received power of the downlink signal in dBm as received by the mobile device.\n\n + RSCP (Reference Signal Code Power): Power of the reference signal in dBm as received by the mobile device.\n\n + + LTE Terms Info + + MCC (Mobile Country Code): Unique country identifier for mobile networks.\n\n + MNC (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 + TAC (Tracking Area Code): Identifier for a group of cell towers that is used for paging.\n\n + CID (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 + eNB ID (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 + Sector ID: Identifies a sector (aka panel) within a cell tower. This is the last 8 bits of the CID.\n\n + EARFCN (E-UTRA Absolute Radio Frequency Channel Number): Number representing LTE carrier frequency.\n\n + Band: That band number representing the frequency range the EARFCN falls in.\n\n + PCI (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 + Bandwidth: Width of the signal.\n\n + TA (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 + RSRP (Reference Signal Received Power): Power of the reference signal in dBm as received by the mobile device. Valid range -44 to -140.\n\n + RSRQ (Reference Signal Received Quality): Measures the quality of the received reference signal. Valid range -3 to -19.5 with -3 being the best.\n + + NR Terms Info + + MCC (Mobile Country Code): Unique country identifier for mobile networks.\n\n + MNC (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 + TAC (Tracking Area Code): Identifier for a group of cell towers that is used for paging.\n\n + CID (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 + NARFCN (New radio Absolute Radio Frequency Channel Number): Number representing NR carrier frequency.\n\n + PCI (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 + TA (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 + SS_RSRP (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 + SS_RSRQ (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 + + Missing Location Permission No GPS detected in device! Please turn on GPS