summaryrefslogtreecommitdiff
path: root/libs/androidfw/include
diff options
context:
space:
mode:
author ELIYAZ MOMIN (xWF) <mohammedeliyaz@google.com> 2024-09-10 10:30:57 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-09-10 10:30:57 +0000
commite2cc267a14a4eccd54b9fe1f7d3c8d860ac80a4f (patch)
treea26b94ce72f56f9050921e2b30f958e3b76aa2fd /libs/androidfw/include
parentfff1d48f432741160019a9266728097f10bd2189 (diff)
Revert "[res] Better modification time resolution in Idmap"
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
Diffstat (limited to 'libs/androidfw/include')
-rw-r--r--libs/androidfw/include/androidfw/AssetManager.h22
-rw-r--r--libs/androidfw/include/androidfw/Idmap.h5
-rw-r--r--libs/androidfw/include/androidfw/misc.h35
3 files changed, 21 insertions, 41 deletions
diff --git a/libs/androidfw/include/androidfw/AssetManager.h b/libs/androidfw/include/androidfw/AssetManager.h
index 376c881ea376..ce0985b38986 100644
--- a/libs/androidfw/include/androidfw/AssetManager.h
+++ b/libs/androidfw/include/androidfw/AssetManager.h
@@ -280,21 +280,21 @@ private:
~SharedZip();
private:
- SharedZip(const String8& path, ModDate modWhen);
- SharedZip(int fd, const String8& path);
- SharedZip(); // <-- not implemented
+ SharedZip(const String8& path, time_t modWhen);
+ SharedZip(int fd, const String8& path);
+ SharedZip(); // <-- not implemented
- String8 mPath;
- ZipFileRO* mZipFile;
- ModDate mModWhen;
+ String8 mPath;
+ ZipFileRO* mZipFile;
+ time_t mModWhen;
- Asset* mResourceTableAsset;
- ResTable* mResourceTable;
+ Asset* mResourceTableAsset;
+ ResTable* mResourceTable;
- Vector<asset_path> mOverlays;
+ Vector<asset_path> mOverlays;
- static Mutex gLock;
- static DefaultKeyedVector<String8, wp<SharedZip> > gOpen;
+ static Mutex gLock;
+ static DefaultKeyedVector<String8, wp<SharedZip> > gOpen;
};
/*
diff --git a/libs/androidfw/include/androidfw/Idmap.h b/libs/androidfw/include/androidfw/Idmap.h
index 98f1aa86f2db..64b1f0c6ed03 100644
--- a/libs/androidfw/include/androidfw/Idmap.h
+++ b/libs/androidfw/include/androidfw/Idmap.h
@@ -25,9 +25,8 @@
#include "android-base/macros.h"
#include "android-base/unique_fd.h"
#include "androidfw/ConfigDescription.h"
-#include "androidfw/ResourceTypes.h"
#include "androidfw/StringPiece.h"
-#include "androidfw/misc.h"
+#include "androidfw/ResourceTypes.h"
#include "utils/ByteOrder.h"
namespace android {
@@ -203,7 +202,7 @@ class LoadedIdmap {
android::base::unique_fd idmap_fd_;
std::string_view overlay_apk_path_;
std::string_view target_apk_path_;
- ModDate idmap_last_mod_time_;
+ time_t idmap_last_mod_time_;
private:
DISALLOW_COPY_AND_ASSIGN(LoadedIdmap);
diff --git a/libs/androidfw/include/androidfw/misc.h b/libs/androidfw/include/androidfw/misc.h
index 09ae40c35369..077609d20d55 100644
--- a/libs/androidfw/include/androidfw/misc.h
+++ b/libs/androidfw/include/androidfw/misc.h
@@ -13,13 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#pragma once
-#include <time.h>
+#include <sys/types.h>
//
// Handy utility functions and portability code.
//
+#ifndef _LIBS_ANDROID_FW_MISC_H
+#define _LIBS_ANDROID_FW_MISC_H
namespace android {
@@ -40,35 +41,15 @@ typedef enum FileType {
} FileType;
/* get the file's type; follows symlinks */
FileType getFileType(const char* fileName);
-
-// MinGW doesn't support nanosecond resolution in stat() modification time, and given
-// that it only matters on the device it's ok to keep it at the second level there.
-#ifdef _WIN32
-using ModDate = time_t;
-inline constexpr ModDate kInvalidModDate = ModDate(-1);
-inline constexpr unsigned long long kModDateResolutionNs = 1ull * 1000 * 1000 * 1000;
-inline time_t toTimeT(ModDate m) {
- return m;
-}
-#else
-using ModDate = timespec;
-inline constexpr ModDate kInvalidModDate = {-1, -1};
-inline constexpr unsigned long long kModDateResolutionNs = 1;
-inline time_t toTimeT(ModDate m) {
- return m.tv_sec;
-}
-#endif
-
-/* get the file's modification date; returns kInvalidModDate w/errno set on failure */
-ModDate getFileModDate(const char* fileName);
+/* get the file's modification date; returns -1 w/errno set on failure */
+time_t getFileModDate(const char* fileName);
/* same, but also returns -1 if the file has already been deleted */
-ModDate getFileModDate(int fd);
+time_t getFileModDate(int fd);
// Check if |path| or |fd| resides on a readonly filesystem.
bool isReadonlyFilesystem(const char* path);
bool isReadonlyFilesystem(int fd);
-} // namespace android
+}; // namespace android
-// Whoever uses getFileModDate() will need this as well
-bool operator==(const timespec& l, const timespec& r);
+#endif // _LIBS_ANDROID_FW_MISC_H