Add callback/listener for satellite communication allowed state changed
Bug: 335760795
Test: atest android.telephony.satellite.cts.SatelliteManagerTestOnMockService
Test: Manually verified if the callback is invoked well when the allowed state is changed in skylo demo mode.
Change-Id: Ia36c8bd1452b2a95dabd5dbba9f364eec057b972
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 4c8c836..f410fad 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -156,6 +156,7 @@
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.telephony.satellite.INtnSignalStrengthCallback;
import android.telephony.satellite.ISatelliteCapabilitiesCallback;
+import android.telephony.satellite.ISatelliteCommunicationAllowedStateCallback;
import android.telephony.satellite.ISatelliteDatagramCallback;
import android.telephony.satellite.ISatelliteModemStateCallback;
import android.telephony.satellite.ISatelliteProvisionStateCallback;
@@ -14082,4 +14083,42 @@
methodName + " is unsupported without " + telephonyFeature);
}
}
+
+ /**
+ * Registers for the satellite communication allowed state changed.
+ *
+ * @param subId The subId of the subscription to register for the satellite communication
+ * allowed state changed.
+ * @param callback The callback to handle the satellite communication allowed
+ * state changed event.
+ *
+ * @return The {@link SatelliteManager.SatelliteResult} result of the operation.
+ *
+ * @throws SecurityException if the caller doesn't have the required permission.
+ */
+ @Override
+ @SatelliteManager.SatelliteResult public int registerForCommunicationAllowedStateChanged(
+ int subId, @NonNull ISatelliteCommunicationAllowedStateCallback callback) {
+ enforceSatelliteCommunicationPermission("registerForCommunicationAllowedStateChanged");
+ return mSatelliteAccessController.registerForCommunicationAllowedStateChanged(
+ subId, callback);
+ }
+
+ /**
+ * Unregisters for the satellite communication allowed state changed.
+ * If callback was not registered before, the request will be ignored.
+ *
+ * @param subId The subId of the subscription to unregister for the satellite communication
+ * allowed state changed.
+ * @param callback The callback that was passed to
+ * {@link #registerForCommunicationAllowedStateChanged(int,
+ * ISatelliteCommunicationAllowedStateCallback)}. *
+ * @throws SecurityException if the caller doesn't have the required permission.
+ */
+ @Override
+ public void unregisterForCommunicationAllowedStateChanged(
+ int subId, @NonNull ISatelliteCommunicationAllowedStateCallback callback) {
+ enforceSatelliteCommunicationPermission("unregisterForCommunicationAllowedStateChanged");
+ mSatelliteAccessController.unregisterForCommunicationAllowedStateChanged(subId, callback);
+ }
}