Revert "Null safe package name in AppOps writeState"
This reverts commit 0b925d4f. Reverted commit introduced a bug: it skipped the "pkg" tag for ops with null package name. This meant that ops with null package name were serialized differently than ops with non-null package name. Tag hierarchy became the following: for non-null package name ops: "pkg" -> "uid" -> "op" -> "st" for null package name ops: "uid" -> "op" -> "st" Uid ops have the same first two tags as null package name ops started to have: "uid" -> "op". (refer to the loop over uidStatesClone elements above). This led to type confusion during deserialization that happens in readState(): null package name ops were deserialized as uid ops, through readUidOps() instead of through readPackage(). Uid ops are serialized differently than uid element inside package ops, specifically the latter skips the op mode ("m") attribute when the op mode is at its default value. Op mode attribute is read unconditionally in readUidOps(), which led to XmlPullParserException: Missing attribute "m" exception. This exception is caught in readState(), and is handled by discarding all deserialized state, which meant that all appops got reset to their default values. Subsequent commit adds skipping of ops with null package name during serialization: they are invalid, package name is defined and treated as @NonNull in multiple places. Such ops are being constructed due to another bug. Change-Id: I8b13b8f0979a6daff2db33a1b8e8544dd9e8e531
Loading
Please register or sign in to comment