6 Commits

Author SHA1 Message Date
Varun Shah
2546cef56c Added APIs for App Usage Limits.
Added a new AppUsageLimit group observer which follows the same pattern as
other UsageGroups. This specific observer allows the launcher to query
for the AppUsageLimit, available via the new LauncherApps API below. The
observer can be registered and unregistered via the respective new APIs in
UsageStats.

LauncherApps has a new API which allows it to get the AppUsageLimit for
a specified package and user, initally set via the API in UsageStats.
This new API allows the launcher to query specifics about the limit such
as how much usage time the limit has, and how much total usage time is
remaining.

Bug: 117409586
Test: atest FrameworksServicesTests:AppTimeLimitControllerTests
Test: atest android.app.usage.cts.UsageStatsTest#testObserveUsagePermissionForRegisterObserver
Test: atest android.app.usage.cts.UsageStatsTest#testObserveUsagePermissionForUnregisterObserver
Test: manual (mmma frameworks/base/tests/UsageStatsTest/)
Change-Id: Ifaffab629409e9191e40404a949c8df70bd3f7cb
2019-01-23 20:30:25 -08:00
Amith Yamasani
bc813eb26e 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
2018-03-22 13:51:57 -07:00
Amith Yamasani
62ec27e97f App Time Limits API in UsageStats
Allow setting groups of apps to control usage time limits on.
Applies only to activity time in the foreground.

Updated UsageStatsTest app to be able to add an observer for
a 30 second timeout across multiple comma separated package
names.

Bug: 74335821
Test: atest FrameworksServicesTests:AppTimeLimitControllerTests
      Install and run frameworks/base/tests/UsageStatsTest

Change-Id: I677c30b4f211f7acf72c9766df3d8c1ac56a4b4e
2018-03-15 17:07:28 -07:00
Makoto Onuki
ad623015a1 Restrict access to instant app data in usage stats
- Events are obfuscated based on whether the app was instant or not at
the time each event was logged.

- UsageStats are obfuscated based on whether each app is instant or
not at the moment.

Bug 38202133
Test: Manual test using UsageStatsTest and instant apps

Change-Id: I3c74309196b88d010d317cb0dd6749bf4624e876
2017-05-16 12:33:43 -07:00
Adam Lesinski
3516800b61 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
2014-08-08 12:08:15 -07:00
Adam Lesinski
e159e2e0b8 Add test UsageStats App
Also fixed UsageStatsService to do the right thing
when AppOps returns MODE_DEFAULT.

Change-Id: I0bdb28350fb2528daf2859cdcbbf9ca48d96dde9
2014-07-22 18:21:58 -07:00