audioserver: return binder call permission error in reply
When a transaction to IAudioFlinger or IAudioPolicyService is detected
from an unauthorized source, return the INVALID_OPERATION status in
reply Parcel and not as transaction status.
Also removed check on SET_RINGER_MODE as it is not implemented on client
side and allow SET_MODE from system AIDs instead of just audioserver.
Bug: 78615605
Test: manual audio smoke tests.
Change-Id: Ia4fdfc22f049da69aaa9d45075e1c502eecf4521
diff --git a/media/libaudioclient/IAudioFlinger.cpp b/media/libaudioclient/IAudioFlinger.cpp
index 8c9d3c1..00af7e8 100644
--- a/media/libaudioclient/IAudioFlinger.cpp
+++ b/media/libaudioclient/IAudioFlinger.cpp
@@ -871,7 +871,6 @@
switch (code) {
case SET_STREAM_VOLUME:
case SET_STREAM_MUTE:
- case SET_MODE:
case OPEN_OUTPUT:
case OPEN_DUPLICATE_OUTPUT:
case CLOSE_OUTPUT:
@@ -892,7 +891,15 @@
case SET_RECORD_SILENCED:
ALOGW("%s: transaction %d received from PID %d",
__func__, code, IPCThreadState::self()->getCallingPid());
- return INVALID_OPERATION;
+ // return status only for non void methods
+ switch (code) {
+ case SET_RECORD_SILENCED:
+ break;
+ default:
+ reply->writeInt32(static_cast<int32_t> (INVALID_OPERATION));
+ break;
+ }
+ return OK;
default:
break;
}
@@ -909,7 +916,15 @@
ALOGW("%s: transaction %d received from PID %d unauthorized UID %d",
__func__, code, IPCThreadState::self()->getCallingPid(),
IPCThreadState::self()->getCallingUid());
- return INVALID_OPERATION;
+ // return status only for non void methods
+ switch (code) {
+ case SYSTEM_READY:
+ break;
+ default:
+ reply->writeInt32(static_cast<int32_t> (INVALID_OPERATION));
+ break;
+ }
+ return OK;
}
} break;
default: