From 8b5c8477f915e8680257657042e64181104b9bda Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Mon, 14 Aug 2023 18:20:02 +0000 Subject: [PATCH] Lock down String8.isEmpty() usage All users should migrate to .empty() Bug: 295394788 Test: make checkbuild Change-Id: I5ec7921b9cf70e6b0857e1087f141dce958d2587 --- libutils/include/utils/String8.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libutils/include/utils/String8.h b/libutils/include/utils/String8.h index ea25c6aa3..c79876296 100644 --- a/libutils/include/utils/String8.h +++ b/libutils/include/utils/String8.h @@ -65,7 +65,6 @@ public: inline size_t size() const; inline size_t bytes() const; inline bool empty() const; - inline bool isEmpty() const; size_t length() const; @@ -206,6 +205,14 @@ private: char* find_extension(void) const; const char* mString; + +// These symbols are for potential backward compatibility with prebuilts. To be removed. +#ifdef ENABLE_STRING8_OBSOLETE_METHODS +public: +#else +private: +#endif + inline bool isEmpty() const; }; // String8 can be trivially moved using memcpy() because moving does not