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

Commit cf6674f9 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[audio] Add playback hardening override plumbing" into main

parents 5dcd5526 f91c0ac7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -498,4 +498,9 @@ interface IAudioPolicyService {
    // When adding a new method, please review and update
    // AudioPolicyService.cpp AudioPolicyService::onTransact()
    // AudioPolicyService.cpp IAUDIOPOLICYSERVICE_BINDER_METHOD_MACRO_LIST

    /**
     * Enable hardening independent of flag or exemption state
     */
     void setEnableHardening(boolean shouldEnable);
}
+6 −0
Original line number Diff line number Diff line
@@ -2400,6 +2400,12 @@ const IPermissionProvider& AudioFlinger::getPermissionProvider() {
    return mAudioPolicyServiceLocal.load()->getPermissionProvider();
}

bool AudioFlinger::isHardeningOverrideEnabled() const {
    // This is inited as part of service construction, prior to binder registration,
    // so it should always be non-null.
    return mAudioPolicyServiceLocal.load()->isHardeningOverrideEnabled();
}

// removeClient_l() must be called with AudioFlinger::clientMutex() held
void AudioFlinger::removeClient_l(pid_t pid)
{
+2 −0
Original line number Diff line number Diff line
@@ -421,6 +421,8 @@ private:

    const ::com::android::media::permission::IPermissionProvider& getPermissionProvider() final;

    bool isHardeningOverrideEnabled() const final;

    // ---- end of IAfThreadCallback interface

    /* List available audio ports and their attributes */
+2 −0
Original line number Diff line number Diff line
@@ -133,6 +133,8 @@ public:

    virtual const ::com::android::media::permission::IPermissionProvider&
            getPermissionProvider() = 0;

    virtual bool isHardeningOverrideEnabled() const = 0;
};

class IAfThreadBase : public virtual RefBase {
+5 −3
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ class IAfPatchTrack;
class IAfPlaybackThread;
class IAfRecordThread;
class IAfThreadBase;
class IAfThreadCallback;

struct TeePatch {
    sp<IAfPatchRecord> patchRecord;
@@ -267,9 +268,10 @@ class AfPlaybackCommon : public virtual VolumePortInterface {
    using AppOpsSession = media::permission::AppOpsSession<media::permission::DefaultAppOpsFacade>;

  public:
    AfPlaybackCommon(
            IAfTrackBase & self, float volume, bool muted, const audio_attributes_t& attr,
            const AttributionSourceState& attributionSource, bool shouldPlaybackHarden = true);
    AfPlaybackCommon(IAfTrackBase& self, IAfThreadCallback& thread, float volume, bool muted,
                     const audio_attributes_t& attr,
                     const AttributionSourceState& attributionSource,
                     bool shouldPlaybackHarden = true);

    /**
     * Updates the mute state and notifies the audio service.
Loading