PersistableBundle.restoreFromXml should return a mutable bundle.

Issue:
  Currently, restoreFromXml/readFromStream returns an immutable
  PersistableBundle.EMPTY when the underlying XML file is
  ill-formatted. Otherwise it returns a mutable one.
  This inconsistent behavior easily causes crash when returned
  PersistableBundle is mutated.

Fix:
  Make restoreFromXml consistently return a mutable
  PersistableBundle.

Bug: 185436202
Test: make
Change-Id: I3c9ab4df9f0fea2d46d1c9b72ffd4b65790180b2
This commit is contained in:
Meng Wang
2021-04-19 21:16:23 +00:00
parent 958f9efba5
commit 9c5f71f364

View File

@@ -302,7 +302,7 @@ public final class PersistableBundle extends BaseBundle implements Cloneable, Pa
new MyReadMapCallback()));
}
}
return EMPTY;
return new PersistableBundle(); // An empty mutable PersistableBundle
}
@Override