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

Commit 2d844ce6 authored by Shashank Mittal's avatar Shashank Mittal Committed by Abhisek Devkota
Browse files

media: Add Ops check before starting audio recording.

Confirm user permission before starting audio recording.

Change-Id: Ia4e6d8fb6986d4e73fb656ba0efaf42c210e92af
parent 4dfe626b
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@
#endif
#endif
#include "StagefrightRecorder.h"
#include "StagefrightRecorder.h"


#include <binder/AppOpsManager.h>
#include <binder/IPCThreadState.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <binder/IServiceManager.h>


@@ -880,6 +881,12 @@ status_t StagefrightRecorder::start() {
}
}


sp<MediaSource> StagefrightRecorder::createAudioSource() {
sp<MediaSource> StagefrightRecorder::createAudioSource() {
    // check record appop
    if (mAppOpsManager.noteOp(AppOpsManager::OP_RECORD_AUDIO, mClientUid,
            mClientName) != AppOpsManager::MODE_ALLOWED) {
        return NULL;
    }

#ifdef QCOM_DIRECTTRACK
#ifdef QCOM_DIRECTTRACK
    bool tunneledSource = false;
    bool tunneledSource = false;
    const char *tunnelMime;
    const char *tunnelMime;
+2 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@
#include <utils/String8.h>
#include <utils/String8.h>


#include <system/audio.h>
#include <system/audio.h>
#include <binder/AppOpsManager.h>


namespace android {
namespace android {


@@ -69,6 +70,7 @@ struct StagefrightRecorder : public MediaRecorderBase {
    virtual sp<IGraphicBufferProducer> querySurfaceMediaSource() const;
    virtual sp<IGraphicBufferProducer> querySurfaceMediaSource() const;


private:
private:
    AppOpsManager mAppOpsManager;
    sp<ICamera> mCamera;
    sp<ICamera> mCamera;
    sp<ICameraRecordingProxy> mCameraProxy;
    sp<ICameraRecordingProxy> mCameraProxy;
    sp<IGraphicBufferProducer> mPreviewSurface;
    sp<IGraphicBufferProducer> mPreviewSurface;