Update the time remaining parameter of #registerAppUsageLimitObserver to
time used to avoid confusion between time limit and time remaining.
Bug: 128414428
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: Ied8e4ca0b8636bb9efc4d85dcae46ac6cf1ef5f7
UsageStatsManager#registerAppUsageLimitObserver now accepts the time
remaining in addition to the total time limit.
The API now also uses java.time.Duration instead of long+TimeUnit for
the total time and remaining time.
Bug: 124272203
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: I6f85ca9295cad46e10a30035b67e6210ae5c1886
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
The Usage Reporting Api allows apps to report usage within the app to
platform. Apps with the the OBSERVE_APP_USAGE permission may register
observers that use the reported in-app usage.
Test: manual (using the included Usage Reporter App)
Test: atest CtsUsageStatsTestCases:UsageReportingTest
Test: atest FrameworksServicesTests:AppTimeLimitControllerTests
Bug: 112486938
Change-Id: Iddd6f0993bbbf68a2032b34d473ef8d67da7747a
1. Add UsageStats Event types:
ACTIVITY_RESUMED is synonym to existing MOVE_TO_FOREGROUND.
ACTIVITY_PAUSED is synonym to existing MOVE_TO_BACKGROUND.
ACTIVITY_STOPPED when an activity becomes invisible on the UI.
2. In UsageStats.java, add API getLastTimeVisible() to report last time the
app is visible (ACTIVITY_RESUMED or ACTIVITY_PAUSED), add API getTotalTimeVisible()
to report total time the app is visible.
The existing API getLastTimeUsed() can report last time the app is in
foreground (AKA have focus).
The existing API getTotalTimeInForeground() can report total time the
app is in foreground (AKA have focus).
3. UsageStats.getTotalTimeVisible() can report screen usage for
split-screen mode and picture-in-picture mode.
4. Because in the same package, activity can be instantiated multiple times,
In UsageEvents.Event class, add a member mInstaceId for activity's
instance ID, add interface getInstanceId() to retrieve the instance ID.
Bug: 112002260
Test: frameworks/base/services/tests/servicestests/src/com/android/server/usage/UsageStatsDatabaseTest.java
atest frameworks/base/core/tests/coretests/src/android/app/usage/UsageStatsTest.java
Change-Id: Ibcef2488e9620804c9f9220b027f976e8fa0c98b
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
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
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.
Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.
Test: make relevant packages
Bug: 73535841
Change-Id: I4233b9091d9066c4fa69f3d24aaf367ea500f760
- 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
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
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
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
- Fix documentation to mention units of time in APIs.
- Return a Map instead of an ArrayMap
Bug:17289531
Change-Id: I0a2cfdc0bc003eeeb65a16e37bb7b991624b2853
Some events in the future may not have originated
from a class, so we shouldn't be using ComponentName.
Bug:17259858
Change-Id: Id7fe3245b91596cf27ae4ec51655602f01665622
Based on feedback from API council, updated the API.
Also added support for querying the event log.
Change-Id: Ibaa008b9e5bd145acdfe8e20c25c2ed2d96be123