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

Commit 4d9f91a1 authored by Jooyung Han's avatar Jooyung Han
Browse files

binder_ndk: use std::optional

Since Android R, Parcel provides read/write methods for "@nullable"
values using std::optional.

Bug: 149784838
Test: m
Test: CtsNdkBinderTestCases
Change-Id: If8f3e4c658766ec197471c0994b0611cdb076944
parent 5b4e68d7
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -261,7 +261,7 @@ binder_status_t AParcel_writeParcelFileDescriptor(AParcel* parcel, int fd) {
}
}


binder_status_t AParcel_readParcelFileDescriptor(const AParcel* parcel, int* fd) {
binder_status_t AParcel_readParcelFileDescriptor(const AParcel* parcel, int* fd) {
    std::unique_ptr<ParcelFileDescriptor> parcelFd;
    std::optional<ParcelFileDescriptor> parcelFd;


    status_t status = parcel->get()->readParcelable(&parcelFd);
    status_t status = parcel->get()->readParcelable(&parcelFd);
    if (status != STATUS_OK) return PruneStatusT(status);
    if (status != STATUS_OK) return PruneStatusT(status);