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

Commit 36e57769 authored by Yu-Ting Tseng's avatar Yu-Ting Tseng
Browse files

Guard the call to onFrozenStateChangeListenerRemoved behind a flag

Bug: 425638507
Bug: 430342210
Flag: build.RELEASE_LIBBINDER_DEFER_BC_REQUEST_FREEZE_NOTIFICATION
Test: atest binderLibTest
Change-Id: I1f5354ea8194686fc2122cc00926a56a54134352
parent 283f1a51
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -72,6 +72,16 @@ namespace android {

using namespace std::chrono_literals;

namespace {
    bool waitForFrozenListenerRemovalCompletion() {
#if defined(LIBBINDER_DEFER_BC_REQUEST_FREEZE_NOTIFICATION)
        return true;
#else
        return false;
#endif
    }
}

// Static const and functions will be optimized out if not used,
// when LOG_NDEBUG and references in IF_LOG_COMMANDS() are optimized out.
static const char* kReturnStrings[] = {
@@ -1628,7 +1638,9 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
   case BR_CLEAR_FREEZE_NOTIFICATION_DONE:
        {
            BpBinder* proxy = (BpBinder*)mIn.readPointer();
            if (waitForFrozenListenerRemovalCompletion()) {
                proxy->getPrivateAccessor().onFrozenStateChangeListenerRemoved();
            }
            proxy->getWeakRefs()->decWeak(proxy);
        }
        break;