diff options
author | 2025-03-31 03:38:11 +0000 | |
---|---|---|
committer | 2025-03-31 20:54:29 -0700 | |
commit | c8b730509d422f819a1e0e3bc0149cb2763bca9b (patch) | |
tree | 361a7645c33cd5ce96789a6680df3c8f4fa3e0e8 | |
parent | e9e45b4a0190e816b4fba92a583d42fc5dea38f3 (diff) |
[Satellite] Restrict requestIsSupported only in Manual type
- SatelliteManager#requestIsSupported only can be used in Manual
conneciton type. Hence add a type check with this API for the
condition check
Flag: EXEMPT bug fix
Fix: b/395811260
Test: atest pass
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d033f603b819c5b1264d116648c9f6f00b061320)
Merged-In: Ia9fed86a63dd8fa87cc20a83888b3cabbf28ddd8
Change-Id: Ia9fed86a63dd8fa87cc20a83888b3cabbf28ddd8
2 files changed, 15 insertions, 4 deletions
diff --git a/src/com/android/settings/network/telephony/satellite/SatelliteSettingsPreferenceCategoryController.java b/src/com/android/settings/network/telephony/satellite/SatelliteSettingsPreferenceCategoryController.java index 614ff6a695f..b404801898f 100644 --- a/src/com/android/settings/network/telephony/satellite/SatelliteSettingsPreferenceCategoryController.java +++ b/src/com/android/settings/network/telephony/satellite/SatelliteSettingsPreferenceCategoryController.java @@ -99,12 +99,19 @@ public class SatelliteSettingsPreferenceCategoryController extends if (!com.android.internal.telephony.flags.Flags.carrierEnabledSatelliteFlag()) { return UNSUPPORTED_ON_DEVICE; } + final PersistableBundle carrierConfig = mCarrierConfigCache.getConfigForSubId(subId); + + boolean isSatelliteConnectedTypeIsAuto = + CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC == carrierConfig.getInt( + KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, + CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC); - if (!mIsSatelliteSupported.get()) { + // SatelliteManager#requestIsSupported is only supported for manual connection type, so + // if type is auto, this check shall be skipped. + if (!isSatelliteConnectedTypeIsAuto && !mIsSatelliteSupported.get()) { return UNSUPPORTED_ON_DEVICE; } - final PersistableBundle carrierConfig = mCarrierConfigCache.getConfigForSubId(subId); boolean isSatelliteSosSupported = false; if (Flags.satelliteOemSettingsUxMigration()) { isSatelliteSosSupported = carrierConfig.getBoolean(KEY_SATELLITE_ESOS_SUPPORTED_BOOL); @@ -118,8 +125,7 @@ public class SatelliteSettingsPreferenceCategoryController extends return AVAILABLE_UNSEARCHABLE; } - if (CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC == carrierConfig.getInt( - KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC)) { + if (isSatelliteConnectedTypeIsAuto) { return AVAILABLE_UNSEARCHABLE; } else { return mCarrierRoamingNtnModeCallback.isSatelliteSmsAvailable() diff --git a/tests/unit/src/com/android/settings/network/telephony/satellite/SatelliteSettingsPreferenceCategoryControllerTest.java b/tests/unit/src/com/android/settings/network/telephony/satellite/SatelliteSettingsPreferenceCategoryControllerTest.java index ef44b928afe..563dddf9875 100644 --- a/tests/unit/src/com/android/settings/network/telephony/satellite/SatelliteSettingsPreferenceCategoryControllerTest.java +++ b/tests/unit/src/com/android/settings/network/telephony/satellite/SatelliteSettingsPreferenceCategoryControllerTest.java @@ -77,6 +77,8 @@ public class SatelliteSettingsPreferenceCategoryControllerTest { CarrierConfigCache.setTestInstance(mContext, mCarrierConfigCache); mController = new SatelliteSettingsPreferenceCategoryController(mContext, KEY); when(mCarrierConfigCache.getConfigForSubId(TEST_SUB_ID)).thenReturn(mPersistableBundle); + mPersistableBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, + CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC); when(mContext.getSystemService(SatelliteManager.class)).thenReturn(satelliteManager); mController.mIsSatelliteSupported.set(true); } @@ -95,7 +97,10 @@ public class SatelliteSettingsPreferenceCategoryControllerTest { @Test @EnableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG) public void getAvailabilityStatus_deviceUnsupported_returnUnsupported() { + mPersistableBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, + CARRIER_ROAMING_NTN_CONNECT_MANUAL); mController.mIsSatelliteSupported.set(false); + mController.init(TEST_SUB_ID); int result = mController.getAvailabilityStatus(TEST_SUB_ID); |