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

Commit 74284663 authored by Devin Moore's avatar Devin Moore
Browse files

Check builtin_available for ndk calls in AIDL native window

These NDK APIs may not be available for modules using this AIDL type on
older devices.

Test: m
Bug: none
Change-Id: I0048285e4bd4d708833704845bed2199800bf42c
parent 9c791c7c
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -97,14 +97,22 @@ public:

    binder_status_t readFromParcel(const AParcel* _Nonnull parcel) {
        reset();
        if (__builtin_available(android __ANDROID_API_U__, *)) {
            return ANativeWindow_readFromParcel(parcel, &mWindow);
        } else {
            return STATUS_FAILED_TRANSACTION;
        }
    }

    binder_status_t writeToParcel(AParcel* _Nonnull parcel) const {
        if (!mWindow) {
            return STATUS_BAD_VALUE;
        }
        if (__builtin_available(android __ANDROID_API_U__, *)) {
            return ANativeWindow_writeToParcel(mWindow, parcel);
        } else {
            return STATUS_FAILED_TRANSACTION;
        }
    }

    /**