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

Commit 1820c942 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix binder_to_string.h for NDK" am: 66f99704 am: 3fc1c341 am: 0fe73419

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1607793

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iee3fed1ac21b27b633ee5a1b4c7666f3839e27c4
parents c738a17f 0fe73419
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -136,8 +136,7 @@ class ToEmptyString {
    template <typename _U>
    static std::enable_if_t<
#ifdef HAS_NDK_INTERFACE
            std::is_base_of_v<::ndk::ICInterface, _U> || std::is_same_v<::ndk::SpAIBinder, _U> ||
                    std::is_same_v<::ndk::ScopedFileDescriptor, _U> ||
            std::is_base_of_v<::ndk::ICInterface, _U> ||
                    std::is_same_v<::ndk::AParcelableHolder, _U>
#else
            std::is_base_of_v<IInterface, _U> || std::is_same_v<IBinder, _U> ||
@@ -168,13 +167,19 @@ std::string ToString(const _T& t) {
        return std::to_string(t);
    } else if constexpr (std::is_same_v<std::string, _T>) {
        return t;
#ifdef HAS_NDK_INTERFACE
    } else if constexpr (std::is_same_v<::ndk::SpAIBinder, _T>) {
        return (t.get() == nullptr) ? "(null)" : "";
    } else if constexpr (std::is_same_v<::ndk::ScopedFileDescriptor, _T>) {
        return (t.get() == -1) ? "(null)" : "";
#endif
#ifdef HAS_STRING16
    } else if constexpr (std::is_same_v<String16, _T>) {
        std::stringstream out;
        out << t;
        return out.str();
#endif
    } else if constexpr (details::IsPointerLike<_T>::value) {
    } else if constexpr (details::IsPointerLike<_T>::value || std::is_pointer_v<_T>) {
        if (!t) return "(null)";
        std::stringstream out;
        out << ToString(*t);