Skip to content

Commit 145737c

Browse files
committed
[audio] Handle DEAD_OBJECT from system server
Aborting when a transaction with system server fails with dead object leads to misattributed native stack traces. Since the system will soon be restarted regardless, softly tolerate this failure within audioserver. Test: compiles Flag: EXEMPT bug fix Fixes: 390298225 Change-Id: Idb3bfae0c0376e884f8771abd0d1ce8695cd9c07
1 parent 708a26c commit 145737c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

services/audiomanager/IAudioManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class BpAudioManager : public BpInterface<IAudioManager>
3535
{
3636
}
3737

38-
// This should never fail
3938
virtual sp<media::IAudioManagerNative> getNativeInterface() {
4039
Parcel data, reply;
4140
data.writeInterfaceToken(IAudioManager::getInterfaceDescriptor());
4241
const status_t res = remote()->transact(GET_NATIVE_INTERFACE, data, &reply, 0);
42+
if (res == DEAD_OBJECT) return nullptr;
4343
LOG_ALWAYS_FATAL_IF(res != OK, "%s failed with result %d", __func__, res);
4444
const int ex = reply.readExceptionCode();
4545
LOG_ALWAYS_FATAL_IF(ex != binder::Status::EX_NONE, "%s failed with exception %d",
@@ -48,7 +48,7 @@ class BpAudioManager : public BpInterface<IAudioManager>
4848
sp<IBinder> binder;
4949
const status_t err = reply.readNullableStrongBinder(&binder);
5050
LOG_ALWAYS_FATAL_IF(binder == nullptr, "%s failed unexpected nullptr %d", __func__, err);
51-
const auto iface = checked_interface_cast<media::IAudioManagerNative>(std::move(binder));
51+
const auto iface = checked_interface_cast<media::IAudioManagerNative>(binder);
5252
LOG_ALWAYS_FATAL_IF(iface == nullptr, "%s failed unexpected interface", __func__);
5353
return iface;
5454
}

0 commit comments

Comments
 (0)