History log of /frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
693d869b32b375a6b3812aa56145e334b3a8c219 13-Sep-2016 Amith Yamasani <yamasani@google.com> Handle charging state separately from temporary parole

Don't use the parole state to deal with the plugged-in trigger.
Otherwise standby apps will only be paroled for a few minutes
after plugging in to charge and not the entire duration.

Use a different intent for charging state, since the CHARGING
intent takes several seconds to be received.

A refactor some time ago changed the charging state behavior
that caused this regression.

Bug: 31399882
Change-Id: Ic036de5e136b3151b225473d0c3f440adb3b48e7
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
f2d87eba750d15093c996c1dbae7b755a7462478 18-Aug-2016 Adam Lesinski <adamlesinski@google.com> AppIdleHistory: Only write screen on durations during regular sync

Stop writing to disk every time the display goes off. Only write to
disk periodically.

Consequences

Previously, if the device rebooted after the screen duration was written
to disk, apps would appear more stale than they actually were.

Now apps will always look fresher, which is a better scenario.

Bug:30807864
Change-Id: Ia69a2e51fc9e397789215b449fae56fa3e29c74a
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
589fca469f8368fec886c6e6e37605a4b805bee8 14-Jul-2016 Tony Mak <tonymak@google.com> Whitelisting device provisioning package from app standby

Change-Id: Ib9cb7a3fdf7aa16a97f22eacbed872880b7f9fbe
Fix: 29892977
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
ac042501c816fa9a65aed005060ebdcfc0a0f3b2 21-May-2016 Makoto Onuki <omakoto@google.com> ShortcutManager: Implement usage report API

Bug 28536054

Change-Id: I293e8eaad523e3b0d76d562fc381601633451ed3
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
5fb47f3ed745c27ded5f901966aeefe077d98b3f 11-Apr-2016 Dianne Hackborn <hackbod@google.com> Fix issue #28118215: Crash during system boot due to null carrier apps

Change-Id: I607ccc4baf769c2fb78b0d745bf9fddc3d240855
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
ae4cde1ccebd41c9ca1af555c0a1a2580c3d7e1c 06-Apr-2016 David Brazdil <dbrazdil@google.com> Do not update idle apps on OTA

Modifies the PackageManagerService.updatePackagesIfNeeded to filter
out packages which are considered idle by the UsageStatsManager.

Bug: 27902702
Change-Id: I8847dfc283e0246265009effb6394bb774848eb3
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
bdda1e076eb30bf88749a1a349f9bb6f52434ecd 14-Mar-2016 Amith Yamasani <yamasani@google.com> Clear app idle state for removed packages

On a package being added or removed, remove
app idle state for the app.

Bug: 27570398
Bug: 26182816
Change-Id: I14bdc1f951bbd99bda8111bea56f8c9dda04148d
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
c53962d4ede82a03b62f0c8bb86bd0da090a15eb 02-Mar-2016 Jeff Sharkey <jsharkey@android.com> When system server goes down, crash apps more.

Apps making calls into the system server may end up persisting
internal state or making security decisions based on the perceived
success or failure of a call, or the default values returned.

The reality is that if the system process just died, init will be
along shortly to kill all running apps, so we should have no problem
rethrowing the RemoteException as a RuntimeException.

Bug: 27364859
Change-Id: Ife0bcb079636c88d54c44d17eb580409fd79028b
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
4ec6368f13a53906757283d50a17ed3ed43eccc4 19-Feb-2016 Amith Yamasani <yamasani@google.com> Optimize calls to TelephonyManager to check for privileged apps

Calling into TelephonyManager each of hundreds of apps to check
if the app is carrier privileged was very expensive, especially
when there aren't even any carrier access rules specified. This
change fetches all the carrier privileged apps in one call,
reducing the number of IPC calls to the radio process and checks
the package names locally.

If the carrier rules change or packages are modified, the list
will be computed and fetched again.

Other optimizations in Telephony help speed up the individual calls
to check if a package is privileged, as well.

Bug: 27271861
Change-Id: I5a77b6da4f2cdc603d2a73bd8569c5c38f06b42d
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
b1e153bcd246f838c336855e1f4c8142625eefed 18-Feb-2016 Amith Yamasani <yamasani@google.com> Reduce locking duration when checking idle states

Synchronize only the methods that need to be, so that
the lock is not held for a few hundred milliseconds, blocking
other usagestats operations.

