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

Commit 3cf71b65 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9536806 from 68773e6b to udc-release

Change-Id: I434766cb259f360eb81277d8271a94d0d9b4d464
parents 0d6c01e4 68773e6b
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -718,7 +718,8 @@ ssize_t ServiceManager::handleServiceClientCallback(const std::string& serviceNa
    if (service.guaranteeClient) {
        // we have no record of this client
        if (!service.hasClients && !hasClients) {
            sendClientCallbackNotifications(serviceName, true);
            sendClientCallbackNotifications(serviceName, true,
                                            "service is guaranteed to be in use");
        }

        // guarantee is temporary
@@ -729,34 +730,41 @@ ssize_t ServiceManager::handleServiceClientCallback(const std::string& serviceNa
    if (isCalledOnInterval) {
        if (hasClients && !service.hasClients) {
            // client was retrieved in some other way
            sendClientCallbackNotifications(serviceName, true);
            sendClientCallbackNotifications(serviceName, true, "we now have a record of a client");
        }

        // there are no more clients, but the callback has not been called yet
        if (!hasClients && service.hasClients) {
            sendClientCallbackNotifications(serviceName, false);
            sendClientCallbackNotifications(serviceName, false,
                                            "we now have no record of a client");
        }
    }

    return count;
}

void ServiceManager::sendClientCallbackNotifications(const std::string& serviceName, bool hasClients) {
void ServiceManager::sendClientCallbackNotifications(const std::string& serviceName,
                                                     bool hasClients, const char* context) {
    auto serviceIt = mNameToService.find(serviceName);
    if (serviceIt == mNameToService.end()) {
        ALOGW("sendClientCallbackNotifications could not find service %s", serviceName.c_str());
        ALOGW("sendClientCallbackNotifications could not find service %s when %s",
              serviceName.c_str(), context);
        return;
    }
    Service& service = serviceIt->second;

    CHECK(hasClients != service.hasClients) << "Record shows: " << service.hasClients
        << " so we can't tell clients again that we have client: " << hasClients;
    CHECK(hasClients != service.hasClients)
            << "Record shows: " << service.hasClients
            << " so we can't tell clients again that we have client: " << hasClients
            << " when: " << context;

    ALOGI("Notifying %s they have clients: %d", serviceName.c_str(), hasClients);
    ALOGI("Notifying %s they %s have clients when %s", serviceName.c_str(),
          hasClients ? "do" : "don't", context);

    auto ccIt = mNameToClientCallback.find(serviceName);
    CHECK(ccIt != mNameToClientCallback.end())
        << "sendClientCallbackNotifications could not find callbacks for service ";
            << "sendClientCallbackNotifications could not find callbacks for service when "
            << context;

    for (const auto& callback : ccIt->second) {
        callback->onClients(service.binder, hasClients);
+3 −2
Original line number Diff line number Diff line
@@ -93,7 +93,8 @@ private:
                        bool* found);
    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);
    void sendClientCallbackNotifications(const std::string& serviceName, bool hasClients,
                                         const char* context);
    // removes a callback from mNameToClientCallback, deleting the entry if the vector is empty
    // this updates the iterator to the next location
    void removeClientCallback(const wp<IBinder>& who, ClientCallbackMap::iterator* it);
+19 −27
Original line number Diff line number Diff line
@@ -138,30 +138,6 @@ class IsIterable {
    enum { value = decltype(_test<_T>(0))::value };
};

template <typename _T>
class ToEmptyString {
    template <typename _U>
    static std::enable_if_t<false
#ifdef HAS_NDK_INTERFACE
                                    || std::is_base_of_v<::ndk::ICInterface, _U>
#if __ANDROID_API__ >= 31
                                    || std::is_same_v<::ndk::AParcelableHolder, _U>
#endif
#endif  // HAS_NDK_INTERFACE
#ifdef HAS_CPP_INTERFACE
                                    || std::is_base_of_v<IInterface, _U> ||
                                    std::is_same_v<IBinder, _U>
#endif
                            ,
                            std::true_type>
    _test(int);
    template <typename _U>
    static std::false_type _test(...);

   public:
    enum { value = decltype(_test<_T>(0))::value };
};

template <typename _T>
struct TypeDependentFalse {
    enum { value = false };
@@ -171,9 +147,7 @@ struct TypeDependentFalse {

template <typename _T>
std::string ToString(const _T& t) {
    if constexpr (details::ToEmptyString<_T>::value) {
        return "<unimplemented>";
    } else if constexpr (std::is_same_v<bool, _T>) {
    if constexpr (std::is_same_v<bool, _T>) {
        return t ? "true" : "false";
    } else if constexpr (std::is_same_v<char16_t, _T>) {
        // TODO(b/244494451): codecvt is deprecated in C++17 -- suppress the
@@ -193,6 +167,24 @@ std::string ToString(const _T& t) {
        return ss.str();
    } else if constexpr (std::is_same_v<::ndk::ScopedFileDescriptor, _T>) {
        return "fd:" + std::to_string(t.get());
    } else if constexpr (std::is_base_of_v<::ndk::ICInterface, _T>) {
        // TODO(b/266248339): this format is to make it easy to handle resolv_integration_test
        // freezing the output format. We would like to print more info.
        return "<interface>";
#if __ANDROID_API__ >= 31
    } else if constexpr (std::is_same_v<::ndk::AParcelableHolder, _T>) {
        return "AParcelableHolder";
#endif
#endif  // HAS_NDK_INTERFACE
#ifdef HAS_CPP_INTERFACE
    } else if constexpr (std::is_base_of_v<IInterface, _T>) {
        std::stringstream ss;
        ss << "interface:" << std::hex << &t;
        return ss.str();
    } else if constexpr (std::is_same_v<IBinder, _T>) {
        std::stringstream ss;
        ss << "binder:" << std::hex << &t;
        return ss.str();
#endif
#ifdef HAS_STRING16
    } else if constexpr (std::is_same_v<String16, _T>) {
+1 −5
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public:
     */
    void* getDecompressedImagePtr();
    /*
     * Returns the decompressed raw image buffer size. This mgit ethod must be called only after
     * Returns the decompressed raw image buffer size. This method must be called only after
     * calling decompressImage().
     */
    size_t getDecompressedImageSize();
@@ -92,10 +92,6 @@ public:
                                      size_t* pWidth, size_t* pHeight,
                                      std::vector<uint8_t>* iccData,
                                      std::vector<uint8_t>* exifData);
    /*
     * Extracts EXIF package and updates the EXIF position / length without decoding the image.
     */
    bool extractEXIF(const void* image, int length);

private:
    bool decode(const void* image, int length, bool decodeToRGBA);
+8 −4
Original line number Diff line number Diff line
@@ -321,13 +321,17 @@ private:
                                jr_compressed_ptr dest);

    /*
     * This method is called in the encoding pipeline. It will take the standard 8-bit JPEG image
     * and the compressed recovery map as input, and update the XMP metadata with the end of JPEG
     * marker, and append the compressed gian map after the JPEG.
     * This method is called in the encoding pipeline. It will take the standard 8-bit JPEG image,
     * the compressed recovery map and optionally the exif package as inputs, and generate the XMP
     * metadata, and finally append everything in the order of:
     *     SOI, APP2(EXIF) (if EXIF is from outside), APP2(XMP), primary image, recovery map
     * Note that EXIF package is only available for encoding API-0 and API-1. For encoding API-2 and
     * API-3 this parameter is null, but the primary image in JPEG/R may still have EXIF as long as
     * the input JPEG has EXIF.
     *
     * @param compressed_jpeg_image compressed 8-bit JPEG image
     * @param compress_recovery_map compressed recover map
     * @param exif EXIF package
     * @param (nullable) exif EXIF package
     * @param metadata JPEG/R metadata to encode in XMP of the jpeg
     * @param dest compressed JPEGR image
     * @return NO_ERROR if calculation succeeds, error code if error occurs.
Loading