Fix NPE
Reported by zezeozue@; if no package defines an application <property> tag, getProperty() was throwing an NPE within the package manager service. NOTE: There's now a CTS test to ensure this works. However, it's not sufficient. As soon as there's a single system application that defines an application <property> tag, the test will no longer catch the condition. We need to re-write the CTS test as a Package Manager Service unit test and verity the behaviour outside of the running service. Bug: 169258655 Test: atest CtsContentTestCases:PackageManagerGetPropertyTest#testPackageRemoval Change-Id: I117272b9b831061b9e915e0eb310d809b3afca2f
This commit is contained in:
@@ -274,7 +274,7 @@ public class PackageProperty {
|
||||
|
||||
private Property getApplicationProperty(String propertyName, String packageName) {
|
||||
final ArrayMap<String, ArrayList<Property>> packagePropertyMap =
|
||||
mApplicationProperties.get(propertyName);
|
||||
mApplicationProperties != null ? mApplicationProperties.get(propertyName) : null;
|
||||
if (packagePropertyMap == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user