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

Commit 4c36ab91 authored by Hakjun Choi's avatar Hakjun Choi Committed by Android (Google) Code Review
Browse files

Merge "Changed API name from 'isNtn()' to 'isOnlyNonTerrestrialNetwork()' and...

Merge "Changed API name from 'isNtn()' to 'isOnlyNonTerrestrialNetwork()' and updated related methods and variables according to API Council recommendations." into main
parents 431d86fb 20eccda8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -281,7 +281,7 @@ public class SubscriptionDatabaseManager extends Handler {
                    SubscriptionInfoInternal::getSatelliteAttachEnabledForCarrier),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_IS_NTN,
                    SubscriptionInfoInternal::getNtn)
                    SubscriptionInfoInternal::getOnlyNonTerrestrialNetwork)
    );

    /**
@@ -2040,7 +2040,7 @@ public class SubscriptionDatabaseManager extends Handler {
            return;
        }
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_IS_NTN, isNtn,
                SubscriptionInfoInternal.Builder::setNtn);
                SubscriptionInfoInternal.Builder::setOnlyNonTerrestrialNetwork);
    }

    /**
@@ -2304,7 +2304,7 @@ public class SubscriptionDatabaseManager extends Handler {
                        cursor.getColumnIndexOrThrow(
                                SimInfo.COLUMN_SATELLITE_ATTACH_ENABLED_FOR_CARRIER)));
        if (mFeatureFlags.oemEnabledSatelliteFlag()) {
            builder.setNtn(cursor.getInt(cursor.getColumnIndexOrThrow(
            builder.setOnlyNonTerrestrialNetwork(cursor.getInt(cursor.getColumnIndexOrThrow(
                    SimInfo.COLUMN_IS_NTN)));
        }
        return builder.build();
+14 −13
Original line number Diff line number Diff line
@@ -452,7 +452,7 @@ public class SubscriptionInfoInternal {
     * Whether this subscription is used for communicating with non-terrestrial networks.
     * By default, its disabled. It is intended to use integer to fit the database format.
     */
    private final int mIsNtn;
    private final int mIsOnlyNonTerrestrialNetwork;

    // Below are the fields that do not exist in the SimInfo table.
    /**
@@ -538,7 +538,7 @@ public class SubscriptionInfoInternal {
        this.mIsSatelliteEnabled = builder.mIsSatelliteEnabled;
        this.mIsSatelliteAttachEnabledForCarrier =
                builder.mIsSatelliteAttachEnabledForCarrier;
        this.mIsNtn = builder.mIsNtn;
        this.mIsOnlyNonTerrestrialNetwork = builder.mIsOnlyNonTerrestrialNetwork;

        // Below are the fields that do not exist in the SimInfo table.
        this.mCardId = builder.mCardId;
@@ -1155,8 +1155,8 @@ public class SubscriptionInfoInternal {
     *
     * @return {@code 1} if the subscription is for non-terrestrial networks. {@code 0} otherwise.
     */
    public int getNtn() {
        return mIsNtn;
    public int getOnlyNonTerrestrialNetwork() {
        return mIsOnlyNonTerrestrialNetwork;
    }

    // Below are the fields that do not exist in SimInfo table.
@@ -1228,7 +1228,7 @@ public class SubscriptionInfoInternal {
                .setUiccApplicationsEnabled(mAreUiccApplicationsEnabled != 0)
                .setPortIndex(mPortIndex)
                .setUsageSetting(mUsageSetting)
                .setNtn(mIsNtn == 1)
                .setOnlyNonTerrestrialNetwork(mIsOnlyNonTerrestrialNetwork == 1)
                .build();
    }

@@ -1286,7 +1286,7 @@ public class SubscriptionInfoInternal {
                + " userId=" + mUserId
                + " isSatelliteEnabled=" + mIsSatelliteEnabled
                + " satellite_attach_enabled_for_carrier=" + mIsSatelliteAttachEnabledForCarrier
                + " getNtn=" + mIsNtn
                + " getOnlyNonTerrestrialNetwork=" + mIsOnlyNonTerrestrialNetwork
                + " isGroupDisabled=" + mIsGroupDisabled
                + "]";
    }
@@ -1344,7 +1344,7 @@ public class SubscriptionInfoInternal {
                that.mDeviceToDeviceStatusSharingContacts) && mNumberFromCarrier.equals(
                that.mNumberFromCarrier) && mNumberFromIms.equals(that.mNumberFromIms)
                && mIsSatelliteAttachEnabledForCarrier == that.mIsSatelliteAttachEnabledForCarrier
                && mIsNtn == that.mIsNtn;
                && mIsOnlyNonTerrestrialNetwork == that.mIsOnlyNonTerrestrialNetwork;
    }

    @Override
