summaryrefslogtreecommitdiff
path: root/libs/androidfw
AgeCommit message (Collapse)Author
2025-04-22[res] Fix a crash for the apps doing a bad thing Yurii Zubrytskyi
Some apps started crashing after the CL that changed one of the parameters of ZipAssetsProvider constructor from time_t to timespec. Apparently they dlsym() and call that constructor, even when it's not a public or somehow supported API. This CL puts one back for them so they at least don't stop working all at once, and instead it just logs an error so the developers could at least know they're doing a BAD THING. + fix the timespec operator== to actually compare nanoseconds. Bug: 406670650 Test: run the app and ensure it launches Flag: EXEMPT bugfix - a dummy symbol that's unflaggable (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:481f13eaff6a88cbe9b8b9da65f52bc26ba440bd) Merged-In: I85e03985d7303f4e0f943441da57cf0f50230db6 Change-Id: I85e03985d7303f4e0f943441da57cf0f50230db6
2025-03-24Merge "[res] A bit more efficient locale collection" into main Yurii Zubrytskyi
2025-03-20[res] A bit more efficient locale collection Yurii Zubrytskyi
Don't copy the string unless it's a new locale, and limit the allocations as well Test: unit tests Flag: EXEMPT minor performance improvement Change-Id: Icfe433ab211a0ca22882bd579415a96dc40db30a
2025-03-20Only check for xml flags when we know there are any Jeremy Meyer
Test: Automation Fixes: 377974898 Fixes: 398541237 Fixes: 398086579 Fixes: 396884481 Fixes: 396992602 Flag: android.content.res.layout_readwrite_flags Change-Id: Ibdabb27689a95eba7b53490ea8651c947beca226
2025-03-19Merge "Regenerate LocaleDataLookup with CLDR patches" into main am: ↵ Victor Chang
24f92f9e9e am: 4e0efee3ef Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3540981 Change-Id: Ib9c0efd96ead1ee2bff2a58ff4ccf6ad2e69112d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-03-19Merge "Regenerate LocaleDataLookup with CLDR patches" into main Victor Chang
2025-03-17[res] Minor code cleanups Yurii Zubrytskyi
- try with resources - use a reference for non-optional argument instead of a pointer Test: unit tests Flag: EXEMPT minor refactoring Change-Id: I365b8fc2058b01edd6dd6bd7d3a131af4834d98c
2025-03-14Merge "Zero-initialize CursorWindow buffer" into main Treehugger Robot
2025-03-14Zero-initialize CursorWindow buffer Lee Shombert
Zero-initialize mData in CursorWindow::create(). The caller might not fully fill that buffer before sending it to the remote end. It is not necessary to zero-initialize in CursorWindow::createFromParcel(), since the buffer is immediately filled from the far end. Flag: EXEMPT bug-fix Bug: 309407957 Test: atest * libandroidfw_tests * FrameworksCoreTests:android.database * CtsDatabaseTestCases Change-Id: I755240b0e3ba185c01036a5e00c8785d2e1ac11a
2025-03-13Regenerate LocaleDataLookup with CLDR patches Victor Chang
CLDR-17809 https://unicode-org.atlassian.net/browse/CLDR-17809 Calendar interval format pattern typo for locale 'hi' CLDR-14088 https://unicode-org.atlassian.net/browse/CLDR-14088 sr_Latn-RU seems odd as default Russian Serbian CLDR-16821 https://unicode-org.atlassian.net/browse/CLDR-16821 Time zone city names for Australian islands are wrong CLDR-18073 https://unicode-org.atlassian.net/browse/CLDR-18073 Samoan time zone names are inconsistent CLDR-17925 https://unicode-org.atlassian.net/browse/CLDR-17925 Danish: typo in translation of "Inche(es) of mercury" - shortform contains (#) instead of (") Bug: 381908969 Test: CtsIcuTestCases CtsIcu4cTestCases Change-Id: I1ec7385584ab0c0ab13d8c595cf67d4706c57860
2025-03-12Merge "Fix incorrect NULL check in IncFsFileMap reference assertions" into ↵ Treehugger Robot
main am: 2576ad7087 am: 67fc583373 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3526790 Change-Id: I265c6c114f74e1b9b6e40edc30b7f5cfb8b3bc27 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-03-12Merge "Fix incorrect NULL check in IncFsFileMap reference assertions" into main Treehugger Robot
2025-03-06Persist whether xml resources have flags Jeremy Meyer
This stores whether an xml document has feature flags in it in a ResTable_entry so that at runtime we can know not to do extra work looking for flags. Test: Automation Bug: 377974898 Flag: android.content.res.layout_readwrite_flags Change-Id: Id43b2d9941d1fab8c654d081bf19df5a33a464f3
2025-03-05Fix incorrect NULL check in IncFsFileMap reference assertions xndcn
Since IncFsFileMap&& is not a pointer type, the check should verify the validity of its underlying data. Change-Id: Ica43ab671831b3e3bb61472e0446aa6dbf51ba91
2025-03-04[res] Add named padding to ResTable_config Yurii Zubrytskyi
Follow the way the structs are defined in this file and explicitly pad the structure with a named field. + add some static_assert statements to make sure nothing accidentally breaks binary structure of configs. Test: build + boot Flag: EXEMPT minor refactoring Change-Id: I7e93aa0e92b080d0dcb77c790e5341f2342d7d2d
2025-02-27Merge 25Q1 (ab/12770256) to aosp-main-future Xin Li
Bug: 385190204 Merged-In: Ibc80f09d54bec2c83814874d94a8f8eb22b5075f Change-Id: If7779ae57fd91631d08bd8af5434c2ddd963aad7
2025-02-21Log locale changes from AssetManager2.cpp Jeremy Meyer
Test: automated Bug: 392255526 Flag: EXEMPT bugfix Change-Id: Ibde9ebc2f00e5046e3778d59f8b919e0262a8e9a
2025-02-19Merge "Filter overlays based on constraints during resource resolution" into ↵ Biswarup Pal
main
2025-02-19Filter overlays based on constraints during resource resolution Biswarup Pal
Keep AssetManager updated about displayId and deviceId changes so that it can filter resource overlays based on displayId and deviceId constraints. Test: atest libandroidfw_tests Test: atest FrameworkServicesTests Test: atest CtsResourcesTestCases Bug: 371801644 Flag: android.content.res.rro_constraints Change-Id: I6163114b62501cb5f77531443e8995a83168701b NO_IFTTT=Introduce overlay constraint type values in libandroidfw, which are already same as the ones in OverlayConstraint.java
2025-02-14Merge "Update LocaleDataTables" into main am: f2535b51b8 am: 2502d67f40 Treehugger Robot
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3463320 Change-Id: I5f8ca680478478edf34a855d02e01490570fa4e9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-02-14Update LocaleDataTables Victor Chang
Due to https://unicode-org.atlassian.net/browse/CLDR-18099 Bug: 381908969 Test: m droid Change-Id: I1f306625e1e178d3a6576bb945b631b5f28b3b58
2025-02-13Merge "[res] Small cleanup in aapt2 output + optimization" into main Treehugger Robot
2025-02-12[res] Small cleanup in aapt2 output + optimization Yurii Zubrytskyi
Don't print the header line when there are no flag-disabled items follow. + move the heavy string allocation to the tightest scope it is used in Test: manual Flag: EXEMPT bugfix Change-Id: I74902f5fb14b64f2ce3624e72d7774042441213b
2025-02-12Revert "Revert "[res] Don't create extra asset provider when not..." Yurii Zubrytskyi
Revert submission 31216694-revert-31021037-TXGRFMNZKV Reason for revert: relanding with a fix The fix is to still return a null AssetsProvider when failing to open the supplied apk, instead of ending up with an empty provider that will fail later Reverted changes: /q/submissionid:31216694-revert-31021037-TXGRFMNZKV Change-Id: Ia8e2cdaddf81683cd58547942d1da3c5df93b087
2025-02-12Revert^2 "[res] Optimize few functions for dtoh() as a noop" Yurii Zubrytskyi
6e4275255688ab4e7a0bc5602f4ba1ee2958cff4 Change-Id: I4f9a92a21d7597eaca5ef69fc67350a25c9859bc
2025-02-12Revert^2 "[res] Optimize isUpToDate() for ApkAssets" Yurii Zubrytskyi
99b48bdd872e8b2a48904f513b4b9feb8299750e Change-Id: I6d6e19bc81842971d6af6aeb3b19fc84b808720a
2025-02-06Merge "Add constraints for enabling RROs" into main Biswarup Pal
2025-02-06Add constraints for enabling RROs Biswarup Pal
This change introduces hidden API's for setting constraints for enabling RROs. Currently, the constraints are of the following types: 1. Display id constraint: This can be set for a RRO if the RRO is desired to be applied on only the apps running on that specific display. 2. Device id constraint: This can be set for a RRO if the RRO is desired to be applied on only the apps running on that specific device (for apps running on the default device, this would be Context#DEVICE_ID_DEFAULT, and for apps running on a virtual device, this would be the id of the virtual device). An overlay would be enabled when any of the given constraints are met. Constraints can only be set while enabling a RRO. Re-enabling a RRO with different constraints updates the constraints for the RRO. This change facilitates the writing of the constraints for RROs into the correspodning idmap files, and also persists them as part of the settings used by OverlayManagerService. The filtering of resource overlays based on constraints during resource resolution will be done in a follow-up CL. Test: atest FrameworksServicesTests Test: atest idmap2_tests Test: atest libandroidfw_tests Test: atest CtsResourcesTestCases Bug: 371801644 Flag: android.content.res.rro_constraints Change-Id: I0cad58bfb5b9b90105e2ef839c58147b9a50767c
2025-01-31Merge "Add benchmarks for LocaleDataLookup" into main am: 533fa597f9 am: ↵ Treehugger Robot
8c1b836852 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3471369 Change-Id: I46d68a04b213a71d2c5a3b4dd7350a669d0fb17e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-01-31Add benchmarks for LocaleDataLookup Victor Chang
on aosp_cf_x86_64_phone-userdebug, the benchmark result is libandroidfw_benchmarks#BM_LocaleDataLookupIsLocaleRepresentative: PASSED (0ms) cpu_time_ns: 55.07607273354898 real_time_ns: 55.19976479889459 libandroidfw_benchmarks#BM_LocaleDataLookupLikelyScript: PASSED (0ms) cpu_time_ns: 87.99205759931041 real_time_ns: 88.19010674954154 With the unordered_set and unordered_map, the result is libandroidfw_benchmarks#BM_LocaleDataLookupIsLocaleRepresentative: PASSED (0ms) cpu_time_ns: 113.01179143336402 real_time_ns: 113.3695957412614 libandroidfw_benchmarks#BM_LocaleDataLookupLikelyScript: PASSED (1ms) cpu_time_ns: 109.63471229710265 real_time_ns: 109.91545630537807 With std::binary_search, the result is libandroidfw_benchmarks#BM_LocaleDataLookupIsLocaleRepresentative: PASSED (0ms) cpu_time_ns: 123.82590108826805 real_time_ns: 123.98891085230711 Let's keep the current implementation, and add a TODO about the disk size. Bug: 383096413 Test: atest libandroidfw_benchmarks Change-Id: Iaa5f1ab5ac4dcc6bbdd3c4b66fe129c61d75c1d1
2025-01-30[aapt2] fix the comments from older review Yurii Zubrytskyi
- add a test case for the null last entry in sparse types - add comments explaining what mLength is for sparse types - remember if the type is sparse in a member - pragma once Test: atest libandroidfw_tests Flag: EXEMPT bugfix / refactor Change-Id: I7c2e516e8887f5fd1c2ab35b20fb49864b6761b6
2025-01-15Remove special case for libs when debuggable="true". Elliott Hughes
This causes confusion, is hard to debug (because the debuggable="true" behavior is more lenient), and doesn't have any obvious value (since it's trivially worked around by renaming "executable" to "libexecutable.so" anyway). Flag: EXEMPT bugfix Bug: https://issuetracker.google.com/160129591 Change-Id: I6a27a5b13df7bdc3fd3f76d8c8682867afded624
2025-01-09Merge "[res] Enable zero-copy assets access" into main Treehugger Robot
2025-01-08Merge changes from topic "revert-31021037-TXGRFMNZKV" into main Treehugger Robot
* changes: Revert "[res] Optimize isUpToDate() for ApkAssets" Revert "[res] Optimize few functions for dtoh() as a noop" Revert "[res] Don't create extra asset provider when not needed" Revert "[res] Dump resources timings in dumpsys"
2025-01-08Revert "[res] Optimize isUpToDate() for ApkAssets" ESWAR MAGATAPALLI (xWF)
Revert submission 31021037 Reason for revert: Droidmonitor created revert due to b/388342212. Will be verifying through ABTD before submission. Reverted changes: /q/submissionid:31021037 Change-Id: I7d0eeaf7476c66f5276c68320f93f2b56953d531
2025-01-08Revert "[res] Optimize few functions for dtoh() as a noop" ESWAR MAGATAPALLI (xWF)
Revert submission 31021037 Reason for revert: Droidmonitor created revert due to b/388342212. Will be verifying through ABTD before submission. Reverted changes: /q/submissionid:31021037 Change-Id: Ibd9504f9ea147e3849a5df4b924c44f9880c69c2
2025-01-08Revert "[res] Don't create extra asset provider when not needed" ESWAR MAGATAPALLI (xWF)
Revert submission 31021037 Reason for revert: Droidmonitor created revert due to b/388342212. Will be verifying through ABTD before submission. Reverted changes: /q/submissionid:31021037 Change-Id: Ic1964e2db736cfa3db3835a52c00cc81acda0bde
2025-01-07Merge changes I5fa70d33,Ibc5ac60a,I2f048fee,I0f801bef into main Yurii Zubrytskyi
* changes: [res] Dump resources timings in dumpsys [res] Don't create extra asset provider when not needed [res] Optimize few functions for dtoh() as a noop [res] Optimize isUpToDate() for ApkAssets
2025-01-06Merge "Turn LocaleDataTables into C switch statements" into main am: ↵ Treehugger Robot
b45d2c4d10 am: 2206598e2e Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3430925 Change-Id: I2a0e422d320ace9eba453949baccbbbf181198d2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-01-03Merge "Regenerate LocaleDataTables.cpp due to ICU 76 upgrade" into main am: ↵ Victor Chang
0805e0e855 am: 0dcbbeabce Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3407251 Change-Id: I26a076143e166903f4b6c019bac21586e34bf43e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2025-01-02Merge "Extract implementation of script and locale matching into ↵ Victor Chang
LocaleDataLookup.h" into main am: b4966de272 am: 60786ca61d Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3432461 Change-Id: Ic9e1b2401f0432ed0f1777e216e171e2a17527e4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-12-31Turn LocaleDataTables into C switch statements Victor Chang
It should save memory from initializing std::unordered_map and _set. The generated code size is large (depending on the exact -O options passed to clang), but they should be in the clean pages, rather than dirty pages. Bug: 349675514 Test: atest libandroidfw_tests Change-Id: If1ff8284f7e3bb208d43e63c93e3294d3755890f
2024-12-31Regenerate LocaleDataTables.cpp due to ICU 76 upgrade Victor Chang
The command: ./tools/localedata/extract_icu_data.py $ANDROID_BUILD_TOP > libs/androidfw/LocaleDataTables.cpp Bug: 383096413 Test: atest FrameworksCoreTests:android.text.format Change-Id: I4eef08dd53508a859f0fb3c89991093e2861d075
2024-12-31Extract implementation of script and locale matching into LocaleDataLookup.h Victor Chang
It helps adding new unit tests, and fixing correctness and performance bugs later. Bug: 386340812 Test: atest libandroidfw_tests Change-Id: I4d3ee1333637d2cd22d5fdfad730935951feeccb
2024-12-27[res] Enable zero-copy assets access Yurii Zubrytskyi
libziparchive supports using the provided memory buffers directly when exracting compressed files, but it requires explicit opt in in the implementation of its interfaces. This CL ensures the functions we use for reading compressed assets use those. Flag: EXEMPT small optimization Test: build + boot + atest libandroidfw_tests Change-Id: I6bcb73081e027b503b8513cf1d732c556df39012
2024-12-19[res] Don't create extra asset provider when not needed Yurii Zubrytskyi
MultiAssetsProvider is useful to combine a ResourcesLoader with a file-based provider, but most of the time it's used without any loaders, and ends up with an EmptyAssetsProvider object that just wastes cycles and RAM. This CL optimizes that out, only creating the extra layer when we have a real loader, and falling back to the only remaining provider otherwise Bug: 319137634 Test: build + boot + manual + atest libandroidfw_tests Flag: EXEMPT optimization Change-Id: Ibc5ac60adc5e008b70a62481a747758c89083ff9
2024-12-19[res] Optimize few functions for dtoh() as a noop Yurii Zubrytskyi
Given that right now our device on disk endianness is exactly the same as the in-memory one, few functions can be optimized into noops or raw memcpy Bug: 319137634 Test: boot + atest libandroidfw_tests Flag: EXEMPT performance optimization Change-Id: I2f048feea7a93fb52434b128aa2905ebf1bb46cb
2024-12-19[res] Optimize isUpToDate() for ApkAssets Yurii Zubrytskyi
This is the most called function in the whole Resources codebase, and it often takes a millisecond+ to just check if the underlying file still exists. This CL optimizes several aspects of the function - knowing that all /data/ paths are writable, return early from the isReadonlyFilesystem() without a syscall - use the same getFileModDate() function for all native classes instead of the custom stat-based code - skip the modification time getter for all readonly filesystems when we know that the idmap, overlay and target can't change. - add some default-disabled logging code to print timings for easier performance measurement Bug: 319137634 Test: build, boot and atest libandroidfw_tests Flag: EXEMPT performance-critical code that can't have two versions Change-Id: I0f801bef386f202eda775cca9657e2a0b6b55c95
2024-12-18Merge changes Ib1c55fe6,I70f74b1a into main Treehugger Robot
* changes: [aapt2] Improve "dump chunks" output [res] Make type iteration more efficient in aapt2
2024-12-16Revert^2 "[res] Better modification time resolution in Idmap" Yurii Zubrytskyi
This reverts commit e2cc267a14a4eccd54b9fe1f7d3c8d860ac80a4f. Reason for revert: relanding with the macos build fix Original comment: We used to track the modification time in seconds, which is both imprecise (an apk installation + idmap generation can easily take less time) and forces us to wait for >1s in the tests to just check if up-to-date checks work. This change updates the time to nanosecond resolution where supported (hm, MinGW for Windows, hm), as the underlying OS API provides Test: build + atest libandroidfw_tests idmap2_tests + boot Flag: EXEMPT minor change Change-Id: I49c36b0a6ae6e677fa1259090da20ccc7a224b99