Merge "Add a demo page in OTA_analyzer." am: ceadd4cff1
Original change: https://android-review.googlesource.com/c/platform/development/+/1778765 Change-Id: I4fc5c21fe6976afcd943bce4ff408f69b4441d3e
This commit is contained in:
1
tools/ota_analysis/.gitignore
vendored
1
tools/ota_analysis/.gitignore
vendored
@@ -3,6 +3,7 @@ node_modules
|
|||||||
/dist
|
/dist
|
||||||
/target
|
/target
|
||||||
/output
|
/output
|
||||||
|
/public
|
||||||
stderr*
|
stderr*
|
||||||
stdout*
|
stdout*
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
links: ['Analysis', 'About'],
|
links: ['Analysis', 'Demo', 'About'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
md="6"
|
md="6"
|
||||||
>
|
>
|
||||||
<BaseFile
|
<BaseFile
|
||||||
|
v-if="!demo"
|
||||||
label="Drag and drop or Select The target Android build"
|
label="Drag and drop or Select The target Android build"
|
||||||
@file-select="selectBuild"
|
@file-select="selectBuild"
|
||||||
/>
|
/>
|
||||||
@@ -74,6 +75,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import PartialCheckbox from '@/components/PartialCheckbox.vue'
|
import PartialCheckbox from '@/components/PartialCheckbox.vue'
|
||||||
import PieChart from '@/components/PieChart.vue'
|
import PieChart from '@/components/PieChart.vue'
|
||||||
import BaseFile from '@/components/BaseFile.vue'
|
import BaseFile from '@/components/BaseFile.vue'
|
||||||
@@ -91,6 +93,10 @@ export default {
|
|||||||
type: update_metadata_pb.DeltaArchiveManifest,
|
type: update_metadata_pb.DeltaArchiveManifest,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
|
demo: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -107,6 +113,19 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
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: {
|
methods: {
|
||||||
async updateChart(metrics) {
|
async updateChart(metrics) {
|
||||||
let partitionSelected = this.manifest.partitions.filter((partition) =>
|
let partitionSelected = this.manifest.partitions.filter((partition) =>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { createRouter, createWebHistory } from 'vue-router'
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
import PackageAnalysis from '@/views/PackageAnalysis.vue'
|
import PackageAnalysis from '@/views/PackageAnalysis.vue'
|
||||||
|
import Demo from'@/views/Demo.vue'
|
||||||
import About from '@/views/About.vue'
|
import About from '@/views/About.vue'
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
@@ -11,6 +12,11 @@ const routes = [
|
|||||||
title: 'Analyse OTA package - from AOSP'
|
title: 'Analyse OTA package - from AOSP'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/Demo',
|
||||||
|
name: 'Demo',
|
||||||
|
component: Demo
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/About',
|
path: '/About',
|
||||||
name: 'About',
|
name: 'About',
|
||||||
|
|||||||
74
tools/ota_analysis/src/views/Demo.vue
Normal file
74
tools/ota_analysis/src/views/Demo.vue
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<template>
|
||||||
|
<v-row>
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="6"
|
||||||
|
>
|
||||||
|
<PayloadDetail
|
||||||
|
v-if="zipFile && payload"
|
||||||
|
:zipFile="zipFile"
|
||||||
|
:payload="payload"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
<v-divider
|
||||||
|
vertical
|
||||||
|
/>
|
||||||
|
<v-col
|
||||||
|
cols="12"
|
||||||
|
md="6"
|
||||||
|
>
|
||||||
|
<PayloadComposition
|
||||||
|
v-if="zipFile && payload.manifest"
|
||||||
|
:manifest="payload.manifest"
|
||||||
|
:demo="true"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
|
import PayloadDetail from '@/components/PayloadDetail.vue'
|
||||||
|
import PayloadComposition from '@/components/PayloadComposition.vue'
|
||||||
|
import { Payload } from '@/services/payload.js'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
PayloadDetail,
|
||||||
|
PayloadComposition,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
zipFile: null,
|
||||||
|
payload: null,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
// put cf_x86_demo.zip and cf_x86_target_file_demo into
|
||||||
|
// this directory: /public/files
|
||||||
|
try {
|
||||||
|
const download = await axios.get(
|
||||||
|
'./files/cf_x86_demo.zip',
|
||||||
|
{responseType: 'blob'}
|
||||||
|
)
|
||||||
|
this.zipFile = new File([download.data], 'ota_demo.zip')
|
||||||
|
this.payload = new Payload(this.zipFile)
|
||||||
|
await this.payload.init()
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Please put a proper example OTA in /public/files/')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async unpackOTA(files) {
|
||||||
|
this.zipFile = files[0]
|
||||||
|
try {
|
||||||
|
this.payload = new Payload(this.zipFile)
|
||||||
|
await this.payload.init()
|
||||||
|
} catch (err) {
|
||||||
|
alert('Please check if this is a correct OTA package (.zip).')
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user