Fix a potential NPE when allocating space for compressed apex

Bug: 189369298
Test: th

Merged-In: I9357be8021e77fc8c3839f15a4a53c2a3c63cb13
Change-Id: I9357be8021e77fc8c3839f15a4a53c2a3c63cb13
This commit is contained in:
Kelvin Zhang
2021-07-12 12:30:41 -04:00
parent 1a208a730d
commit 796514a1b8

View File

@@ -970,6 +970,12 @@ public class RecoverySystemService extends IRecoverySystem.Stub implements Reboo
final long token = Binder.clearCallingIdentity();
try {
CompressedApexInfoList apexInfoList = getCompressedApexInfoList(packageFile);
if (apexInfoList == null) {
Log.i(TAG, "apex_info.pb not present in OTA package. "
+ "Assuming device doesn't support compressed"
+ "APEX, continueing without allocating space.");
return true;
}
ApexManager apexManager = ApexManager.getInstance();
apexManager.reserveSpaceForCompressedApex(apexInfoList);
return true;