@@ -1366,7 +1366,7 @@ public class SubscriptionInfoInternal {
                mNumberFromCarrier,
                mNumberFromIms, mPortIndex, mUsageSetting, mLastUsedTPMessageReference, mUserId,
                mIsSatelliteEnabled, mCardId, mIsGroupDisabled,
                mIsSatelliteAttachEnabledForCarrier, mIsNtn);
                mIsSatelliteAttachEnabledForCarrier, mIsOnlyNonTerrestrialNetwork);
        result = 31 * result + Arrays.hashCode(mNativeAccessRules);
        result = 31 * result + Arrays.hashCode(mCarrierConfigAccessRules);
        result = 31 * result + Arrays.hashCode(mRcsConfig);
@@ -1737,7 +1737,7 @@ public class SubscriptionInfoInternal {
        /**
         * Whether this subscription is used for communicating with non-terrestrial network or not.
         */
        private int mIsNtn = 0;
        private int mIsOnlyNonTerrestrialNetwork = 0;

        // The following fields do not exist in the SimInfo table.
        /**
@@ -1827,7 +1827,7 @@ public class SubscriptionInfoInternal {
            mUserId = info.mUserId;
            mIsSatelliteEnabled = info.mIsSatelliteEnabled;
            mIsSatelliteAttachEnabledForCarrier = info.mIsSatelliteAttachEnabledForCarrier;
            mIsNtn = info.mIsNtn;
            mIsOnlyNonTerrestrialNetwork = info.mIsOnlyNonTerrestrialNetwork;
            // Below are the fields that do not exist in the SimInfo table.
            mCardId = info.mCardId;
            mIsGroupDisabled = info.mIsGroupDisabled;
@@ -2714,12 +2714,13 @@ public class SubscriptionInfoInternal {
        /**
         * Set whether the subscription is for NTN or not.
         *
         * @param isNtn {@code 1} if the subscription is for NTN, {@code 0} otherwise.
         * @param isOnlyNonTerrestrialNetwork {@code 1} if the subscription is for NTN, {@code 0}
         * otherwise.
         * @return The builder.
         */
        @NonNull
        public Builder setNtn(int isNtn) {
            mIsNtn = isNtn;
        public Builder setOnlyNonTerrestrialNetwork(int isOnlyNonTerrestrialNetwork) {
            mIsOnlyNonTerrestrialNetwork = isOnlyNonTerrestrialNetwork;
            return this;
        }

+3 −2
Original line number Diff line number Diff line
@@ -843,7 +843,7 @@ public class SubscriptionManagerService extends ISub.Stub {
        try {
            mSubscriptionDatabaseManager.setNtn(subId, (isNtn ? 1 : 0));
        } catch (IllegalArgumentException e) {
            loge("setNtn: invalid subId=" + subId);
            loge("setOnlyNonTerrestrialNetwork: invalid subId=" + subId);
        }
    }

@@ -1143,7 +1143,8 @@ public class SubscriptionManagerService extends ISub.Stub {
                        builder.setMcc(mcc);
                        builder.setMnc(mnc);
                        if (mFeatureFlags.oemEnabledSatelliteFlag()) {
                            builder.setNtn(isSatellitePlmn(mcc + mnc) ? 1 : 0);
                            builder.setOnlyNonTerrestrialNetwork(
                                    isSatellitePlmn(mcc + mnc) ? 1 : 0);
                        }
                    }
                    // If cardId = unsupported or un-initialized, we have no reason to update DB.
+2 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public class SubscriptionInfoTest {
                .setEhplmns(EHPLMNS)
                .setHplmns(HPLMNS)
                .setCountryIso("us")
                .setNtn(true)
                .setOnlyNonTerrestrialNetwork(true)
                .build();
    }

@@ -75,7 +75,7 @@ public class SubscriptionInfoTest {
        assertThat(mSubscriptionInfoUT.getSimSlotIndex()).isEqualTo(0);
        assertThat(mSubscriptionInfoUT.getIccId()).isEqualTo("890126042XXXXXXXXXXX");
        if (Flags.oemEnabledSatelliteFlag()) {
            assertThat(mSubscriptionInfoUT.isNtn()).isTrue();
            assertThat(mSubscriptionInfoUT.isOnlyNonTerrestrialNetwork()).isTrue();
        }
    }

+6 −6
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ public class SubscriptionDatabaseManagerTest extends TelephonyTest {
                    .setSatelliteEnabled(0)
                    .setSatelliteAttachEnabledForCarrier(
                            FAKE_SATELLITE_ATTACH_FOR_CARRIER_DISABLED)
                    .setNtn(FAKE_SATELLITE_IS_NTN_DISABLED)
                    .setOnlyNonTerrestrialNetwork(FAKE_SATELLITE_IS_NTN_DISABLED)
                    .setGroupDisabled(false)
                    .build();

@@ -268,7 +268,7 @@ public class SubscriptionDatabaseManagerTest extends TelephonyTest {
                    .setSatelliteEnabled(1)
                    .setSatelliteAttachEnabledForCarrier(
                            FAKE_SATELLITE_ATTACH_FOR_CARRIER_ENABLED)
                    .setNtn(FAKE_SATELLITE_IS_NTN_ENABLED)
                    .setOnlyNonTerrestrialNetwork(FAKE_SATELLITE_IS_NTN_ENABLED)
                    .setGroupDisabled(false)
                    .build();

@@ -1994,7 +1994,7 @@ public class SubscriptionDatabaseManagerTest extends TelephonyTest {
        processAllMessages();

        subInfo = new SubscriptionInfoInternal.Builder(subInfo)
                .setNtn(FAKE_SATELLITE_IS_NTN_ENABLED)
                .setOnlyNonTerrestrialNetwork(FAKE_SATELLITE_IS_NTN_ENABLED)
                .build();
        verifySubscription(subInfo);
        verify(mSubscriptionDatabaseManagerCallback, times(2)).onSubscriptionChanged(eq(1));
@@ -2006,7 +2006,7 @@ public class SubscriptionDatabaseManagerTest extends TelephonyTest {
        mDatabaseManagerUT.setSubscriptionProperty(FAKE_SUBSCRIPTION_INFO1.getSubscriptionId(),
                SimInfo.COLUMN_IS_NTN, FAKE_SATELLITE_IS_NTN_DISABLED);
        assertThat(mDatabaseManagerUT.getSubscriptionInfoInternal(
                        FAKE_SUBSCRIPTION_INFO1.getSubscriptionId()).getNtn())
                        FAKE_SUBSCRIPTION_INFO1.getSubscriptionId()).getOnlyNonTerrestrialNetwork())
                .isEqualTo(FAKE_SATELLITE_IS_NTN_DISABLED);
    }

@@ -2026,7 +2026,7 @@ public class SubscriptionDatabaseManagerTest extends TelephonyTest {
        when(mFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(false);
        reset(mSubscriptionDatabaseManagerCallback);
        subInfo = new SubscriptionInfoInternal.Builder(subInfo)
                .setNtn(FAKE_SATELLITE_IS_NTN_ENABLED)
                .setOnlyNonTerrestrialNetwork(FAKE_SATELLITE_IS_NTN_ENABLED)
                .build();

        int subId = subInfo.getSubscriptionId();
@@ -2051,7 +2051,7 @@ public class SubscriptionDatabaseManagerTest extends TelephonyTest {
        mDatabaseManagerUT.setSubscriptionProperty(FAKE_SUBSCRIPTION_INFO1.getSubscriptionId(),
                SimInfo.COLUMN_IS_NTN, FAKE_SATELLITE_IS_NTN_ENABLED);
        assertThat(mDatabaseManagerUT.getSubscriptionInfoInternal(
                FAKE_SUBSCRIPTION_INFO1.getSubscriptionId()).getNtn())
                FAKE_SUBSCRIPTION_INFO1.getSubscriptionId()).getOnlyNonTerrestrialNetwork())
                .isNotEqualTo(FAKE_SATELLITE_IS_NTN_ENABLED);
    }

Loading