Internal Telephony Support For Cellular Identifier Disclosure HALs
This implements the required interfaces for the new HALs. Wiring
together the actual implementation of the unsolicited call to
`cellularIdentifierDisclosed` is left as a TODO and will be gated behind a feature flag.
Bug: 276752426
Test: m
Change-Id: I1859bd205fb0d36b87c56fef747588b60f9d1a3c
diff --git a/src/java/com/android/internal/telephony/CommandsInterface.java b/src/java/com/android/internal/telephony/CommandsInterface.java
index 1ed6be0..4b977ff 100644
--- a/src/java/com/android/internal/telephony/CommandsInterface.java
+++ b/src/java/com/android/internal/telephony/CommandsInterface.java
@@ -2897,4 +2897,19 @@
* @param result Callback message to receive the result.
*/
default void isN1ModeEnabled(Message result) {}
+
+ /**
+ * Enables or disables cellular identifier disclosure transparency.
+ *
+ * @param enable {@code true} to enable, {@code false} to disable.
+ * @param result Callback message to receive the result.
+ */
+ default void setCellularIdentifierTransparencyEnabled(boolean enable, Message result) {}
+
+ /**
+ * Check whether cellular identifier transparency.
+ *
+ * @param result Callback message to receive the result.
+ */
+ default void isCellularIdentifierTransparencyEnabled(Message result) {}
}
\ No newline at end of file
diff --git a/src/java/com/android/internal/telephony/NetworkIndication.java b/src/java/com/android/internal/telephony/NetworkIndication.java
index 6025273..dc3fbf1 100644
--- a/src/java/com/android/internal/telephony/NetworkIndication.java
+++ b/src/java/com/android/internal/telephony/NetworkIndication.java
@@ -33,6 +33,7 @@
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIGNAL_STRENGTH;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SUPP_SVC_NOTIFICATION;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_VOICE_RADIO_TECH_CHANGED;
+import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CELLULAR_IDENTIFIER_DISCLOSED;
import android.annotation.ElapsedRealtimeLong;
import android.hardware.radio.network.IRadioNetworkIndication;
@@ -421,6 +422,22 @@
new AsyncResult(null, response, null));
}
+ /**
+ * Cellular identifier disclosure events
+ * @param indicationType Type of radio indication
+ * @param identifierDisclsoure the result of the Emergency Network Scan
+ */
+ public void cellularIdentifierDisclosed(int indicationType,
+ android.hardware.radio.network.CellularIdentifierDisclosure identifierDisclsoure) {
+ mRil.processIndication(HAL_SERVICE_NETWORK, indicationType);
+
+ if (mRil.isLogOrTrace()) {
+ mRil.unsljLogRet(RIL_UNSOL_CELLULAR_IDENTIFIER_DISCLOSED, identifierDisclsoure);
+ }
+
+ // TODO (b/276752426) notify registrants of identifier disclosure
+ }
+
@Override
public String getInterfaceHash() {
return IRadioNetworkIndication.HASH;
diff --git a/src/java/com/android/internal/telephony/NetworkResponse.java b/src/java/com/android/internal/telephony/NetworkResponse.java
index f26022e..e4e2b1b 100644
--- a/src/java/com/android/internal/telephony/NetworkResponse.java
+++ b/src/java/com/android/internal/telephony/NetworkResponse.java
@@ -504,6 +504,30 @@
RadioResponse.responseVoid(HAL_SERVICE_NETWORK, mRil, responseInfo);
}
+ /**
+ * @param responseInfo Response info struct containing response type, serial no. and error
+ */
+ public void setCellularIdentifierTransparencyEnabledResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_NETWORK, mRil, responseInfo);
+ }
+
+ /**
+ * @param responseInfo Response info struct containing response type, serial no. and error.
+ * @param isEnabled Indicates whether cellular identifier disclosure transparency from the modem
+ * is enabled.
+ */
+ public void isCellularIdentifierTransparencyEnabledResponse(RadioResponseInfo responseInfo,
+ boolean isEnabled) {
+ RILRequest rr = mRil.processResponse(HAL_SERVICE_NETWORK, responseInfo);
+
+ if (rr != null) {
+ if (responseInfo.error == RadioError.NONE) {
+ RadioResponse.sendMessageResponse(rr.mResult, isEnabled);
+ }
+ mRil.processResponseDone(rr, responseInfo, isEnabled);
+ }
+ }
+
@Override
public String getInterfaceHash() {
return IRadioNetworkResponse.HASH;
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index da15df6..cab9a11 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -5079,6 +5079,59 @@
});
}
+ /**
+ * {@inheritDoc}
+ */
+ public void setCellularIdentifierTransparencyEnabled(boolean enable, Message result) {
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (!canMakeRequest(
+ "setCellularIdentifierDisclosedEnabled",
+ networkProxy,
+ result,
+ RADIO_HAL_VERSION_2_2)) {
+ return;
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_CELLULAR_IDENTIFIER_DISCLOSED_ENABLED, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " enable=" + enable);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK, rr, "setCellularIdentifierDisclosedEnabled", () -> {
+ networkProxy.setCellularIdentifierTransparencyEnabled(rr.mSerial, enable);
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void isCellularIdentifierTransparencyEnabled(Message result) {
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (!canMakeRequest(
+ "isCellularIdentifierDisclosedEnabled",
+ networkProxy,
+ result,
+ RADIO_HAL_VERSION_2_2)) {
+ return;
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_IS_CELLULAR_IDENTIFIER_DISCLOSED_ENABLED, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest));
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK, rr, "isCellularIdentifierDisclosedEnabled", () -> {
+ networkProxy.isCellularIdentifierTransparencyEnabled(rr.mSerial);
+ });
+ }
+
//***** Private Methods
/**
* This is a helper function to be called when an indication callback is called for any radio
@@ -5256,7 +5309,7 @@
* @param responseInfo RadioResponseInfo received in the callback
* @param ret object to be returned to request sender
*/
- @VisibleForTesting
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PROTECTED)
public void processResponseDone(RILRequest rr, RadioResponseInfo responseInfo, Object ret) {
processResponseDoneInternal(rr, responseInfo.error, responseInfo.type, ret);
}
diff --git a/src/java/com/android/internal/telephony/RadioNetworkProxy.java b/src/java/com/android/internal/telephony/RadioNetworkProxy.java
index 5a56d23..fc308ca 100644
--- a/src/java/com/android/internal/telephony/RadioNetworkProxy.java
+++ b/src/java/com/android/internal/telephony/RadioNetworkProxy.java
@@ -921,4 +921,32 @@
}
// Only supported on AIDL.
}
+
+ /**
+ * Enables or disables cellular identifier disclosure transparency.
+ *
+ * @param serial Serial number of request.
+ * @param enable Indicates whether to enable disclosure transparency or not.
+ */
+ public void setCellularIdentifierTransparencyEnabled(int serial, boolean enable)
+ throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mNetworkProxy.setCellularIdentifierTransparencyEnabled(serial, enable);
+ }
+ // Only supported on AIDL.
+ }
+
+ /**
+ * Checks whether cellular identifier transparency disclosure is enabled.
+ *
+ * @param serial Serial number of request.
+ */
+ public void isCellularIdentifierTransparencyEnabled(int serial) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mNetworkProxy.isCellularIdentifierTransparencyEnabled(serial);
+ }
+ // Only supported on AIDL.
+ }
}