@@ -271,31 +271,31 @@ class PersistableBundle {
271271 }
272272 }
273273
274- bool getBoolean (const std::string& key, bool * _Nonnull val) {
274+ bool getBoolean (const std::string& key, bool * _Nonnull val) const {
275275 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
276276 return APersistableBundle_getBoolean (mPBundle , key.c_str (), val);
277277 } else {
278278 return false ;
279279 }
280280 }
281281
282- bool getInt (const std::string& key, int32_t * _Nonnull val) {
282+ bool getInt (const std::string& key, int32_t * _Nonnull val) const {
283283 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
284284 return APersistableBundle_getInt (mPBundle , key.c_str (), val);
285285 } else {
286286 return false ;
287287 }
288288 }
289289
290- bool getLong (const std::string& key, int64_t * _Nonnull val) {
290+ bool getLong (const std::string& key, int64_t * _Nonnull val) const {
291291 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
292292 return APersistableBundle_getLong (mPBundle , key.c_str (), val);
293293 } else {
294294 return false ;
295295 }
296296 }
297297
298- bool getDouble (const std::string& key, double * _Nonnull val) {
298+ bool getDouble (const std::string& key, double * _Nonnull val) const {
299299 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
300300 return APersistableBundle_getDouble (mPBundle , key.c_str (), val);
301301 } else {
@@ -307,7 +307,7 @@ class PersistableBundle {
307307 return (char *)malloc (bufferSizeBytes);
308308 }
309309
310- bool getString (const std::string& key, std::string* _Nonnull val) {
310+ bool getString (const std::string& key, std::string* _Nonnull val) const {
311311 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
312312 char * outString = nullptr ;
313313 bool ret = APersistableBundle_getString (mPBundle , key.c_str (), &outString,
@@ -325,7 +325,7 @@ class PersistableBundle {
325325 bool getVecInternal (int32_t (*_Nonnull getVec)(const APersistableBundle* _Nonnull,
326326 const char * _Nonnull, T* _Nullable, int32_t ),
327327 const APersistableBundle* _Nonnull pBundle, const char* _Nonnull key,
328- std::vector<T>* _Nonnull vec) {
328+ std::vector<T>* _Nonnull vec) const {
329329 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
330330 int32_t bytes = 0 ;
331331 // call first with nullptr to get required size in bytes
@@ -347,28 +347,28 @@ class PersistableBundle {
347347 return false ;
348348 }
349349
350- bool getBooleanVector (const std::string& key, std::vector<bool >* _Nonnull vec) {
350+ bool getBooleanVector (const std::string& key, std::vector<bool >* _Nonnull vec) const {
351351 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
352352 return getVecInternal<bool >(&APersistableBundle_getBooleanVector, mPBundle , key.c_str (),
353353 vec);
354354 }
355355 return false ;
356356 }
357- bool getIntVector (const std::string& key, std::vector<int32_t >* _Nonnull vec) {
357+ bool getIntVector (const std::string& key, std::vector<int32_t >* _Nonnull vec) const {
358358 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
359359 return getVecInternal<int32_t >(&APersistableBundle_getIntVector, mPBundle , key.c_str (),
360360 vec);
361361 }
362362 return false ;
363363 }
364- bool getLongVector (const std::string& key, std::vector<int64_t >* _Nonnull vec) {
364+ bool getLongVector (const std::string& key, std::vector<int64_t >* _Nonnull vec) const {
365365 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
366366 return getVecInternal<int64_t >(&APersistableBundle_getLongVector, mPBundle , key.c_str (),
367367 vec);
368368 }
369369 return false ;
370370 }
371- bool getDoubleVector (const std::string& key, std::vector<double >* _Nonnull vec) {
371+ bool getDoubleVector (const std::string& key, std::vector<double >* _Nonnull vec) const {
372372 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
373373 return getVecInternal<double >(&APersistableBundle_getDoubleVector, mPBundle ,
374374 key.c_str (), vec);
@@ -379,7 +379,7 @@ class PersistableBundle {
379379 // Takes ownership of and frees the char** and its elements.
380380 // Creates a new set or vector based on the array of char*.
381381 template <typename T>
382- T moveStringsInternal (char * _Nullable* _Nonnull strings, int32_t bufferSizeBytes) {
382+ T moveStringsInternal (char * _Nullable* _Nonnull strings, int32_t bufferSizeBytes) const {
383383 if (strings && bufferSizeBytes > 0 ) {
384384 int32_t num = bufferSizeBytes / sizeof (char *);
385385 T ret;
@@ -393,7 +393,7 @@ class PersistableBundle {
393393 return T ();
394394 }
395395
396- bool getStringVector (const std::string& key, std::vector<std::string>* _Nonnull vec) {
396+ bool getStringVector (const std::string& key, std::vector<std::string>* _Nonnull vec) const {
397397 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
398398 int32_t bytes = APersistableBundle_getStringVector (mPBundle , key.c_str (), nullptr , 0 ,
399399 &stringAllocator, nullptr );
@@ -410,7 +410,7 @@ class PersistableBundle {
410410 return false ;
411411 }
412412
413- bool getPersistableBundle (const std::string& key, PersistableBundle* _Nonnull val) {
413+ bool getPersistableBundle (const std::string& key, PersistableBundle* _Nonnull val) const {
414414 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
415415 APersistableBundle* bundle = nullptr ;
416416 bool ret = APersistableBundle_getPersistableBundle (mPBundle , key.c_str (), &bundle);
@@ -429,7 +429,7 @@ class PersistableBundle {
429429 int32_t bufferSizeBytes,
430430 APersistableBundle_stringAllocator stringAllocator,
431431 void * _Nullable),
432- const APersistableBundle* _Nonnull pBundle) {
432+ const APersistableBundle* _Nonnull pBundle) const {
433433 // call first with nullptr to get required size in bytes
434434 int32_t bytes = getTypedKeys (pBundle, nullptr , 0 , &stringAllocator, nullptr );
435435 if (bytes > 0 ) {
@@ -442,84 +442,84 @@ class PersistableBundle {
442442 return {};
443443 }
444444
445- std::set<std::string> getBooleanKeys () {
445+ std::set<std::string> getBooleanKeys () const {
446446 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
447447 return getKeys (&APersistableBundle_getBooleanKeys, mPBundle );
448448 } else {
449449 return {};
450450 }
451451 }
452- std::set<std::string> getIntKeys () {
452+ std::set<std::string> getIntKeys () const {
453453 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
454454 return getKeys (&APersistableBundle_getIntKeys, mPBundle );
455455 } else {
456456 return {};
457457 }
458458 }
459- std::set<std::string> getLongKeys () {
459+ std::set<std::string> getLongKeys () const {
460460 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
461461 return getKeys (&APersistableBundle_getLongKeys, mPBundle );
462462 } else {
463463 return {};
464464 }
465465 }
466- std::set<std::string> getDoubleKeys () {
466+ std::set<std::string> getDoubleKeys () const {
467467 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
468468 return getKeys (&APersistableBundle_getDoubleKeys, mPBundle );
469469 } else {
470470 return {};
471471 }
472472 }
473- std::set<std::string> getStringKeys () {
473+ std::set<std::string> getStringKeys () const {
474474 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
475475 return getKeys (&APersistableBundle_getStringKeys, mPBundle );
476476 } else {
477477 return {};
478478 }
479479 }
480- std::set<std::string> getBooleanVectorKeys () {
480+ std::set<std::string> getBooleanVectorKeys () const {
481481 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
482482 return getKeys (&APersistableBundle_getBooleanVectorKeys, mPBundle );
483483 } else {
484484 return {};
485485 }
486486 }
487- std::set<std::string> getIntVectorKeys () {
487+ std::set<std::string> getIntVectorKeys () const {
488488 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
489489 return getKeys (&APersistableBundle_getIntVectorKeys, mPBundle );
490490 } else {
491491 return {};
492492 }
493493 }
494- std::set<std::string> getLongVectorKeys () {
494+ std::set<std::string> getLongVectorKeys () const {
495495 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
496496 return getKeys (&APersistableBundle_getLongVectorKeys, mPBundle );
497497 } else {
498498 return {};
499499 }
500500 }
501- std::set<std::string> getDoubleVectorKeys () {
501+ std::set<std::string> getDoubleVectorKeys () const {
502502 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
503503 return getKeys (&APersistableBundle_getDoubleVectorKeys, mPBundle );
504504 } else {
505505 return {};
506506 }
507507 }
508- std::set<std::string> getStringVectorKeys () {
508+ std::set<std::string> getStringVectorKeys () const {
509509 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
510510 return getKeys (&APersistableBundle_getStringVectorKeys, mPBundle );
511511 } else {
512512 return {};
513513 }
514514 }
515- std::set<std::string> getPersistableBundleKeys () {
515+ std::set<std::string> getPersistableBundleKeys () const {
516516 if API_LEVEL_AT_LEAST (__ANDROID_API_V__, 202404 ) {
517517 return getKeys (&APersistableBundle_getPersistableBundleKeys, mPBundle );
518518 } else {
519519 return {};
520520 }
521521 }
522- std::set<std::string> getMonKeys () {
522+ std::set<std::string> getMonKeys () const {
523523 // :P
524524 return {" c(o,o)b" , " c(o,o)b" };
525525 }
0 commit comments