Provide app launch count in UsageStats

This counts the number of times the app was launched from outside
the app and ignores intra-app activity transitions.

Introduce a new permission for registering to observe app usage.

Fixes a bug where Settings couldn't force the app into another
bucket if it was recently launched.

Bug: 74335821
Fixes: 76100712
Test: Manual test using Settings
Test: UsageStatsTest to verify permission change
Change-Id: Ibd343c1cfa37089a3ac6fc30ba3194e21a9be499
This commit is contained in:
Amith Yamasani
2018-03-20 19:37:46 -07:00
parent 9531b70cae
commit bc813eb26e
10 changed files with 103 additions and 38 deletions

View File

@@ -10,6 +10,7 @@
>
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<uses-permission android:name="android.permission.OBSERVE_APP_USAGE" />
<application android:label="Usage Access Test">
<activity android:name=".UsageStatsActivity"