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

Commit b9da080c authored by Ytai Ben-tsvi's avatar Ytai Ben-tsvi Committed by Android (Google) Code Review
Browse files

Merge "Fix AudioFlinger TimeCheck" into sc-dev

parents 8b877159 24b33fc7
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -749,10 +749,20 @@ status_t AudioFlingerClientAdapter::setVibratorInfos(
AudioFlingerServerAdapter::AudioFlingerServerAdapter(
        const sp<AudioFlingerServerAdapter::Delegate>& delegate) : mDelegate(delegate) {}

status_t AudioFlingerServerAdapter::onTransact(uint32_t code, const Parcel& data, Parcel* reply,
status_t AudioFlingerServerAdapter::onTransact(uint32_t code,
                                               const Parcel& data,
                                               Parcel* reply,
                                               uint32_t flags) {
    return mDelegate->onPreTransact(static_cast<Delegate::TransactionCode>(code), data, flags)
           ?: BnAudioFlingerService::onTransact(code, data, reply, flags);
    return mDelegate->onTransactWrapper(static_cast<Delegate::TransactionCode>(code),
                                        data,
                                        flags,
                                        [&] {
                                            return BnAudioFlingerService::onTransact(
                                                    code,
                                                    data,
                                                    reply,
                                                    flags);
                                        });
}

status_t AudioFlingerServerAdapter::dump(int fd, const Vector<String16>& args) {
+12 −8
Original line number Diff line number Diff line
@@ -516,18 +516,22 @@ public:
        };

        /**
         * And optional hook, called on every transaction, before unparceling the data and
         * dispatching to the respective method. Useful for bulk operations, such as logging or
         * permission checks.
         * If an error status is returned, the transaction will return immediately and will not be
         * processed.
         * And optional hook, called on every transaction, allowing additional operations to be
         * performed before/after the unparceling  ofthe data and dispatching to the respective
         * method. Useful for bulk operations, such as logging or permission checks.
         * The implementer is responsible to invoke the provided delegate function, which is the
         * actual onTransact(), unless an error occurs.
         * By default, this is just a pass-through to the delegate.
         */
        virtual status_t onPreTransact(TransactionCode code, const Parcel& data, uint32_t flags) {
        virtual status_t onTransactWrapper(TransactionCode code,
                                           const Parcel& data,
                                           uint32_t flags,
                                           const std::function<status_t()>& delegate) {
            (void) code;
            (void) data;
            (void) flags;
            return OK;
        };
            return delegate();
        }

        /**
         * An optional hook for implementing diagnostics dumping.
+10 −4
Original line number Diff line number Diff line
@@ -4115,9 +4115,13 @@ bool AudioFlinger::updateOrphanEffectChains(const sp<AudioFlinger::EffectModule>

// ----------------------------------------------------------------------------

status_t AudioFlinger::onPreTransact(
        TransactionCode code, const Parcel& /* data */, uint32_t /* flags */)
{
status_t AudioFlinger::onTransactWrapper(TransactionCode code,
                                         const Parcel& data,
                                         uint32_t flags,
                                         const std::function<status_t()>& delegate) {
    (void) data;
    (void) flags;

    // make sure transactions reserved to AudioPolicyManager do not come from other processes
    switch (code) {
        case TransactionCode::SET_STREAM_VOLUME:
@@ -4150,6 +4154,7 @@ status_t AudioFlinger::onPreTransact(
                default:
                    return INVALID_OPERATION;
            }
            // Fail silently in these cases.
            return OK;
        default:
            break;
@@ -4177,6 +4182,7 @@ status_t AudioFlinger::onPreTransact(
                    default:
                        return INVALID_OPERATION;
                }
                // Fail silently in these cases.
                return OK;
            }
        } break;
@@ -4218,7 +4224,7 @@ status_t AudioFlinger::onPreTransact(
        AudioSystem::get_audio_policy_service();
    }

    return OK;
    return delegate();
}

} // namespace android
+2 −1
Original line number Diff line number Diff line
@@ -272,7 +272,8 @@ public:

    virtual status_t setVibratorInfos(const std::vector<media::AudioVibratorInfo>& vibratorInfos);

    status_t onPreTransact(TransactionCode code, const Parcel& data, uint32_t flags) override;
    status_t onTransactWrapper(TransactionCode code, const Parcel& data, uint32_t flags,
        const std::function<status_t()>& delegate) override;

    // end of IAudioFlinger interface