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

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

Merge "Address API review comments" into main

parents 83a49985 478c307d
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -133,7 +133,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;
@@ -160,6 +159,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;
@@ -420,7 +420,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<>();

    /**
@@ -3328,7 +3328,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;
@@ -3343,10 +3343,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");
@@ -5017,10 +5017,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);
@@ -7148,7 +7148,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);
@@ -7157,7 +7157,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 −11
Original line number Diff line number Diff line
@@ -164,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;
@@ -187,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;
@@ -3769,8 +3769,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);
@@ -3928,10 +3928,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 {
@@ -4020,10 +4020,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();
@@ -4891,10 +4891,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;
    }