libbinder: add getters for PersistableBundle keys
Add getters for the keys in each map stored in
PersistableBundle. This will allow users of
PersistableBundle to iterate over entries of
a specific type in PersistableBundle.
Also, add "using" statements to PersistableBundle
for std containers to reduce verbosity.
BUG: 27171235
Change-Id: Idd4b3bf713071ca8d8d023f1f83bdaf3ccbdd46f
TEST: libbinder compiles successfully.
diff --git a/include/binder/PersistableBundle.h b/include/binder/PersistableBundle.h
index fe5619f..322fef9 100644
--- a/include/binder/PersistableBundle.h
+++ b/include/binder/PersistableBundle.h
@@ -18,6 +18,7 @@
#define ANDROID_PERSISTABLE_BUNDLE_H
#include <map>
+#include <set>
#include <vector>
#include <binder/Parcelable.h>
@@ -79,6 +80,19 @@
bool getStringVector(const String16& key, std::vector<String16>* out) const;
bool getPersistableBundle(const String16& key, PersistableBundle* out) const;
+ /* Getters for all keys for each value type */
+ std::set<String16> getBooleanKeys() const;
+ std::set<String16> getIntKeys() const;
+ std::set<String16> getLongKeys() const;
+ std::set<String16> getDoubleKeys() const;
+ std::set<String16> getStringKeys() const;
+ std::set<String16> getBooleanVectorKeys() const;
+ std::set<String16> getIntVectorKeys() const;
+ std::set<String16> getLongVectorKeys() const;
+ std::set<String16> getDoubleVectorKeys() const;
+ std::set<String16> getStringVectorKeys() const;
+ std::set<String16> getPersistableBundleKeys() const;
+
friend bool operator==(const PersistableBundle& lhs, const PersistableBundle& rhs) {
return (lhs.mBoolMap == rhs.mBoolMap && lhs.mIntMap == rhs.mIntMap &&
lhs.mLongMap == rhs.mLongMap && lhs.mDoubleMap == rhs.mDoubleMap &&