summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/telephony/PhoneStateListener.java5
-rw-r--r--core/java/android/telephony/TelephonyCallback.java40
-rw-r--r--core/java/android/telephony/TelephonyRegistryManager.java20
-rw-r--r--core/java/com/android/internal/telephony/IPhoneStateListener.aidl1
-rw-r--r--core/java/com/android/internal/telephony/ITelephonyRegistry.aidl1
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java60
-rw-r--r--telephony/java/android/telephony/satellite/SatelliteManager.java16
7 files changed, 138 insertions, 5 deletions
diff --git a/core/java/android/telephony/PhoneStateListener.java b/core/java/android/telephony/PhoneStateListener.java
index e8ef9d65a2b4..bce51f297aff 100644
--- a/core/java/android/telephony/PhoneStateListener.java
+++ b/core/java/android/telephony/PhoneStateListener.java
@@ -1701,6 +1701,11 @@ public class PhoneStateListener {
public final void onCarrierRoamingNtnEligibleStateChanged(boolean eligible) {
// not supported on the deprecated interface - Use TelephonyCallback instead
}
+
+ public final void onCarrierRoamingNtnAvailableServicesChanged(
+ @NetworkRegistrationInfo.ServiceType int[] availableServices) {
+ // not supported on the deprecated interface - Use TelephonyCallback instead
+ }
}
private void log(String s) {
diff --git a/core/java/android/telephony/TelephonyCallback.java b/core/java/android/telephony/TelephonyCallback.java
index 5295b606dd19..46e27dc60adc 100644
--- a/core/java/android/telephony/TelephonyCallback.java
+++ b/core/java/android/telephony/TelephonyCallback.java
@@ -681,6 +681,20 @@ public class TelephonyCallback {
public static final int EVENT_CARRIER_ROAMING_NTN_ELIGIBLE_STATE_CHANGED = 43;
/**
+ * Event for listening to changes in carrier roaming non-terrestrial network available services
+ * via callback onCarrierRoamingNtnAvailableServicesChanged().
+ * This callback is triggered when the available services provided by the carrier roaming
+ * satellite changes. The carrier roaming satellite is defined by the following conditions.
+ * <ul>
+ * <li>Subscription supports attaching to satellite which is defined by
+ * {@link CarrierConfigManager#KEY_SATELLITE_ATTACH_SUPPORTED_BOOL} </li>
+ * </ul>
+ *
+ * @hide
+ */
+ public static final int EVENT_CARRIER_ROAMING_NTN_AVAILABLE_SERVICES_CHANGED = 44;
+
+ /**
* @hide
*/
@IntDef(prefix = {"EVENT_"}, value = {
@@ -726,7 +740,8 @@ public class TelephonyCallback {
EVENT_EMERGENCY_CALLBACK_MODE_CHANGED,
EVENT_SIMULTANEOUS_CELLULAR_CALLING_SUBSCRIPTIONS_CHANGED,
EVENT_CARRIER_ROAMING_NTN_MODE_CHANGED,
- EVENT_CARRIER_ROAMING_NTN_ELIGIBLE_STATE_CHANGED
+ EVENT_CARRIER_ROAMING_NTN_ELIGIBLE_STATE_CHANGED,
+ EVENT_CARRIER_ROAMING_NTN_AVAILABLE_SERVICES_CHANGED
})
@Retention(RetentionPolicy.SOURCE)
public @interface TelephonyEvent {
@@ -1784,6 +1799,15 @@ public class TelephonyCallback {
* </ul>
*/
default void onCarrierRoamingNtnEligibleStateChanged(boolean eligible) {}
+
+ /**
+ * Callback invoked when carrier roaming non-terrestrial network available
+ * service changes.
+ *
+ * @param availableServices The list of the supported services.
+ */
+ default void onCarrierRoamingNtnAvailableServicesChanged(
+ @NetworkRegistrationInfo.ServiceType List<Integer> availableServices) {}
}
/**
@@ -2235,5 +2259,19 @@ public class TelephonyCallback {
Binder.withCleanCallingIdentity(() -> mExecutor.execute(
() -> listener.onCarrierRoamingNtnEligibleStateChanged(eligible)));
}
+
+ public void onCarrierRoamingNtnAvailableServicesChanged(
+ @NetworkRegistrationInfo.ServiceType int[] availableServices) {
+ if (!Flags.carrierRoamingNbIotNtn()) return;
+
+ CarrierRoamingNtnModeListener listener =
+ (CarrierRoamingNtnModeListener) mTelephonyCallbackWeakRef.get();
+ if (listener == null) return;
+
+ List<Integer> ServiceList = Arrays.stream(availableServices).boxed()
+ .collect(Collectors.toList());
+ Binder.withCleanCallingIdentity(() -> mExecutor.execute(
+ () -> listener.onCarrierRoamingNtnAvailableServicesChanged(ServiceList)));
+ }
}
}
diff --git a/core/java/android/telephony/TelephonyRegistryManager.java b/core/java/android/telephony/TelephonyRegistryManager.java
index 3c7e924f07df..4d50a450490e 100644
--- a/core/java/android/telephony/TelephonyRegistryManager.java
+++ b/core/java/android/telephony/TelephonyRegistryManager.java
@@ -1118,6 +1118,21 @@ public class TelephonyRegistryManager {
}
/**
+ * Notify external listeners that carrier roaming non-terrestrial available services changed.
+ * @param availableServices The list of the supported services.
+ * @hide
+ */
+ public void notifyCarrierRoamingNtnAvailableServicesChanged(
+ int subId, @NetworkRegistrationInfo.ServiceType int[] availableServices) {
+ try {
+ sRegistry.notifyCarrierRoamingNtnAvailableServicesChanged(subId, availableServices);
+ } catch (RemoteException ex) {
+ // system server crash
+ throw ex.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Processes potential event changes from the provided {@link TelephonyCallback}.
*
* @param telephonyCallback callback for monitoring callback changes to the telephony state.
@@ -1272,12 +1287,9 @@ public class TelephonyRegistryManager {
if (telephonyCallback instanceof TelephonyCallback.CarrierRoamingNtnModeListener) {
eventList.add(TelephonyCallback.EVENT_CARRIER_ROAMING_NTN_MODE_CHANGED);
- }
-
- if (telephonyCallback instanceof TelephonyCallback.CarrierRoamingNtnModeListener) {
eventList.add(TelephonyCallback.EVENT_CARRIER_ROAMING_NTN_ELIGIBLE_STATE_CHANGED);
+ eventList.add(TelephonyCallback.EVENT_CARRIER_ROAMING_NTN_AVAILABLE_SERVICES_CHANGED);
}
-
return eventList;
}
diff --git a/core/java/com/android/internal/telephony/IPhoneStateListener.aidl b/core/java/com/android/internal/telephony/IPhoneStateListener.aidl
index 81b885aa626b..b5c87868af12 100644
--- a/core/java/com/android/internal/telephony/IPhoneStateListener.aidl
+++ b/core/java/com/android/internal/telephony/IPhoneStateListener.aidl
@@ -84,4 +84,5 @@ oneway interface IPhoneStateListener {
void onSimultaneousCallingStateChanged(in int[] subIds);
void onCarrierRoamingNtnModeChanged(in boolean active);
void onCarrierRoamingNtnEligibleStateChanged(in boolean eligible);
+ void onCarrierRoamingNtnAvailableServicesChanged(in int[] availableServices);
}
diff --git a/core/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/core/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index f836cf2b9d87..ca75abdedfcc 100644
--- a/core/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/core/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -123,4 +123,5 @@ interface ITelephonyRegistry {
void notifyCallbackModeStopped(int phoneId, int subId, int type, int reason);
void notifyCarrierRoamingNtnModeChanged(int subId, in boolean active);
void notifyCarrierRoamingNtnEligibleStateChanged(int subId, in boolean eligible);
+ void notifyCarrierRoamingNtnAvailableServicesChanged(int subId, in int[] availableServices);
}
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 39ac5150c7f1..363807d2aa8c 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -68,6 +68,7 @@ import android.telephony.CellSignalStrengthWcdma;
import android.telephony.DisconnectCause;
import android.telephony.LinkCapacityEstimate;
import android.telephony.LocationAccessPolicy;
+import android.telephony.NetworkRegistrationInfo;
import android.telephony.PhoneCapability;
import android.telephony.PhoneStateListener;
import android.telephony.PhysicalChannelConfig;
@@ -90,6 +91,7 @@ import android.telephony.ims.MediaQualityStatus;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArraySet;
+import android.util.IntArray;
import android.util.LocalLog;
import android.util.Pair;
import android.util.SparseArray;
@@ -429,6 +431,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private boolean[] mCarrierRoamingNtnMode = null;
private boolean[] mCarrierRoamingNtnEligible = null;
+ private List<IntArray> mCarrierRoamingNtnAvailableServices;
+
/**
* Per-phone map of precise data connection state. The key of the map is the pair of transport
* type and APN setting. This is the cache to prevent redundant callbacks to the listeners.
@@ -741,6 +745,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
cutListToSize(mCarrierServiceStates, mNumPhones);
cutListToSize(mCallStateLists, mNumPhones);
cutListToSize(mMediaQualityStatus, mNumPhones);
+ cutListToSize(mCarrierRoamingNtnAvailableServices, mNumPhones);
return;
}
@@ -789,6 +794,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mSCBMDuration[i] = 0;
mCarrierRoamingNtnMode[i] = false;
mCarrierRoamingNtnEligible[i] = false;
+ mCarrierRoamingNtnAvailableServices.add(i, new IntArray());
}
}
}
@@ -864,6 +870,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mSCBMDuration = new long[numPhones];
mCarrierRoamingNtnMode = new boolean[numPhones];
mCarrierRoamingNtnEligible = new boolean[numPhones];
+ mCarrierRoamingNtnAvailableServices = new ArrayList<>();
for (int i = 0; i < numPhones; i++) {
mCallState[i] = TelephonyManager.CALL_STATE_IDLE;
@@ -909,6 +916,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mSCBMDuration[i] = 0;
mCarrierRoamingNtnMode[i] = false;
mCarrierRoamingNtnEligible[i] = false;
+ mCarrierRoamingNtnAvailableServices.add(i, new IntArray());
}
mAppOps = mContext.getSystemService(AppOpsManager.class);
@@ -1533,6 +1541,15 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
remove(r.binder);
}
}
+ if (events.contains(
+ TelephonyCallback.EVENT_CARRIER_ROAMING_NTN_AVAILABLE_SERVICES_CHANGED)) {
+ try {
+ r.callback.onCarrierRoamingNtnAvailableServicesChanged(
+ mCarrierRoamingNtnAvailableServices.get(r.phoneId).toArray());
+ } catch (RemoteException ex) {
+ remove(r.binder);
+ }
+ }
}
}
}
@@ -3642,6 +3659,47 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
}
+ /**
+ * Notify external listeners that carrier roaming non-terrestrial available services changed.
+ * @param availableServices The list of the supported services.
+ */
+ public void notifyCarrierRoamingNtnAvailableServicesChanged(
+ int subId, @NetworkRegistrationInfo.ServiceType int[] availableServices) {
+ if (!checkNotifyPermission("notifyCarrierRoamingNtnEligibleStateChanged")) {
+ log("notifyCarrierRoamingNtnAvailableServicesChanged: caller does not have required "
+ + "permissions.");
+ return;
+ }
+
+ if (VDBG) {
+ log("notifyCarrierRoamingNtnAvailableServicesChanged: "
+ + "availableServices=" + Arrays.toString(availableServices));
+ }
+
+ synchronized (mRecords) {
+ int phoneId = getPhoneIdFromSubId(subId);
+ if (!validatePhoneId(phoneId)) {
+ loge("Invalid phone ID " + phoneId + " for " + subId);
+ return;
+ }
+ IntArray availableServicesIntArray = new IntArray(availableServices.length);
+ availableServicesIntArray.addAll(availableServices);
+ mCarrierRoamingNtnAvailableServices.set(phoneId, availableServicesIntArray);
+ for (Record r : mRecords) {
+ if (r.matchTelephonyCallbackEvent(
+ TelephonyCallback.EVENT_CARRIER_ROAMING_NTN_AVAILABLE_SERVICES_CHANGED)
+ && idMatch(r, subId, phoneId)) {
+ try {
+ r.callback.onCarrierRoamingNtnAvailableServicesChanged(availableServices);
+ } catch (RemoteException ex) {
+ mRemoveList.add(r.binder);
+ }
+ }
+ }
+ handleRemoveListLocked();
+ }
+ }
+
@NeverCompile // Avoid size overhead of debugging code.
@Override
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
@@ -3706,6 +3764,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
Pair<String, Integer> carrierServiceState = mCarrierServiceStates.get(i);
pw.println("mCarrierServiceState=<package=" + pii(carrierServiceState.first)
+ ", uid=" + carrierServiceState.second + ">");
+ pw.println("mCarrierRoamingNtnAvailableServices="
+ + mCarrierRoamingNtnAvailableServices.get(i));
pw.decreaseIndent();
}
diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java
index 44de65a009ff..79b3a7c4de65 100644
--- a/telephony/java/android/telephony/satellite/SatelliteManager.java
+++ b/telephony/java/android/telephony/satellite/SatelliteManager.java
@@ -582,6 +582,22 @@ public final class SatelliteManager {
"android.telephony.action.ACTION_SATELLITE_SUBSCRIBER_ID_LIST_CHANGED";
/**
+ * 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
+ * P2P SMS over carrier roaming satellites should add the following in their AndroidManifest.
+ * {@code
+ * <application
+ * <meta-data
+ * android:name="android.telephony.METADATA_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT"
+ * android:value="true"/>
+ * </application>
+ * }
+ * @hide
+ */
+ public static final String METADATA_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT =
+ "android.telephony.METADATA_SATELLITE_MANUAL_CONNECT_P2P_SUPPORT";
+
+ /**
* Request to enable or disable the satellite modem and demo mode.
* If satellite modem and cellular modem cannot work concurrently,
* then this will disable the cellular modem if satellite modem is enabled,