1
0
mirror of https://github.com/yurisieucuti/treble_evolution.git synced 2024-11-24 09:46:19 +00:00
treble_evolution/patches/platform_packages_services_Telephony/0001-Revert-Remove-deprecated-IRadio-1.4-APIs-and-referen.patch
2024-04-24 15:13:17 +00:00

87 lines
3.9 KiB
Diff

From d471946c91b4dfed8c1fbcbae9f681d116957158 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 3bd29e311..dd3869217 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -302,6 +302,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;
@@ -1161,6 +1163,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);
@@ -7519,6 +7534,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.25.1