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

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

Merge "Address API review comments" into main

parents e873b51c f895a024
Loading
Loading
Loading
Loading
+21 −13
Original line number Diff line number Diff line
@@ -18684,7 +18684,7 @@ package android.telephony.satellite {
    method @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public int registerForProvisionStateChanged(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.satellite.SatelliteProvisionStateCallback);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void registerForSatelliteDisallowedReasonsChanged(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.satellite.SatelliteDisallowedReasonsCallback);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public int registerForSelectedNbIotSatelliteSubscriptionChanged(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.satellite.SelectedNbIotSatelliteSubscriptionCallback);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public int registerForSupportedStateChanged(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.satellite.SatelliteSupportedStateCallback);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public int registerForSupportedStateChanged(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
    method @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void removeAttachRestrictionForCarrier(int, int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
    method @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void requestAttachEnabledForCarrier(int, boolean, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
    method @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void requestCapabilities(@NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.telephony.satellite.SatelliteCapabilities,android.telephony.satellite.SatelliteManager.SatelliteException>);
@@ -18713,7 +18713,7 @@ package android.telephony.satellite {
    method @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void unregisterForProvisionStateChanged(@NonNull android.telephony.satellite.SatelliteProvisionStateCallback);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void unregisterForSatelliteDisallowedReasonsChanged(@NonNull android.telephony.satellite.SatelliteDisallowedReasonsCallback);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void unregisterForSelectedNbIotSatelliteSubscriptionChanged(@NonNull android.telephony.satellite.SelectedNbIotSatelliteSubscriptionCallback);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void unregisterForSupportedStateChanged(@NonNull android.telephony.satellite.SatelliteSupportedStateCallback);
    method @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void unregisterForSupportedStateChanged(@NonNull java.util.function.Consumer<java.lang.Boolean>);
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public static final String ACTION_SATELLITE_START_NON_EMERGENCY_SESSION = "android.telephony.satellite.action.SATELLITE_START_NON_EMERGENCY_SESSION";
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public static final String ACTION_SATELLITE_SUBSCRIBER_ID_LIST_CHANGED = "android.telephony.satellite.action.SATELLITE_SUBSCRIBER_ID_LIST_CHANGED";
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public static final int DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS = 7; // 0x7
@@ -18734,12 +18734,12 @@ package android.telephony.satellite {
    field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int DISPLAY_MODE_UNKNOWN = 0; // 0x0
    field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS = 1; // 0x1
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") public static final int EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911 = 2; // 0x2
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public static final String METADATA_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT = "android.telephony.METADATA_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT";
    field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int NT_RADIO_TECHNOLOGY_EMTC_NTN = 3; // 0x3
    field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int NT_RADIO_TECHNOLOGY_NB_IOT_NTN = 1; // 0x1
    field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int NT_RADIO_TECHNOLOGY_NR_NTN = 2; // 0x2
    field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int NT_RADIO_TECHNOLOGY_PROPRIETARY = 4; // 0x4
    field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int NT_RADIO_TECHNOLOGY_UNKNOWN = 0; // 0x0
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public static final String PROPERTY_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT = "android.telephony.satellite.PROPERTY_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT";
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") public static final int SATELLITE_COMMUNICATION_RESTRICTION_REASON_ENTITLEMENT = 2; // 0x2
    field @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") public static final int SATELLITE_COMMUNICATION_RESTRICTION_REASON_GEOLOCATION = 1; // 0x1
    field @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public static final int SATELLITE_COMMUNICATION_RESTRICTION_REASON_USER = 0; // 0x0
@@ -18803,11 +18803,12 @@ package android.telephony.satellite {
  }
  @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public final class SatelliteModemEnableRequestAttributes implements android.os.Parcelable {
    ctor public SatelliteModemEnableRequestAttributes(boolean, boolean, boolean, @NonNull android.telephony.satellite.SatelliteSubscriptionInfo);
    method public int describeContents();
    method @NonNull public android.telephony.satellite.SatelliteSubscriptionInfo getSatelliteSubscriptionInfo();
    method public boolean isDemoMode();
    method public boolean isEmergencyMode();
    method public boolean isEnabled();
    method public boolean isForDemoMode();
    method public boolean isForEmergencyMode();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.satellite.SatelliteModemEnableRequestAttributes> CREATOR;
  }
@@ -18817,9 +18818,10 @@ package android.telephony.satellite {
  }
  @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public final class SatellitePosition implements android.os.Parcelable {
    ctor public SatellitePosition(@FloatRange(from=0xffffff4c, to=180) double, @FloatRange(from=0.0) double);
    method public int describeContents();
    method public double getAltitudeKm();
    method public double getLongitudeDegrees();
    method @FloatRange(from=0.0) public double getAltitudeKm();
    method @FloatRange(from=0xffffff4c, to=180) public double getLongitudeDegrees();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.satellite.SatellitePosition> CREATOR;
  }
@@ -18838,8 +18840,8 @@ package android.telephony.satellite {
    method public int getSubscriberIdType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.satellite.SatelliteSubscriberInfo> CREATOR;
    field public static final int ICCID = 0; // 0x0
    field public static final int IMSI_MSISDN = 1; // 0x1
    field public static final int SUBSCRIBER_ID_TYPE_ICCID = 0; // 0x0
    field public static final int SUBSCRIBER_ID_TYPE_IMSI_MSISDN = 1; // 0x1
  }
  public static final class SatelliteSubscriberInfo.Builder {
@@ -18875,10 +18877,6 @@ package android.telephony.satellite {
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.satellite.SatelliteSubscriptionInfo> CREATOR;
  }
  @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public interface SatelliteSupportedStateCallback {
    method public void onSatelliteSupportedStateChanged(boolean);
  }
  @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public interface SatelliteTransmissionUpdateCallback {
    method @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public void onReceiveDatagramStateChanged(int, int, int);
    method @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public void onSatellitePositionChanged(@NonNull android.telephony.satellite.PointingInfo);
@@ -18902,6 +18900,16 @@ package android.telephony.satellite {
    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.satellite.SystemSelectionSpecifier> CREATOR;
  }
  public static final class SystemSelectionSpecifier.Builder {
    ctor public SystemSelectionSpecifier.Builder();
    method @NonNull public android.telephony.satellite.SystemSelectionSpecifier build();
    method @NonNull public android.telephony.satellite.SystemSelectionSpecifier.Builder setBands(@NonNull int[]);
    method @NonNull public android.telephony.satellite.SystemSelectionSpecifier.Builder setEarfcns(@NonNull int[]);
    method @NonNull public android.telephony.satellite.SystemSelectionSpecifier.Builder setMccMnc(@NonNull String);
    method @NonNull public android.telephony.satellite.SystemSelectionSpecifier.Builder setSatelliteInfos(@NonNull java.util.List<android.telephony.satellite.SatelliteInfo>);
    method @NonNull public android.telephony.satellite.SystemSelectionSpecifier.Builder setTagIds(@NonNull int[]);
  }
}
package android.text {
+3 −3
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.telephony.satellite.SatelliteManager
import android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS
import android.telephony.satellite.SatelliteModemStateCallback
import android.telephony.satellite.SatelliteProvisionStateCallback
import android.telephony.satellite.SatelliteSupportedStateCallback
import androidx.annotation.VisibleForTesting
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
@@ -51,6 +50,7 @@ import com.android.systemui.util.kotlin.getOrNull
import com.android.systemui.util.kotlin.pairwise
import com.android.systemui.util.time.SystemClock
import java.util.Optional
import java.util.function.Consumer
import javax.inject.Inject
import kotlin.coroutines.resume
import kotlinx.coroutines.CoroutineDispatcher
@@ -322,7 +322,7 @@ constructor(
            flowOf(false)
        } else {
            conflatedCallbackFlow {
                val callback = SatelliteSupportedStateCallback { supported ->
                val callback = Consumer<Boolean> { supported ->
                    logBuffer.i {
                        "onSatelliteSupportedStateChanged: " +
                                "${if (supported) "supported" else "not supported"}"
+5 −5
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_ERROR
import android.telephony.satellite.SatelliteManager.SatelliteException
import android.telephony.satellite.SatelliteModemStateCallback
import android.telephony.satellite.SatelliteProvisionStateCallback
import android.telephony.satellite.SatelliteSupportedStateCallback
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
@@ -52,6 +51,7 @@ import com.android.systemui.util.mockito.withArgCaptor
import com.android.systemui.util.time.FakeSystemClock
import com.google.common.truth.Truth.assertThat
import java.util.Optional
import java.util.function.Consumer
import kotlin.test.Test
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.StandardTestDispatcher
@@ -535,7 +535,7 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() {
            runCurrent()

            val callback =
                withArgCaptor<SatelliteSupportedStateCallback> {
                withArgCaptor<Consumer<Boolean>> {
                    verify(satelliteManager).registerForSupportedStateChanged(any(), capture())
                }

@@ -548,7 +548,7 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() {
            verify(satelliteManager, times(1)).registerForNtnSignalStrengthChanged(any(), any())

            // WHEN satellite support turns off
            callback.onSatelliteSupportedStateChanged(false)
            callback.accept(false)
            runCurrent()

            // THEN listeners are unregistered
@@ -564,7 +564,7 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() {
            runCurrent()

            val callback =
                withArgCaptor<SatelliteSupportedStateCallback> {
                withArgCaptor<Consumer<Boolean>> {
                    verify(satelliteManager).registerForSupportedStateChanged(any(), capture())
                }

@@ -577,7 +577,7 @@ class DeviceBasedSatelliteRepositoryImplTest : SysuiTestCase() {
            verify(satelliteManager, times(0)).registerForNtnSignalStrengthChanged(any(), any())

            // WHEN satellite support turns on
            callback.onSatelliteSupportedStateChanged(true)
            callback.accept(true)
            runCurrent()

            // THEN listeners are registered
+0 −31
Original line number Diff line number Diff line
/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony.satellite;

/**
 * Interface for satellite supported state change callback.
 * @hide
 */
oneway interface ISatelliteSupportedStateCallback {
    /**
     * Called when satellite supported state has changed.
     *
     * @param supoprted Whether satellite is supported or not.
     */
    void onSatelliteSupportedStateChanged(in boolean supported);
}
+37 −20
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.telephony.TelephonyFrameworkInitializer;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyRegistryManager;

import com.android.internal.telephony.IBooleanConsumer;
import com.android.internal.telephony.IIntegerConsumer;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.IVoidConsumer;
@@ -96,8 +97,8 @@ public final class SatelliteManager {
    private static final ConcurrentHashMap<SatelliteCapabilitiesCallback,
            ISatelliteCapabilitiesCallback>
            sSatelliteCapabilitiesCallbackMap = new ConcurrentHashMap<>();
    private static final ConcurrentHashMap<SatelliteSupportedStateCallback,
            ISatelliteSupportedStateCallback> sSatelliteSupportedStateCallbackMap =
    private static final ConcurrentHashMap<Consumer<Boolean>,
            IBooleanConsumer> sSatelliteSupportedStateCallbackMap =
            new ConcurrentHashMap<>();
    private static final ConcurrentHashMap<SatelliteCommunicationAllowedStateCallback,
            ISatelliteCommunicationAllowedStateCallback>
@@ -781,6 +782,28 @@ public final class SatelliteManager {
    @FlaggedApi(Flags.FLAG_SATELLITE_SYSTEM_APIS)
    public static final String ACTION_SATELLITE_START_NON_EMERGENCY_SESSION =
            "android.telephony.satellite.action.SATELLITE_START_NON_EMERGENCY_SESSION";

    /**
     * Application level {@link android.content.pm.PackageManager.Property} tag that represents
     * whether the application supports P2P SMS over carrier roaming satellite which needs manual
     * trigger to connect to satellite. The messaging applications that supports P2P SMS over
     * carrier roaming satellite should set value of this property to {@code true}.
     *
     * <p><b>Syntax:</b>
     * <pre>
     * &lt;application&gt;
     *   &lt;property
     *     android:name="android.telephony.satellite.PROPERTY_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT"
     *     android:value="true"/&gt;
     * &lt;/application&gt;
     * </pre>
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SATELLITE_SYSTEM_APIS)
    public static final String PROPERTY_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT =
            "android.telephony.satellite.PROPERTY_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT";

    /**
     * Meta-data represents whether the application supports P2P SMS over carrier roaming satellite
     * which needs manual trigger to connect to satellite. The messaging applications that supports
@@ -794,8 +817,6 @@ public final class SatelliteManager {
     * }
     * @hide
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_SATELLITE_SYSTEM_APIS)
    public static final String METADATA_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT =
            "android.telephony.METADATA_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT";

@@ -3303,7 +3324,7 @@ public final class SatelliteManager {
     * @param executor The executor on which the callback will be called.
     * @param callback The callback to handle the satellite supoprted state changed event.
     *
     * @return The {@link SatelliteResult} result of the operation.
     * @return The result of the operation.
     *
     * @throws SecurityException if the caller doesn't have required permission.
     * @throws IllegalStateException if the Telephony process is not currently available.
@@ -3313,21 +3334,18 @@ public final class SatelliteManager {
    @FlaggedApi(Flags.FLAG_SATELLITE_SYSTEM_APIS)
    @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION)
    @SatelliteResult public int registerForSupportedStateChanged(
            @NonNull @CallbackExecutor Executor executor,
            @NonNull SatelliteSupportedStateCallback callback) {
            @NonNull @CallbackExecutor Executor executor, @NonNull Consumer<Boolean> callback) {
        Objects.requireNonNull(executor);
        Objects.requireNonNull(callback);

        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                ISatelliteSupportedStateCallback internalCallback =
                        new ISatelliteSupportedStateCallback.Stub() {
                IBooleanConsumer internalCallback = new IBooleanConsumer.Stub() {
                    @Override
                            public void onSatelliteSupportedStateChanged(boolean supported) {
                    public void accept(boolean supported) {
                        executor.execute(() -> Binder.withCleanCallingIdentity(
                                        () -> callback.onSatelliteSupportedStateChanged(
                                                supported)));
                                () -> callback.accept(supported)));
                    }
                };
                sSatelliteSupportedStateCallbackMap.put(callback, internalCallback);
@@ -3348,7 +3366,7 @@ public final class SatelliteManager {
     * If callback was not registered before, the request will be ignored.
     *
     * @param callback The callback that was passed to
     * {@link #registerForSupportedStateChanged(Executor, SatelliteSupportedStateCallback)}
     * {@link #registerForSupportedStateChanged(Executor, Consumer)}
     *
     * @throws SecurityException if the caller doesn't have required permission.
     * @throws IllegalStateException if the Telephony process is not currently available.
@@ -3357,10 +3375,9 @@ public final class SatelliteManager {
    @SystemApi
    @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION)
    @FlaggedApi(Flags.FLAG_SATELLITE_SYSTEM_APIS)
    public void unregisterForSupportedStateChanged(
            @NonNull SatelliteSupportedStateCallback callback) {
    public void unregisterForSupportedStateChanged(@NonNull Consumer<Boolean> callback) {
        Objects.requireNonNull(callback);
        ISatelliteSupportedStateCallback internalCallback =
        IBooleanConsumer internalCallback =
                sSatelliteSupportedStateCallbackMap.remove(callback);

        try {
Loading