Commit graph

10 commits

Author SHA1 Message Date
Kalesh Singh
55405b61be zipalign: Allow specifiying the target page size
Allow apps to specify the target page size for aligning their
uncompressed shared libraries.

This allows apps that want to support larger page sizes to do
so by specifiying the -P <pagesize_kb> flag.

However, apps built for 4k-only devices are unaffected as they
can continue to use -p flag for 4kB page alignment of uncompressed
shared libraries.

Bug: 276963821
Test: atest -c zipalign_tests
Change-Id: I890db067b8f898045f73e86788662f94a48af772
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-08-24 14:46:13 -07:00
Kalesh Singh
7e0aa04637 zipalign: Fix pageAlignSharedLibs arg in tests
zipalign_test is passing (int)4096 instead of required bool
for the pageAlignSharedLibs parameter. Update the test to use
the correct type.

Bug: 276963821
Test: atest -c zipalign_tests
Change-Id: I4150dbd411e5a40427281645aa03262f7b0c9e3a
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-08-22 11:26:23 -07:00
Fabien Sanglard
8163cfa5f4 Zipalign: Don't align directory entries
Directories are entries with uncompressed size zero and ending with
character '/' or '\' are allowed in apks since b/204425803. These
entries should not be considered for alignment since they are not
mmap by the framework.

Test: align_test.cpp
Bug: 250872480
Change-Id: I964aad118a82839f9ed230acc4c2c76f51888c67
2022-10-12 13:57:16 -07:00
weisu
eae45315cd Write files in a temporary directory
Avoid writing test files in the build output directory which fails when
run with Bazel. This happens because Bazel's sandboxing environment
ensures that the test's working directory is unwritable.

See https://docs.bazel.build/versions/main/sandboxing.html for more
information.

Bug: 209687942
Test: atest --bazel-mode zipalign_tests
Test: atest zipalign_tests

Change-Id: Ie22f464830c1ffe4d38a94a16dbd39dafa7fe317
2021-12-22 00:06:14 +00:00
Fabien Sanglard
df73d1b473 Zipalign: Avoid unnecessary padding
Problem: Aligned entry always get padded to the next aligned slot.
Solution: Fix alignment test.

Bug: 199932309
Test: align_test.cpp
Change-Id: I1e61c67dcf45454dd782d0fcc6903f7e71954083
2021-09-14 15:20:42 -07:00
Fabien Sanglard
3d38ff9f38 Merge "Improve Zipalign test" 2020-11-13 20:43:11 +00:00
Fabien Sanglard
a720635be2 Fix zipalign alignment error
Problem: Zipalign operates over several false assumptions. First it
assumes that zip entries are in the same order in the body and in
the Central Direcotry. Second, it assumes there are not space
between entries. This makes alignment incorrect when these asserts
are not true.

Solution: Don't align entries by tracking bias based on input zip
entry location. Calculate the expected alignment based on the out-
put zip file and correct with extra padding.

Fixes: 162117652
Test: Units Tests
Change-Id: Ia179338f658cab18a377cba2c7c8e629089a2785
2020-11-11 17:00:22 -08:00
Fabien Sanglard
4b4b495d88 Improve Zipalign test
Problem: Zipalign test invokes process but not verify.
Solution: Invoke both during test.

Test: Unit Test
Bug: NA
Change-Id: If603df301048f4b508e3429c4a8c77339ab351ae
2020-11-11 16:50:18 -08:00
Fabien Sanglard
6dfc6fb4c4 Fix zipalign tests with GetExecutableDirectory
Test: Self-tested
Bug: NA
Change-Id: Idc15c0e028b74a2b38c26af0e7d4a51f32210145
2020-11-06 17:04:59 -08:00
Fabien Sanglard
0f29f54695 Refactor zipalign to allow unit tests
Test: Self-tested
Bug: NA
Change-Id: I322b78c5e18082f7abf7427cdc62dbabcb18b4a0
2020-11-03 10:03:30 -08:00