X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyCell.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacycell%2Fhelpers%2FProtocolHelper.kt;fp=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacycell%2Fhelpers%2FProtocolHelper.kt;h=11407f7517d0e9e87941876f5597c0c20b8ec50d;hp=dcbc9adc71b1972cabfc3c6747e715287fe5c973;hb=ff2f3992b7ecddb804a96322789bd35010529f43;hpb=ab7601a6d91b6035862bb47b1ac259855e3aba3b diff --git a/app/src/main/java/com/stoutner/privacycell/helpers/ProtocolHelper.kt b/app/src/main/java/com/stoutner/privacycell/helpers/ProtocolHelper.kt index dcbc9ad..11407f7 100644 --- a/app/src/main/java/com/stoutner/privacycell/helpers/ProtocolHelper.kt +++ b/app/src/main/java/com/stoutner/privacycell/helpers/ProtocolHelper.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2022 Soren Stoutner . + * Copyright 2022 Soren Stoutner . * * This file is part of Privacy Cell . * @@ -69,17 +69,17 @@ class ProtocolHelper { } fun checkAdditionalNetworkInfo(additionalNetworkInfoType: Int): Int { - if ((additionalNetworkInfoType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) || - (additionalNetworkInfoType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED)) { + return if ((additionalNetworkInfoType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE) || + (additionalNetworkInfoType == TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED)) { // The additional network info is secure. - return SECURE + SECURE } else { // The additional network info is insecure. // TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA // TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO // TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA // TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE -- Can be removed once the minimum API >= 31. - return INSECURE + INSECURE } } @@ -112,14 +112,16 @@ class ProtocolHelper { fun getAdditionalNetworkInfoStringArray(overrideNetworkType: Int, context: Context) : Array { // Return the string array that corresponds to the override network type. + @Suppress("DEPRECATION") // OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE can be removed once the minimum API >= 31. return when(overrideNetworkType) { TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NONE -> arrayOf(context.getString(R.string.none), "") TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_CA -> arrayOf(context.getString(R.string.lte_ca), context.getString(R.string.lte_ca_detail)) TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO -> arrayOf(context.getString(R.string.lte_advanced_pro), context.getString(R.string.lte_advanced_pro_detail)) TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA -> arrayOf(context.getString(R.string.nr_nsa), context.getString(R.string.nr_nsa_detail)) - TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE -> arrayOf(context.getString(R.string.nr_nsa_mmwave), context.getString(R.string.nr_nsa_mmwave_detail)) // Can be removed once the minimum API >= 31. + // OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE can be removed once the minimum API >= 31. + TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE -> arrayOf(context.getString(R.string.nr_nsa_mmwave), context.getString(R.string.nr_nsa_mmwave_detail)) TelephonyDisplayInfo.OVERRIDE_NETWORK_TYPE_NR_ADVANCED -> arrayOf(context.getString(R.string.nr_advanced), context.getString(R.string.nr_advanced_detail)) else -> arrayOf(context.getString(R.string.error), "") } } -} \ No newline at end of file +}