Add API invokeOemRilRequestRaw
this API is used by system app, app could communicate with RIL
with it.
Change-Id: I5397c1cf2b108d9dc3a9694b1f071dc60bb5b341
Conflicts:
src/com/android/phone/PhoneInterfaceManager.java
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 72d9a83..2d93eca 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -114,6 +114,8 @@
private static final int EVENT_SEND_ENVELOPE_DONE = 26;
private static final int CMD_SET_CDMA_SUBSCRIPTION = 27;
private static final int EVENT_SET_CDMA_SUBSCRIPTION_DONE = 28;
+ private static final int CMD_INVOKE_OEM_RIL_REQUEST_RAW = 29;
+ private static final int EVENT_INVOKE_OEM_RIL_REQUEST_RAW_DONE = 30;
/** The singleton instance. */
private static PhoneInterfaceManager sInstance;
@@ -494,6 +496,21 @@
handleNullReturnEvent(msg, "setCdmaSubscription");
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;
+
default:
Log.w(LOG_TAG, "MainThreadHandler: unexpected message code: " + msg.what);
break;
@@ -1786,4 +1803,36 @@
enforceModifyPermissionOrCarrierPrivilege();
return mPhone.setOperatorBrandOverride(iccId, brand);
}
+
+ @Override
+ 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;
+ }
}