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

Commit 5549fe99 authored by Jiabin Huang's avatar Jiabin Huang Committed by Android (Google) Code Review
Browse files

Merge "Add thread safety annotation in oboeservice." into main

parents 9ae496fe e1001322
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ private:
    private:
        mutable std::mutex                              mLock;
        const pid_t                                     mProcessId;
        std::set<android::sp<AAudioServiceStreamBase>>  mStreams;
        std::set<android::sp<AAudioServiceStreamBase>>  mStreams GUARDED_BY(mLock);
        // hold onto binder to receive death notifications
        android::sp<IBinder>                            mBinder;
        bool                                            mExclusiveEnabled = true;
+17 −9
Original line number Diff line number Diff line
@@ -58,18 +58,25 @@ public:
     * @param sharingMode
     * @return endpoint or null
     */
    android::sp<AAudioServiceEndpoint> openEndpoint(android::AAudioService &audioService,
                                        const aaudio::AAudioStreamRequest &request);
    android::sp<AAudioServiceEndpoint> openEndpoint(
            android::AAudioService &audioService,
            const aaudio::AAudioStreamRequest &request)
            EXCLUDES(mExclusiveLock, mSharedLock);

    void closeEndpoint(const android::sp<AAudioServiceEndpoint>& serviceEndpoint);
    void closeEndpoint(const android::sp<AAudioServiceEndpoint>& serviceEndpoint)
            EXCLUDES(mExclusiveLock, mSharedLock);;

private:
    android::sp<AAudioServiceEndpoint> openExclusiveEndpoint(android::AAudioService &aaudioService,
    android::sp<AAudioServiceEndpoint> openExclusiveEndpoint(
            android::AAudioService &aaudioService,
            const aaudio::AAudioStreamRequest &request,
                                                 sp<AAudioServiceEndpoint> &endpointToSteal);
            sp<AAudioServiceEndpoint> &endpointToSteal)
            EXCLUDES(mExclusiveLock);

    android::sp<AAudioServiceEndpoint> openSharedEndpoint(android::AAudioService &aaudioService,
                                              const aaudio::AAudioStreamRequest &request);
    android::sp<AAudioServiceEndpoint> openSharedEndpoint(
            android::AAudioService &aaudioService,
            const aaudio::AAudioStreamRequest &request)
            EXCLUDES(mSharedLock);

    android::sp<AAudioServiceEndpoint> findExclusiveEndpoint_l(
            const AAudioStreamConfiguration& configuration)
@@ -77,7 +84,8 @@ private:

    android::sp<AAudioServiceEndpointShared> findSharedEndpoint_l(
            const AAudioStreamConfiguration& configuration)
            REQUIRES(mSharedLock);
            REQUIRES(mSharedLock)
            EXCLUDES(mExclusiveLock);

    void closeExclusiveEndpoint(const android::sp<AAudioServiceEndpoint>& serviceEndpoint);
    void closeSharedEndpoint(const android::sp<AAudioServiceEndpoint>& serviceEndpoint);
+8 −4
Original line number Diff line number Diff line
@@ -55,9 +55,11 @@ public:
     */
    virtual void close() = 0;

    aaudio_result_t registerStream(const android::sp<AAudioServiceStreamBase>& stream);
    aaudio_result_t registerStream(const android::sp<AAudioServiceStreamBase>& stream)
            EXCLUDES(mLockStreams);

    aaudio_result_t unregisterStream(const android::sp<AAudioServiceStreamBase>& stream);
    aaudio_result_t unregisterStream(const android::sp<AAudioServiceStreamBase>& stream)
            EXCLUDES(mLockStreams);

    virtual aaudio_result_t startStream(android::sp<AAudioServiceStreamBase> stream,
                                        audio_port_handle_t *clientHandle) = 0;
@@ -148,9 +150,11 @@ protected:
     * @param portHandle
     * @return return true if a stream with the given portHandle is registered
     */
    bool                     isStreamRegistered(audio_port_handle_t portHandle);
    bool                     isStreamRegistered(audio_port_handle_t portHandle)
                                    EXCLUDES(mLockStreams);

    std::vector<android::sp<AAudioServiceStreamBase>> disconnectRegisteredStreams();
    std::vector<android::sp<AAudioServiceStreamBase>> disconnectRegisteredStreams()
            EXCLUDES(mLockStreams);

    mutable std::mutex       mLockStreams;
    std::vector<android::sp<AAudioServiceStreamBase>> mRegisteredStreams
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@

#include <atomic>
#include <functional>
#include <mutex>
#include <vector>

#include "client/AudioStreamInternal.h"
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@

#include <atomic>
#include <functional>
#include <mutex>
#include <vector>

#include "client/AudioStreamInternal.h"
Loading