History log of /frameworks/base/services/java/com/android/server/am/UsageStatsService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2286cdc0cab77e61b75e6fe9a45b91f6e57cd46d 02-Jul-2013 Dianne Hackborn <hackbod@google.com> Misc memory stuff.

- 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
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
904a857d5a319e32d1df065b38e3191324b35b0f 29-Jun-2013 Dianne Hackborn <hackbod@google.com> More work on procstats: save/restore state, fixes.

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
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
c72fc674a33b8d17585764d09d3bb6c77d7d947e 20-Sep-2012 Dianne Hackborn <hackbod@google.com> Implement multi-user PackageMonitor.

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
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
39606a007a5b1309dd000234f2b8cf156c49fd0f 01-Aug-2012 Dianne Hackborn <hackbod@google.com> Make AtomicFile a public API. It's about time!

Change-Id: Ib34e294747405b7ab709cb0bbb2d9a0cc80ce86a
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
d0d7503fd3e941113094532f28986f49b11b5fdb 20-Apr-2012 Dianne Hackborn <hackbod@google.com> Move handling of package changes to a background thread.

Helps get rid of some jank when installing applications.

Change-Id: I97d0022f82d67796e334d37086e5911dd6ca6b62
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
3abd75ba3a981850cac43a401d0014a836559cb0 29-Sep-2011 Kenny Root <kroot@google.com> Add DUMP permission checks to services

Some services have info that is not readily available any other way. Add
a permission check to those services.

Bug: 5389201
Change-Id: I5a9724ec89e1c11ef7813eeb52a6a05b3ea92af5
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
c63502720e7b7c72e823589cf9afeb16f08c7c7d 05-Aug-2011 Mark Brophy <mbrophy@google.com> Store last-resume times in a separate XML file.

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
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
9fc033083267d0c7f01e083400721b6cddb3a398 01-Jul-2011 Mark Brophy <mbrophy@google.com> Expose app resume times to the ApplicationProvider.

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
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
8bdf5935c0db4a66ab33a10b43398d2523cfa15d 15-Oct-2010 Dianne Hackborn <hackbod@google.com> Work on issue #3101415: Crespo apps seem to have their UID changed over time.

fsync!

Change-Id: Ie6c5397202579935ac69bf61d3e7b3081ecf269c
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
cef65eeb0315c3118bf8860d6f723cb49ff6bc52 01-Oct-2010 Dianne Hackborn <hackbod@google.com> Rub in a little 'ol log-b-gone.

Mmmmmm... great fresh scent!

Change-Id: I050e70b31b5d4a9c6731f15a4b51a3620a33a78d
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
389a916769aaf4b329839285d2f975fc23aadfb4 04-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> Usage Stats: don't block writing stats to disk.

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
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
1afd1c90ebe789b8d3a137004127a50d2db7e3b5 19-Mar-2010 Dianne Hackborn <hackbod@google.com> Maybe fix issue #2457218: Corrupt batterystats.bin file preventing phone 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
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
8a9b22056b13477f59df934928c00c58b5871c95 27-Feb-2010 Joe Onorato <joeo@android.com> Switch the services library to using the new Slog
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
be1c422a73cf70e1478a13463de5ab929991c619 04-Dec-2009 Suchi Amalapurapu <asuchitra@google.com> If the usage stats file doesn't exist in the first place there is no need to
backup and short return.
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
8550f255232eb4e4852466c5297fdc125887f5af 30-Sep-2009 Suchi Amalapurapu <asuchitra@google.com> Check if rename of backed up file fails before persisting new changes.
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
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
6639bb65c5ebb9493afba6d701a22223ac45ba04 13-Aug-2009 Christian Sonntag <cxs@dhcp-172-31-153-155.sfo.corp.google.com> Add a more compact representation of usage stats.

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
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
9fdbf6ae465f90b50ca5feb320215b98018c9937 19-Jul-2009 Dianne Hackborn <hackbod@google.com> Issue #1884058 (Need to only record frequency and duration for selected 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.
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
760ec4a095567457707abe764cf4dfda0ed84032 18-Jun-2009 Dianne Hackborn <hackbod@google.com> Fix issue #1924851

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).
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
55280a91884b9256e8db6af6a09f28b3feeaa9d8 08-May-2009 Dianne Hackborn <hackbod@google.com> Improve shutdown process to send broadcast for applications.

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.
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
f210d6b75e2c0fe60b90c074ff9f615c1137f23e 14-Apr-2009 Dianne Hackborn <hackbod@google.com> Let's do bug #1769910 actually right.

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.
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
6447ca30b8e41c22c7214f201120327057e356dc 08-Apr-2009 Dianne Hackborn <hackbod@google.com> Fix issue #1769910 (Track activity launch times)

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.
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
da996f390e17e16f2dfa60e972e7ebc4f868f37e 13-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@131421
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/services/java/com/android/server/am/UsageStatsService.java