Restore the OEM hook implementation and usage
The current plan is to keep the OEM hook implementation in the
framework, this is for legacy device and old device upgrading
(per b/78098059).
For P launching device, the OEM hook service is removed in hal,
so the OEM hook api in framework should return something dummy, and
prevent infinite loop to get service, but these parts should be done
in seperate CLs after this restore CL is merged.
This reverts commit f120147b56cf529c18fc6f0de0ea8db356c4102a.
Bug: 34344851
Test: pass Treehugger tests; pass cuttlefish test RilE2eTests
Change-Id: I8310e985ca805fcda519f5aac2b7c767aac1f4c6
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 5cbb6f6..8d1df85 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -167,6 +167,8 @@
private static final int EVENT_SET_PREFERRED_NETWORK_TYPE_DONE = 24;
private static final int CMD_SEND_ENVELOPE = 25;
private static final int EVENT_SEND_ENVELOPE_DONE = 26;
+ private static final int CMD_INVOKE_OEM_RIL_REQUEST_RAW = 27;
+ private static final int EVENT_INVOKE_OEM_RIL_REQUEST_RAW_DONE = 28;
private static final int CMD_TRANSMIT_APDU_BASIC_CHANNEL = 29;
private static final int EVENT_TRANSMIT_APDU_BASIC_CHANNEL_DONE = 30;
private static final int CMD_EXCHANGE_SIM_IO = 31;
@@ -744,6 +746,21 @@
handleNullReturnEvent(msg, "setPreferredNetworkType");
break;
+ case CMD_INVOKE_OEM_RIL_REQUEST_RAW:
+ request = (MainThreadRequest)msg.obj;
+ onCompleted = obtainMessage(EVENT_INVOKE_OEM_RIL_REQUEST_RAW_DONE, request);
+ mPhone.invokeOemRilRequestRaw((byte[])request.argument, onCompleted);
+ break;
+
+ case EVENT_INVOKE_OEM_RIL_REQUEST_RAW_DONE:
+ ar = (AsyncResult)msg.obj;
+ request = (MainThreadRequest)ar.userObj;
+ request.result = ar;
+ synchronized (request) {
+ request.notifyAll();
+ }
+ break;
+
case CMD_SET_VOICEMAIL_NUMBER:
request = (MainThreadRequest) msg.obj;
onCompleted = obtainMessage(EVENT_SET_VOICEMAIL_NUMBER_DONE, request);
@@ -3287,6 +3304,39 @@
}
@Override
+ @Deprecated
+ public int invokeOemRilRequestRaw(byte[] oemReq, byte[] oemResp) {
+ enforceModifyPermission();
+
+ int returnValue = 0;
+ try {
+ AsyncResult result = (AsyncResult)sendRequest(CMD_INVOKE_OEM_RIL_REQUEST_RAW, oemReq);
+ if(result.exception == null) {
+ if (result.result != null) {
+ byte[] responseData = (byte[])(result.result);
+ if(responseData.length > oemResp.length) {
+ Log.w(LOG_TAG, "Buffer to copy response too small: Response length is " +
+ responseData.length + "bytes. Buffer Size is " +
+ oemResp.length + "bytes.");
+ }
+ System.arraycopy(responseData, 0, oemResp, 0, responseData.length);
+ returnValue = responseData.length;
+ }
+ } else {
+ CommandException ex = (CommandException) result.exception;
+ returnValue = ex.getCommandError().ordinal();
+ if(returnValue > 0) returnValue *= -1;
+ }
+ } catch (RuntimeException e) {
+ Log.w(LOG_TAG, "sendOemRilRequestRaw: Runtime Exception");
+ returnValue = (CommandException.Error.GENERIC_FAILURE.ordinal());
+ if(returnValue > 0) returnValue *= -1;
+ }
+
+ return returnValue;
+ }
+
+ @Override
public void setRadioCapability(RadioAccessFamily[] rafs) {
try {
ProxyController.getInstance().setRadioCapability(rafs);