Bug: 27208519
Change-Id: I43bda0791dd8b2576a8af506bcdc67a09a5830f2
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
ca5d6d2a814fbe4bceffa01b8c18ac05f70fbba0 16-Feb-2016 Amith Yamasani <yamasani@google.com> Clean up App Standby code

Don't continue to check idle states for removed / stopped users.
No need to check for uninstalled packages for all users.

Bug: 27208519
Change-Id: I9a3a3bbec560dd380ce90df9fef102d7f62769ca
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
a93542f9d341897f3206f775fd5720663b17504f 04-Feb-2016 Amith Yamasani <yamasani@google.com> Rewrite app standby stats

Don't mix up with usage stats. Keep a separate db and history
based on elapsed time and screen on time.

Unit tests for AppIdleHistory class.

Bug: 26989006
Change-Id: If343785b46da1db67f7c1c1263854c2732a232c6
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
538c11cf2175d4e30337e8776401bfede85866be 29-Jan-2016 Jeff Sharkey <jsharkey@android.com> Hack to get devices booting again.

If we try scheduling a pass before the system is ready, record a
pending event and dispatch once we're actually ready.

Bug: 26863668
Change-Id: I028285383c8bbe8b653aeaa7544eefe3d41277bc
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
63668e8ab04c1eb05b8d63371c3547677129f1b9 28-Jan-2016 Adam Lesinski <adamlesinski@google.com> Merge commit '5142a2d5b3f70c2017792ce04d3f254221ab3d21' into manual_merge_5142a2d5b3

Change-Id: I6681b0e132e95bd7e861e183e7369b4da07738eb
b2d3ffaa208e341b67285e761e58ea39df89f906 27-Jan-2016 Adam Lesinski <adamlesinski@google.com> Don't change screen on time on time changes

Screen on time should be measured in elapsed realtime, not wallclock.

Cause a checkIdleStates to occur when reloading stats
(on rollover and on time change).

When time changes occur in the negative direction, the new stats file
we create can overlap the previous one with regards to its end timestamp.
Use the begin timestamp to determine which of the latest stats to merge.
(b/22716352)

Bug: 26488100
Change-Id: If31b29bbbee9e98401205b5e26bce86e181286e7
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
8a6ce2cb64f4d61ee426240c539dc8b00dac857f 17-Dec-2015 Ritesh Reddy <riteshr@google.com> Enabled Backup/Restore of Package UsageStatistics

Backing up UsageStatistics using a new API in
UsageStatsService like the Notifications backup.
The backup logic is in the same package as UsageStatsDatabase
while the BackupAgentHelper resides in the android package
alongside SystemBackupAgent.

Bug: 26179323
Change-Id: I022d85fbcd4abb763230bec6eea50a7e723b5152
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
9b4716b531a26b2db4eeae307e20a38668ae6a21 22-Jan-2016 Amith Yamasani <yamasani@google.com> Check apps idle states on time changes am: c465e71cdc am: d4bd4cb4b1
am: 375901244c

* commit '375901244c051d85a63d7ca83807e5f1ca7a5d0a':
Check apps idle states on time changes
c465e71cdc401e1565c29a895a5c6d366ba5344c 22-Jan-2016 Amith Yamasani <yamasani@google.com> Check apps idle states on time changes

And ensure that the listeners are informed of app standby transitions
that might occur during time changes.

Fix for apps that sometimes don't have network access until reboot.

Bug: 26488100
Change-Id: Ic342c188a6cd19faee88f50b2c6a342a6968cb23
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
89a697a7e78de121a228b5a8d08a86ee76a40f1c 14-Jan-2016 Adam Lesinski <adamlesinski@google.com> Merge "UsageStats: Use new settings key idle_duration2 for app idle" into mnc-dr1.5-dev am: d2e215978b am: a5c7106017
am: 6a8c328d73

* commit '6a8c328d7386d19f4590dfbfc71338b1ec208fb7':
UsageStats: Use new settings key idle_duration2 for app idle
f0ef3c112683e4e04406f0355de34f4f1ac20386 13-Jan-2016 Adam Lesinski <adamlesinski@google.com> UsageStats: Use new settings key idle_duration2 for app idle

Ignores the old, re-appropriated key "idle_duration" which is now
set to a high value in order to force disable app idle on devices
with bug b/26355386

Bug:26355386
Change-Id: Iff9de843ad6e547d29c1583687fc7f7ce7e15090
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
7856f3c283e6332c22d5cee41d2e673e1dfe09f8 13-Jan-2016 Adam Lesinski <adamlesinski@google.com> UsageStats: Fix issue where initializing data for first time would cause crash

