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

Commit 77d28154 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5000538 from 6afb474a to qt-release

Change-Id: I13041f6894fbef25831a0098e5626b8adc545a47
parents 746ee774 6afb474a
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -202,6 +202,22 @@ bool AIBinder_isRemote(const AIBinder* binder) {
    return binder->isRemote();
}

bool AIBinder_isAlive(const AIBinder* binder) {
    if (binder == nullptr) {
        return false;
    }

    return const_cast<AIBinder*>(binder)->getBinder()->isBinderAlive();
}

binder_status_t AIBinder_ping(AIBinder* binder) {
    if (binder == nullptr) {
        return EX_NULL_POINTER;
    }

    return binder->getBinder()->pingBinder();
}

void AIBinder_incStrong(AIBinder* binder) {
    if (binder == nullptr) {
        LOG(ERROR) << __func__ << ": on null binder";
@@ -269,6 +285,13 @@ binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) {
        return EX_ILLEGAL_STATE;
    }

    if (!binder->isRemote()) {
        LOG(WARNING) << "A binder object at " << binder
                     << " is being transacted on, however, this object is in the same process as "
                        "its proxy. Transacting with this binder is expensive compared to just "
                        "calling the corresponding functionality in the same process.";
    }

    *in = new AParcel(binder);
    binder_status_t status = (**in)->writeInterfaceToken(clazz->getInterfaceDescriptor());
    if (status != EX_NONE) {
+19 −3
Original line number Diff line number Diff line
@@ -146,6 +146,22 @@ __attribute__((warn_unused_result)) AIBinder* AIBinder_new(const AIBinder_Class*
 */
bool AIBinder_isRemote(const AIBinder* binder);

/**
 * If this binder is known to be alive. This will not send a transaction to a remote process and
 * returns a result based on the last known information. That is, whenever a transaction is made,
 * this is automatically updated to reflect the current alive status of this binder. This will be
 * updated as the result of a transaction made using AIBinder_transact, but it will also be updated
 * based on the results of bookkeeping or other transactions made internally.
 */
bool AIBinder_isAlive(const AIBinder* binder);

/**
 * Built-in transaction for all binder objects. This sends a transaction which will immediately
 * return. Usually this is used to make sure that a binder is alive, as a placeholder call, or as a
 * sanity check.
 */
binder_status_t AIBinder_ping(AIBinder* binder);

/**
 * This can only be called if a strong reference to this object already exists in process.
 */
@@ -172,7 +188,7 @@ int32_t AIBinder_debugGetRefCount(AIBinder* binder);
 */
bool AIBinder_associateClass(AIBinder* binder, const AIBinder_Class* clazz);

/*
/**
 * Returns the class that this binder was constructed with or associated with.
 */
const AIBinder_Class* AIBinder_getClass(AIBinder* binder);
@@ -221,13 +237,13 @@ binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in);
binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, AParcel** in,
                                  AParcel** out, binder_flags_t flags);

/*
/**
 * This does not take any ownership of the input binder, but it can be used to retrieve it if
 * something else in some process still holds a reference to it.
 */
__attribute__((warn_unused_result)) AIBinder_Weak* AIBinder_Weak_new(AIBinder* binder);

/*
/**
 * Deletes the weak reference. This will have no impact on the lifetime of the binder.
 */
void AIBinder_Weak_delete(AIBinder_Weak** weakBinder);
+4 −0
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@ TEST(NdkBinder, DoubleNumber) {
TEST(NdkBinder, RetrieveNonNdkService) {
    AIBinder* binder = AServiceManager_getService(kExistingNonNdkService);
    ASSERT_NE(nullptr, binder);
    EXPECT_TRUE(AIBinder_isRemote(binder));
    EXPECT_TRUE(AIBinder_isAlive(binder));
    EXPECT_EQ(EX_NONE, AIBinder_ping(binder));

    AIBinder_decStrong(binder);
}

+4 −3
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ cc_library_shared {
        "-Werror",
    ],
    cppflags: [
        "-std=c++1z",
        "-Weverything",

        // The static constructors and destructors in this library have not been noted to
@@ -116,7 +117,7 @@ cc_library_shared {
        "SyncFeatures.cpp",
        "view/Surface.cpp",
        "bufferqueue/1.0/B2HProducerListener.cpp",
        "bufferqueue/1.0/H2BGraphicBufferProducer.cpp"
        "bufferqueue/1.0/H2BGraphicBufferProducer.cpp",
    ],

    shared_libs: [
+31 −0
Original line number Diff line number Diff line
@@ -558,6 +558,25 @@ public:
        outLayers->clear();
        return reply.readParcelableVector(outLayers);
    }

    virtual status_t getCompositionPreference(ui::Dataspace* dataSpace,
                                              ui::PixelFormat* pixelFormat) const {
        Parcel data, reply;
        status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (error != NO_ERROR) {
            return error;
        }
        error = remote()->transact(BnSurfaceComposer::GET_COMPOSITION_PREFERENCE, data, &reply);
        if (error != NO_ERROR) {
            return error;
        }
        error = static_cast<status_t>(reply.readInt32());
        if (error == NO_ERROR) {
            *dataSpace = static_cast<ui::Dataspace>(reply.readInt32());
            *pixelFormat = static_cast<ui::PixelFormat>(reply.readInt32());
        }
        return error;
    }
};

// Out-of-line virtual method definition to trigger vtable emission in this
@@ -881,6 +900,18 @@ status_t BnSurfaceComposer::onTransact(
            }
            return result;
        }
        case GET_COMPOSITION_PREFERENCE: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            ui::Dataspace dataSpace;
            ui::PixelFormat pixelFormat;
            status_t error = getCompositionPreference(&dataSpace, &pixelFormat);
            reply->writeInt32(error);
            if (error == NO_ERROR) {
                reply->writeInt32(static_cast<int32_t>(dataSpace));
                reply->writeInt32(static_cast<int32_t>(pixelFormat));
            }
            return NO_ERROR;
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
Loading