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

Commit eb1cdc5b authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix check for nullptr surface IBinder"

parents 1aa60c16 09e60052
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -5663,7 +5663,10 @@ void SurfaceFlinger::SetInputWindowsListener::onSetInputWindowsFinished() {
}

sp<Layer> SurfaceFlinger::fromHandle(const sp<IBinder>& handle) {
    BBinder *b = handle->localBinder();
    BBinder* b = nullptr;
    if (handle) {
        b = handle->localBinder();
    }
    if (b == nullptr) {
        return nullptr;
    }
+5 −0
Original line number Diff line number Diff line
@@ -393,6 +393,11 @@ public:
    auto& mutableInternalHwcDisplayId() { return getHwComposer().mInternalHwcDisplayId; }
    auto& mutableExternalHwcDisplayId() { return getHwComposer().mExternalHwcDisplayId; }

    auto fromHandle(const sp<IBinder>& handle) {
        Mutex::Autolock _l(mFlinger->mStateLock);
        return mFlinger->fromHandle(handle);
    }

    ~TestableSurfaceFlinger() {
        // All these pointer and container clears help ensure that GMock does
        // not report a leaked object, since the SurfaceFlinger instance may
+5 −0
Original line number Diff line number Diff line
@@ -315,4 +315,9 @@ TEST_F(TransactionApplicationTest, BlockWithPriorTransaction_SyncInputWindows) {
    BlockedByPriorTransaction(/*flags*/ 0, /*syncInputWindows*/ true);
}

TEST_F(TransactionApplicationTest, FromHandle) {
    sp<IBinder> badHandle;
    auto ret = mFlinger.fromHandle(badHandle);
    EXPECT_EQ(nullptr, ret.get());
}
} // namespace android