With the updated rolling window of stats for app idleness, we need to make sure
it is populated before we initialize some defaults.

Now that we look at older entries to figure out idleness, if those
entries are in the future (due to time change), set them to the current
screen on time.

Bug:26504153
Change-Id: I4c21e8f094a1a6727373368d043f523053280d7d
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
76e9d76c22fe164f301e85ebbcbdd4cae26fca71 12-Jan-2016 Adam Lesinski <adamlesinski@google.com> UsageStats: Fix issue where initializing data for first time would cause crash

With the updated rolling window of stats for app idleness, we need to make sure
it is populated before we initialize some defaults.

Now that we look at older entries to figure out idleness, if those
entries are in the future (due to time change), set them to the current
screen on time.
Bug:26504153

Change-Id: Ia22add0e8eaf0f137002bbe3e91d747fef5b7d69
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
cd65448ccd13c4c2d0fe9e9623fec3a898ab9372 09-Jan-2016 Jeff Sharkey <jsharkey@android.com> Even more PackageManager caller triage.

Finish moving all UID/GID callers to single AIDL method that requires
callers to provide flags.

Triage AppWidgets and PrintServices, which currently can only live on
internal storage; we should revisit that later.

Fix two bugs where we'd drop pending install sessions and persisted
Uri grants for apps installed on external storage.

Bug: 26471205
Change-Id: I66fdfc737fda0042050d81ff8839de55c2b4effd
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
c5967e9862489024c932b0c7fcb84ed0af2a7fd7 08-Jan-2016 Jeff Sharkey <jsharkey@android.com> More progress on triaging PackageManager callers.

Catch a bunch of simple cases where the PackageManager flags are
obvious. Add the ability to use the MATCH_SYSTEM_ONLY flag on
PackageInfo and ApplicationInfo queries.

Re-examine recent tasks after a user is unlocked, since some of the
activities may now be available and runnable.

Bug: 26471205, 26253870
Change-Id: I989d9f8409070e5cae13202b47e2c7de85bf4a5b
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
e06b4d1d9f718b9fe02980fea794a36831a16db2 06-Jan-2016 Jeff Sharkey <jsharkey@android.com> Consistent naming for PackageManager methods.

When hidden PackageManager methods take a userId argument, they
should be named explicitly with the "AsUser" suffix. This fixes
several lagging examples so that we can pave the way to safely
start passing flags to new methods without scary overloading.

Also fix spacing issues in various logging statements.

Change-Id: I1e42f7f66427410275df713bea04f6e0445fba28
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
8877120173fd62d6701822471f06fe84e992c2ae 06-Nov-2015 Mark Lu <Mark_Lu@htc.com> Fix system watchdog timeout when reading too many usage events.

Symptom:
As issue link:
https://code.google.com/p/android/issues/detail?id=193100

RootCause:
UsageStatsService.onDisplayChanged executed in system main thread,
If calling UsageStatsManager.queryEvents with too many events before it
(i.e. in daily usage event file,
too many activity resume / pause events or configuration change
during monkey test),
System will be blocked then watchdog timeout.

Solution:
Let display listener executed in background thread handler

BUG: 25355086

Change-Id: Ic894d112612400ed8fb7ba843b3309fdc4f66fe1
(Cherrypicked from 4e59db328d8b0cc163d2e3eb0f7f3a108f20a58d)
(cherry picked from commit 7018f60b06fd0c647ebf13225320d7e15d02e075)
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
ccf7d9e8ce11fd44e5b70b375ce25bed93e7153c 11-Nov-2015 Amith Yamasani <yamasani@google.com> Use correct lock for reading/writing usage stats files

Bug: 25355086
Change-Id: I65946e5afa841215f161fc25ad70b31a108a33c3
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
bdb94fe2ce45325f2f569f76a85f8183d0fc7488 11-Nov-2015 Amith Yamasani <yamasani@google.com> Merge "Fix system watchdog timeout when reading too many usage events." am: 10b0bae06f am: b3d48f18a9
am: f12ffe6d76

* commit 'f12ffe6d762f281cbda56322be83a1da80b707ea':
Fix system watchdog timeout when reading too many usage events.
f12ffe6d762f281cbda56322be83a1da80b707ea 11-Nov-2015 Amith Yamasani <yamasani@google.com> Merge "Fix system watchdog timeout when reading too many usage events." am: 10b0bae06f
am: b3d48f18a9

