factor out reading of ro.product.ab_ota_partitions prop into a function

This commit is contained in:
Dmitry Muhomor 2023-06-05 16:06:38 +03:00 committed by Daniel Micay
parent 7963a6428f
commit 2b26cec4e3

View file

@ -168,8 +168,8 @@ export async function extractProps(config: DeviceConfig, customState: SystemStat
let missingProps: PartitionProps = new Map(Array.from(propChanges.entries()).map(([part, props]) => [part, props.removed])) let missingProps: PartitionProps = new Map(Array.from(propChanges.entries()).map(([part, props]) => [part, props.removed]))
// A/B OTA partitions // A/B OTA partitions
let stockOtaParts = stockProps.get('product')!.get('ro.product.ab_ota_partitions')!.split(',') let stockOtaParts = getAbOtaPartitionsProps(stockProps)!!
let customOtaParts = new Set(customProps.get('product')?.get('ro.product.ab_ota_partitions')?.split(',') ?? []) let customOtaParts = new Set(getAbOtaPartitionsProps(customProps) ?? [])
let missingOtaParts = stockOtaParts.filter(p => !customOtaParts.has(p) && filterValue(config.filters.partitions, p)) let missingOtaParts = stockOtaParts.filter(p => !customOtaParts.has(p) && filterValue(config.filters.partitions, p))
return { return {
@ -181,6 +181,10 @@ export async function extractProps(config: DeviceConfig, customState: SystemStat
} as PropResults } as PropResults
} }
function getAbOtaPartitionsProps(props: PartitionProps): string[] | undefined {
return props.get('product')?.get('ro.product.ab_ota_partitions')?.split(',')
}
export async function resolveSepolicyDirs( export async function resolveSepolicyDirs(
config: DeviceConfig, config: DeviceConfig,
customState: SystemState, customState: SystemState,