Add new public API to get and callback report signal strength
new public API/AIDL get and callback report signal strength
Bug: 301511156
Test: SatelliteManagerTest, SatelliteControllerTest
Change-Id: If09e769c013d1f1c14e656eedf55a23d032d1ee1
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 6c5e916..26d1e73 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -146,6 +146,7 @@
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.stub.ImsConfigImplBase;
import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.telephony.satellite.INtnSignalStrengthCallback;
import android.telephony.satellite.ISatelliteDatagramCallback;
import android.telephony.satellite.ISatelliteProvisionStateCallback;
import android.telephony.satellite.ISatelliteStateCallback;
@@ -12510,6 +12511,70 @@
}
/**
+ * Request to get the signal strength of the satellite connection.
+ *
+ * @param subId The subId of the subscription to request for.
+ * @param result Result receiver to get the error code of the request and the current signal
+ * strength of the satellite connection.
+ *
+ * @throws SecurityException if the caller doesn't have required permission.
+ */
+ @Override
+ public void requestNtnSignalStrength(int subId, @NonNull ResultReceiver result) {
+ enforceSatelliteCommunicationPermission("requestNtnSignalStrength");
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mSatelliteController.requestNtnSignalStrength(subId, result);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ /**
+ * Registers for NTN signal strength changed from satellite modem.
+ *
+ * @param subId The subId of the subscription to request for.
+ * @param callback The callback to handle the NTN signal strength 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 registerForNtnSignalStrengthChanged(
+ int subId, @NonNull INtnSignalStrengthCallback callback) {
+ enforceSatelliteCommunicationPermission("registerForNtnSignalStrengthChanged");
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ return mSatelliteController.registerForNtnSignalStrengthChanged(subId, callback);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ /**
+ * Unregisters for NTN signal strength changed from satellite modem.
+ * If callback was not registered before, the request will be ignored.
+ *
+ * @param subId The subId of the subscription to unregister for provision state changed.
+ * @param callback The callback that was passed to
+ * {@link #registerForNtnSignalStrengthChanged(int, INtnSignalStrengthCallback)}
+ *
+ * @throws SecurityException if the caller doesn't have the required permission.
+ */
+ @Override
+ public void unregisterForNtnSignalStrengthChanged(
+ int subId, @NonNull INtnSignalStrengthCallback callback) {
+ enforceSatelliteCommunicationPermission("unregisterForNtnSignalStrengthChanged");
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mSatelliteController.unregisterForNtnSignalStrengthChanged(subId, callback);
+ } 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.