Files
android_development/tools/ota_analysis/src/components/PayloadComposition.vue
lishutong 5bf9ad0eed Add support for non-A/B OTA package in OTA_analysis.
The non-A/B OTA package has a very different file system compared with
an OTA package. However, our OTA_analysis tool is based on the
update_metadata.proto. What we do here is try to convert the non-A/B OTA
package information, into a standard update_metadata.proto formated
manifest. The format and how the conversion works can be found in this
document:
https://docs.google.com/document/d/e/2PACX-1vRwMRodq4TCvTPEmlU6KL9vPSeFmEJjVXzq4PHhrB8tGy6oHFDJGCk3bIDA5Uv-4UEP0stLarBlhl2c/pub

In this CL, most of the information is successfully parsed, except
installation ops like stash, free, bsdiff, imgdiff, move. (anything
related to stash is not yet implemented)

Test: test by selecting a non-A/B OTA package.
Change-Id: I298f238395478422daece47cedbaa52a976d9f4c
2021-08-09 16:16:14 +00:00

158 lines
3.3 KiB
Vue

<template>
<PartialCheckbox
v-model="partitionInclude"
:labels="updatePartitions"
/>
<div v-if="echartsData">
<PieChart :echartsData="echartsData" />
</div>
<v-divider />
<v-row>
<v-col
cols="12"
md="6"
>
<v-btn
block
@click="updateChart('blocks')"
>
Analyse Installed Blocks (in target build)
</v-btn>
</v-col>
<v-col
cols="12"
md="6"
>
<v-btn
block
@click="updateChart('payload')"
>
Analyse Payload Composition
</v-btn>
</v-col>
</v-row>
<v-row>
<v-col
cols="12"
md="6"
>
<v-btn
:disabled="manifest.nonAB"
block
@click="updateChart('COWmerge')"
>
Analyse COW Merge Operations
</v-btn>
</v-col>
<v-col
cols="12"
md="6"
>
<v-btn
block
:disabled="!targetFile"
@click="updateChart('extensions')"
>
Analyse File Extensions
</v-btn>
</v-col>
</v-row>
<v-row>
<v-col
cols="12"
md="6"
/>
<v-col
cols="12"
md="6"
>
<BaseFile
v-if="!demo"
label="Drag and drop or Select The target Android build"
@file-select="selectBuild"
/>
</v-col>
</v-row>
</template>
<script>
import axios from 'axios'
import PartialCheckbox from '@/components/PartialCheckbox.vue'
import PieChart from '@/components/PieChart.vue'
import BaseFile from '@/components/BaseFile.vue'
import { analysePartitions } from '../services/payload_composition.js'
import { chromeos_update_engine as update_metadata_pb } from '../services/update_metadata_pb.js'
export default {
components: {
PartialCheckbox,
PieChart,
BaseFile,
},
props: {
manifest: {
type: update_metadata_pb.DeltaArchiveManifest,
default: () => [],
},
demo: {
type: Boolean,
default: false
}
},
data() {
return {
partitionInclude: new Map(),
echartsData: null,
listData: '',
targetFile: null,
}
},
computed: {
updatePartitions() {
return this.manifest.partitions.map((partition) => {
return partition.partitionName
})
},
},
async mounted() {
if (this.demo) {
try {
const download = await axios.get(
'./files/cf_x86_target_file_demo.zip',
{responseType: 'blob'}
)
this.targetFile = new File([download.data], 'target_demo.zip')
} catch (err) {
console.log('Please put a proper example target file in /public/files/')
}
}
},
methods: {
async updateChart(metrics) {
let partitionSelected = this.manifest.partitions.filter((partition) =>
this.partitionInclude.get(partition.partitionName)
)
try {
this.echartsData = await analysePartitions(
metrics,
partitionSelected,
this.manifest.blockSize,
this.targetFile
)
} catch (err) {
alert('Cannot be processed for the following issue: ', err)
}
},
selectBuild(files) {
//TODO(lishutong) check the version of target file is same to the OTA target
this.targetFile = files[0]
},
},
}
</script>
<style scoped>
.list-data {
text-align: center;
}
</style>