Parcel: deprecate unique_ptr read/write methods
Since Android R, Parcel provides read/write methods for "@nullable"
values using std::optional. Deprecating "unique_ptr" versions
so that the compiler emits errors like following when trying to use
unique_ptr variants:
error: 'readUtf8FromUtf16' is deprecated: use std::optional
version instead [-Werror,-Wdeprecated-declarations]
Note that parcel_puzzer/binder.cpp still tests deprecated functions.
Bug: 149784838
Test: m
Change-Id: I65fc58333373ce04a871dd5cdbe4b761ce548393
diff --git a/libs/binder/parcel_fuzzer/binder.cpp b/libs/binder/parcel_fuzzer/binder.cpp
index a94f06f..394d222 100644
--- a/libs/binder/parcel_fuzzer/binder.cpp
+++ b/libs/binder/parcel_fuzzer/binder.cpp
@@ -86,6 +86,8 @@
PARCEL_READ_WITH_STATUS(T, FUN), \
PARCEL_READ_NO_STATUS(T, FUN)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// clang-format off
std::vector<ParcelRead<::android::Parcel>> BINDER_PARCEL_READ_FUNCTIONS {
PARCEL_READ_NO_STATUS(size_t, dataSize),
@@ -289,3 +291,4 @@
PARCEL_READ_WITH_STATUS(android::os::PersistableBundle, readParcelable),
};
// clang-format on
+#pragma clang diagnostic pop