* commit 'b3d48f18a94c586823462c93fc0f739c83f3db78':
Fix system watchdog timeout when reading too many usage events.
b3d48f18a94c586823462c93fc0f739c83f3db78 11-Nov-2015 Amith Yamasani <yamasani@google.com> Merge "Fix system watchdog timeout when reading too many usage events."
am: 10b0bae06f

* commit '10b0bae06ffdeb79494ddd1aff19387b56770960':
Fix system watchdog timeout when reading too many usage events.
4e59db328d8b0cc163d2e3eb0f7f3a108f20a58d 06-Nov-2015 Mark Lu <Mark_Lu@htc.com> Fix system watchdog timeout when reading too many usage events.

Symptom:
As issue link:
https://code.google.com/p/android/issues/detail?id=193100

RootCause:
UsageStatsService.onDisplayChanged executed in system main thread,
If calling UsageStatsManager.queryEvents with too many events before it
(i.e. in daily usage event file,
too many activity resume / pause events or configuration change
during monkey test),
System will be blocked then watchdog timeout.

Solution:
Let display listener executed in background thread handler

Change-Id: Ic894d112612400ed8fb7ba843b3309fdc4f66fe1
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
24937d235da1648ece1866ce326da539c0ccb4bf 03-Nov-2015 Dianne Hackborn <hackbod@google.com> resolve merge conflicts of 3aee38c86e to master.

Change-Id: I9ff3f92b37e24f5f0527a0034b159920f6d7ffe1
fcc95a6d2c749d6b77eca14bf301d665d858a840 02-Nov-2015 Dianne Hackborn <hackbod@google.com> Fix issue #25357209: Could not send SMS or MMS messages, had to reboot

I think what probably happened is that since we only report an app
going in to the "interaction" state as an interaction event to usage
stats, apps that sit around in that state forever will only see one
interaction at the start and never again. So usage stats could start
thinking they are idle.

Fix this by having the activity manager report an interaction event
for such long running applications at least once a day.

Also, because it is correct and for paranoia by protected us another
way, system uids should never go in to standby.

Change-Id: I8a3805bfca86cbe78560488a649ecd07427da99a
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
9d77be8383fe7546989425a35b80509dfa054034 13-Oct-2015 Jeff Sharkey <jsharkey@google.com> am d2c95f98: am 97604b42: am 9f1ae4dc: am fe9c950a: Merge "Fix parole scheduling bugs." into mnc-dr-dev

* commit 'd2c95f9821c98604ab06fb3d7c6f617bd88ada3e':
Fix parole scheduling bugs.
5ded7af622539ded176f81951843c3c52c89a6d1 15-Sep-2015 Jeff Sharkey <jsharkey@android.com> Fix parole scheduling bugs.

There were a few subtle bugs in app idle parole scheduling that
would cause us to never end a parole period we had entered. The
updated logic in this change concentrates the registration for the
next event in one place in setAppIdleParoled().

Bug: 24050462
Change-Id: I1efe43cd6e00a547f70c4a4a37e1f3ef52a7e706
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
35eb8d6205994c0cd147840dff45d09a1a2ca705 19-Aug-2015 Dianne Hackborn <hackbod@google.com> am 1559f1c5: am 217d4568: am 8100b3fa: am 4439dcdc: am af75c17b: Fix issue #23270878: NPE in UsageStatsService while running UserManagementTest

* commit '1559f1c5a0a4db23b8338b8c4792dcb351c541f8':
Fix issue #23270878: NPE in UsageStatsService while running UserManagementTest
af75c17bca8b2f017e254131393cd72e2fe7c6e8 18-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #23270878: NPE in UsageStatsService while running UserManagementTest

Change-Id: I34d4fcdc103b3a6ea5c4ed78895f2fe18597237a
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
908109c1f909cbeeb766f551c16121ddd1a3adba 08-Aug-2015 Dianne Hackborn <hackbod@google.com> am 0385e3e9: am 8e63bbfd: am efa4dee1: am 977d421a: am f0e5501e: Merge "Fix issue #22989030: Separate battery whitelists" into mnc-dev

* commit '0385e3e908fb9988bb2d2d0d15e32cb6a819b34e':
Fix issue #22989030: Separate battery whitelists
4a503b1ece485d44c15eb02ec2bcd464b46e6f7f 07-Aug-2015 Dianne Hackborn <hackbod@google.com> Fix issue #22989030: Separate battery whitelists

We now have a new whitelist you can put apps in, which
opts them out of the old battery saver mode and new app idle,
but doesn't keep them from going in to doze. This is for a few
special cases that we had previously whitelisted for battery saver,
and inherited to the new modes... ultimately we should figure out
how to get these apps out of the whitelist completely, but this
will help for now.

