private static License deserializeLicense(Build.License licensePb) throws PackageDeserializationException { List<String> licenseStrings = new ArrayList<>(); licenseStrings.addAll(licensePb.getLicenseTypeList()); for (String exception : licensePb.getExceptionList()) { licenseStrings.add("exception=" + exception); } try { return License.parseLicense(licenseStrings); } catch (LicenseParsingException e) { throw new PackageDeserializationException(e); } }