- @SuppressLint("SwitchIntDef")
- override fun onDisplayInfoChanged(telephonyDisplayInfo: TelephonyDisplayInfo) {
- // Declare the stingray dialog type integer.
- val summaryDialogTypeInteger: Int
-
- // Populate the stingray security information. <https://source.android.com/devices/tech/connect/acts-5g-testing>
- if ((telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_NR) || (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_IWLAN) ||
- (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_UNKNOWN)) { // This is a secure network.
- // Populate the image view.
- stingrayImageView.setImageDrawable(AppCompatResources.getDrawable(applicationContext, R.drawable.secure))
-
- // Set the text.
- summaryTextView.text = getString(R.string.secure_protocols)
-
- // Set the text color.
- summaryTextView.setTextColor(getColor(R.color.blue_text))
-
- // Set the stingray dialog type integer.
- summaryDialogTypeInteger = WebViewDialog.STINGRAY
- } else if ((telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_LTE) || (!consider3gAntiquated && (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_1xRTT ||
- (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_EVDO_0) || (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_EVDO_A) ||
- (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_EVDO_B) || (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_EHRPD) ||
- (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_UMTS) || (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_TD_SCDMA) ||
- (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_HSDPA) || (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_HSUPA) ||
- (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_HSPA) || (telephonyDisplayInfo.networkType == TelephonyManager.NETWORK_TYPE_HSPAP)))) {
- // This is an insecure network.
- // Populate the image view.
- stingrayImageView.setImageDrawable(AppCompatResources.getDrawable(applicationContext, R.drawable.insecure))
-
- // Set the text.
- summaryTextView.text = getString(R.string.insecure_protocols)
-
- // Set the text color.
- summaryTextView.setTextColor(getColor(R.color.yellow_900))
-
- // Set the stingray dialog type integer.
- summaryDialogTypeInteger = WebViewDialog.STINGRAY
- } else { // This is an antiquated network.
- // Populate the image view.
- stingrayImageView.setImageDrawable(AppCompatResources.getDrawable(applicationContext, R.drawable.antiquated))
-
- // Set the text.
- summaryTextView.text = getString(R.string.antiquated_protocols)
-
- // Set the text color.
- summaryTextView.setTextColor(getColor(R.color.red_text))
-
- // Set the stingray dialog type integer.
- summaryDialogTypeInteger = WebViewDialog.ANTIQUATED_NETWORK
- }