Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8b73050 authored by tom hsu's avatar tom hsu Committed by Android Build Coastguard Worker
Browse files

[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
parent e9e45b4a
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -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()
+5 −0
Original line number Diff line number Diff line
@@ -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);