Apps in this new whitelist are not shown in the UI, because they
are still significantly restricted by not being able to operate
normally in doze. This also means they are still visible in the
list of all apps for the user to be able to put them on/off the
complete whitelist if that is what they really want.

In the course of doing this, I needed to clean up code in the
network policy manager to better separate management of the
two firewall rules that now have different whitelists applied
to them. This also hopefully just generally simplifies and cleans
up that code. Hopefully!

Change-Id: I92e15f2f85899571dd8b049b5e3eb1354f55f353
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
233d94c0df13a7e54f738f442457cebc62294384 31-Jul-2015 Xiaohui Chen <xiaohuic@google.com> clean up UserHandle.USER_OWNER reference

cleaning up a few in framework/base/services.

Bug: 19913735
Change-Id: I1af5f24d9b39d6712ad3a665effa6166e32ce3d3
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
7cc902bea78dd16488d367e8ed0ccf25d4d825c2 22-Jul-2015 Wenchao Tong <tongwenchao@google.com> Ignore the active network scorer when checking for idleness

Bug: 22667334
Change-Id: I97085e653c146eff148458440bbac0a2ac64d6d2
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
fd854ee58c5d56f84047007ead9f88a767ae956f 14-Jul-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21626564: MMS should be receivied while Dozing

We now place whoever is receiving the MMS on the temporary
whitelist while doing so, so they can get network access to
download it.

There was also an issue that needed to be fixed where we
were no longer updating the list of allowed uids while
dozing based on their proc states... we now do that.

Also did a bit of optimization of the temp white list update
path do the network policy manager, instead of going through
a broadcast we now directly call in to the network policy
manager. This also allows us to have a synchronous version
of updating the list, so we can know the app has network access
before we tell it to do anything.

Finally added battery stats events for things going on and off
the whitelist so we can diagnose the behavior there.

Change-Id: Ic7fe010af680034d9f8cb014bb135b2addef7455
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
8dca36dc8a5d17315775ce216689addc5bd9be00 19-Jun-2015 Xiaohui Chen <xiaohuic@google.com> system_server: optimize app idle parole state change

Currently when app idle parole state changes, all idle apps' states
are updated one by one including firewall modifications which are
very expensive. This optimization gets rid of individual firewall
rule changes and makes sure we only modify the firewall once at child
chain level.

BUG: 21446713
Change-Id: Iafc415fe0bc127826fe17894d4fedcf1755cb17d
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
92617036fcc9b25378c8448c923d6346a012346b 20-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21930140: Add config to turn off auto power features

Doze and app standby are now off in the default platform config.
The Google overlay turns them on. Other people can do that as
well, if they are feeling like it.

Change-Id: Ic8a87f696df94f2d8354fe0772d03b672f464e32
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
37a40c24deb02bca3868a8085069afae112f22e4 17-Jun-2015 Amith Yamasani <yamasani@google.com> App Standby : Association between content providers and their sync adapter

Set sync adapters to active if the associated content providers are used
at foreground process state.

Minimize how frequently published content providers are reported by
keeping track of last reported time.

Also cache sync adapters associated with an authority in SyncManager.

Bug: 21785111
Change-Id: Ic2c8cb6a27f005d1a1d0aad21d36b1510160753a
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
a750a63d639f6936af456df904fa6b9ba941885e 17-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21814207 and issue #21814212 (alarm manager)

Issue #21814207: AlarmManager.setAndAllowWhileIdle should also allow wake locks.

Introduce a whole new infrastructure for providing options when
sending broadcasts, much like ActivityOptions. There is a single
option right now, asking the activity manager to apply a tempory
whitelist to each receiver of the broadcast.

Issue #21814212: Need to allow configuration of alarm manager parameters

The various alarm manager timing configurations are not modifiable
through settings, much like DeviceIdleController. Also did a few
tweaks in the existing DeviceIdleController impl.

Change-Id: Ifd01013185acc4de668617b1e46e78e30ebed041
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
1958e5e7870579337f1d1d3e6c6fae096ba3abb9 13-Jun-2015 Dianne Hackborn <hackbod@google.com> Fix issue #21813831: Need API for asking to be added to power whitelist

Add the API. Clean up a few related things.

Change-Id: I190adad1812f36f6095b98a1001fedb94874e8b5
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
a6232df053cdc2df9d8a1d97a5c81d55cce7a1e2 12-Jun-2015 Adam Lesinski <adamlesinski@google.com> App Standby: Convert constants to Settings.Global

