Return UNSUPPORTED_ON_DEVICE in network/imei when no telephony
If the device does not have any telephony support (either via the build-time config_show_sim_info=false boolean flag, or when not declaring the PackageManager.FEATURE_TELEPHONY_DATA feature flag), returning UNSUPPORTED_ON_DEVICE makes more sense than CONDITIONALLY_UNAVAILABLE, as there is no runtime change that would make it available. This change also aligns the behavior with the deviceinfo/imei entry. Bug: 395714454 Flag: EXEMPT bugfix Test: atest MobileNetworkImeiPreferenceControllerTest Change-Id: Ia01cf3812f8343eabd8ea6970b691ac71432e8bd
This commit is contained in:
@@ -64,12 +64,12 @@ class MobileNetworkImeiPreferenceController(context: Context, key: String) :
|
||||
}
|
||||
|
||||
override fun getAvailabilityStatus(subId: Int): Int = when {
|
||||
!Flags.isDualSimOnboardingEnabled() -> CONDITIONALLY_UNAVAILABLE
|
||||
SubscriptionManager.isValidSubscriptionId(subId)
|
||||
&& SubscriptionUtil.isSimHardwareVisible(mContext)
|
||||
&& mContext.userManager.isAdminUser
|
||||
&& !Utils.isWifiOnly(mContext) -> AVAILABLE
|
||||
else -> CONDITIONALLY_UNAVAILABLE
|
||||
!SubscriptionUtil.isSimHardwareVisible(mContext)
|
||||
|| Utils.isWifiOnly(mContext) -> UNSUPPORTED_ON_DEVICE
|
||||
!Flags.isDualSimOnboardingEnabled()
|
||||
|| !SubscriptionManager.isValidSubscriptionId(subId)
|
||||
|| !mContext.userManager.isAdminUser -> CONDITIONALLY_UNAVAILABLE
|
||||
else -> AVAILABLE
|
||||
}
|
||||
|
||||
override fun displayPreference(screen: PreferenceScreen) {
|
||||
|
@@ -176,7 +176,7 @@ class MobileNetworkImeiPreferenceControllerTest {
|
||||
whenever(SubscriptionUtil.isSimHardwareVisible(context)).thenReturn(false)
|
||||
|
||||
val availabilityStatus = controller.availabilityStatus
|
||||
assertThat(availabilityStatus).isEqualTo(BasePreferenceController.CONDITIONALLY_UNAVAILABLE)
|
||||
assertThat(availabilityStatus).isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -196,7 +196,7 @@ class MobileNetworkImeiPreferenceControllerTest {
|
||||
whenever(Utils.isWifiOnly(context)).thenReturn(true)
|
||||
|
||||
val availabilityStatus = controller.availabilityStatus
|
||||
assertThat(availabilityStatus).isEqualTo(BasePreferenceController.CONDITIONALLY_UNAVAILABLE)
|
||||
assertThat(availabilityStatus).isEqualTo(BasePreferenceController.UNSUPPORTED_ON_DEVICE)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
Reference in New Issue
Block a user