Skip to content

Commit d6c2963

Browse files
Treehugger RobotAndroid (Google) Code Review
authored andcommitted
Merge "[audio] Handle DEAD_OBJECT from system server" into main
2 parents a9bb707 + 145737c commit d6c2963

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)