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

Commit 145737c2 authored by Atneya Nair's avatar Atneya Nair
Browse files

[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
parent 708a26c6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -35,11 +35,11 @@ public:
    {
    }

    // This should never fail
    virtual sp<media::IAudioManagerNative> getNativeInterface() {
        Parcel data, reply;
        data.writeInterfaceToken(IAudioManager::getInterfaceDescriptor());
        const status_t res = remote()->transact(GET_NATIVE_INTERFACE, data, &reply, 0);
        if (res == DEAD_OBJECT) return nullptr;
        LOG_ALWAYS_FATAL_IF(res != OK, "%s failed with result %d", __func__, res);
        const int ex = reply.readExceptionCode();
        LOG_ALWAYS_FATAL_IF(ex != binder::Status::EX_NONE, "%s failed with exception %d",
@@ -48,7 +48,7 @@ public:
        sp<IBinder> binder;
        const status_t err = reply.readNullableStrongBinder(&binder);
        LOG_ALWAYS_FATAL_IF(binder == nullptr, "%s failed unexpected nullptr %d", __func__, err);
        const auto iface = checked_interface_cast<media::IAudioManagerNative>(std::move(binder));
        const auto iface = checked_interface_cast<media::IAudioManagerNative>(binder);
        LOG_ALWAYS_FATAL_IF(iface == nullptr, "%s failed unexpected interface", __func__);
        return iface;
    }