Commit Graph

24 Commits

Author SHA1 Message Date
lishutong
fce8266b7e Add test to the MapParser class in OTA_analyzer.
Add unit test to the MapParser class in map_parser.js. Please refer to
this CL for the original class definition:

https://android-review.googlesource.com/c/platform/development/+/1760909

Test: npm run test:unit
Change-Id: I2d640e9c5e27c0a012e32b4be09348034b67b235
2021-08-18 16:06:32 +00:00
Kelvin Zhang
c05d0bd37c Fix a bug where small manifest isn't read
If a single read request contains the entire manifest, we will return
right after prefixLength is computed, and the UI just hangs there.

Test: load a small OTA pkg
Change-Id: Idb93fdba103f9c6e7b14974b45d1aecdb2ae9168
2021-08-12 10:32:07 -07:00
lishutong
400253b224 Add jest to dependency.
Jest is a JavaScript test framework. Test-utils is used to test vue
components.

No-Typo-Check: auto-generated artifacts

Test: npm run test.
Change-Id: I2466687120b96a3a393299d127c6d7e1f15204e7
2021-08-11 20:24:55 +00:00
lishutong
b9b565edb6 Add hint when user is using non-A/B OTA.
Disable the 'Analyse COW operation' button and add a tooltip 'This is
only supported in A/B OTA'.

Test: tested by non-A/B OTA package.
Change-Id: Ib6be1671f9106ee7e332cd2d0937c666a912a26e
2021-08-09 16:26:16 +00:00
lishutong
a00eafc419 Add support for move, bsdiff, imgdiff to OTA analyzer.
Now the OTA analyzer could properly parse the installation operations
like move, bsdiff, imgdiff in non-A/B packages. It still cannot properly
parse the stash and free operations. Which means any operation involve
stash-id cannot be parsed properly.

Test: tested by a non-A/B incremental OTA package.
Change-Id: I08c5ab162e8ed62ea3313ec53b4fa4577a28799a
2021-08-09 16:16:15 +00:00
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
Kelvin Zhang
e5eb5c9d38 Speed up the payload.bin read in process.
A 700MiB OTA package now takes only 100ms to read in, compared with
7000ms previously. That's 70x faster.

When parsing the update_metadata in payload.bin, the entire file has to
be read in previously, because zip.js does not support partial read-in.
In fact, only a small portion of the payload.bin is update_metadata.
Reading the entire payload.bin not only slows down the process but also
occupy excessive memory.

The new class OTAPayloadBlobWriter (inherited from zip.Writer) will read
in the metadata (header, manifest, signature) and throw an StopIteration
exception when finished.

Test: open a large OTA package
Change-Id: Iebf8045325dae9a118d9d8ea5674872aa7c280c4
2021-07-28 23:38:51 +00:00
lishutong
ff2b99cd89 Fix a compatibility issue: getBigUint64.
The method getBigUint64 is not supported by safari until version 15:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView/getBigUint64
This CL mannual reload this method.

Test: Mannual tested.
Change-Id: I1d967eda93f9f628fb7f0f5d9f90efb92429ed5e
2021-07-28 20:31:37 +00:00
lishutong
30f991bf6e Fix a bug: redirect to homepage for some url.
In a single page application, the url sometimes does not correspond to
the actual resources on the server. Thus, it might cause 404 when users
refresh the page. By redirecting this kind of url back to the homepage,
the proper page can be rendered. If the url does not exist, the front
end will redirect to a Not Found page.

Test: mannual tested.
Change-Id: I36beff436a450ae7fcabe9172df9c7cc217d7305
2021-07-28 18:14:35 +00:00
lishutong
ad6b75df3d Add prebuild and postbuild info to OTA_analysis.
The metadata file in ota package contains prebuild and postbuild info,
now the basic info section will display those.

