summaryrefslogtreecommitdiff
path: root/libs/androidfw/misc.cpp
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-02-12Revert^2 "[res] Optimize isUpToDate() for ApkAssets" Yurii Zubrytskyi
99b48bdd872e8b2a48904f513b4b9feb8299750e Change-Id: I6d6e19bc81842971d6af6aeb3b19fc84b808720a
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
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-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
2024-09-10Revert "[res] Better modification time resolution in Idmap" ELIYAZ MOMIN (xWF)
This reverts commit fff1d48f432741160019a9266728097f10bd2189. Reason for revert: <Potential culprit for b/365676142 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.> Change-Id: I6b0a0bd67a14e4738a8cd64be2214840d02eee3f
2024-09-06[res] Better modification time resolution in Idmap Yurii Zubrytskyi
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: I37635e6f3b62aff3b4794912ac585a9ef5ea7a1e
2024-02-29[res] Use fstat() for idmap::IsUpToDate() Yurii Zubrytskyi
The most common operation when getting a new Resources object is checking if all apks and overlays are still up to date to reuse the cached object. It makes sense to optimize it by excluding the file by path lookups and instead keeping an open FD to the file in the cache + Make IsFabricatedOverlay() more efficient via a name check and string_view where possible Bug: 282215580 Test: build + boot + presubmit Change-Id: Ib1ab20cba359c2195a72dd2e10096883d95b4453
2022-12-01Mac build break: remove include that's not there Yurii Zubrytskyi
isReadonlyFilesystem() only matters for the code running on the deivces, disable its implementation on Windows and Mac Bug: 260973096 Test: build Change-Id: Idefe4c874003cdaeb9fc212a71efc3fa266f2fcc
2022-11-30[res] Don't stat asset providers on RO filesystems Yurii Zubrytskyi
IsUpToDate() is one of the most often called functions, let's make sure it only performs a syscall if it makes any sense and the underlying file can really change. Bug: 237583012 Test: build + boot + UTs Change-Id: Ie5999ddadf10b56f35354d00ad3402b229ffa2c3
2015-01-13am d6c475dc: am 595ae39f: Merge "Use more intention-revealing tests for ↵ Elliott Hughes
S_ISLNK and S_ISSOCK." * commit 'd6c475dc246b1681f5c9af9e00ac74183812329c': Use more intention-revealing tests for S_ISLNK and S_ISSOCK.
2015-01-12Use more intention-revealing tests for S_ISLNK and S_ISSOCK. Elliott Hughes
Change-Id: Ia7f13eb7d5a36cf2b4c0a253b2b4d7f7af396951
2014-11-03Fix issues that will be present in C++11 Adam Lesinski
- char16_t is a distinct type, so stay consistent with it throughout the code base. - char16_t is defined as minimum size of 16 bits. Since we mmap and cast data structures onto raw memory, we need a precise definition (uint16_t), so we cast between that (and static_assert that they are the same size). Change-Id: I869c32637543bbcfb39d2643e7d9df10d33acd3c
2014-01-27Revert "move libandroidfw to frameworks/native" Adam Lesinski
This reverts commit 84b6292c33d71b5739828d08aa8101d1954577f2.
2013-10-03move libandroidfw to frameworks/native Mike Lockwood
Change-Id: Ic5b8a2742c7141156ab0f00ca29097bfe92bce60
2013-05-07libutils clean-up Mathias Agopian
Change-Id: I11ee943da23a66828455a9770fc3c5ceb4bbcaa9