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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user