From fc0431fda1ece685a3c87fcd54df76febd3c24f9 Mon Sep 17 00:00:00 2001 From: lishutong Date: Tue, 20 Jul 2021 04:44:02 +0000 Subject: [PATCH] Add all possible flags to the front end. A complete set of flags for the CLI tool can be found in this script: https://source.corp.google.com/android/build/make/tools/releasetools/ota_from_target_files.py Now most of the flags are being added to the front end. However, there are several TODOs: 1. flags that require extra arguements or file operations are not supported yet. 2. the flags can depend or exclude on other flags. Dependency is included in file 'JobSubmissions.js'-'OTAExtraFlags'. But the function is not implemented yet. Test: Mannual tested. Change-Id: I3b6b76d48861cff81bfad86b549ff53f6536933b --- tools/otagui/ota_interface.py | 4 + tools/otagui/src/components/OTAOptions.vue | 89 +++++----- tools/otagui/src/services/JobSubmission.js | 179 ++++++++++++++++++++- 3 files changed, 230 insertions(+), 42 deletions(-) diff --git a/tools/otagui/ota_interface.py b/tools/otagui/ota_interface.py index fc1fd28e8..159ab7dc2 100644 --- a/tools/otagui/ota_interface.py +++ b/tools/otagui/ota_interface.py @@ -176,6 +176,10 @@ class ProcessesManagement: args['output'] = os.path.join('output', str(id) + '.zip') if args['verbose']: command.append('-v') + if args['extra_keys']: + args['extra'] += '--' + ' --'.join(args['extra_keys']) + if args['extra']: + command.append(args['extra']) command.append('-k') command.append( '../../../build/make/target/product/security/testkey') diff --git a/tools/otagui/src/components/OTAOptions.vue b/tools/otagui/src/components/OTAOptions.vue index f19db5c50..b194b59b3 100644 --- a/tools/otagui/src/components/OTAOptions.vue +++ b/tools/otagui/src/components/OTAOptions.vue @@ -13,43 +13,45 @@ /> - - - - - - -
+
+ +

Select Partitions

