summaryrefslogtreecommitdiffstats
path: root/core/java/android/util
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-07-16 19:09:13 -0700
committerAdam Lesinski <adamlesinski@google.com>2014-07-18 15:24:20 -0700
commit0debc9aff4c0cbc28e083a948081d91b0f171319 (patch)
tree3ac4d7a9927cdd2741f65393d4e6855508ab3c26 /core/java/android/util
parentd3de42cae84fadfa1befd082a2cf1bf72f9ad82a (diff)
downloadframeworks_base-0debc9aff4c0cbc28e083a948081d91b0f171319.zip
frameworks_base-0debc9aff4c0cbc28e083a948081d91b0f171319.tar.gz
frameworks_base-0debc9aff4c0cbc28e083a948081d91b0f171319.tar.bz2
First iteration of a public UsageStats API
UsageStats API that allows apps to get a list of packages that have been recently used, along with basic stats like how long they have been in the foreground and the most recent time they were running. Bug: 15165667 Change-Id: I2a2d1ff69bd0b5703ac3d9de1780df42ad90d439
Diffstat (limited to 'core/java/android/util')
-rw-r--r--core/java/android/util/AtomicFile.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/util/AtomicFile.java b/core/java/android/util/AtomicFile.java
index 4fca570..a6466fc 100644
--- a/core/java/android/util/AtomicFile.java
+++ b/core/java/android/util/AtomicFile.java
@@ -200,6 +200,20 @@ public class AtomicFile {
}
/**
+ * Gets the last modified time of the atomic file.
+ * {@hide}
+ *
+ * @return last modified time in milliseconds since epoch.
+ * @throws IOException
+ */
+ public long getLastModifiedTime() throws IOException {
+ if (mBackupName.exists()) {
+ return mBackupName.lastModified();
+ }
+ return mBaseName.lastModified();
+ }
+
+ /**
* A convenience for {@link #openRead()} that also reads all of the
* file contents into a byte array which is returned.
*/