AudioSystem: Modernize return value optimization
Storing sp<> return values in a const ref to temporary
seems like an outdated way to avoid an additional copy,
if that was indeed the original intention to optimize.
Avoid storing the sp<> return value in a const ref to avoid
confusion with returning a reference (which is dangerous
as it allows access without the lock). Instead store the
sp<> return value in a const lvalue to invoke copy elision
which is guaranteed in C++17.
Test: atest CtsMediaAudioTestCases
Bug: 326504627
Change-Id: I3e34f01be0d9b85289ff88e0bc289eec833b5348
2 files changed