summaryrefslogtreecommitdiffstats
path: root/services/java
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 /services/java
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 'services/java')
-rw-r--r--services/java/com/android/server/SystemServer.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index de929cb..bf2edc8 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -20,6 +20,7 @@ import android.app.ActivityManagerNative;
import android.app.ActivityThread;
import android.app.IAlarmManager;
import android.app.INotificationManager;
+import android.app.usage.UsageStatsManagerInternal;
import android.bluetooth.BluetoothAdapter;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -91,6 +92,7 @@ import com.android.server.storage.DeviceStorageMonitorService;
import com.android.server.trust.TrustManagerService;
import com.android.server.tv.TvInputManagerService;
import com.android.server.twilight.TwilightService;
+import com.android.server.usage.UsageStatsService;
import com.android.server.usb.UsbService;
import com.android.server.wallpaper.WallpaperManagerService;
import com.android.server.webkit.WebViewUpdateService;
@@ -366,6 +368,11 @@ public final class SystemServer {
// Tracks the battery level. Requires LightService.
mSystemServiceManager.startService(BatteryService.class);
+
+ // Tracks application usage stats.
+ mSystemServiceManager.startService(UsageStatsService.class);
+ mActivityManagerService.setUsageStatsManager(
+ LocalServices.getService(UsageStatsManagerInternal.class));
}
/**