Loading src/com/android/settings/network/telephony/satellite/SatelliteSettingAccountInfoController.java +4 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,10 @@ public class SatelliteSettingAccountInfoController extends TelephonyBasePreferen @Override public int getAvailabilityStatus(int subId) { if (mConfigBundle.getInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT) == CARRIER_ROAMING_NTN_CONNECT_MANUAL) { return AVAILABLE; } return mConfigBundle.getBoolean(KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE; Loading tests/unit/src/com/android/settings/network/telephony/satellite/SatelliteSettingAccountInfoControllerTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settings.network.telephony.satellite; import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC; import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_MANUAL; import static android.telephony.CarrierConfigManager.KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL; import static com.android.settings.core.BasePreferenceController.AVAILABLE; Loading Loading @@ -81,6 +84,8 @@ public class SatelliteSettingAccountInfoControllerTest { @Test public void getAvailabilityStatus_entitlementNotSupport_returnConditionalUnavailable() { mPersistableBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC); when(mContext.getSystemService(SatelliteManager.class)).thenReturn(null); mController.init(TEST_SUB_ID, mPersistableBundle, false, false); Loading @@ -91,6 +96,8 @@ public class SatelliteSettingAccountInfoControllerTest { @Test public void getAvailabilityStatus_entitlementIsSupported_returnConditionalUnavailable() { mPersistableBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC); mPersistableBundle.putBoolean(KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true); mController.init(TEST_SUB_ID, mPersistableBundle, false, false); Loading @@ -99,6 +106,17 @@ public class SatelliteSettingAccountInfoControllerTest { assertThat(result).isEqualTo(AVAILABLE); } @Test public void getAvailabilityStatus_connectionTypeISManual_returnAvailable() { mPersistableBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, CARRIER_ROAMING_NTN_CONNECT_MANUAL); mController.init(TEST_SUB_ID, mPersistableBundle, false, false); int result = mController.getAvailabilityStatus(TEST_SUB_ID); assertThat(result).isEqualTo(AVAILABLE); } @Test public void displayPreference_showCategoryTitle_correctOperatorName() { mPersistableBundle.putBoolean(KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true); Loading Loading
src/com/android/settings/network/telephony/satellite/SatelliteSettingAccountInfoController.java +4 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,10 @@ public class SatelliteSettingAccountInfoController extends TelephonyBasePreferen @Override public int getAvailabilityStatus(int subId) { if (mConfigBundle.getInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT) == CARRIER_ROAMING_NTN_CONNECT_MANUAL) { return AVAILABLE; } return mConfigBundle.getBoolean(KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL) ? AVAILABLE : CONDITIONALLY_UNAVAILABLE; Loading
tests/unit/src/com/android/settings/network/telephony/satellite/SatelliteSettingAccountInfoControllerTest.java +18 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.settings.network.telephony.satellite; import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC; import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_MANUAL; import static android.telephony.CarrierConfigManager.KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT; import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL; import static com.android.settings.core.BasePreferenceController.AVAILABLE; Loading Loading @@ -81,6 +84,8 @@ public class SatelliteSettingAccountInfoControllerTest { @Test public void getAvailabilityStatus_entitlementNotSupport_returnConditionalUnavailable() { mPersistableBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC); when(mContext.getSystemService(SatelliteManager.class)).thenReturn(null); mController.init(TEST_SUB_ID, mPersistableBundle, false, false); Loading @@ -91,6 +96,8 @@ public class SatelliteSettingAccountInfoControllerTest { @Test public void getAvailabilityStatus_entitlementIsSupported_returnConditionalUnavailable() { mPersistableBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC); mPersistableBundle.putBoolean(KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true); mController.init(TEST_SUB_ID, mPersistableBundle, false, false); Loading @@ -99,6 +106,17 @@ public class SatelliteSettingAccountInfoControllerTest { assertThat(result).isEqualTo(AVAILABLE); } @Test public void getAvailabilityStatus_connectionTypeISManual_returnAvailable() { mPersistableBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, CARRIER_ROAMING_NTN_CONNECT_MANUAL); mController.init(TEST_SUB_ID, mPersistableBundle, false, false); int result = mController.getAvailabilityStatus(TEST_SUB_ID); assertThat(result).isEqualTo(AVAILABLE); } @Test public void displayPreference_showCategoryTitle_correctOperatorName() { mPersistableBundle.putBoolean(KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true); Loading