Use settings instead of hardcoded constants, and listen for their changes.

Bug:21640379
Change-Id: Id8305bb234f93f7c64c1a5e82e26b31504624324
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
6776849dc5ff851a225745393f082b702754e278 09-Jun-2015 Amith Yamasani <yamasani@google.com> Report app standby state to batterystats

Also reduce idle checks to the target user if possible.
Optimized calls to some internal methods

Bug: 21639147
Change-Id: If1faf26f862e5c4ca905f2603a4ba52a8d1af954
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
c8e8729244d75584ce71a74d29c452fe538a22c5 11-Jun-2015 Adam Lesinski <adamlesinski@google.com> UsageStats: Change INTERACTION to SYSTEM_INTERACTION

SYSTEM_INTERACTION events are signals to the system for a package's
implicit actions (service bound, etc).

These should not affect the API visible stats like lastTimeUsed, etc.
USER_INTERACTION is for user initiated actions (notification interaction, etc).

Bug:21761781
Change-Id: I4585cf35fbb158612a3c737710108bec34e89183
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
b4b9ca7580c75f07330e5222cbd9ccc93b12935e 19-May-2015 Zach Johnson <zachoverflow@google.com> Ignore carrier apps when checking for idleness

Also introduce a way to check if a package has
carrier privileges for any active phone.

Change-Id: If5c5fe07f05ffc90fc21431eb27cf48030c0175b
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
af575b9f8e1b59be9c8862b6a65c0dcb88145a23 30-May-2015 Amith Yamasani <yamasani@google.com> Temporarily whitelist an app for network during doze

API to allow an app to be whitelisted for network and wakelock
access for a short period. So even if the device is in idle
mode, such apps can be given a chance to download the payload
related to a high priority cloud-to-device message.

This API is meant for system apps only.

A new permission CHANGE_DEVICE_IDLE_TEMP_WHITELIST is required
to make this call.

Bug: 21525864
Change-Id: Id7a761a664f21af5d7ff55aa56e8df98d15511ca
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
547116ea62bde21012dbda1531cb58dfe61026a7 20-May-2015 Amith Yamasani <yamasani@google.com> Use screen-on time and wallclock time for idleness calc

12 hours of screen-on time and 2 days of wallclock time
must elapse before considering an app idle.

Bug: 20066058
Change-Id: Ie7b584b40e644d868aa2708876723c3391fd432e
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
901e924392dd79c6d1b61c3bb92461585f7b3204 14-May-2015 Amith Yamasani <yamasani@google.com> Allow settings to change app inactive state

Change-Id: I57efb4b5fa69c9a268025fb1ef83de36c4cc83ca
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
0a11e69428d4c00dfcb368c1eb4e60ad8e0dc918 09-May-2015 Amith Yamasani <yamasani@google.com> Track app idle history and dump it

"dumpsys usagestats history" will show the
active state of each app for the last 100 hours,
if the device hasn't rebooted.

Bug: 20066058
Change-Id: I703e5bc121298e4363c202da56fffb0b8534bcaf
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
520d8f2ac6ad2c3cd244e1f710103b3a43a41725 09-May-2015 Amith Yamasani <yamasani@google.com> Allow exemption to idle apps at periodic intervals

Triggers are device idle mode changing as well as
internal delayed message handlers.

Bug: 20066058
Change-Id: I0627cfbcc16cfc2b8ac7d298fd2c681a5a6571dd
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
06bf824628c118fbd5ad6756913d7fd63a6f4ce5 09-May-2015 Amith Yamasani <yamasani@google.com> Idle timebase

Use screen on time as timebase for idling out apps
that have been inactive.

Store the time when an app was last active as an additional
package state in UsageStats. Compare it to screenOnTime to decide
if it's inactive.

Exclude device idle whitelist from apps that can go inactive.

Bug: 20066058

Change-Id: I709f9f31a9affa7ca6e1ae3e4c5729c5fb221669
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
e5f330456bdf5e138485ee117929fc4337866132 08-May-2015 Amith Yamasani <yamasani@google.com> Rename *AppIdle to *AppInactive per api-council

Change to setAppInactive and isAppInactive in a few places.

Bug: 20823737
Change-Id: Ie57dbc0dd2842e771bb5fd9f69b8041aacaa005c
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
e4a8da8ea241858b52d8122480316db79582c44d 01-May-2015 Amith Yamasani <yamasani@google.com> Exclude bound app widgets from idle app list