+
+ + More Options + + + + + + [] + default: () => [], }, incrementalSource: { type: String, - default: '' + default: '', }, targetBuild: { type: String, - default: '' - } + default: '', + }, }, - data () { + data() { return { - input: new OTAConfiguration() + input: new OTAConfiguration(), + moreOptions: false, + basicFlags: OTABasicFlags, + extraFlags: OTAExtraFlags } }, computed: { @@ -112,25 +117,25 @@ export default { }, checkIncremental() { return this.input.isIncremental - } + }, }, watch: { incrementalSource: { handler: function () { this.input.isIncremental = true this.input.incremental = this.incrementalSource - } + }, }, targetBuild: { handler: function () { this.input.target = this.targetBuild - } + }, }, checkIncremental: { handler: function () { this.$emit('update:isIncremental', this.checkIncremental) - } - } + }, + }, }, methods: { /** @@ -141,10 +146,12 @@ export default { let response_message = await this.input.sendForm() alert(response_message) } catch (err) { - alert('Job cannot be started properly for the following reasons: ' + err) + alert( + 'Job cannot be started properly for the following reasons: ' + err + ) } this.input = new OTAInput() - } - } + }, + }, } \ No newline at end of file diff --git a/tools/otagui/src/services/JobSubmission.js b/tools/otagui/src/services/JobSubmission.js index b70a9427c..a3986f6f6 100644 --- a/tools/otagui/src/services/JobSubmission.js +++ b/tools/otagui/src/services/JobSubmission.js @@ -12,12 +12,21 @@ export class OTAConfiguration { * Initialize the input for the api /run/ */ constructor() { + /** + * Please refer to: + * https://source.corp.google.com/android/build/make/tools/releasetools/ota_from_target_files.py + * for the complete and up-to-date configurations that can be set for + * the OTA package generation. + * TODO (lishutong): there are dependencies on this flags, + * disable checkboxes of which dependencies are not fulfilled. + */ this.verbose = false, this.target = '', this.incremental = '', this.isIncremental = false, this.partial = [], this.isPartial = false, + this.extra_keys = [], this.extra = '', this.id = uuid.v1() } @@ -26,6 +35,11 @@ export class OTAConfiguration { * Start the generation process, will throw an error if not succeed */ async sendForm() { + for (let flag of OTAExtraFlags.slice(3, OTAflags.length)) { + if (this[flag.key]) { + this.extra_keys.push(flag.key) + } + } try { let response = await ApiServices.postInput(JSON.stringify(this), this.id) return response.data @@ -33,4 +47,167 @@ export class OTAConfiguration { throw err } } -} \ No newline at end of file +} + +export const OTABasicFlags = [ + { + key: 'isIncremental', + label: 'Incremental OTA', + requireArg: 'incremental' + }, + { + key: 'isPartial', + label: 'Partial OTA', + requireArg: 'partial' + }, + { + key: 'verbose', + label: 'Verbose' + },] + +export const OTAExtraFlags = [ + { + key: 'downgrade', + label: 'Downgrade', + depend: ['isIncremental'] + }, + { + key: 'override_timestamp', + label: 'Override time stamp' + }, + { + key: 'wipe_user_data', + label: 'Wipe User data' + }, + //{ + // key: 'retrofit_dynamic_partitions', + // label: 'Support dynamic partition' + //}, + { + key: 'skip_compatibility_check', + label: 'Skip compatibility check' + }, + //{ + // key: 'output_metadata_path', + // label: 'Output metadata path' + //}, + { + key: 'force_non_ab', + label: 'Generate non-A/B package' + }, + /** TODO(lishutong): the following comments are flags + * that requires file operation, will add these functions later. + */ + //{key: 'oem_settings', label: 'Specify the OEM properties', + // requireArg: 'oem_settings_files'}, + //{key: 'binary', label: 'Use given binary', requireArg: 'binary_file', + // depend: ['force_non_ab']}, + { + key: 'block', + label: 'Block-based OTA', + depend: ['force_non_ab'] + }, + //{key: 'extra_script', label: 'Extra script', requireArg: 'script_file', + // depend: ['force_non_ab']}, + { + key: 'full_bootloader', + label: 'Full bootloader', + depend: ['force_non_ab', 'isIncremental'] + }, + { + key: 'full_radio', + label: 'Full radio', + depend: ['force_non_ab', 'isIncremental'] + }, + //{key: 'log_diff', label: 'Log difference', + // requireArg: 'log_diff_path',depend: ['force_non_ab', 'isIncremental']}, + //{key: 'oem_no_mount', label: 'Do not mount OEM partition', + // depend: ['force_non_ab', 'oem_settings']}, + //{ + // key: 'stash_threshold', + // label: 'Threshold for maximum stash size', + // requireArg: 'stash_threshold_float', + // depend: ['force_non_ab'] + //}, + //{ + // key: 'worker_threads', + // label: 'Number of worker threads', + // requireArg: 'worker_threads_int', + // depend: ['force_non_ab', 'isIncremental'] + //}, + //{ + // key: 'verify', + // label: 'Verify the checksum', + // depend: ['force_non_ab', 'isIncremental'] + //}, + { + key: 'two_step', + label: 'Generate two-step OTA', + depend: ['force_non_ab'] + }, + { + key: 'disable_fec_computation', + label: 'Disable the on device FEC computation', + depend: ['isIncremental'], + exclude: ['force_non_ab'] + }, + { + key: 'include_secondary', + label: 'Include secondary slot images', + exclude: ['force_non_ab', 'isIncremental'] + }, + //{key: 'payload_signer', label: 'Specify the signer', + // requireArg: ['payload_signer_singer'], exclude: ['force_non_ab']}, + //{key: 'payload_singer_args', label: 'Specify the args for signer', + // requireArg: ['payload_signer_args_args], exclude: ['force_non_ab']}, + //{ + // key: 'payload_signer_maximum_signature_size', + // label: 'The maximum signature size (in bytes)', + // requireArg: ['payload_signer_maximum_signature_size_int'], + // exclude: ['force_non_ab'] + //}, + //{key: 'boot_variable_file', label: 'Specify values of ro.boot.*', + // requireArg: ['boot_variable_file_file'], exclude: ['force_non_ab']}, + { + key: 'skip_postinstall', + label: 'Skip the postinstall', + exclude: ['force_non_ab'] + }, + //{key: 'custom_image', label: 'Use custom image', + // requireArg: ['custom_image_files'], exclude: ['force_non_ab]}, + { + key: 'disable_vabc', + label: 'Disable Virtual A/B compression', + exclude: ['force_non_ab'] + }, + { + key: 'vabc_downgrade', + label: "Don't disable VABC for downgrading", + depend: ['isIncremental', 'downgrade'], + exclude: ['force_non_ab'] + }, +] + +/** export const requireArgs = new Map([ + [ + "stash_threshold_float", + { + type: "BaseInput", + label: "Threshold for maximum stash size" + } + ], + [ + "worker_threads", + { + type: "BaseInput", + label: "Number of worker threads" + } + ], + [ + "payload_signer_maximum_signature_size", + { + type: "BaseInput", + label: "The maximum signature size (in bytes)" + } + ], +]) */ \ No newline at end of file