Test: mannual tested.
Change-Id: I264fe656ff6fab42d5161100c04210ab9a94c7a0
2021-07-28 17:51:29 +00:00
lishutong
2232234d48 Remove the look behind regex for Safari.
The lookbehind/lookahead regular expression is not supported in safari
yet. (https://caniuse.com/js-regexp-lookbehind) Removed it for
compatibility reason.

Test: manual tested.
Change-Id: I5801bcc389b20df31175adbb8a841eb1d31703aa
2021-07-27 03:40:33 +00:00
lishutong
a3c85492cc Change the url to lowercase.
Test: mannual tested.
Change-Id: Ib22905462aa47aeaa700407fe5b90e3261d0b3a3
2021-07-27 03:33:48 +00:00
lishutong
cdf499330d Add a demo page in OTA_analyzer.
Please put an ota package and its target build as cf_x86_demo.zip and
cf_x86_target_file_demo into this directory: /public/files/

This OTA package and target build do not have to be complete - only the
manifest part in OTA package and .map files in target build are
necessary. The previous one can be generated using:
https://source.corp.google.com/android/vendor/google_tradefederation/contrib/src/com/google/android/tradefed/ota/util/PayloadUtil.java;l=196;bpv=1;bpt=1?q=PayloadUtil&sq=package:android
The following one can be generated by unzip and keep the .map files
only, zip again.

Add a demo page, now the user can view the complete function of
OTA_analyzer without uploading their own ota packages / android build.

Test: Mannual tested.
Change-Id: I7552e0222fc40e9a4b1aff9750f74cd3ed3f4feb
2021-07-26 17:51:51 +00:00
lishutong
c0f6a27222 Show the old and new partition infos in OTA analysis.
Test: Mannual tested.
Change-Id: I1e45d3efaefc7368a72f1ed59d09fd48f01b4132
2021-07-20 16:33:49 +00:00
lishutong
85044ed571 Change the look of cross emoji.
Test: Mannual tested.
Change-Id: I4117f5d9986aece6da8c25757baed8f750cc438e
2021-07-20 15:46:13 +00:00
lishutong
f506b57791 Add VAB, VABC state checker to OTA_analyzer.
Add BasicInfo.vue to show some basic facts of the ota package,
including:
- is partial or not
- is incremental or not
- is VAB or not
- is VABC or not

Test: Mannual tested.
Change-Id: Ibc3e0a88ea03fc310b401ffe14c5b63d9e0f9452
2021-07-19 17:32:39 +00:00
lishutong
be609f5b31 Add responsive design to the UI.
Now the columns width can be adjusted according to the window size.

Test: Mannual tested.
Change-Id: I1e2911b757948ee95f487631bcdceb5ede1fa63e
2021-07-16 19:38:16 +00:00
lishutong
8ff98dca4a Add drag and drop file upload.
Test: Mannual tested.
Change-Id: Ia7442fc468dcaebb6244aaf693d70f251d7199c7
2021-07-13 15:23:55 +00:00
lishutong
bccd4df851 Refactor the frontend using material-desing UI.
Changed the layout and improved UX.

Test: Mannual tested.
Change-Id: I964357aec78af57bc42efc79dd4ab9be6df6b777
2021-07-13 15:23:54 +00:00
lishutong
8d5a72c784 Add dependency for material-design ui.
Add vuetify and material-design-icons.

No-Typo-Check: auto-generated artifacts

Test: Mannual tested.
Change-Id: Ib38002237961162907772a20f5721f745c931563
2021-07-12 17:46:35 +00:00
lishutong
ff71e8784c Avoid showing too many entries in the pie chart once.
When there are too many data entries, the pie chart is too crowded to
view. So we set a parameter in the class EchartsData called
maximumEntries, only the top <maximumEntries> will be shown and the rest
will be added to a single entry called 'other'.

Test: mannual tested.
Change-Id: I84bfadd3513c5827426d84ee7d5ad957b1ac5eab
2021-07-09 18:46:49 +00:00
lishutong
9a06a92a35 Add support to analyse the disk usage by file extensions.
An Android AB OTA-package provide installation operations by their
operation types, block adresses and payloads. One cannot know which file
is being operated by an installation operation unless checking the .map
file in the target build.

Now, the OTA_analysis tool can analyse which file is being operated and
do statistics over the the filename extensions when provided the target
build. This is done by building a hashtable according to the .map file
in the target build, and then query this hashtable by the operated
blocks, which is defined in the OTA package.

In the future, we can use segment tree instead of hashtable for better
query performance.

Test: Mannual tested, unit test will be added in a seperate CL.
Change-Id: I150677ff81c79813ff13bf96b6401dac01e4e17a
2021-07-09 18:25:23 +00:00
lishutong
9a5b57e68d Seperate the ota_analysis from OTAgui.
The default entry point is /analyseOTA in production enviroment. This is
for the deployment on android.github.io/.

Test: Mannual tested.
Change-Id: Ic77277024b34b67b9964be8cf4f1592cebf5c5e8
2021-07-08 16:05:13 +00:00
lishutong
c9cebf06b4 Add dependency for OTA analysis.
Package.json is for npm and update_metadata_pb.js is generated from
protobufjs.

No-Typo-Check: auto-generated artifacts

Test: Mannual tested.
Change-Id: Id4808a26fb9c5b18d3ae0680a97045bee5d650b0
2021-07-08 15:33:28 +00:00