Merge "Revert "Handle emergency registration failure case"" into main
diff --git a/OWNERS b/OWNERS
index 7b7fde3..2c7aed3 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,16 +1,3 @@
-breadley@google.com
-fionaxu@google.com
-jackyu@google.com
-rgreenwalt@google.com
-tgunn@google.com
-sarahchin@google.com
-xiaotonj@google.com
-huiwang@google.com
-jayachandranc@google.com
-amruthr@google.com
-sasindran@google.com
-tjstuart@google.com
-pmadapurmath@google.com
-grantmenke@google.com
+include platform/frameworks/opt/telephony:/OWNERS
per-file *SimPhonebookProvider* = file:platform/packages/apps/Contacts:/OWNERS
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 6ee7251..469740c 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -12442,6 +12442,76 @@
}
/**
+ * Add a restriction reason for disallowing carrier supported satellite plmn scan and attach
+ * by modem.
+ *
+ * @param subId The subId of the subscription to request for.
+ * @param reason Reason for disallowing satellite communication for carrier.
+ * @param callback Listener for the {@link SatelliteManager.SatelliteError} result of the
+ * operation.
+ *
+ * @throws SecurityException if the caller doesn't have required permission.
+ */
+ public void addSatelliteAttachRestrictionForCarrier(int subId,
+ @SatelliteManager.SatelliteCommunicationRestrictionReason int reason,
+ @NonNull IIntegerConsumer callback) {
+ enforceSatelliteCommunicationPermission("addSatelliteAttachRestrictionForCarrier");
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mSatelliteController.addSatelliteAttachRestrictionForCarrier(subId, reason, callback);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ /**
+ * Remove a restriction reason for disallowing carrier supported satellite plmn scan and attach
+ * by modem.
+ *
+ * @param subId The subId of the subscription to request for.
+ * @param reason Reason for disallowing satellite communication.
+ * @param callback Listener for the {@link SatelliteManager.SatelliteError} result of the
+ * operation.
+ *
+ * @throws SecurityException if the caller doesn't have required permission.
+ */
+ public void removeSatelliteAttachRestrictionForCarrier(int subId,
+ @SatelliteManager.SatelliteCommunicationRestrictionReason int reason,
+ @NonNull IIntegerConsumer callback) {
+ enforceSatelliteCommunicationPermission("removeSatelliteAttachRestrictionForCarrier");
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mSatelliteController.removeSatelliteAttachRestrictionForCarrier(subId, reason,
+ callback);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ /**
+ * Get reasons for disallowing satellite communication, as requested by
+ * {@link #addSatelliteAttachRestrictionForCarrier(int, int, IIntegerConsumer)}.
+ *
+ * @param subId The subId of the subscription to request for.
+ *
+ * @return Integer array of reasons for disallowing satellite communication.
+ *
+ * @throws SecurityException if the caller doesn't have the required permission.
+ */
+ public @NonNull int[] getSatelliteAttachRestrictionReasonsForCarrier(
+ int subId) {
+ enforceSatelliteCommunicationPermission("getSatelliteAttachRestrictionReasonsForCarrier");
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ Set<Integer> reasonSet =
+ mSatelliteController.getSatelliteAttachRestrictionReasonsForCarrier(subId);
+ return reasonSet.stream().mapToInt(i->i).toArray();
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ /**
* This API can be used by only CTS to update satellite vendor service package name.
*
* @param servicePackageName The package name of the satellite vendor service.
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 242fe24..a381d7c 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -19,6 +19,8 @@
import static android.telephony.DomainSelectionService.SELECTOR_TYPE_CALLING;
import static android.telephony.TelephonyManager.HAL_SERVICE_VOICE;
+import static com.android.internal.telephony.flags.Flags.carrierEnabledSatelliteFlag;
+
import android.annotation.NonNull;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -4077,6 +4079,10 @@
* else {@code false}.
*/
private boolean isCallDisallowedDueToSatellite(Phone phone) {
+ if (!carrierEnabledSatelliteFlag()) {
+ return false;
+ }
+
if (phone == null) {
return false;
}
diff --git a/tests/Android.bp b/tests/Android.bp
index 1f15b9b..abe93e7 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -49,6 +49,7 @@
"truth-prebuilt",
"testables",
"platform-compat-test-rules",
+ "flag-junit",
],
test_suites: [
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 65750c8..95d4fdc 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -58,6 +58,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
+import android.platform.test.flag.junit.SetFlagsRule;
import android.telecom.Conference;
import android.telecom.Conferenceable;
import android.telecom.ConnectionRequest;
@@ -98,6 +99,7 @@
import com.android.internal.telephony.emergency.EmergencyStateTracker;
import com.android.internal.telephony.emergency.RadioOnHelper;
import com.android.internal.telephony.emergency.RadioOnStateListener;
+import com.android.internal.telephony.flags.Flags;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.imsphone.ImsPhone;
import com.android.internal.telephony.satellite.SatelliteController;
@@ -105,6 +107,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -126,6 +129,8 @@
@RunWith(AndroidJUnit4.class)
public class TelephonyConnectionServiceTest extends TelephonyTestBase {
+ @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
+
/**
* Unlike {@link TestTelephonyConnection}, a bare minimal {@link TelephonyConnection} impl
* that does not try to configure anything.
@@ -278,6 +283,7 @@
replaceInstance(TelephonyConnectionService.class,
"mSatelliteController", mTestConnectionService, mSatelliteController);
mBinderStub = (IConnectionService.Stub) mTestConnectionService.onBind(null);
+ mSetFlagsRule.disableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
}
@After
@@ -2967,7 +2973,9 @@
}
@Test
- public void testNormalCallUsingNonTerrestrialNetwork() {
+ public void testNormalCallUsingNonTerrestrialNetwork_enableFlag() throws Exception {
+ mSetFlagsRule.enableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
+
setupForCallTest();
// Call is not supported while using satellite
NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
@@ -2996,6 +3004,26 @@
disconnectCause.getTelephonyDisconnectCause());
}
+ @Test
+ public void testNormalCallUsingNonTerrestrialNetwork_disableFlag() throws Exception {
+ mSetFlagsRule.disableFlags(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG);
+
+ setupForCallTest();
+ // Flag is disabled, so call is supported while using satellite
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setIsNonTerrestrialNetwork(true)
+ .setAvailableServices(List.of(NetworkRegistrationInfo.SERVICE_TYPE_DATA))
+ .build();
+ ServiceState ss = new ServiceState();
+ ss.addNetworkRegistrationInfo(nri);
+ when(mPhone0.getServiceState()).thenReturn(ss);
+ mConnection = mTestConnectionService.onCreateOutgoingConnection(PHONE_ACCOUNT_HANDLE_1,
+ createConnectionRequest(PHONE_ACCOUNT_HANDLE_1, "1234", TELECOM_CALL_ID1));
+ DisconnectCause disconnectCause = mConnection.getDisconnectCause();
+ assertNotEquals(android.telephony.DisconnectCause.SATELLITE_ENABLED,
+ disconnectCause.getTelephonyDisconnectCause());
+ }
+
private void setupForDialForDomainSelection(Phone mockPhone, int domain, boolean isEmergency) {
if (isEmergency) {
doReturn(mEmergencyCallDomainSelectionConnection).when(mDomainSelectionResolver)