summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/am/UsageStatsService.java
AgeCommit message (Collapse)Author
2013-12-19Move some system services to separate directoriesAmith Yamasani
Refactored the directory structure so that services can be optionally excluded. This is step 1. Will be followed by another change that makes it possible to remove services from the build. Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
2013-07-02Misc memory stuff.Dianne Hackborn
- New Activity.reportFullyDrawn() method that applicatins can call when they know they are fully drawn, allowing us to have better app launch time info. This data is also included in usage stats. - Added total and free memory data "dumpsys meminfo". - Tuned the moderate memory levels to be more aggressive about considering the device getting low on RAM, and thus starting to prune RAM from processes. - Fixed issues in processstats when reading old data as well as resetting and other various fixes. Change-Id: I20efe7451afb4edfa1aeec448328ba601c24d869
2013-06-28More work on procstats: save/restore state, fixes.Dianne Hackborn
We now persistent the current procstats to storage to keep them across boots. Still need to do division and pruning across days; right now they will just keep collecting forever. Also fix some bugs in the checkin output. Change-Id: I4dd9317dbe2ee0642af8f2f0be1f2bd9c4055e80
2012-09-20Implement multi-user PackageMonitor.Dianne Hackborn
New APIs let you indicate what user(s) to monitor, and tell you what user is changing when receiving a callback. Fix package manager to only deliver package brpadcasts to the running users. (This isn't really a change in behavior, since the activity manager would not deliver to stopped users anyway). Make sure all broadcasts that package monitor receives also include user information for it to use. Update wallpaper service to (hopefully) now Really Correctly monitor package changes per user. Change-Id: Idd952dd274abcaeab452277d9160d1ae62919aa0
2012-07-31Make AtomicFile a public API. It's about time!Dianne Hackborn
Change-Id: Ib34e294747405b7ab709cb0bbb2d9a0cc80ce86a
2012-04-19Move handling of package changes to a background thread.Dianne Hackborn
Helps get rid of some jank when installing applications. Change-Id: I97d0022f82d67796e334d37086e5911dd6ca6b62
2011-09-29Add DUMP permission checks to servicesKenny Root
Some services have info that is not readily available any other way. Add a permission check to those services. Bug: 5389201 Change-Id: I5a9724ec89e1c11ef7813eeb52a6a05b3ea92af5
2011-08-08Store last-resume times in a separate XML file.Mark Brophy
In UsageStatsService, separate last-resume times from the rest of the statistics, and serialize them to an XML file daily. This way, ApplicationsProvider will still be able to acces this data, even thoguh other statistics are flushed to disk and discarded each day. Bug: 5108745 Change-Id: Id3df3c98243ba02cde16b31e5e29bd9ff3602108
2011-07-10Expose app resume times to the ApplicationProvider.Mark Brophy
Add ActivityManager.getAllPackageUsageStats which returns the PkgUsageStats object for all packages. In UsageStatsService, remember the last resume time of each component, and add that info to PkgUsageStats instances. ApplicationProvider will use getAllPackageUsageStats and the new field in PkgUsageStats to set the new SearchManager column SUGGEST_COLUMN_LAST_USAGE_HINT for requests with the GLOBAL_SEARCH permission. Change-Id: I80e9b127410ed0d528515d2256787f30a953e9b0
2010-10-15Work on issue #3101415: Crespo apps seem to have their UID changed over time.Dianne Hackborn
fsync! Change-Id: Ie6c5397202579935ac69bf61d3e7b3081ecf269c
2010-09-30Rub in a little 'ol log-b-gone.Dianne Hackborn
Mmmmmm... great fresh scent! Change-Id: I050e70b31b5d4a9c6731f15a4b51a3620a33a78d
2010-08-03Usage Stats: don't block writing stats to disk.Brad Fitzpatrick
I was seeing lots of stack traces of people hung for noticeable amounts of time when switching between activities. e.g. On of the common gmail stacks showing this pause was: android.os.StrictMode$StrictModeDiskWriteViolation: policy=391 violation=1 at android.os.StrictMode$AndroidBlockGuardPolicy.startHandlingViolationException(StrictMode.java:272) at android.os.StrictMode$AndroidBlockGuardPolicy.onWriteToDisk(StrictMode.java:243) at dalvik.system.BlockGuard$WrappedFileSystem.open(BlockGuard.java:238) at java.io.FileOutputStream.<init>(FileOutputStream.java:97) at java.io.FileOutputStream.<init>(FileOutputStream.java:69) at com.android.server.am.UsageStatsService.writeStatsFLOCK(UsageStatsService.java:424) at com.android.server.am.UsageStatsService.writeStatsToFile(UsageStatsService.java:398) at com.android.server.am.UsageStatsService.notePauseComponent(UsageStatsService.java:539) at com.android.server.am.ActivityManagerService.updateUsageStats(ActivityManagerService.java:1856) at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:667) at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2925) at com.android.server.am.ActivityStack.requestFinishActivityLocked(ActivityStack.java:2836) at com.android.server.am.ActivityManagerService.finishActivity(ActivityManagerService.java:2276) at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:237) at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1415) at android.os.Binder.execTransact(Binder.java:320) at dalvik.system.NativeStart.run(Native Method) at android.app.ActivityManagerProxy.finishActivity(ActivityManagerNative.java:1454) at android.app.Activity.finish(Activity.java:3260) at android.app.Activity.onBackPressed(Activity.java:1929) at android.app.Activity.onKeyUp(Activity.java:1907) at android.view.KeyEvent.dispatch(KeyEvent.java:1088) at android.app.Activity.dispatchKeyEvent(Activity.java:2087) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1661) at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2543) at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2516) at android.view.ViewRoot.handleMessage(ViewRoot.java:1866) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:3609) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) at dalvik.system.NativeStart.main(Native Method) Change-Id: Id49157bc635017292eaefddc5e22d73f5f4ab05e
2010-03-19Maybe fix issue #2457218: Corrupt batterystats.bin file preventing phone ↵Dianne Hackborn
boot - LIBtt68127 No steps to repro, but makes the code more robust by using the standard JournaledFile class and doing sanity checks on the input it reads. This required moving the JournaledFile class in to the framework (and we really should get rid of either it or AtomicFile, but they have different recovery semantics so that is tough). Also went through and cleaned up the file management in various places. Change-Id: Ieb7268d8435e77dff66b6e67bb63b62e5dea572e
2010-03-01Switch the services library to using the new SlogJoe Onorato
2009-12-04If the usage stats file doesn't exist in the first place there is no need toSuchi Amalapurapu
backup and short return.
2009-09-30Check if rename of backed up file fails before persisting new changes.Suchi Amalapurapu
If not these system services will end up with inconsistent settings files when the device runs out of storage. Delete mangled settings file in PackageManager if the current write fails so that we don't end up overwriting the backed up version with the mangled version Include null check when retrieving fwd locked resource for an existing package
2009-08-13Add a more compact representation of usage stats.Christian Sonntag
We are replaceing the package name in the activity name with a * iff the activity is in the same package, otherwise the activity name is pritned out in full. This small change will remove a lot of bytes (in the order of kilobytes for a real log) from the logged data on the network and downstream processing, since the package name is repeated in almost all cases. An exampe of the new format is here: DUMP OF SERVICE usagestats: D:4,20090813 P:com.android.launcher,4,155456 A:*.Launcher,4,0,0,0,0,0,0,0,0,0,2 P:com.android.browser,1,6724 A:*.BrowserActivity,1,0,0,0,0,0,0,0,0,0,0 A:*.CombinedBookmarkHistoryActivity,1,0,0,0,0,0,0,0,0,0,1 P:com.google.android.apps.maps,1,2219 A:com.google.android.maps.MapsActivity,1,0,0,0,0,0,0,0,0,0,0 P:com.android.contacts,1,0 A:*.DialtactsActivity,1,0,0,0,0,0,0,0,0,0,1
2009-07-19Issue #1884058 (Need to only record frequency and duration for selected ↵Dianne Hackborn
Google apps) Quick and dirty solution: a new --packages argument allows you to specify an explicit set of packages to include in the dump. There is also now a new GServices setting that can provide a value for it.
2009-06-17Fix issue #1924851Dianne Hackborn
We now only increment the launch count when we are launching from one package to another. Also the individual components in a package now have a count of the number of times they have been entered, which likewise is only updated when going to one component from another. This requires a new data format (all old data is wiped) and new checkin dump format (tools must be updated to read it).
2009-05-08Improve shutdown process to send broadcast for applications.Dianne Hackborn
This introduces a new class in the base platform for performing a clean shutdown (which was copied from the classes in the policies). It includes new features to send a shutdown broadcast for applications to do cleanup, and ot have the activity manager pause the current activity before proceeding with the shutdown. These facilities are also use to write at the most recent stat files for sync, battery and user activity.
2009-04-13Let's do bug #1769910 actually right.Dianne Hackborn
My original implementation was computing averages and medians. Now we do binning, as requested. So much simpler, too! In addition, it fixes a bug where when hoping across activities we were only accounting for the last activity as the total time; now we count the time from the start of the initial activity. This also includes some reduction and optimization of the activity manager dumpsys output.
2009-04-07Fix issue #1769910 (Track activity launch times)Dianne Hackborn
The usage stats service now collects per-activity launch time stats. There are a number of fixes and improvements to its statistics management and collection; it now operates its calendar in GMT and ensures that for checkin purposes it always reports one day and only one complete day to the checkin service. Also change the checkin option from "-c" to "--checkin" since it is really a special thing.
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2009-03-03auto import from //depot/cupcake/@135843The Android Open Source Project
2009-02-13auto import from //branches/cupcake/...@131421The Android Open Source Project
2009-02-10auto import from //branches/cupcake/...@130745The Android Open Source Project