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

Commit 67ed663e authored by Aishwarya Mallampati's avatar Aishwarya Mallampati Committed by Android (Google) Code Review
Browse files

Merge "Address API review comments." into main

parents 3233d47f e59d2c11
Loading
Loading
Loading
Loading
+23 −23
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ import android.telephony.satellite.ISelectedNbIotSatelliteSubscriptionCallback;
import android.telephony.satellite.NtnSignalStrength;
import android.telephony.satellite.SatelliteAccessConfiguration;
import android.telephony.satellite.SatelliteCapabilities;
import android.telephony.satellite.SatelliteCommunicationAllowedStateCallback;
import android.telephony.satellite.SatelliteCommunicationAccessStateCallback;
import android.telephony.satellite.SatelliteDatagram;
import android.telephony.satellite.SatelliteManager;
import android.telephony.satellite.SatelliteModemEnableRequestAttributes;
@@ -392,7 +392,7 @@ public class SatelliteController extends Handler {
            new AtomicBoolean(false);
    private final AtomicBoolean mRegisteredForTerrestrialNetworkAvailableChanged =
            new AtomicBoolean(false);
    private final AtomicBoolean mRegisteredForSatelliteCommunicationAllowedStateChanged =
    private final AtomicBoolean mRegisteredForSatelliteCommunicationAccessStateChanged =
        new AtomicBoolean(false);
    /**
     * Map key: subId, value: callback to get error code of the provision request.
@@ -895,7 +895,7 @@ public class SatelliteController extends Handler {
        registerForSatelliteModemStateChanged();
        registerForServiceStateChanged();
        registerForSignalStrengthChanged();
        registerForSatelliteCommunicationAllowedStateChanged();
        registerForSatelliteCommunicationAccessStateChanged();
        mContentResolver = mContext.getContentResolver();
        mCarrierConfigManager = mContext.getSystemService(CarrierConfigManager.class);

@@ -4796,7 +4796,7 @@ public class SatelliteController extends Handler {
        synchronized (mSatelliteTokenProvisionedLock) {
            for (SatelliteSubscriberInfo subscriberInfo : newList) {

                int subId = subscriberInfo.getSubId();
                int subId = subscriberInfo.getSubscriptionId();
                Boolean currentProvisioned =
                        mProvisionedSubscriberId.get(subscriberInfo.getSubscriberId());
                if (currentProvisioned == null) {
@@ -6136,7 +6136,7 @@ public class SatelliteController extends Handler {
            return;
        }

        registerForSatelliteCommunicationAllowedStateChanged();
        registerForSatelliteCommunicationAccessStateChanged();

        boolean eligible = isCarrierRoamingNtnEligible(getSatellitePhone());
        plogd("evaluateCarrierRoamingNtnEligibilityChange: "
@@ -7380,7 +7380,7 @@ public class SatelliteController extends Handler {
                    SatelliteSubscriberInfo satelliteSubscriberInfo =
                            new SatelliteSubscriberInfo.Builder().setSubscriberId(subscriberId)
                                    .setCarrierId(carrierId).setNiddApn(apn)
                                    .setSubId(info.getSubscriptionId())
                                    .setSubscriptionId(info.getSubscriptionId())
                                    .setSubscriberIdType(subscriberIdPair.second)
                                    .build();
                    boolean provisioned = mProvisionedSubscriberId.getOrDefault(subscriberId,
@@ -7898,25 +7898,25 @@ public class SatelliteController extends Handler {
    }

    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
    protected void registerForSatelliteCommunicationAllowedStateChanged() {
        if (mRegisteredForSatelliteCommunicationAllowedStateChanged.get()) {
    protected void registerForSatelliteCommunicationAccessStateChanged() {
        if (mRegisteredForSatelliteCommunicationAccessStateChanged.get()) {
            if (DEBUG) {
                plogd("registerForSatelliteCommunicationAllowedStateChanged: already registered.");
                plogd("registerForSatelliteCommunicationAccessStateChanged: already registered.");
            }
            return;
        }

        SatelliteManager satelliteManager = mContext.getSystemService(SatelliteManager.class);
        if (satelliteManager == null) {
            ploge("registerForSatelliteCommunicationAllowedStateChanged: SatelliteManager is null");
            ploge("registerForSatelliteCommunicationAccessStateChanged: SatelliteManager is null");
            return;
        }

        SatelliteCommunicationAllowedStateCallback allowedStateCallback =
            new SatelliteCommunicationAllowedStateCallback() {
        SatelliteCommunicationAccessStateCallback accessStateCallback =
            new SatelliteCommunicationAccessStateCallback() {
                @Override
                public void onSatelliteCommunicationAllowedStateChanged(boolean isAllowed) {
                    plogd("onSatelliteCommunicationAllowedStateChanged: isAllowed="
                public void onAccessAllowedStateChanged(boolean isAllowed) {
                    plogd("onAccessStateChanged: isAllowed="
                        + isAllowed);
                    synchronized (mSatelliteAccessConfigLock) {
                        mSatelliteAccessAllowed = isAllowed;
@@ -7925,23 +7925,23 @@ public class SatelliteController extends Handler {
                }

                @Override
                public void onSatelliteAccessConfigurationChanged(
                public void onAccessConfigurationChanged(
                    SatelliteAccessConfiguration satelliteAccessConfiguration) {
                    plogd("onSatelliteAccessConfigurationChanged: satelliteAccessConfiguration="
                    plogd("onAccessConfigurationChanged: satelliteAccessConfiguration="
                        + satelliteAccessConfiguration);
                    handleSatelliteAccessConfigUpdateResult(satelliteAccessConfiguration);
                }
            };
        try {
            satelliteManager.registerForCommunicationAllowedStateChanged(
                    this::post, allowedStateCallback);
            satelliteManager.registerForCommunicationAccessStateChanged(
                    this::post, accessStateCallback);
        } catch(RuntimeException e) {
            plogd("registerForSatelliteCommunicationAllowedStateChanged: " +
                    "satelliteManager.registerForCommunicationAllowedStateChanged() failed, " +
                    "e=" + e);
            plogd("registerForSatelliteCommunicationAccessStateChanged: "
                    + "satelliteManager.registerForCommunicationAccessStateChanged() failed, "
                    + "e=" + e);
            return;
        }
        mRegisteredForSatelliteCommunicationAllowedStateChanged.set(true);
        mRegisteredForSatelliteCommunicationAccessStateChanged.set(true);
    }

    private void handleSatelliteAccessConfigUpdateResult(
@@ -8224,7 +8224,7 @@ public class SatelliteController extends Handler {
        }
        return new SatelliteSubscriberInfo.Builder().setSubscriberId(subscriberId)
                        .setCarrierId(carrierId).setNiddApn(apn)
                        .setSubId(subInfo.getSubscriptionId())
                        .setSubscriptionId(subInfo.getSubscriptionId())
                        .setSubscriberIdType(subscriberIdPair.second)
                        .build();
    }
+1 −1
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ public class TelephonyRegistryTest extends TelephonyTest {
            TelephonyCallback.DataActivityListener,
            TelephonyCallback.SimultaneousCellularCallingSupportListener,
            TelephonyCallback.EmergencyCallbackModeListener,
            TelephonyCallback.CarrierRoamingNtnModeListener,
            TelephonyCallback.CarrierRoamingNtnListener,
            TelephonyCallback.SecurityAlgorithmsListener,
            TelephonyCallback.CellularIdentifierDisclosedListener,
            TelephonyCallback.CallAttributesListener {
+6 −6
Original line number Diff line number Diff line
@@ -4895,10 +4895,10 @@ public class SatelliteControllerTest extends TelephonyTest {
    private List<SatelliteSubscriberInfo> getExpectedSatelliteSubscriberInfoList() {
        List<SatelliteSubscriberInfo> list = new ArrayList<>();
        list.add(new SatelliteSubscriberInfo.Builder().setSubscriberId(mSubscriberId).setCarrierId(
                mCarrierId).setNiddApn(mNiddApn).setSubId(SUB_ID).setSubscriberIdType(
                mCarrierId).setNiddApn(mNiddApn).setSubscriptionId(SUB_ID).setSubscriberIdType(
                SatelliteSubscriberInfo.SUBSCRIBER_ID_TYPE_IMSI_MSISDN).build());
        list.add(new SatelliteSubscriberInfo.Builder().setSubscriberId(mSubscriberId2).setCarrierId(
                mCarrierId).setNiddApn(mNiddApn).setSubId(SUB_ID1).setSubscriberIdType(
                mCarrierId).setNiddApn(mNiddApn).setSubscriptionId(SUB_ID1).setSubscriberIdType(
                SatelliteSubscriberInfo.SUBSCRIBER_ID_TYPE_ICCID).build());
        return list;
    }
@@ -5003,7 +5003,7 @@ public class SatelliteControllerTest extends TelephonyTest {
    }

    @Test
    public void testRegisterForSatelliteCommunicationAllowedStateChanged() throws Exception {
    public void testRegisterForSatelliteCommunicationAccessStateChanged() throws Exception {
        when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
        mContextFixture.putIntArrayResource(
                R.array.config_verizon_satellite_enabled_tagids,
@@ -5035,7 +5035,7 @@ public class SatelliteControllerTest extends TelephonyTest {
        setComponentName();
        mSatelliteControllerUT.setIsSatelliteAllowedState(true);

        mSatelliteControllerUT.registerForSatelliteCommunicationAllowedStateChanged();
        mSatelliteControllerUT.registerForSatelliteCommunicationAccessStateChanged();

        // Test satelliteAccessConfigCallback.onSuccess
        // with current location NOT supporting carrier satellite
@@ -6218,8 +6218,8 @@ public class SatelliteControllerTest extends TelephonyTest {
        }

        @Override
        protected void registerForSatelliteCommunicationAllowedStateChanged() {
            logd("registerForSatelliteCommunicationAllowedStateChanged");
        protected void registerForSatelliteCommunicationAccessStateChanged() {
            logd("registerForSatelliteCommunicationAccessStateChanged");
        }

        void setSatelliteSessionController(SatelliteSessionController satelliteSessionController) {
+4 −4
Original line number Diff line number Diff line
@@ -877,8 +877,8 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest {
        }

        @Override
        protected void registerForSatelliteCommunicationAllowedStateChanged() {
            logd("registerForSatelliteCommunicationAllowedStateChanged");
        protected void registerForSatelliteCommunicationAccessStateChanged() {
            logd("registerForSatelliteCommunicationAccessStateChanged");
        }

        @Override
@@ -1004,8 +1004,8 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest {
        }

        @Override
        protected void registerForSatelliteCommunicationAllowedStateChanged() {
            logd("registerForSatelliteCommunicationAllowedStateChanged");
        protected void registerForSatelliteCommunicationAccessStateChanged() {
            logd("registerForSatelliteCommunicationAccessStateChanged");
        }
    }