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

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

Snap for 6174197 from 34189ff1 to rvc-release

Change-Id: Ib7ba354d168112fb288b6c46dad62907dc25825a
parents 62e34edf 34189ff1
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -423,11 +423,12 @@ ssize_t ServiceManager::Service::getNodeStrongRefCount() {

void ServiceManager::handleClientCallbacks() {
    for (const auto& [name, service] : mNameToService) {
        handleServiceClientCallback(name);
        handleServiceClientCallback(name, true);
    }
}

ssize_t ServiceManager::handleServiceClientCallback(const std::string& serviceName) {
ssize_t ServiceManager::handleServiceClientCallback(const std::string& serviceName,
                                                    bool isCalledOnInterval) {
    auto serviceIt = mNameToService.find(serviceName);
    if (serviceIt == mNameToService.end() || mNameToClientCallback.count(serviceName) < 1) {
        return -1;
@@ -451,6 +452,8 @@ ssize_t ServiceManager::handleServiceClientCallback(const std::string& serviceNa
        service.guaranteeClient = false;
    }

    // only send notifications if this was called via the interval checking workflow
    if (isCalledOnInterval) {
        if (hasClients && !service.hasClients) {
            // client was retrieved in some other way
            sendClientCallbackNotifications(serviceName, true);
@@ -460,6 +463,7 @@ ssize_t ServiceManager::handleServiceClientCallback(const std::string& serviceNa
        if (!hasClients && service.hasClients) {
            sendClientCallbackNotifications(serviceName, false);
        }
    }

    return count;
}
@@ -518,7 +522,7 @@ Status ServiceManager::tryUnregisterService(const std::string& name, const sp<IB
        return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
    }

    int clients = handleServiceClientCallback(name);
    int clients = handleServiceClientCallback(name, false);

    // clients < 0: feature not implemented or other error. Assume clients.
    // Otherwise:
@@ -527,7 +531,7 @@ Status ServiceManager::tryUnregisterService(const std::string& name, const sp<IB
    // So, if clients > 2, then at least one other service on the system must hold a refcount.
    if (clients < 0 || clients > 2) {
        // client callbacks are either disabled or there are other clients
        LOG(INFO) << "Tried to unregister " << name << " but there are clients: " << clients;
        LOG(INFO) << "Tried to unregister " << name << ", but there are clients: " << clients;
        return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE);
    }

+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ private:
    void removeRegistrationCallback(const wp<IBinder>& who,
                        ServiceCallbackMap::iterator* it,
                        bool* found);
    ssize_t handleServiceClientCallback(const std::string& serviceName);
    ssize_t handleServiceClientCallback(const std::string& serviceName, bool isCalledOnInterval);
     // Also updates mHasClients (of what the last callback was)
    void sendClientCallbackNotifications(const std::string& serviceName, bool hasClients);
    // removes a callback from mNameToClientCallback, deleting the entry if the vector is empty
+7 −7
Original line number Diff line number Diff line
@@ -354,9 +354,9 @@ public:

    inline int32_t getDeviceId() const { return mDeviceId; }

    inline int32_t getSource() const { return mSource; }
    inline uint32_t getSource() const { return mSource; }

    inline void setSource(int32_t source) { mSource = source; }
    inline void setSource(uint32_t source) { mSource = source; }

    inline int32_t getDisplayId() const { return mDisplayId; }

@@ -365,12 +365,12 @@ public:
    inline std::array<uint8_t, 32> getHmac() const { return mHmac; }

protected:
    void initialize(int32_t deviceId, int32_t source, int32_t displayId,
    void initialize(int32_t deviceId, uint32_t source, int32_t displayId,
                    std::array<uint8_t, 32> hmac);
    void initialize(const InputEvent& from);

    int32_t mDeviceId;
    int32_t mSource;
    uint32_t mSource;
    int32_t mDisplayId;
    std::array<uint8_t, 32> mHmac;
};
@@ -405,7 +405,7 @@ public:
    static const char* getLabel(int32_t keyCode);
    static int32_t getKeyCodeFromLabel(const char* label);

    void initialize(int32_t deviceId, int32_t source, int32_t displayId,
    void initialize(int32_t deviceId, uint32_t source, int32_t displayId,
                    std::array<uint8_t, 32> hmac, int32_t action, int32_t flags, int32_t keyCode,
                    int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime,
                    nsecs_t eventTime);
@@ -629,7 +629,7 @@ public:

    ssize_t findPointerIndex(int32_t pointerId) const;

    void initialize(int32_t deviceId, int32_t source, int32_t displayId,
    void initialize(int32_t deviceId, uint32_t source, int32_t displayId,
                    std::array<uint8_t, 32> hmac, int32_t action, int32_t actionButton,
                    int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState,
                    MotionClassification classification, float xScale, float yScale, float xOffset,
@@ -657,7 +657,7 @@ public:
    status_t writeToParcel(Parcel* parcel) const;
#endif

    static bool isTouchEvent(int32_t source, int32_t action);
    static bool isTouchEvent(uint32_t source, int32_t action);
    inline bool isTouchEvent() const {
        return isTouchEvent(mSource, mAction);
    }
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

#include <binder/BufferedTextOutput.h>
#include "BufferedTextOutput.h"
#include <binder/Debug.h>

#include <cutils/atomic.h>
Loading