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

Commit 478c307d authored by Aishwarya Mallampati's avatar Aishwarya Mallampati
Browse files

Address API review comments

Bug: 383759250 , 383759437, 383759107, 383759286
Test: Manually tested SMS/MMS/CALLS/DATA
FLAG: com.android.internal.telephony.flags.satellite_system_apis
Change-Id: I037a7fddc9d4a4369216acc7e747f735deeee7e7
parent 33b3f9a3
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -134,7 +134,6 @@ import android.telephony.satellite.ISatelliteCapabilitiesCallback;
import android.telephony.satellite.ISatelliteDatagramCallback;
import android.telephony.satellite.ISatelliteModemStateCallback;
import android.telephony.satellite.ISatelliteProvisionStateCallback;
import android.telephony.satellite.ISatelliteSupportedStateCallback;
import android.telephony.satellite.ISatelliteTransmissionUpdateCallback;
import android.telephony.satellite.ISelectedNbIotSatelliteSubscriptionCallback;
import android.telephony.satellite.NtnSignalStrength;
@@ -159,6 +158,7 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.DeviceStateMonitor;
import com.android.internal.telephony.IBooleanConsumer;
import com.android.internal.telephony.IIntegerConsumer;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
@@ -417,7 +417,7 @@ public class SatelliteController extends Handler {
    /**
     * Map key: binder of the callback, value: callback to receive supported state changed events.
     */
    private final ConcurrentHashMap<IBinder, ISatelliteSupportedStateCallback>
    private final ConcurrentHashMap<IBinder, IBooleanConsumer>
            mSatelliteSupportedStateChangedListeners = new ConcurrentHashMap<>();

    /**
@@ -3317,7 +3317,7 @@ public class SatelliteController extends Handler {
     * @return The {@link SatelliteManager.SatelliteResult} result of the operation.
     */
    @SatelliteManager.SatelliteResult public int registerForSatelliteSupportedStateChanged(
            @NonNull ISatelliteSupportedStateCallback callback) {
            @NonNull IBooleanConsumer callback) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            plogd("registerForSatelliteSupportedStateChanged: oemEnabledSatelliteFlag is disabled");
            return SatelliteManager.SATELLITE_RESULT_REQUEST_NOT_SUPPORTED;
@@ -3332,10 +3332,10 @@ public class SatelliteController extends Handler {
     * If callback was not registered before, the request will be ignored.
     *
     * @param callback The callback that was passed to
     * {@link #registerForSatelliteSupportedStateChanged(int, ISatelliteSupportedStateCallback)}.
     *                 {@link #registerForSatelliteSupportedStateChanged(IBooleanConsumer)}
     */
    public void unregisterForSatelliteSupportedStateChanged(
            @NonNull ISatelliteSupportedStateCallback callback) {
            @NonNull IBooleanConsumer callback) {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            plogd("unregisterForSatelliteSupportedStateChanged: "
                    + "oemEnabledSatelliteFlag is disabled");
@@ -4994,10 +4994,10 @@ public class SatelliteController extends Handler {
    }

    private void notifySatelliteSupportedStateChanged(boolean supported) {
        List<ISatelliteSupportedStateCallback> deadCallersList = new ArrayList<>();
        List<IBooleanConsumer> deadCallersList = new ArrayList<>();
        mSatelliteSupportedStateChangedListeners.values().forEach(listener -> {
            try {
                listener.onSatelliteSupportedStateChanged(supported);
                listener.accept(supported);
            } catch (RemoteException e) {
                plogd("handleSatelliteSupportedStateChangedEvent RemoteException: " + e);
                deadCallersList.add(listener);
@@ -7121,7 +7121,7 @@ public class SatelliteController extends Handler {
    private Pair<String, Integer> getSubscriberIdAndType(@Nullable SubscriptionInfo info) {
        String subscriberId = "";
        @SatelliteSubscriberInfo.SubscriberIdType int subscriberIdType =
                SatelliteSubscriberInfo.ICCID;
                SatelliteSubscriberInfo.SUBSCRIBER_ID_TYPE_ICCID;
        if (info == null) {
            logd("getSubscriberIdAndType: subscription info is null");
            return new Pair<>(subscriberId, subscriberIdType);
@@ -7130,7 +7130,7 @@ public class SatelliteController extends Handler {
            subscriberId = info.getIccId();
        } else if (info.isSatelliteESOSSupported()) {
            subscriberId = getPhoneNumberBasedCarrier(info.getSubscriptionId());
            subscriberIdType = SatelliteSubscriberInfo.IMSI_MSISDN;
            subscriberIdType = SatelliteSubscriberInfo.SUBSCRIBER_ID_TYPE_IMSI_MSISDN;
        }
        logd("getSubscriberIdAndType: subscriberId=" + subscriberId + ", subscriberIdType="
                + subscriberIdType);
+2 −2
Original line number Diff line number Diff line
@@ -290,8 +290,8 @@ public class SatelliteServiceUtils {
        android.telephony.satellite.stub.SatelliteModemEnableRequestAttributes converted =
                new android.telephony.satellite.stub.SatelliteModemEnableRequestAttributes();
        converted.isEnabled = attributes.isEnabled();
        converted.isDemoMode = attributes.isDemoMode();
        converted.isEmergencyMode = attributes.isEmergencyMode();
        converted.isDemoMode = attributes.isForDemoMode();
        converted.isEmergencyMode = attributes.isForEmergencyMode();
        converted.satelliteSubscriptionInfo = toSatelliteSubscriptionInfo(
                attributes.getSatelliteSubscriptionInfo());
        return converted;
+11 −12
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ROAMING_P2P_S
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ROAMING_TURN_OFF_SESSION_FOR_EMERGENCY_CALL_BOOL;
import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_ALL;
import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED;
import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_ONLY_RESTRICTED;
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_VOICE;
@@ -165,7 +164,6 @@ import android.telephony.satellite.ISatelliteCapabilitiesCallback;
import android.telephony.satellite.ISatelliteDatagramCallback;
import android.telephony.satellite.ISatelliteModemStateCallback;
import android.telephony.satellite.ISatelliteProvisionStateCallback;
import android.telephony.satellite.ISatelliteSupportedStateCallback;
import android.telephony.satellite.ISatelliteTransmissionUpdateCallback;
import android.telephony.satellite.ISelectedNbIotSatelliteSubscriptionCallback;
import android.telephony.satellite.NtnSignalStrength;
@@ -188,6 +186,7 @@ import android.util.SparseArray;
import android.util.SparseBooleanArray;

import com.android.internal.R;
import com.android.internal.telephony.IBooleanConsumer;
import com.android.internal.telephony.IIntegerConsumer;
import com.android.internal.telephony.IVoidConsumer;
import com.android.internal.telephony.Phone;
@@ -3761,8 +3760,8 @@ public class SatelliteControllerTest extends TelephonyTest {
                enableSatelliteResponse.capture());
        SatelliteModemEnableRequestAttributes request = enableSatelliteRequest.getValue();
        assertTrue(request.isEnabled());
        assertFalse(request.isDemoMode());
        assertFalse(request.isEmergencyMode());
        assertFalse(request.isForDemoMode());
        assertFalse(request.isForEmergencyMode());

        clearInvocations(mMockSatelliteModemInterface);
        moveTimeForward(TEST_WAIT_FOR_SATELLITE_ENABLING_RESPONSE_TIMEOUT_MILLIS);
@@ -3920,10 +3919,10 @@ public class SatelliteControllerTest extends TelephonyTest {

        Semaphore semaphore = new Semaphore(0);
        final boolean[] isSupported  = new boolean[1];
        ISatelliteSupportedStateCallback callback =
                new ISatelliteSupportedStateCallback.Stub() {
        IBooleanConsumer callback =
                new IBooleanConsumer.Stub() {
                    @Override
                    public void onSatelliteSupportedStateChanged(boolean supported) {
                    public void accept(boolean supported) {
                        logd("onSatelliteSupportedStateChanged: supported=" + supported);
                        isSupported[0] = supported;
                        try {
@@ -4012,10 +4011,10 @@ public class SatelliteControllerTest extends TelephonyTest {
        when(mFeatureFlags.oemEnabledSatelliteFlag()).thenReturn(false);

        Semaphore semaphore = new Semaphore(0);
        ISatelliteSupportedStateCallback callback =
                new ISatelliteSupportedStateCallback.Stub() {
        IBooleanConsumer callback =
                new IBooleanConsumer.Stub() {
                    @Override
                    public void onSatelliteSupportedStateChanged(boolean supported) {
                    public void accept(boolean supported) {
                        logd("onSatelliteSupportedStateChanged: supported=" + supported);
                        try {
                            semaphore.release();
@@ -4905,10 +4904,10 @@ public class SatelliteControllerTest extends TelephonyTest {
        List<SatelliteSubscriberInfo> list = new ArrayList<>();
        list.add(new SatelliteSubscriberInfo.Builder().setSubscriberId(mSubscriberId).setCarrierId(
                mCarrierId).setNiddApn(mNiddApn).setSubId(SUB_ID).setSubscriberIdType(
                SatelliteSubscriberInfo.IMSI_MSISDN).build());
                SatelliteSubscriberInfo.SUBSCRIBER_ID_TYPE_IMSI_MSISDN).build());
        list.add(new SatelliteSubscriberInfo.Builder().setSubscriberId(mSubscriberId2).setCarrierId(
                mCarrierId).setNiddApn(mNiddApn).setSubId(SUB_ID1).setSubscriberIdType(
                SatelliteSubscriberInfo.ICCID).build());
                SatelliteSubscriberInfo.SUBSCRIBER_ID_TYPE_ICCID).build());
        return list;
    }