OSDN Git Service

Wire up storage stats API to installd.
authorJeff Sharkey <jsharkey@android.com>
Tue, 10 Jan 2017 01:21:21 +0000 (18:21 -0700)
committerJeff Sharkey <jsharkey@android.com>
Tue, 10 Jan 2017 05:30:58 +0000 (22:30 -0700)
commit8dedad31f7fa604028ee6d28963bcc564e76c467
tree56b0761b6cc37c6e56b639358edde3d7efb6db00
parentbd439dcef072fd9a853a6bc9055cfa347ad7c969
Wire up storage stats API to installd.

Now that installd has the implementation details we need, we can wire
up the public APIs to use them.

Shuffle APIs around a bit so that StorageStats can be reused for both
UID and UserHandle results, and rename StorageSummary to
ExternalStorageStats.  Provide getTotalBytes() and getFreeBytes() as
first-class methods so we can answer those questions quickly without
paying the cost of measuring external storage details.

Current costs on a typical device with a test account after flushing
dentry caches:

queryStatsForUid() manual: 6922ms
queryStatsForUid() quota: 525ms

queryStatsForUser() manual: 1686ms
queryStatsForUser() quota: 113ms

queryExternalStatsForUser() manual: 42ms
queryExternalStatsForUser() quota: 2ms

For verification purposes, a new "fw.verify_storage" system property
can be set to compute both manual and quota statistics, and log any
discrepancies.

Test: builds, boots
Bug: 2794881732206268
Change-Id: I4ea3df3372a7379aa8cf4c20c44120c8f0702c15
12 files changed:
Android.mk
api/current.txt
api/system-current.txt
api/test-current.txt
core/java/android/app/usage/ExternalStorageStats.aidl [moved from core/java/android/app/usage/StorageSummary.aidl with 95% similarity]
core/java/android/app/usage/ExternalStorageStats.java [new file with mode: 0644]
core/java/android/app/usage/IStorageStatsManager.aidl
core/java/android/app/usage/StorageStats.java
core/java/android/app/usage/StorageStatsManager.java
core/java/android/app/usage/StorageSummary.java [deleted file]
services/tests/servicestests/src/com/android/server/pm/InstallerTest.java
services/usage/java/com/android/server/usage/StorageStatsService.java