Track package names of bound app widgets and use the list when
querying for idle apps.

Bug: 20066058
Change-Id: If8039397a061ef04bb13aa38d57cd7f0221f5fc7
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
15e47235c055495ec0ccc24768a6746a960d3a61 25-Apr-2015 Amith Yamasani <yamasani@google.com> Remove network access for idle apps

Track apps going in and out of idle in the NetworkPolicyManagerService.
Apply DROP rules in firewall controller if app is to be blacklisted
for network access.

Firewall can now be in whitelist (old) or blacklist mode. When in
blacklist, it allows all by default and we can selectively DENY
some uids.

Track app idle in UsageStats and update periodically.
Track charging/discharging states.

TODO: Check for appidle temporary parole state

Bug: 20066058
Change-Id: Ia65d7544204b3bcb78a517310ef4adcc05aac6fb
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
f47e51ec605fccf7fed9e50d1adc98fbd4e8b340 17-Apr-2015 Amith Yamasani <yamasani@google.com> More usage tracking

Notification listeners can now report that a notification
has been seen by the user and that package is then marked
as active.

Bug: 20066058
Change-Id: I336040a52c44c21fd0d78b02ec9a19d448c64b40
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
cf76872a62075abf9008e99ca08413fb70761dc2 24-Apr-2015 Amith Yamasani <yamasani@google.com> Add ability to get and set idle state of apps

Add am shell command to set and get idle
Add public API to check if an app is idle

Bug: 20534955
Bug: 20493806
Change-Id: Ib48b3fe847c71f05ef3905563f6e903cf060c498
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
96a0fd65e18e5b9a0eaed3c24fd8a60a1fac1c3a 11-Apr-2015 Amith Yamasani <yamasani@google.com> Delay syncs for idle apps

Apps that haven't been in use for a while and are considered idle
are not synced until the device is charging or the app is used.

Bug: 20066058
Change-Id: I3471e3a11edae04777163b0dbd74e86495743caa
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
55717a613c23fc6b05cab86c3b0de283a027e9f6 04-Apr-2015 Amith Yamasani <yamasani@google.com> Mark apps as not-idle at least once

On a fresh boot or update to M, mark existing apps
as being used if there is no existing entry in the
usage stats. On subsequent OTAs, make sure that at
least the new system apps are marked as used.

Reduce idle threshold to 1 day.

Bug: 20066058
Change-Id: I9a273c051d04432877bacd381c85bf6e721c1a85
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
b0ff32245cb6b51e43dd3ee40b86d683c62de2b9 04-Mar-2015 Amith Yamasani <yamasani@google.com> Throttle jobs for idle apps

First pass at delaying jobs from apps that are idle.

TODO: Throttle syncs
TODO: Provide a periodic point at which apps are checked for idleness.

Apps that switch to foreground process state are tracked by UsageStats
as an INTERACTION event that affects the last-used timestamp.

JobScheduler's logic for when an app is ready is trumped by the idleness
of the app, and only if the battery is not charging. When charging state
changes, we update the idle state of all the tracked jobs.

android package is whitelisted.

Bug: 20066058
Change-Id: I0a0acb517b100a5c7b11e3f435f4141375f3451f
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
978a1ed5aa2752cd36ff51df91d2d2d8be2171d9 02-Mar-2015 Adam Lesinski <adamlesinski@google.com> Add generic "INTERACTION" event type to UsageStatsManager

This will allow for updating a package's last time used
property for packages that are interacted in ways other than
launching their activities (interacting with notifications, etc.)

Change-Id: Ic6f9519f46fa04abd37ea6fc9475bcd9ea721003
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
720a5c51beb5beab442832ea8d169aa5b4edb43f 30-Oct-2014 Adam Lesinski <adamlesinski@google.com> Merge "Add dumpsys output to UsageStatsService, along with --checkin support" into lmp-mr1-dev
1bb18c435dbf967f3a9bc9d680411471b8bab4ac 18-Aug-2014 Adam Lesinski <adamlesinski@google.com> Add dumpsys output to UsageStatsService, along with --checkin support

Bug:17814138
Change-Id: If414ae5f4b8e4a2838f63f52d80e764915cee934
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
7eb599b267d00cbde891c0a87924f2f5086f4497 23-Oct-2014 Jeff Hao <jeffhao@google.com> Get UsageStats if no PackageUsage is available for boot dexopt filtering.

