Loading include/android/OWNERS +4 −0 Original line number Original line Diff line number Diff line per-file input.h, keycodes.h = file:platform/frameworks/base:/INPUT_OWNERS per-file input.h, keycodes.h = file:platform/frameworks/base:/INPUT_OWNERS # Window manager per-file surface_control_input_receiver.h = file:platform/frameworks/base:/services/core/java/com/android/server/wm/OWNERS per-file input_transfer_token.h = file:platform/frameworks/base:/services/core/java/com/android/server/wm/OWNERS include/android/input_transfer_token_jni.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,9 @@ /** /** * @file input_transfer_token_jni.h * @file input_transfer_token_jni.h */ */ #ifndef ANDROID_INPUT_TRANSFER_TOKEN_JNI_H #define ANDROID_INPUT_TRANSFER_TOKEN_JNI_H #pragma once #include <sys/cdefs.h> #include <sys/cdefs.h> #include <jni.h> #include <jni.h> Loading Loading @@ -60,9 +61,8 @@ jobject _Nonnull AInputTransferToken_toJava(JNIEnv* _Nonnull env, * * * Available since API level 35. * Available since API level 35. */ */ void AInputTransferToken_release(AInputTransferToken* _Nonnull aInputTransferToken) void AInputTransferToken_release(AInputTransferToken* _Nullable aInputTransferToken) __INTRODUCED_IN(__ANDROID_API_V__); __INTRODUCED_IN(__ANDROID_API_V__); __END_DECLS __END_DECLS #endif // ANDROID_INPUT_TRANSFER_TOKEN_JNI_H /** @} */ /** @} */ include/android/surface_control_input_receiver.h +11 −3 Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,14 @@ * See the License for the specific language governing permissions and * See the License for the specific language governing permissions and * limitations under the License. * limitations under the License. */ */ /** * @addtogroup NativeActivity Native Activity * @{ */ /** * @file surface_control_input_receiver.h */ #pragma once #pragma once #include <stdint.h> #include <stdint.h> Loading Loading @@ -69,7 +77,7 @@ typedef struct AInputReceiver AInputReceiver __INTRODUCED_IN(__ANDROID_API_V__); * other input events will be delivered immediately. * other input events will be delivered immediately. * * * This is different from AInputReceiver_createUnbatchedInputReceiver in that the input events are * This is different from AInputReceiver_createUnbatchedInputReceiver in that the input events are * received batched. The caller must invoke AInputReceiver_release to cleanv up the resources when * received batched. The caller must invoke AInputReceiver_release to clean up the resources when * no longer needing to use the input receiver. * no longer needing to use the input receiver. * * * \param aChoreographer The AChoreographer used for batching. This should match the * \param aChoreographer The AChoreographer used for batching. This should match the Loading Loading @@ -144,7 +152,7 @@ AInputReceiver_getInputTransferToken(AInputReceiver *_Nonnull aInputReceiver) * Available since API level 35. * Available since API level 35. */ */ void void AInputReceiver_release(AInputReceiver *_Nonnull aInputReceiver) __INTRODUCED_IN(__ANDROID_API_V__); AInputReceiver_release(AInputReceiver *_Nullable aInputReceiver) __INTRODUCED_IN(__ANDROID_API_V__); /** /** * Creates a AInputReceiverCallbacks object that is used when registering for an AInputReceiver. * Creates a AInputReceiverCallbacks object that is used when registering for an AInputReceiver. Loading @@ -164,7 +172,7 @@ AInputReceiverCallbacks* _Nonnull AInputReceiverCallbacks_create(void* _Nullable * * * Available since API level 35 * Available since API level 35 */ */ void AInputReceiverCallbacks_release(AInputReceiverCallbacks* _Nonnull callbacks) void AInputReceiverCallbacks_release(AInputReceiverCallbacks* _Nullable callbacks) __INTRODUCED_IN(__ANDROID_API_V__); __INTRODUCED_IN(__ANDROID_API_V__); /** /** Loading libs/binder/ndk/include_cpp/android/persistable_bundle_aidl.h +56 −50 Original line number Original line Diff line number Diff line Loading @@ -22,14 +22,20 @@ #include <set> #include <set> #include <sstream> #include <sstream> namespace aidl::android::os { // Include llndk-versioning.h only for vendor build as it is not available for NDK headers. #if defined(__ANDROID_VENDOR__) #if defined(__ANDROID_VENDOR__) #define AT_LEAST_V_OR_202404 constexpr(__ANDROID_VENDOR_API__ >= 202404) #include <android/llndk-versioning.h> #else #else // __ANDROID_VENDOR__ // TODO(b/322384429) switch this to __ANDROID_API_V__ when V is finalized #if defined(API_LEVEL_AT_LEAST) #define AT_LEAST_V_OR_202404 (__builtin_available(android __ANDROID_API_FUTURE__, *)) // Redefine API_LEVEL_AT_LEAST here to replace the version to __ANDROID_API_FUTURE__ as a workaround #undef API_LEVEL_AT_LEAST #endif #endif // TODO(b/322384429) switch this __ANDROID_API_FUTURE__ to sdk_api_level when V is finalized #define API_LEVEL_AT_LEAST(sdk_api_level, vendor_api_level) \ (__builtin_available(android __ANDROID_API_FUTURE__, *)) #endif // __ANDROID_VENDOR__ namespace aidl::android::os { /** /** * Wrapper class that enables interop with AIDL NDK generation * Wrapper class that enables interop with AIDL NDK generation Loading @@ -39,7 +45,7 @@ namespace aidl::android::os { class PersistableBundle { class PersistableBundle { public: public: PersistableBundle() noexcept { PersistableBundle() noexcept { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { mPBundle = APersistableBundle_new(); mPBundle = APersistableBundle_new(); } } } } Loading @@ -49,13 +55,13 @@ class PersistableBundle { PersistableBundle(PersistableBundle&& other) noexcept : mPBundle(other.release()) {} PersistableBundle(PersistableBundle&& other) noexcept : mPBundle(other.release()) {} // duplicates, does not take ownership of the APersistableBundle* // duplicates, does not take ownership of the APersistableBundle* PersistableBundle(const PersistableBundle& other) { PersistableBundle(const PersistableBundle& other) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { mPBundle = APersistableBundle_dup(other.mPBundle); mPBundle = APersistableBundle_dup(other.mPBundle); } } } } // duplicates, does not take ownership of the APersistableBundle* // duplicates, does not take ownership of the APersistableBundle* PersistableBundle& operator=(const PersistableBundle& other) { PersistableBundle& operator=(const PersistableBundle& other) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { mPBundle = APersistableBundle_dup(other.mPBundle); mPBundle = APersistableBundle_dup(other.mPBundle); } } return *this; return *this; Loading @@ -65,7 +71,7 @@ class PersistableBundle { binder_status_t readFromParcel(const AParcel* _Nonnull parcel) { binder_status_t readFromParcel(const AParcel* _Nonnull parcel) { reset(); reset(); if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_readFromParcel(parcel, &mPBundle); return APersistableBundle_readFromParcel(parcel, &mPBundle); } else { } else { return STATUS_INVALID_OPERATION; return STATUS_INVALID_OPERATION; Loading @@ -76,7 +82,7 @@ class PersistableBundle { if (!mPBundle) { if (!mPBundle) { return STATUS_BAD_VALUE; return STATUS_BAD_VALUE; } } if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_writeToParcel(mPBundle, parcel); return APersistableBundle_writeToParcel(mPBundle, parcel); } else { } else { return STATUS_INVALID_OPERATION; return STATUS_INVALID_OPERATION; Loading @@ -91,7 +97,7 @@ class PersistableBundle { */ */ void reset(APersistableBundle* _Nullable pBundle = nullptr) noexcept { void reset(APersistableBundle* _Nullable pBundle = nullptr) noexcept { if (mPBundle) { if (mPBundle) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_delete(mPBundle); APersistableBundle_delete(mPBundle); } } mPBundle = nullptr; mPBundle = nullptr; Loading @@ -104,7 +110,7 @@ class PersistableBundle { * what should be used to check for equality. * what should be used to check for equality. */ */ bool deepEquals(const PersistableBundle& rhs) const { bool deepEquals(const PersistableBundle& rhs) const { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_isEqual(get(), rhs.get()); return APersistableBundle_isEqual(get(), rhs.get()); } else { } else { return false; return false; Loading Loading @@ -143,7 +149,7 @@ class PersistableBundle { inline std::string toString() const { inline std::string toString() const { if (!mPBundle) { if (!mPBundle) { return "<PersistableBundle: null>"; return "<PersistableBundle: null>"; } else if AT_LEAST_V_OR_202404 { } else if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { std::ostringstream os; std::ostringstream os; os << "<PersistableBundle: "; os << "<PersistableBundle: "; os << "size: " << std::to_string(APersistableBundle_size(mPBundle)); os << "size: " << std::to_string(APersistableBundle_size(mPBundle)); Loading @@ -154,7 +160,7 @@ class PersistableBundle { } } int32_t size() const { int32_t size() const { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_size(mPBundle); return APersistableBundle_size(mPBundle); } else { } else { return 0; return 0; Loading @@ -162,7 +168,7 @@ class PersistableBundle { } } int32_t erase(const std::string& key) { int32_t erase(const std::string& key) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_erase(mPBundle, key.c_str()); return APersistableBundle_erase(mPBundle, key.c_str()); } else { } else { return 0; return 0; Loading @@ -170,37 +176,37 @@ class PersistableBundle { } } void putBoolean(const std::string& key, bool val) { void putBoolean(const std::string& key, bool val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putBoolean(mPBundle, key.c_str(), val); APersistableBundle_putBoolean(mPBundle, key.c_str(), val); } } } } void putInt(const std::string& key, int32_t val) { void putInt(const std::string& key, int32_t val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putInt(mPBundle, key.c_str(), val); APersistableBundle_putInt(mPBundle, key.c_str(), val); } } } } void putLong(const std::string& key, int64_t val) { void putLong(const std::string& key, int64_t val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putLong(mPBundle, key.c_str(), val); APersistableBundle_putLong(mPBundle, key.c_str(), val); } } } } void putDouble(const std::string& key, double val) { void putDouble(const std::string& key, double val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putDouble(mPBundle, key.c_str(), val); APersistableBundle_putDouble(mPBundle, key.c_str(), val); } } } } void putString(const std::string& key, const std::string& val) { void putString(const std::string& key, const std::string& val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putString(mPBundle, key.c_str(), val.c_str()); APersistableBundle_putString(mPBundle, key.c_str(), val.c_str()); } } } } void putBooleanVector(const std::string& key, const std::vector<bool>& vec) { void putBooleanVector(const std::string& key, const std::vector<bool>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { // std::vector<bool> has no ::data(). // std::vector<bool> has no ::data(). int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { Loading @@ -217,7 +223,7 @@ class PersistableBundle { } } void putIntVector(const std::string& key, const std::vector<int32_t>& vec) { void putIntVector(const std::string& key, const std::vector<int32_t>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { APersistableBundle_putIntVector(mPBundle, key.c_str(), vec.data(), num); APersistableBundle_putIntVector(mPBundle, key.c_str(), vec.data(), num); Loading @@ -225,7 +231,7 @@ class PersistableBundle { } } } } void putLongVector(const std::string& key, const std::vector<int64_t>& vec) { void putLongVector(const std::string& key, const std::vector<int64_t>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { APersistableBundle_putLongVector(mPBundle, key.c_str(), vec.data(), num); APersistableBundle_putLongVector(mPBundle, key.c_str(), vec.data(), num); Loading @@ -233,7 +239,7 @@ class PersistableBundle { } } } } void putDoubleVector(const std::string& key, const std::vector<double>& vec) { void putDoubleVector(const std::string& key, const std::vector<double>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { APersistableBundle_putDoubleVector(mPBundle, key.c_str(), vec.data(), num); APersistableBundle_putDoubleVector(mPBundle, key.c_str(), vec.data(), num); Loading @@ -241,7 +247,7 @@ class PersistableBundle { } } } } void putStringVector(const std::string& key, const std::vector<std::string>& vec) { void putStringVector(const std::string& key, const std::vector<std::string>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { char** inVec = (char**)malloc(num * sizeof(char*)); char** inVec = (char**)malloc(num * sizeof(char*)); Loading @@ -256,13 +262,13 @@ class PersistableBundle { } } } } void putPersistableBundle(const std::string& key, const PersistableBundle& pBundle) { void putPersistableBundle(const std::string& key, const PersistableBundle& pBundle) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putPersistableBundle(mPBundle, key.c_str(), pBundle.mPBundle); APersistableBundle_putPersistableBundle(mPBundle, key.c_str(), pBundle.mPBundle); } } } } bool getBoolean(const std::string& key, bool* _Nonnull val) { bool getBoolean(const std::string& key, bool* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_getBoolean(mPBundle, key.c_str(), val); return APersistableBundle_getBoolean(mPBundle, key.c_str(), val); } else { } else { return false; return false; Loading @@ -270,7 +276,7 @@ class PersistableBundle { } } bool getInt(const std::string& key, int32_t* _Nonnull val) { bool getInt(const std::string& key, int32_t* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_getInt(mPBundle, key.c_str(), val); return APersistableBundle_getInt(mPBundle, key.c_str(), val); } else { } else { return false; return false; Loading @@ -278,7 +284,7 @@ class PersistableBundle { } } bool getLong(const std::string& key, int64_t* _Nonnull val) { bool getLong(const std::string& key, int64_t* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_getLong(mPBundle, key.c_str(), val); return APersistableBundle_getLong(mPBundle, key.c_str(), val); } else { } else { return false; return false; Loading @@ -286,7 +292,7 @@ class PersistableBundle { } } bool getDouble(const std::string& key, double* _Nonnull val) { bool getDouble(const std::string& key, double* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_getDouble(mPBundle, key.c_str(), val); return APersistableBundle_getDouble(mPBundle, key.c_str(), val); } else { } else { return false; return false; Loading @@ -298,7 +304,7 @@ class PersistableBundle { } } bool getString(const std::string& key, std::string* _Nonnull val) { bool getString(const std::string& key, std::string* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { char* outString = nullptr; char* outString = nullptr; bool ret = APersistableBundle_getString(mPBundle, key.c_str(), &outString, bool ret = APersistableBundle_getString(mPBundle, key.c_str(), &outString, &stringAllocator, nullptr); &stringAllocator, nullptr); Loading @@ -316,7 +322,7 @@ class PersistableBundle { const char* _Nonnull, T* _Nullable, int32_t), const char* _Nonnull, T* _Nullable, int32_t), const APersistableBundle* _Nonnull pBundle, const char* _Nonnull key, const APersistableBundle* _Nonnull pBundle, const char* _Nonnull key, std::vector<T>* _Nonnull vec) { std::vector<T>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t bytes = 0; int32_t bytes = 0; // call first with nullptr to get required size in bytes // call first with nullptr to get required size in bytes bytes = getVec(pBundle, key, nullptr, 0); bytes = getVec(pBundle, key, nullptr, 0); Loading @@ -338,28 +344,28 @@ class PersistableBundle { } } bool getBooleanVector(const std::string& key, std::vector<bool>* _Nonnull vec) { bool getBooleanVector(const std::string& key, std::vector<bool>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getVecInternal<bool>(&APersistableBundle_getBooleanVector, mPBundle, key.c_str(), return getVecInternal<bool>(&APersistableBundle_getBooleanVector, mPBundle, key.c_str(), vec); vec); } } return false; return false; } } bool getIntVector(const std::string& key, std::vector<int32_t>* _Nonnull vec) { bool getIntVector(const std::string& key, std::vector<int32_t>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getVecInternal<int32_t>(&APersistableBundle_getIntVector, mPBundle, key.c_str(), return getVecInternal<int32_t>(&APersistableBundle_getIntVector, mPBundle, key.c_str(), vec); vec); } } return false; return false; } } bool getLongVector(const std::string& key, std::vector<int64_t>* _Nonnull vec) { bool getLongVector(const std::string& key, std::vector<int64_t>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getVecInternal<int64_t>(&APersistableBundle_getLongVector, mPBundle, key.c_str(), return getVecInternal<int64_t>(&APersistableBundle_getLongVector, mPBundle, key.c_str(), vec); vec); } } return false; return false; } } bool getDoubleVector(const std::string& key, std::vector<double>* _Nonnull vec) { bool getDoubleVector(const std::string& key, std::vector<double>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getVecInternal<double>(&APersistableBundle_getDoubleVector, mPBundle, return getVecInternal<double>(&APersistableBundle_getDoubleVector, mPBundle, key.c_str(), vec); key.c_str(), vec); } } Loading @@ -384,7 +390,7 @@ class PersistableBundle { } } bool getStringVector(const std::string& key, std::vector<std::string>* _Nonnull vec) { bool getStringVector(const std::string& key, std::vector<std::string>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t bytes = APersistableBundle_getStringVector(mPBundle, key.c_str(), nullptr, 0, int32_t bytes = APersistableBundle_getStringVector(mPBundle, key.c_str(), nullptr, 0, &stringAllocator, nullptr); &stringAllocator, nullptr); if (bytes > 0) { if (bytes > 0) { Loading @@ -401,7 +407,7 @@ class PersistableBundle { } } bool getPersistableBundle(const std::string& key, PersistableBundle* _Nonnull val) { bool getPersistableBundle(const std::string& key, PersistableBundle* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle* bundle = nullptr; APersistableBundle* bundle = nullptr; bool ret = APersistableBundle_getPersistableBundle(mPBundle, key.c_str(), &bundle); bool ret = APersistableBundle_getPersistableBundle(mPBundle, key.c_str(), &bundle); if (ret) { if (ret) { Loading Loading @@ -433,77 +439,77 @@ class PersistableBundle { } } std::set<std::string> getBooleanKeys() { std::set<std::string> getBooleanKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getBooleanKeys, mPBundle); return getKeys(&APersistableBundle_getBooleanKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getIntKeys() { std::set<std::string> getIntKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getIntKeys, mPBundle); return getKeys(&APersistableBundle_getIntKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getLongKeys() { std::set<std::string> getLongKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getLongKeys, mPBundle); return getKeys(&APersistableBundle_getLongKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getDoubleKeys() { std::set<std::string> getDoubleKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getDoubleKeys, mPBundle); return getKeys(&APersistableBundle_getDoubleKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getStringKeys() { std::set<std::string> getStringKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getStringKeys, mPBundle); return getKeys(&APersistableBundle_getStringKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getBooleanVectorKeys() { std::set<std::string> getBooleanVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getBooleanVectorKeys, mPBundle); return getKeys(&APersistableBundle_getBooleanVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getIntVectorKeys() { std::set<std::string> getIntVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getIntVectorKeys, mPBundle); return getKeys(&APersistableBundle_getIntVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getLongVectorKeys() { std::set<std::string> getLongVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getLongVectorKeys, mPBundle); return getKeys(&APersistableBundle_getLongVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getDoubleVectorKeys() { std::set<std::string> getDoubleVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getDoubleVectorKeys, mPBundle); return getKeys(&APersistableBundle_getDoubleVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getStringVectorKeys() { std::set<std::string> getStringVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getStringVectorKeys, mPBundle); return getKeys(&APersistableBundle_getStringVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getPersistableBundleKeys() { std::set<std::string> getPersistableBundleKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getPersistableBundleKeys, mPBundle); return getKeys(&APersistableBundle_getPersistableBundleKeys, mPBundle); } else { } else { return {}; return {}; Loading libs/binder/ndk/include_ndk/android/persistable_bundle.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,10 @@ #if defined(__ANDROID_VENDOR__) #if defined(__ANDROID_VENDOR__) #include <android/llndk-versioning.h> #include <android/llndk-versioning.h> #else #else #define __INTRODUCED_IN_LLNDK(x) #if !defined(__INTRODUCED_IN_LLNDK) #define __INTRODUCED_IN_LLNDK(level) __attribute__((annotate("introduced_in_llndk=" #level))) #endif #endif #endif // __ANDROID_VENDOR__ #include <stdbool.h> #include <stdbool.h> #include <stdint.h> #include <stdint.h> #include <sys/cdefs.h> #include <sys/cdefs.h> Loading Loading
include/android/OWNERS +4 −0 Original line number Original line Diff line number Diff line per-file input.h, keycodes.h = file:platform/frameworks/base:/INPUT_OWNERS per-file input.h, keycodes.h = file:platform/frameworks/base:/INPUT_OWNERS # Window manager per-file surface_control_input_receiver.h = file:platform/frameworks/base:/services/core/java/com/android/server/wm/OWNERS per-file input_transfer_token.h = file:platform/frameworks/base:/services/core/java/com/android/server/wm/OWNERS
include/android/input_transfer_token_jni.h +4 −4 Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,9 @@ /** /** * @file input_transfer_token_jni.h * @file input_transfer_token_jni.h */ */ #ifndef ANDROID_INPUT_TRANSFER_TOKEN_JNI_H #define ANDROID_INPUT_TRANSFER_TOKEN_JNI_H #pragma once #include <sys/cdefs.h> #include <sys/cdefs.h> #include <jni.h> #include <jni.h> Loading Loading @@ -60,9 +61,8 @@ jobject _Nonnull AInputTransferToken_toJava(JNIEnv* _Nonnull env, * * * Available since API level 35. * Available since API level 35. */ */ void AInputTransferToken_release(AInputTransferToken* _Nonnull aInputTransferToken) void AInputTransferToken_release(AInputTransferToken* _Nullable aInputTransferToken) __INTRODUCED_IN(__ANDROID_API_V__); __INTRODUCED_IN(__ANDROID_API_V__); __END_DECLS __END_DECLS #endif // ANDROID_INPUT_TRANSFER_TOKEN_JNI_H /** @} */ /** @} */
include/android/surface_control_input_receiver.h +11 −3 Original line number Original line Diff line number Diff line Loading @@ -13,6 +13,14 @@ * See the License for the specific language governing permissions and * See the License for the specific language governing permissions and * limitations under the License. * limitations under the License. */ */ /** * @addtogroup NativeActivity Native Activity * @{ */ /** * @file surface_control_input_receiver.h */ #pragma once #pragma once #include <stdint.h> #include <stdint.h> Loading Loading @@ -69,7 +77,7 @@ typedef struct AInputReceiver AInputReceiver __INTRODUCED_IN(__ANDROID_API_V__); * other input events will be delivered immediately. * other input events will be delivered immediately. * * * This is different from AInputReceiver_createUnbatchedInputReceiver in that the input events are * This is different from AInputReceiver_createUnbatchedInputReceiver in that the input events are * received batched. The caller must invoke AInputReceiver_release to cleanv up the resources when * received batched. The caller must invoke AInputReceiver_release to clean up the resources when * no longer needing to use the input receiver. * no longer needing to use the input receiver. * * * \param aChoreographer The AChoreographer used for batching. This should match the * \param aChoreographer The AChoreographer used for batching. This should match the Loading Loading @@ -144,7 +152,7 @@ AInputReceiver_getInputTransferToken(AInputReceiver *_Nonnull aInputReceiver) * Available since API level 35. * Available since API level 35. */ */ void void AInputReceiver_release(AInputReceiver *_Nonnull aInputReceiver) __INTRODUCED_IN(__ANDROID_API_V__); AInputReceiver_release(AInputReceiver *_Nullable aInputReceiver) __INTRODUCED_IN(__ANDROID_API_V__); /** /** * Creates a AInputReceiverCallbacks object that is used when registering for an AInputReceiver. * Creates a AInputReceiverCallbacks object that is used when registering for an AInputReceiver. Loading @@ -164,7 +172,7 @@ AInputReceiverCallbacks* _Nonnull AInputReceiverCallbacks_create(void* _Nullable * * * Available since API level 35 * Available since API level 35 */ */ void AInputReceiverCallbacks_release(AInputReceiverCallbacks* _Nonnull callbacks) void AInputReceiverCallbacks_release(AInputReceiverCallbacks* _Nullable callbacks) __INTRODUCED_IN(__ANDROID_API_V__); __INTRODUCED_IN(__ANDROID_API_V__); /** /** Loading
libs/binder/ndk/include_cpp/android/persistable_bundle_aidl.h +56 −50 Original line number Original line Diff line number Diff line Loading @@ -22,14 +22,20 @@ #include <set> #include <set> #include <sstream> #include <sstream> namespace aidl::android::os { // Include llndk-versioning.h only for vendor build as it is not available for NDK headers. #if defined(__ANDROID_VENDOR__) #if defined(__ANDROID_VENDOR__) #define AT_LEAST_V_OR_202404 constexpr(__ANDROID_VENDOR_API__ >= 202404) #include <android/llndk-versioning.h> #else #else // __ANDROID_VENDOR__ // TODO(b/322384429) switch this to __ANDROID_API_V__ when V is finalized #if defined(API_LEVEL_AT_LEAST) #define AT_LEAST_V_OR_202404 (__builtin_available(android __ANDROID_API_FUTURE__, *)) // Redefine API_LEVEL_AT_LEAST here to replace the version to __ANDROID_API_FUTURE__ as a workaround #undef API_LEVEL_AT_LEAST #endif #endif // TODO(b/322384429) switch this __ANDROID_API_FUTURE__ to sdk_api_level when V is finalized #define API_LEVEL_AT_LEAST(sdk_api_level, vendor_api_level) \ (__builtin_available(android __ANDROID_API_FUTURE__, *)) #endif // __ANDROID_VENDOR__ namespace aidl::android::os { /** /** * Wrapper class that enables interop with AIDL NDK generation * Wrapper class that enables interop with AIDL NDK generation Loading @@ -39,7 +45,7 @@ namespace aidl::android::os { class PersistableBundle { class PersistableBundle { public: public: PersistableBundle() noexcept { PersistableBundle() noexcept { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { mPBundle = APersistableBundle_new(); mPBundle = APersistableBundle_new(); } } } } Loading @@ -49,13 +55,13 @@ class PersistableBundle { PersistableBundle(PersistableBundle&& other) noexcept : mPBundle(other.release()) {} PersistableBundle(PersistableBundle&& other) noexcept : mPBundle(other.release()) {} // duplicates, does not take ownership of the APersistableBundle* // duplicates, does not take ownership of the APersistableBundle* PersistableBundle(const PersistableBundle& other) { PersistableBundle(const PersistableBundle& other) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { mPBundle = APersistableBundle_dup(other.mPBundle); mPBundle = APersistableBundle_dup(other.mPBundle); } } } } // duplicates, does not take ownership of the APersistableBundle* // duplicates, does not take ownership of the APersistableBundle* PersistableBundle& operator=(const PersistableBundle& other) { PersistableBundle& operator=(const PersistableBundle& other) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { mPBundle = APersistableBundle_dup(other.mPBundle); mPBundle = APersistableBundle_dup(other.mPBundle); } } return *this; return *this; Loading @@ -65,7 +71,7 @@ class PersistableBundle { binder_status_t readFromParcel(const AParcel* _Nonnull parcel) { binder_status_t readFromParcel(const AParcel* _Nonnull parcel) { reset(); reset(); if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_readFromParcel(parcel, &mPBundle); return APersistableBundle_readFromParcel(parcel, &mPBundle); } else { } else { return STATUS_INVALID_OPERATION; return STATUS_INVALID_OPERATION; Loading @@ -76,7 +82,7 @@ class PersistableBundle { if (!mPBundle) { if (!mPBundle) { return STATUS_BAD_VALUE; return STATUS_BAD_VALUE; } } if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_writeToParcel(mPBundle, parcel); return APersistableBundle_writeToParcel(mPBundle, parcel); } else { } else { return STATUS_INVALID_OPERATION; return STATUS_INVALID_OPERATION; Loading @@ -91,7 +97,7 @@ class PersistableBundle { */ */ void reset(APersistableBundle* _Nullable pBundle = nullptr) noexcept { void reset(APersistableBundle* _Nullable pBundle = nullptr) noexcept { if (mPBundle) { if (mPBundle) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_delete(mPBundle); APersistableBundle_delete(mPBundle); } } mPBundle = nullptr; mPBundle = nullptr; Loading @@ -104,7 +110,7 @@ class PersistableBundle { * what should be used to check for equality. * what should be used to check for equality. */ */ bool deepEquals(const PersistableBundle& rhs) const { bool deepEquals(const PersistableBundle& rhs) const { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_isEqual(get(), rhs.get()); return APersistableBundle_isEqual(get(), rhs.get()); } else { } else { return false; return false; Loading Loading @@ -143,7 +149,7 @@ class PersistableBundle { inline std::string toString() const { inline std::string toString() const { if (!mPBundle) { if (!mPBundle) { return "<PersistableBundle: null>"; return "<PersistableBundle: null>"; } else if AT_LEAST_V_OR_202404 { } else if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { std::ostringstream os; std::ostringstream os; os << "<PersistableBundle: "; os << "<PersistableBundle: "; os << "size: " << std::to_string(APersistableBundle_size(mPBundle)); os << "size: " << std::to_string(APersistableBundle_size(mPBundle)); Loading @@ -154,7 +160,7 @@ class PersistableBundle { } } int32_t size() const { int32_t size() const { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_size(mPBundle); return APersistableBundle_size(mPBundle); } else { } else { return 0; return 0; Loading @@ -162,7 +168,7 @@ class PersistableBundle { } } int32_t erase(const std::string& key) { int32_t erase(const std::string& key) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_erase(mPBundle, key.c_str()); return APersistableBundle_erase(mPBundle, key.c_str()); } else { } else { return 0; return 0; Loading @@ -170,37 +176,37 @@ class PersistableBundle { } } void putBoolean(const std::string& key, bool val) { void putBoolean(const std::string& key, bool val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putBoolean(mPBundle, key.c_str(), val); APersistableBundle_putBoolean(mPBundle, key.c_str(), val); } } } } void putInt(const std::string& key, int32_t val) { void putInt(const std::string& key, int32_t val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putInt(mPBundle, key.c_str(), val); APersistableBundle_putInt(mPBundle, key.c_str(), val); } } } } void putLong(const std::string& key, int64_t val) { void putLong(const std::string& key, int64_t val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putLong(mPBundle, key.c_str(), val); APersistableBundle_putLong(mPBundle, key.c_str(), val); } } } } void putDouble(const std::string& key, double val) { void putDouble(const std::string& key, double val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putDouble(mPBundle, key.c_str(), val); APersistableBundle_putDouble(mPBundle, key.c_str(), val); } } } } void putString(const std::string& key, const std::string& val) { void putString(const std::string& key, const std::string& val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putString(mPBundle, key.c_str(), val.c_str()); APersistableBundle_putString(mPBundle, key.c_str(), val.c_str()); } } } } void putBooleanVector(const std::string& key, const std::vector<bool>& vec) { void putBooleanVector(const std::string& key, const std::vector<bool>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { // std::vector<bool> has no ::data(). // std::vector<bool> has no ::data(). int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { Loading @@ -217,7 +223,7 @@ class PersistableBundle { } } void putIntVector(const std::string& key, const std::vector<int32_t>& vec) { void putIntVector(const std::string& key, const std::vector<int32_t>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { APersistableBundle_putIntVector(mPBundle, key.c_str(), vec.data(), num); APersistableBundle_putIntVector(mPBundle, key.c_str(), vec.data(), num); Loading @@ -225,7 +231,7 @@ class PersistableBundle { } } } } void putLongVector(const std::string& key, const std::vector<int64_t>& vec) { void putLongVector(const std::string& key, const std::vector<int64_t>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { APersistableBundle_putLongVector(mPBundle, key.c_str(), vec.data(), num); APersistableBundle_putLongVector(mPBundle, key.c_str(), vec.data(), num); Loading @@ -233,7 +239,7 @@ class PersistableBundle { } } } } void putDoubleVector(const std::string& key, const std::vector<double>& vec) { void putDoubleVector(const std::string& key, const std::vector<double>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { APersistableBundle_putDoubleVector(mPBundle, key.c_str(), vec.data(), num); APersistableBundle_putDoubleVector(mPBundle, key.c_str(), vec.data(), num); Loading @@ -241,7 +247,7 @@ class PersistableBundle { } } } } void putStringVector(const std::string& key, const std::vector<std::string>& vec) { void putStringVector(const std::string& key, const std::vector<std::string>& vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t num = vec.size(); int32_t num = vec.size(); if (num > 0) { if (num > 0) { char** inVec = (char**)malloc(num * sizeof(char*)); char** inVec = (char**)malloc(num * sizeof(char*)); Loading @@ -256,13 +262,13 @@ class PersistableBundle { } } } } void putPersistableBundle(const std::string& key, const PersistableBundle& pBundle) { void putPersistableBundle(const std::string& key, const PersistableBundle& pBundle) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle_putPersistableBundle(mPBundle, key.c_str(), pBundle.mPBundle); APersistableBundle_putPersistableBundle(mPBundle, key.c_str(), pBundle.mPBundle); } } } } bool getBoolean(const std::string& key, bool* _Nonnull val) { bool getBoolean(const std::string& key, bool* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_getBoolean(mPBundle, key.c_str(), val); return APersistableBundle_getBoolean(mPBundle, key.c_str(), val); } else { } else { return false; return false; Loading @@ -270,7 +276,7 @@ class PersistableBundle { } } bool getInt(const std::string& key, int32_t* _Nonnull val) { bool getInt(const std::string& key, int32_t* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_getInt(mPBundle, key.c_str(), val); return APersistableBundle_getInt(mPBundle, key.c_str(), val); } else { } else { return false; return false; Loading @@ -278,7 +284,7 @@ class PersistableBundle { } } bool getLong(const std::string& key, int64_t* _Nonnull val) { bool getLong(const std::string& key, int64_t* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_getLong(mPBundle, key.c_str(), val); return APersistableBundle_getLong(mPBundle, key.c_str(), val); } else { } else { return false; return false; Loading @@ -286,7 +292,7 @@ class PersistableBundle { } } bool getDouble(const std::string& key, double* _Nonnull val) { bool getDouble(const std::string& key, double* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return APersistableBundle_getDouble(mPBundle, key.c_str(), val); return APersistableBundle_getDouble(mPBundle, key.c_str(), val); } else { } else { return false; return false; Loading @@ -298,7 +304,7 @@ class PersistableBundle { } } bool getString(const std::string& key, std::string* _Nonnull val) { bool getString(const std::string& key, std::string* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { char* outString = nullptr; char* outString = nullptr; bool ret = APersistableBundle_getString(mPBundle, key.c_str(), &outString, bool ret = APersistableBundle_getString(mPBundle, key.c_str(), &outString, &stringAllocator, nullptr); &stringAllocator, nullptr); Loading @@ -316,7 +322,7 @@ class PersistableBundle { const char* _Nonnull, T* _Nullable, int32_t), const char* _Nonnull, T* _Nullable, int32_t), const APersistableBundle* _Nonnull pBundle, const char* _Nonnull key, const APersistableBundle* _Nonnull pBundle, const char* _Nonnull key, std::vector<T>* _Nonnull vec) { std::vector<T>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t bytes = 0; int32_t bytes = 0; // call first with nullptr to get required size in bytes // call first with nullptr to get required size in bytes bytes = getVec(pBundle, key, nullptr, 0); bytes = getVec(pBundle, key, nullptr, 0); Loading @@ -338,28 +344,28 @@ class PersistableBundle { } } bool getBooleanVector(const std::string& key, std::vector<bool>* _Nonnull vec) { bool getBooleanVector(const std::string& key, std::vector<bool>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getVecInternal<bool>(&APersistableBundle_getBooleanVector, mPBundle, key.c_str(), return getVecInternal<bool>(&APersistableBundle_getBooleanVector, mPBundle, key.c_str(), vec); vec); } } return false; return false; } } bool getIntVector(const std::string& key, std::vector<int32_t>* _Nonnull vec) { bool getIntVector(const std::string& key, std::vector<int32_t>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getVecInternal<int32_t>(&APersistableBundle_getIntVector, mPBundle, key.c_str(), return getVecInternal<int32_t>(&APersistableBundle_getIntVector, mPBundle, key.c_str(), vec); vec); } } return false; return false; } } bool getLongVector(const std::string& key, std::vector<int64_t>* _Nonnull vec) { bool getLongVector(const std::string& key, std::vector<int64_t>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getVecInternal<int64_t>(&APersistableBundle_getLongVector, mPBundle, key.c_str(), return getVecInternal<int64_t>(&APersistableBundle_getLongVector, mPBundle, key.c_str(), vec); vec); } } return false; return false; } } bool getDoubleVector(const std::string& key, std::vector<double>* _Nonnull vec) { bool getDoubleVector(const std::string& key, std::vector<double>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getVecInternal<double>(&APersistableBundle_getDoubleVector, mPBundle, return getVecInternal<double>(&APersistableBundle_getDoubleVector, mPBundle, key.c_str(), vec); key.c_str(), vec); } } Loading @@ -384,7 +390,7 @@ class PersistableBundle { } } bool getStringVector(const std::string& key, std::vector<std::string>* _Nonnull vec) { bool getStringVector(const std::string& key, std::vector<std::string>* _Nonnull vec) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { int32_t bytes = APersistableBundle_getStringVector(mPBundle, key.c_str(), nullptr, 0, int32_t bytes = APersistableBundle_getStringVector(mPBundle, key.c_str(), nullptr, 0, &stringAllocator, nullptr); &stringAllocator, nullptr); if (bytes > 0) { if (bytes > 0) { Loading @@ -401,7 +407,7 @@ class PersistableBundle { } } bool getPersistableBundle(const std::string& key, PersistableBundle* _Nonnull val) { bool getPersistableBundle(const std::string& key, PersistableBundle* _Nonnull val) { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { APersistableBundle* bundle = nullptr; APersistableBundle* bundle = nullptr; bool ret = APersistableBundle_getPersistableBundle(mPBundle, key.c_str(), &bundle); bool ret = APersistableBundle_getPersistableBundle(mPBundle, key.c_str(), &bundle); if (ret) { if (ret) { Loading Loading @@ -433,77 +439,77 @@ class PersistableBundle { } } std::set<std::string> getBooleanKeys() { std::set<std::string> getBooleanKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getBooleanKeys, mPBundle); return getKeys(&APersistableBundle_getBooleanKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getIntKeys() { std::set<std::string> getIntKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getIntKeys, mPBundle); return getKeys(&APersistableBundle_getIntKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getLongKeys() { std::set<std::string> getLongKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getLongKeys, mPBundle); return getKeys(&APersistableBundle_getLongKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getDoubleKeys() { std::set<std::string> getDoubleKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getDoubleKeys, mPBundle); return getKeys(&APersistableBundle_getDoubleKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getStringKeys() { std::set<std::string> getStringKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getStringKeys, mPBundle); return getKeys(&APersistableBundle_getStringKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getBooleanVectorKeys() { std::set<std::string> getBooleanVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getBooleanVectorKeys, mPBundle); return getKeys(&APersistableBundle_getBooleanVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getIntVectorKeys() { std::set<std::string> getIntVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getIntVectorKeys, mPBundle); return getKeys(&APersistableBundle_getIntVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getLongVectorKeys() { std::set<std::string> getLongVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getLongVectorKeys, mPBundle); return getKeys(&APersistableBundle_getLongVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getDoubleVectorKeys() { std::set<std::string> getDoubleVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getDoubleVectorKeys, mPBundle); return getKeys(&APersistableBundle_getDoubleVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getStringVectorKeys() { std::set<std::string> getStringVectorKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getStringVectorKeys, mPBundle); return getKeys(&APersistableBundle_getStringVectorKeys, mPBundle); } else { } else { return {}; return {}; } } } } std::set<std::string> getPersistableBundleKeys() { std::set<std::string> getPersistableBundleKeys() { if AT_LEAST_V_OR_202404 { if API_LEVEL_AT_LEAST(__ANDROID_API_V__, 202404) { return getKeys(&APersistableBundle_getPersistableBundleKeys, mPBundle); return getKeys(&APersistableBundle_getPersistableBundleKeys, mPBundle); } else { } else { return {}; return {}; Loading
libs/binder/ndk/include_ndk/android/persistable_bundle.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -20,8 +20,10 @@ #if defined(__ANDROID_VENDOR__) #if defined(__ANDROID_VENDOR__) #include <android/llndk-versioning.h> #include <android/llndk-versioning.h> #else #else #define __INTRODUCED_IN_LLNDK(x) #if !defined(__INTRODUCED_IN_LLNDK) #define __INTRODUCED_IN_LLNDK(level) __attribute__((annotate("introduced_in_llndk=" #level))) #endif #endif #endif // __ANDROID_VENDOR__ #include <stdbool.h> #include <stdbool.h> #include <stdint.h> #include <stdint.h> #include <sys/cdefs.h> #include <sys/cdefs.h> Loading