Skip to content

Commit 6af6f87

Browse files
adithya2306kutemeikito
authored andcommitted
audio: Check MODIFY_AUDIO_ROUTING permission for per-app volume
We need to use this from SystemUI which runs under app uid. Instead check for MODIFY_AUDIO_ROUTING permission which is granted only to select system apps (including SystemUI) and also matches the API @RequiresPermission annotation in framework. Change-Id: Ib78565c15cbdc8619bf94240a2329e97fd40c6a9 Signed-off-by: Edwiin Kusuma Jaya <kutemeikito0905@gmail.com>
1 parent 6b12def commit 6af6f87

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

services/audioflinger/AudioFlinger.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4897,6 +4897,22 @@ status_t AudioFlinger::onTransactWrapper(TransactionCode code,
48974897
break;
48984898
}
48994899

4900+
// make sure the following transactions require MODIFY_AUDIO_ROUTING permission
4901+
switch (code) {
4902+
case TransactionCode::SET_APP_VOLUME:
4903+
case TransactionCode::SET_APP_MUTE: {
4904+
if (!modifyAudioRoutingAllowed()) {
4905+
ALOGW("%s: transaction %d received from PID %d UID %d does not have "
4906+
"MODIFY_AUDIO_ROUTING permission",
4907+
__func__, code, IPCThreadState::self()->getCallingPid(),
4908+
IPCThreadState::self()->getCallingUid());
4909+
return INVALID_OPERATION;
4910+
}
4911+
} break;
4912+
default:
4913+
break;
4914+
}
4915+
49004916
// List of relevant events that trigger log merging.
49014917
// Log merging should activate during audio activity of any kind. This are considered the
49024918
// most relevant events.

0 commit comments

Comments
 (0)