Bug: 17191977
Change-Id: I33e18459e49afa42b8e8218574a2434e5205a6da
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
3bab7c188d5e823484eda5c0f3df7759ce4a6c98 12-Sep-2014 Adam Lesinski <adamlesinski@google.com> Merge "UsageStats should deal with changing time" into lmp-dev
66143fa5b34eea7413335111838fb692987b611a 11-Sep-2014 Adam Lesinski <adamlesinski@google.com> UsageStats should deal with changing time

When the system time is changed, the UsageStats API
will modify all existing entries to correspond with the
new time change. If the time changed when the device was
off, stats in the future will be deleted.

Change-Id: Ica3e9917d4d1a180f97700e52ab390e3673e1e82
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
8cd28b57ed732656d002d97879e15c5695b54fff 09-Jun-2014 Amith Yamasani <yamasani@google.com> Apply cross-user restrictions to Shell

Even though Shell user is allowed to perform cross-user actions,
lock that path down if the target user has restrictions imposed by
the profile owner device admin that prevents access via adb.

If the profile owner has imposed DISALLOW_DEBUGGING_FEATURES, don't
allow the shell user to make the following types of calls:
start activities, make service calls, access content providers,
send broadcasts, block/unblock packages, clear user data, etc.

Bug: 15086577
Change-Id: I9669fc165953076f786ed51cbc17d20d6fa995c3
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
37a46b48dcb7e34ee3669cfb2ed78af08bfca3c7 06-Sep-2014 Adam Lesinski <adamlesinski@google.com> Store time offsets for UsageStats XML

This will make adjusting for time changes easier
in the future.

Change-Id: I49d2dda4cc6dcb1378a58c814849924f585e0417
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
d26bea3a1498d1b327ae37cc796fb8cd67e9c977 04-Sep-2014 Adam Lesinski <adamlesinski@google.com> Returns UsageEvents from previous days

- Avoid writing to disk when querying UsageStats.
- Use new UnixCalendar to avoid issues with Locale and TimeZone.

Bug: 16951313

Change-Id: I2473b8ef8dc1e2f6be22d4c689b96e346bdcafd5
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
7f61e96db7c90c1f4418359672aa4656aebee500 03-Sep-2014 Adam Lesinski <adamlesinski@google.com> Add Configuration changes to UsageStats

Bug:17354208
Change-Id: I9b2f595e51b656607e30e798926cfb7e25134944
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
9d9607527f5bbf49c96565b63b90e36276b0dda7 25-Aug-2014 Adam Lesinski <adamlesinski@google.com> Split up ComponentName in UsageEvents.Event

Some events in the future may not have originated
from a class, so we shouldn't be using ComponentName.

Bug:17259858
Change-Id: Id7fe3245b91596cf27ae4ec51655602f01665622
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
9a0b289f060e68e42d3db0b843d55cf920f3da12 12-Aug-2014 Adam Lesinski <adamlesinski@google.com> Fix NPE in UsageStats for new User

Bug:16946585

Change-Id: Ibd0d674681f3f49087305cea33ce7292f5d2229d
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
3516800b611a79339a3c188332d13a26e9086b09 22-Jul-2014 Adam Lesinski <adamlesinski@google.com> Second iteration of the UsageStats API

Based on feedback from API council, updated the API.
Also added support for querying the event log.

Change-Id: Ibaa008b9e5bd145acdfe8e20c25c2ed2d96be123
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
3c153519ca5f2b66b88901374383f943c9d77df7 24-Jul-2014 Adam Lesinski <adamlesinski@google.com> Add Per-User logging of UsageStats

Change-Id: I4518c5d3c56b3821292accb886f9fb21f3a8b25f
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
e159e2e0b83f9ea9d48f4c8666f9536e9338a70c 23-Jul-2014 Adam Lesinski <adamlesinski@google.com> Add test UsageStats App

Also fixed UsageStatsService to do the right thing
when AppOps returns MODE_DEFAULT.

Change-Id: I0bdb28350fb2528daf2859cdcbbf9ca48d96dde9
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
53ab92d89069fb0178ba98eb641a6fc87145543a 21-Jul-2014 Adam Lesinski <adamlesinski@google.com> Change UsageStatsService to check uses-permission

Have UsageStatsService check permission grants when AppOps
returns the default MODE_IGNORED mode for a package.

Change-Id: I784a708451a56863b13fc5f178e10bba6ce37a2f
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java
0debc9aff4c0cbc28e083a948081d91b0f171319 17-Jul-2014 Adam Lesinski <adamlesinski@google.com> 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
/frameworks/base/services/usage/java/com/android/server/usage/UsageStatsService.java