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

Commit f89561be authored by Hakjun Choi's avatar Hakjun Choi
Browse files

Filter out satellite plmn when in SAT mode

1. Added a new API getAllSatellitePlmnsForCarrier, which
is used for filtering out satellite plmns when manually scan the
cellular network.
2. Added a new carrier config key remove_satellite_plmn_in_manual_network_scan_bool, which determines whether satellite plmn should be filtered out when network is manually scanned.

Bug: 316264277
Test: Manual test with pixel in live network.
Test: atest SatelliteManagerTest, SatelliteControllerTest,
SatelliteManagerTestOnMockService

Change-Id: I5bad38d7d12b21a8cd3fd42358fa74050414149b
parent fa4a9b44
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -17075,6 +17075,7 @@ package android.telephony.satellite {
  @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public final class SatelliteManager {
    method @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void addSatelliteAttachRestrictionForCarrier(int, int, @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 deprovisionSatelliteService(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
    method @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") @NonNull @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public java.util.List<java.lang.String> getAllSatellitePlmnsForCarrier(int);
    method @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") @NonNull @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public java.util.Set<java.lang.Integer> getSatelliteAttachRestrictionReasonsForCarrier(int);
    method @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") @RequiresPermission(android.Manifest.permission.SATELLITE_COMMUNICATION) public void pollPendingSatelliteDatagrams(@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 provisionSatelliteService(@NonNull String, @NonNull byte[], @Nullable android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+12 −0
Original line number Diff line number Diff line
@@ -9682,6 +9682,17 @@ public class CarrierConfigManager {
    public static final String KEY_PARAMETERS_USED_FOR_NTN_LTE_SIGNAL_BAR_INT =
            "parameters_used_for_ntn_lte_signal_bar_int";
    /**
     * Indicating whether plmns associated with carrier satellite can be exposed to user when
     * manually scanning available cellular network.
     * If key is {@code true}, satellite plmn should not be exposed to user and should be
     * automatically set, {@code false} otherwise. Default value is {@code true}.
     *
     * @hide
     */
    public static final String KEY_REMOVE_SATELLITE_PLMN_IN_MANUAL_NETWORK_SCAN_BOOL =
            "remove_satellite_plmn_in_manual_network_scan_bool";
    /**
     * Indicating whether DUN APN should be disabled when the device is roaming. In that case,
     * the default APN (i.e. internet) will be used for tethering.
@@ -10787,6 +10798,7 @@ public class CarrierConfigManager {
                });
        sDefaults.putInt(KEY_PARAMETERS_USED_FOR_NTN_LTE_SIGNAL_BAR_INT,
                CellSignalStrengthLte.USE_RSRP);
        sDefaults.putBoolean(KEY_REMOVE_SATELLITE_PLMN_IN_MANUAL_NETWORK_SCAN_BOOL, true);
        sDefaults.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL, false);
        sDefaults.putString(KEY_DEFAULT_PREFERRED_APN_NAME_STRING, "");
        sDefaults.putBoolean(KEY_SUPPORTS_CALL_COMPOSER_BOOL, false);
+31 −0
Original line number Diff line number Diff line
@@ -49,8 +49,10 @@ import com.android.telephony.Rlog;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -2142,6 +2144,35 @@ public final class SatelliteManager {
        }
    }

    /**
     * Get all satellite PLMNs for which attach is enable for carrier.
     *
     * @param subId subId The subscription ID of the carrier.
     *
     * @return List of plmn for carrier satellite service. If no plmn is available, empty list will
     * be returned.
     */
    @RequiresPermission(Manifest.permission.SATELLITE_COMMUNICATION)
    @FlaggedApi(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG)
    @NonNull public List<String> getAllSatellitePlmnsForCarrier(int subId) {
        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
            throw new IllegalArgumentException("Invalid subscription ID");
        }

        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                return telephony.getAllSatellitePlmnsForCarrier(subId);
            } else {
                throw new IllegalStateException("Telephony service is null.");
            }
        } catch (RemoteException ex) {
            loge("getAllSatellitePlmnsForCarrier() RemoteException: " + ex);
            ex.rethrowFromSystemServer();
        }
        return new ArrayList<>();
    }

    private static ITelephony getITelephony() {
        ITelephony binder = ITelephony.Stub.asInterface(TelephonyFrameworkInitializer
                .getTelephonyServiceManager()
+13 −0
Original line number Diff line number Diff line
@@ -3258,4 +3258,17 @@ interface ITelephony {
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
        + "android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)")
    boolean isNullCipherNotificationsEnabled();

    /**
     * Get the aggregated satellite plmn list. This API collects plmn data from multiple sources,
     * including carrier config, entitlement server, and config update.
     *
     * @param subId subId The subscription ID of the carrier.
     *
     * @return List of plmns for carrier satellite service. If no plmn is available, empty list will
     * be returned.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission("
            + "android.Manifest.permission.SATELLITE_COMMUNICATION)")
    List<String> getAllSatellitePlmnsForCarrier(int subId);
}