Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3009a12c authored by jiabin's avatar jiabin Committed by Eric Laurent
Browse files

Check if calling uid is system uid for setAllowedPolicyCapture.

AudioSystem.setAllowedPolicyCapture is only called from audio service.
In that case, checking if the calling uid is system uid to before taking
action.

Bug: 151922109
Bug: 145115448

Test: AudioManagerTest#testAllowedCapturePolicy
Change-Id: I614ac881ecde6bad13f22f1382de701f314a7ada
Merged-In: I614ac881ecde6bad13f22f1382de701f314a7ada
(cherry picked from commit 140a34fb)
parent 292e854b
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -989,11 +989,6 @@ status_t AudioPolicyService::setAllowedCapturePolicy(uid_t uid, audio_flags_mask
        ALOGV("%s() mAudioPolicyManager == NULL", __func__);
        return NO_INIT;
    }
    uint_t callingUid = IPCThreadState::self()->getCallingUid();
    if (uid != callingUid) {
        ALOGD("%s() uid invalid %d != %d", __func__, uid, callingUid);
        return PERMISSION_DENIED;
    }
    return mAudioPolicyManager->setAllowedCapturePolicy(uid, capturePolicy);
}