History log of /frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
d5f25d2cd882c89965b6538082556d9469f72288 23-May-2018 Makoto Onuki <omakoto@google.com> Tweak exemption for sync requests made by FG apps

Exemption given to a sync request made by a foreground app (including
PROCESS_STATE_IMPORTANT_FOREGROUND).
At the schedule time, we promote the sync adapter app for a higher bucket:
- If the device is not dozing (so the sync will start right away)
promote to ACTIVE for 1 hour.
- If the device is dozing (so the sync *won't* start right away),
promote to WORKING_SET for 4 hours, so it'll get a higher chance to be started once the
device comes out of doze.
- When the sync actually starts, we promote the sync adapter app to ACTIVE for 10 minutes,
so it can schedule and start more syncs without getting throttled, even when the first
operation was canceled and now we're retrying.

Test: atest cts/tests/tests/syncmanager/
Test: Manual test with "requestsync -f" and "am set-standby-bucket", while checking
"dumpsys usagestats"
Test: settings put global app_idle_constants \
exempted_sync_scheduled_nd_duration=1,exempted_sync_scheduled_d_duration=2,exempted_sync_start_duration=3
and check "dumpsys usagestats" and make sure the constants are properly updated.
Fixes: 72443754

Change-Id: I233d8e4be85769150830bac798abc04810f4cc7b
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
5ca5cb6c5350d8f79beb418251cad90eb152813e 26-Apr-2018 Michael Wachenschwanz <mwachens@google.com> Add Stable Charging Threshold for AppStandby

Delay parole when charging to ensure the device has some time to charge
and avoid a spike is activity on plug in.

Change-Id: If85f097249aeed6b64f43a22f4d25ff0a070febb
Fixes: 78040839
Test: atest AppStandbyControllerTests
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
3154dcf94a4f451d2b32607b30cdd070e61bd2ae 28-Mar-2018 Amith Yamasani <yamasani@google.com> Fallback to ML prediction after short ACTIVE states

When an app is temporarily elevated to ACTIVE state for some
reason, keep track of the last predicted bucket and drop back
to that if the ACTIVE state ends.

Also keep track of prediction during a forced ACTIVE state, even
if it's not applied right away.

Bug: 77158823
Test: atest AppStandbyControllerTests
Change-Id: Ic6de6c24bb25c5392ac5b41a2c05889d94f23436
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
7f53c7bc975041cb3ba1be7a1e33d305abaf1ddf 26-Mar-2018 Amith Yamasani <yamasani@google.com> Shorter bucket elevation for system_interaction and sync_adapter

Don't keep the app in ACTIVE for too long after an indirect
use of the app. Also don't mark as used, so bucketing algorithm
can override quickly.

Bug: 74340258
Test: atest AppStandbyControllerTests
Change-Id: I3b8014873aaf881de07304b64039da211a63a525
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
1918ef7569e90c70246e535478b26732b82d92d3 14-Mar-2018 Jason Monk <jmonk@google.com> UsageEvents for slices pinning

Test: atest frameworks/base/services/tests/servicestests
Bug: 73455786
Change-Id: I6a37f5525c29d3f47aa37e262c8834840309ba44
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
119be9a5fc4033eba570ec94b94862401ee84570 19-Feb-2018 Amith Yamasani <yamasani@google.com> Improve reporting of bucketing reason

Keep track of main and sub reason for bucket change

Bug: 73178753
Test: atest AppIdleHistoryTests
Change-Id: I4936281ac06046bb5ffed9f3306efa24c7fd47ab
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
bbbad9cc0fc1def37bcec1fc8626e3c0ab6e3491 11-Feb-2018 Amith Yamasani <yamasani@google.com> Cascading timeouts for App Standby

Fixes overlapping of predictions, strong usage events
and mild usage events which have forced durations.

Having separate timeouts for ACTIVE and WORKING_SET
and moving between them when necessary prevents
getting stuck in the wrong state (higher) for longer
than necessary.

Bug: 73294677
Test: atest FrameworksServicesTests:AppStandbyControllerTests
Change-Id: I35530e62cffe2c86945b5da64a41704f807708ce
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
777b1537c2d8afbd3a422bb64d6f5f2f101dc1c3 29-Jan-2018 Amith Yamasani <yamasani@google.com> Fix an issue with apps EXEMPTED after OTA

After an OTA, all system apps were being
pushed into EXEMPTED for 4 hours because
of a race with the boot phase resulting in
it appearing as if app standby was disabled.

Another bug in updating the state out of EXEMPTED
was preventing checkIdleStates() from fixing
the issue soon after.

Bug: 72835804
Test: Manual:
Manually delete /data/system/usagestats/version
Reboot
Verify that correct apps are EXEMPTED
Automated:
atest FrameworksServicesTests:AppStandbyControllerTests
Change-Id: Ib53f0c45e5c2e2456442f6782ad5ca9b9d0c3d72
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
101c353a7d039b352cbfe9146807f072ff340469 09-Jan-2018 Sudheer Shanka <sudheersai@google.com> Update DPMS to push active admins info to UsageStatsService.

Bug: 71710099
Test: atest services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
Test: atest services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Change-Id: Ia46be9008470b0228978306b9992560fc4f2c586
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
53f06eae611ffa559f80d9efaddba17544eb7819 06-Jan-2018 Amith Yamasani <yamasani@google.com> Track last job run time

JobScheduler can store the last job run time
for an app and use it later to help with
throttling.

Also, allow reporting a usage for a temporary
period. This will put the app in ACTIVE for a
minimum specified period during which timeouts
and predictions will not be able to reduce the
bucket level.

Bug: 71536897
Test: atest AppIdleHistoryTests
atest AppStandbyControllerTests
Change-Id: I2985f7f3766671f15ea641972346c69875f17946
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
9388519d5e66a84485f8951242b9756e586a85ac 13-Dec-2017 Amith Yamasani <yamasani@google.com> Don't allow certain bucket overrides

Don't allow EXEMPT to be overridden
Differentiate between shell and other callers who set
buckets.
Don't allow forced to be modified by bucketeer.
Don't allow bucketeer to modify NEVER bucket.

Fix a locking issue in listeners list. Don't use
the primary lock when calling out to listeners.

Fixes: 70622791
Fixes: 70622338

Test: atest FrameworksServicesTests:AppIdleHistoryTests
atest FrameworksServicesTests:AppStandbyControllerTests
atest CtsAppUsageHostTestCases
Change-Id: I22309478b947d6461235f5a77e08c7be86309e4b
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
bd7b302f91f225f2dd2367cc37db9d2b75aec521 07-Dec-2017 Amith Yamasani <yamasani@google.com> Timeout app predictions after 12 hours

Ignore predicted bucket if it's been too long since the
last update, and use internal timeout logic to set
standby buckets.

Keep track of last predicted time and persist it.

Bug: 70219058
Test: atest FrameworksServicesTests:AppStandbyControllerTests

Change-Id: Ib2992201d204b92fdd4a0a00754d81e7bbfc292f
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
afbccb7d37647f6da61ebcc52a598c7a9f54bc3f 27-Nov-2017 Amith Yamasani <yamasani@google.com> Expose App Standby APIs for apps and system

Allow apps to query their own standby bucket.
Allow privileged apps with PACKAGE_USAGE_STATS permission to
query apps.
Allow privileged apps with CHANGE_APP_IDLE_STATE to set the
standby state for apps, but not for themselves.
Removed AppStandby class and moved constants into UsageStatsManager.

Bug: 63527785
Test: cts-tradefed run cts-dev -m CtsAppUsageHostTestCases
Change-Id: I3c1c20f6ecb6d54e248233696039286b243d663c
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
301e94a9ef8bebfbe76ba92ef4756969c65a0073 18-Nov-2017 Amith Yamasani <yamasani@google.com> Shorter thresholds for app standby

Start off with slightly more aggressive timeouts to
switch between buckets. 12Hrs, 24Hrs and 48Hrs.

Bug: 63527785
Test: atest AppStandbyControllerTests
Change-Id: I4aa0cc38ef91538192eda0f48dd3840217aa49c4
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
803eab6906427517b22c7fd42b21dbf57456eb72 10-Nov-2017 Amith Yamasani <yamasani@google.com> Add a new usage event type for seen notification

On a notification becoming visible, NOTIFICATION_SEEN event is
dispatched. This will only bump up the app's bucket to WORKING_SET and
no higher. Same goes for sync adapters associated with a content
provider. Only move them to WORKING_SET.

Updated NotificationManagerService to report event to usagestats on
visibility changes.

Bug: 63527785
Test: runtest -x
frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
atest NotificationManagerServiceTest
Change-Id: I5b132e1fc1f70e2126473b43b9b1979fbc523b85
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
84cd7b7a9e5ad6a604c075bc620f6bd9ab6b1486 07-Nov-2017 Amith Yamasani <yamasani@google.com> Allow standby timeouts to occur after usage

And inform listeners when the bucket changes, not just when
going in and out of RARE bucket.
Avoid redundant callbacks when informing listeners.

Bug: 63527785
Test: runtest -x
frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
Change-Id: Icd98d59f597147fbf8ea4bf44edf4b3b3d5c8e14
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java
17fffee4908f11038ba9cc5a672d15cb25be3dfe 29-Sep-2017 Amith Yamasani <yamasani@google.com> App Bucketing for Standby

Manage the standby bucket in AppStandbyController

Default implementation of bucketing based on simple timeout:
ACTIVE, if recently used
12 hrs to move to WORKING_SET
2 days to move to FREQUENT
7 days to move to RARE
(subject to change)

RARE bucket equates to the old "idle" or "inactive" state for
an app.

Bug: 63527785
Test: AppStandbyControllerTests.java
Change-Id: I970d7afcdf47c31a9413da8fd4852066a13676a2
/frameworks/base/services/tests/servicestests/src/com/android/server/usage/AppStandbyControllerTests.java