1
0
mirror of https://github.com/ponces/treble_aosp.git synced 2024-11-22 04:16:14 +00:00
treble_aosp/patches/trebledroid/platform_packages_services_Telephony/0001-Revert-Remove-deprecated-IRadio-1.4-APIs-and-referen.patch
2024-06-18 10:56:01 +01:00

87 lines
3.9 KiB
Diff

From 9199bcc009aae59a36572e9df9aca41b516b031f Mon Sep 17 00:00:00 2001
From: Alberto Ponces <ponces26@gmail.com>
Date: Mon, 1 Apr 2024 09:15:33 +0000
Subject: [PATCH] Revert "Remove deprecated IRadio <1.4 APIs and references"
This reverts commit b4a31f92a15ccf1f74c804ab3706ef8e4b59c8df.
---
.../android/phone/PhoneInterfaceManager.java | 48 +++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index e18818c0f..3a6a96725 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -312,6 +312,8 @@ public class PhoneInterfaceManager extends ITelephony.Stub {
private static final int EVENT_GET_ALLOWED_NETWORK_TYPES_BITMASK_DONE = 22;
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;
@@ -1174,6 +1176,19 @@ public class PhoneInterfaceManager extends ITelephony.Stub {
handleNullReturnEvent(msg, "setAllowedNetworkTypesForReason");
break;
+ case CMD_INVOKE_OEM_RIL_REQUEST_RAW:
+ request = (MainThreadRequest)msg.obj;
+ onCompleted = obtainMessage(EVENT_INVOKE_OEM_RIL_REQUEST_RAW_DONE, request);
+ defaultPhone.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;
+ notifyRequester(request);
+ break;
+
case CMD_SET_VOICEMAIL_NUMBER:
request = (MainThreadRequest) msg.obj;
onCompleted = obtainMessage(EVENT_SET_VOICEMAIL_NUMBER_DONE, request);
@@ -8047,6 +8062,39 @@ public class PhoneInterfaceManager extends ITelephony.Stub {
}
}
+ @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 int getRadioAccessFamily(int phoneId, String callingPackage) {
int raf = RadioAccessFamily.RAF_UNKNOWN;
--
2.34.1