summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-08-29 19:34:09 +0000
committerAdam Lesinski <adamlesinski@google.com>2014-08-29 19:34:09 +0000
commitdf77a40d4078f12fb0fd2ed23516f683945b4521 (patch)
tree6a70d22c929ac4d988b1ab1a15be62cf63d46a95 /core/java/android
parentc5bf108e70cd196c5e723145ae912b30cfa3481c (diff)
downloadframeworks_base-df77a40d4078f12fb0fd2ed23516f683945b4521.zip
frameworks_base-df77a40d4078f12fb0fd2ed23516f683945b4521.tar.gz
frameworks_base-df77a40d4078f12fb0fd2ed23516f683945b4521.tar.bz2
Revert "Make UsageStats API comply with API Council"
This reverts commit 3811dabe57a60e4729f67b6fdc7fbe91eb8b3e06. Did not update current.txt Change-Id: I93faccaf24570b1ce88ade37c00506c4a48a8a1d
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/usage/UsageEvents.java4
-rw-r--r--core/java/android/app/usage/UsageStats.java16
-rw-r--r--core/java/android/app/usage/UsageStatsManager.java10
3 files changed, 11 insertions, 19 deletions
diff --git a/core/java/android/app/usage/UsageEvents.java b/core/java/android/app/usage/UsageEvents.java
index fb80de2..2431ad0 100644
--- a/core/java/android/app/usage/UsageEvents.java
+++ b/core/java/android/app/usage/UsageEvents.java
@@ -106,9 +106,7 @@ public final class UsageEvents implements Parcelable {
}
/**
- * The time at which this event occurred, measured in milliseconds since the epoch.
- * <p/>
- * See {@link System#currentTimeMillis()}.
+ * The time at which this event occurred.
*/
public long getTimeStamp() {
return mTimeStamp;
diff --git a/core/java/android/app/usage/UsageStats.java b/core/java/android/app/usage/UsageStats.java
index abfc435..e47a802 100644
--- a/core/java/android/app/usage/UsageStats.java
+++ b/core/java/android/app/usage/UsageStats.java
@@ -81,36 +81,28 @@ public final class UsageStats implements Parcelable {
}
/**
- * Get the beginning of the time range this {@link android.app.usage.UsageStats} represents,
- * measured in milliseconds since the epoch.
- * <p/>
- * See {@link System#currentTimeMillis()}.
+ * Get the beginning of the time range this {@link android.app.usage.UsageStats} represents.
*/
public long getFirstTimeStamp() {
return mBeginTimeStamp;
}
/**
- * Get the end of the time range this {@link android.app.usage.UsageStats} represents,
- * measured in milliseconds since the epoch.
- * <p/>
- * See {@link System#currentTimeMillis()}.
+ * Get the end of the time range this {@link android.app.usage.UsageStats} represents.
*/
public long getLastTimeStamp() {
return mEndTimeStamp;
}
/**
- * Get the last time this package was used, measured in milliseconds since the epoch.
- * <p/>
- * See {@link System#currentTimeMillis()}.
+ * Get the last time this package was used.
*/
public long getLastTimeUsed() {
return mLastTimeUsed;
}
/**
- * Get the total time this package spent in the foreground, measured in milliseconds.
+ * Get the total time this package spent in the foreground.
*/
public long getTotalTimeInForeground() {
return mTotalTimeInForeground;
diff --git a/core/java/android/app/usage/UsageStatsManager.java b/core/java/android/app/usage/UsageStatsManager.java
index 5830fcf..f9b8928 100644
--- a/core/java/android/app/usage/UsageStatsManager.java
+++ b/core/java/android/app/usage/UsageStatsManager.java
@@ -23,7 +23,6 @@ import android.util.ArrayMap;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
/**
* Provides access to device usage history and statistics. Usage data is aggregated into
@@ -150,6 +149,7 @@ public final class UsageStatsManager {
* @param endTime The exclusive end of the range of events to include in the results.
* @return A {@link UsageEvents}.
*/
+ @SuppressWarnings("unchecked")
public UsageEvents queryEvents(long beginTime, long endTime) {
try {
UsageEvents iter = mService.queryEvents(beginTime, endTime,
@@ -170,13 +170,15 @@ public final class UsageStatsManager {
*
* @param beginTime The inclusive beginning of the range of stats to include in the results.
* @param endTime The exclusive end of the range of stats to include in the results.
- * @return A {@link java.util.Map} keyed by package name, or null if no stats are
+ * @return An {@link android.util.ArrayMap} keyed by package name or null if no stats are
* available.
*/
- public Map<String, UsageStats> queryAndAggregateUsageStats(long beginTime, long endTime) {
+ public ArrayMap<String, UsageStats> queryAndAggregateUsageStats(long beginTime, long endTime) {
List<UsageStats> stats = queryUsageStats(INTERVAL_BEST, beginTime, endTime);
if (stats.isEmpty()) {
- return Collections.emptyMap();
+ @SuppressWarnings("unchecked")
+ ArrayMap<String, UsageStats> emptyStats = ArrayMap.EMPTY;
+ return emptyStats;
}
ArrayMap<String, UsageStats> aggregatedStats = new ArrayMap<>();