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

Commit d3a5ff9a authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "Fix potential deadlock between AudioPolicyService and AudioSystem" into lmp-dev

parents 6d61a4f8 b445375f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -582,9 +582,13 @@ const sp<IAudioPolicyService>& AudioSystem::get_audio_policy_service()
        }
        binder->linkToDeath(gAudioPolicyServiceClient);
        gAudioPolicyService = interface_cast<IAudioPolicyService>(binder);
        gAudioPolicyService->registerClient(gAudioPolicyServiceClient);
        gLock.unlock();
        // Registering the client takes the AudioPolicyService lock.
        // Don't hold the AudioSystem lock at the same time.
        gAudioPolicyService->registerClient(gAudioPolicyServiceClient);
    } else {
        // There exists a benign race condition where gAudioPolicyService
        // is set, but gAudioPolicyServiceClient is not yet registered.
        gLock.unlock();
    }
    return gAudioPolicyService;