From f595a467354c738540812784b8970bf1e27e0c41 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Mon, 10 Sep 2018 17:36:11 -0700 Subject: Enable fingerprint in care_map Enable the encoding and parsing of the property_id & partition fingerprint by default; and add a flag "--no_fingerprint" to disable the fingerprint generation/parsing to convert the legacy care_map.txt Bug: 114778109 Test: run unittests in add_img_to_target_files Change-Id: Id4216d5954e78c3a2d8e8bf19342109daf66a528 --- update_verifier/care_map_generator.py | 39 ++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/update_verifier/care_map_generator.py b/update_verifier/care_map_generator.py index 5057ffea7..051d98deb 100644 --- a/update_verifier/care_map_generator.py +++ b/update_verifier/care_map_generator.py @@ -27,32 +27,44 @@ import sys import care_map_pb2 -def GenerateCareMapProtoFromLegacyFormat(lines): +def GenerateCareMapProtoFromLegacyFormat(lines, fingerprint_enabled): """Constructs a care map proto message from the lines of the input file.""" # Expected format of the legacy care_map.txt: # system # system's care_map ranges + # [system's fingerprint property id] + # [system's fingerprint] # [vendor] # [vendor's care_map ranges] + # [vendor's fingerprint property id] + # [vendor's fingerprint] # ... - assert len(lines) % 2 == 0, "line count must be even: {}".format(len(lines)) + + step = 4 if fingerprint_enabled else 2 + assert len(lines) % step == 0, \ + "line count must be multiple of {}: {}".format(step, len(lines)) care_map_proto = care_map_pb2.CareMap() - for index in range(0, len(lines), 2): + for index in range(0, len(lines), step): info = care_map_proto.partitions.add() info.name = lines[index] info.ranges = lines[index + 1] - - logging.info("Adding '%s': '%s' to care map", info.name, info.ranges) + if fingerprint_enabled: + info.id = lines[index + 2] + info.fingerprint = lines[index + 3] + logging.info("Care map info: name %s, ranges %s, id %s, fingerprint %s", + info.name, info.ranges, info.id, info.fingerprint) return care_map_proto -def ParseProtoMessage(message): +def ParseProtoMessage(message, fingerprint_enabled): """Parses the care_map proto message and returns its text representation. Args: - message: care_map in protobuf message + message: Care_map in protobuf format. + fingerprint_enabled: Input protobuf message contains the fields 'id' and + 'fingerprint'. Returns: A string of the care_map information, similar to the care_map legacy @@ -66,8 +78,11 @@ def ParseProtoMessage(message): assert info.name, "partition name is required in care_map" assert info.ranges, "source range is required in care_map" info_list += [info.name, info.ranges] + if fingerprint_enabled: + assert info.id, "property id is required in care_map" + assert info.fingerprint, "fingerprint is required in care_map" + info_list += [info.id, info.fingerprint] - # TODO(xunchang) add a flag to output id & fingerprint also. return '\n'.join(info_list) @@ -81,6 +96,10 @@ def main(argv): " specified).") parser.add_argument("output_file", help="Path to output file to write the result.") + parser.add_argument("--no_fingerprint", action="store_false", + dest="fingerprint_enabled", + help="The 'id' and 'fingerprint' fields are disabled in" + " the caremap.") parser.add_argument("--parse_proto", "-p", action="store_true", help="Parses the input as proto message, and outputs" " the care_map in plain text.") @@ -96,10 +115,10 @@ def main(argv): content = input_care_map.read() if args.parse_proto: - result = ParseProtoMessage(content) + result = ParseProtoMessage(content, args.fingerprint_enabled) else: care_map_proto = GenerateCareMapProtoFromLegacyFormat( - content.rstrip().splitlines()) + content.rstrip().splitlines(), args.fingerprint_enabled) result = care_map_proto.SerializeToString() with open(args.output_file, 'w') as output: -- cgit v1.2.3 From 77d6173714928b43750d79b6c659c056e4f827b9 Mon Sep 17 00:00:00 2001 From: katao Date: Thu, 20 Sep 2018 20:34:05 +0800 Subject: Allow OTA package size larger than 2GiB(2147483647 bytes) on sideload. At present, multiple partitions such as vendor have been added, which reduces the coupling between mobile phone manufacturers and Android systems. However, it may increase the generated package size substantially (e.g. from ~200MB to ~800MB). Causes the package size to exceed the int limit (2147483647 bytes). Change the int length parameters to long. Bug: http://b/112003354 Test: adb sideload ota.zip (ota.zip bigger than 2147483647 bytes) Change-Id: Ifb656431f7b961ac0e91754107578dc8b89ff14e Signed-off-by: katao --- minadbd/minadbd_services.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/minadbd/minadbd_services.cpp b/minadbd/minadbd_services.cpp index ab1939e92..e9c51da0a 100644 --- a/minadbd/minadbd_services.cpp +++ b/minadbd/minadbd_services.cpp @@ -33,19 +33,20 @@ #include "sysdeps.h" static void sideload_host_service(unique_fd sfd, const std::string& args) { - int file_size; - int block_size; - if (sscanf(args.c_str(), "%d:%d", &file_size, &block_size) != 2) { - printf("bad sideload-host arguments: %s\n", args.c_str()); - exit(1); - } + int64_t file_size; + int block_size; + if ((sscanf(args.c_str(), "%" SCNd64 ":%d", &file_size, &block_size) != 2) || file_size <= 0 || + block_size <= 0) { + printf("bad sideload-host arguments: %s\n", args.c_str()); + exit(1); + } - printf("sideload-host file size %d block size %d\n", file_size, block_size); + printf("sideload-host file size %" PRId64 " block size %d\n", file_size, block_size); - int result = run_adb_fuse(sfd, file_size, block_size); + int result = run_adb_fuse(sfd, file_size, block_size); - printf("sideload_host finished\n"); - exit(result == 0 ? 0 : 1); + printf("sideload_host finished\n"); + exit(result == 0 ? 0 : 1); } unique_fd daemon_service_to_fd(const char* name, atransport* /* transport */) { -- cgit v1.2.3 From a71c10b46427388932c662ffe59f6513fd5227c0 Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Wed, 19 Sep 2018 18:38:04 -0700 Subject: recovery_test_component: Add libbinderthreadstate as static dependency. Bug: 110364143 Bug: 114311116 Test: mm -j64 Change-Id: I3b9174443b00ad57be60881736afde7647351bd1 Signed-off-by: Jayant Chowdhary --- tests/Android.bp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Android.bp b/tests/Android.bp index ab4d31da2..9f3dce78c 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -45,7 +45,7 @@ cc_defaults { static_libs: [ "libutils", ], - } + }, }, } @@ -93,6 +93,7 @@ librecovery_static_libs = [ "libhidlbase", "libhidltransport", "libhwbinder", + "libbinderthreadstate", "libvndksupport", "libtinyxml2", ] -- cgit v1.2.3 From 26b86bb1dc895881cf507dfab0850c47c68c2779 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Fri, 28 Sep 2018 07:51:13 +0000 Subject: Revert "recovery_test_component: Add libbinderthreadstate as static dependency." This reverts commit a71c10b46427388932c662ffe59f6513fd5227c0. Reason for revert: This breaks framework tests and blocks presubmit Change-Id: Iae94878889c1e71e2da5336fe75af88dfd3bfcfa --- tests/Android.bp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Android.bp b/tests/Android.bp index 9f3dce78c..ab4d31da2 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -45,7 +45,7 @@ cc_defaults { static_libs: [ "libutils", ], - }, + } }, } @@ -93,7 +93,6 @@ librecovery_static_libs = [ "libhidlbase", "libhidltransport", "libhwbinder", - "libbinderthreadstate", "libvndksupport", "libtinyxml2", ] -- cgit v1.2.3