History log of /frameworks/base/core/java/android/os/storage/StorageManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
b31afd22737e847280213878cd94872055871654 12-Jun-2017 Jeff Sharkey <jsharkey@android.com> Improve developer docs for storage APIs.

No code changes; only docs.

Test: builds
Bug: 38508833, 37987197, 37978296
Change-Id: Idfeb680480b2f818d18f787cbf20ceab896763a2
/frameworks/base/core/java/android/os/storage/StorageManager.java
2063e4f6ba6cb606db3dfd5b67927ec36ea78f68 07-Jun-2017 Jeff Sharkey <jsharkey@android.com> Remove old FUSE bypass now that we have sdcardfs.

This forces everyone to go through sdcardfs, instead of letting them
around the back door.

Test: builds, boots
Bug: 38231314, 27992761
Change-Id: I97b24d25599c7f86f9b535689e2f4ecf68261dac
/frameworks/base/core/java/android/os/storage/StorageManager.java
bfc4fcde9f756337fc8d0867ff04549b08688fff 06-Jun-2017 Jeff Sharkey <jsharkey@android.com> Give Doclava our manifest; more permission docs.

We've seen some @SystemApi methods protected with non-system
permissions, so give Doclava the platform AndroidManifest.xml so it
can parse the actual permission protection levels to look for APIs
that are letting in non-system apps.

Also document more @SystemApi permissions.

This is purely a docs change; no logic changes are being made.

Test: make -j32 update-api
Bug: 62263906
Change-Id: Ie0f0a5fb0033817bcc95060f2183a52ae4ae7b06
/frameworks/base/core/java/android/os/storage/StorageManager.java
d86b8fea43ebb6e5c31691b44d8ceb0d8d3c9072 03-Jun-2017 Jeff Sharkey <jsharkey@android.com> Annotate @SystemApi with required permissions.

Most @SystemApi methods should be protected with system (or higher)
permissions, so annotate common methods with @RequiresPermission to
make automatic verification easier.

Verification is really only relevant when calling into system
services (where permissions checking can happen on the other side of
a Binder call), so annotate managers with the new @SystemService
annotation, which is now automatically documented.

This is purely a docs change; no logic changes are being made.

Test: make -j32 update-api && make -j32 offline-sdk-docs
Bug: 62263906
Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
/frameworks/base/core/java/android/os/storage/StorageManager.java
ddff807b762a8a455287abc97aea8f97b98fb104 26-May-2017 Jeff Sharkey <jsharkey@android.com> Consistent "low storage" behavior.

When answering the question "how much space is free", use the same
logic for Settings UI and StorageManager.getAllocatableBytes(). That
is, the reported free space is usable bytes plus any cached data the
system is willing to delete automatically.

This does *not* include any reserved cache space, since we don't want
abusive apps to penalize other well-behaved apps that are storing
their data in cache locations. Callers freeing cached data need to
now explicitly request defiance of the reserved cache space. (Most
callers are already doing this by using FLAG_ALLOCATE_AGGRESSIVE.)

Rewrite the core logic of DeviceStorageMonitorService to understand
this new "reserved" cache space, and to be easier to understand. It
also now handles cached data on adopted storage volumes, which had
been ignored until now. Also fix bug where we had skipped "low"
broadcasts when the device skipped directly from/to "full" state.

Bug: 38008706
Test: cts-tradefed run commandAndExit cts-dev -m CtsJobSchedulerTestCases -t android.jobscheduler.cts.StorageConstraintTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Change-Id: Icbdcf3b52775f7ada1ceaeff2f96094c8d8052f9
/frameworks/base/core/java/android/os/storage/StorageManager.java
ee67b61bb08ab09be413f181f948f6359f4c256d 27-Apr-2017 Rubin Xu <rubinxu@google.com> Invoke BLKSECDISCARD to securely delete sensitive data

Bug: 34600579
Test: manual - change device lock under synthetic password, verify
old data on disk is erased.

Change-Id: I247bd1f095dd27335e671981f9e2d77e149af84f
Merged-In: I247bd1f095dd27335e671981f9e2d77e149af84f
/frameworks/base/core/java/android/os/storage/StorageManager.java
4315c1e3d541912eb13ec6a7e0873fb8896f878f 28-Apr-2017 Jeff Sharkey <jsharkey@google.com> Merge "@hide non-Handler variant of SM.openProxyFileDescriptor" into oc-dev
2443a091b1dd379f6a3732b57299ac1690cbcd5a 28-Apr-2017 Daichi Hirono <hirono@google.com> @hide non-Handler variant of SM.openProxyFileDescriptor

Bug: 37749462
Test: Build succeeded
Change-Id: I2e3d0cf9e219353eae4dae384c93d99b9ef60ea9
/frameworks/base/core/java/android/os/storage/StorageManager.java
a4d34d971c9566a162a53e6b027ba2bc341ae5b4 27-Apr-2017 Jeff Sharkey <jsharkey@android.com> Respond to API council feedback.

Move aggressive allocation to @SystemApi, which means we can hide
the "flags" API variants.

Remove UUID APIs, since we should use existing Serializable APIs.

Relax permission checks to allow apps to ask for their own stats.

Improve docs.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 37534687, 37534941, 37718184, 37738770
Change-Id: I6a763fb3ab3169c8d3329765bb31e1ee08d9ced7
/frameworks/base/core/java/android/os/storage/StorageManager.java
4b32f7c676e014c3d59aac280be6a159cef3d4b8 21-Apr-2017 Jeff Sharkey <jsharkey@google.com> Merge "Fix code accounting bugs, track external app data." into oc-dev
60a82cd4c29ade3e03ac0d1305e701471e40b7cf 19-Apr-2017 Jeff Sharkey <jsharkey@android.com> Flesh out more API docs.

Flesh out docs for Context.getCacheDir(), Intent.addFlags(),
Intent.removeFlags(), and PackageManager.setApplicationCategoryHint().

Test: builds, boots
Bug: 37470473, 37327774, 35812899
Change-Id: Ided031185258a89c3e275d65c162d537065ad49e
/frameworks/base/core/java/android/os/storage/StorageManager.java
0034788844fd053f87beee60092c1dd44c7046e2 18-Apr-2017 Jeff Sharkey <jsharkey@android.com> Fix code accounting bugs, track external app data.

When counting code size, don't include APKs baked into the system.

Settings already accounts external storage used by apps, so they
need a way to exclude that from the total space used by external
storage; give them new getAppSize() API.

Refine docs to explain that emulated storage might be included in
measured statistics.

Resolve symlinks as part of matching getUuidForPath().

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 35812899, 35844919, 37193650
Change-Id: Iec3ce8b336b71dc98a7d25fdd30fa78e9ee826dc
/frameworks/base/core/java/android/os/storage/StorageManager.java
789a8fc792725e4988ff43d554b3c8c037c41921 16-Apr-2017 Jeff Sharkey <jsharkey@android.com> Storage API polishing.

Based on API council feedback, switch to using real UUID objects
instead of Strings. Since UUID is a general-purpose utility class
that will be passed around quite a bit, add it to Parcel and Bundle.

Define well-known namespaced UUID values for "default" and "primary
physical" storage devices, which will let us annotate a bunch of
things with @NonNull.

Define new extras for MANAGE_STORAGE intent that apps can use to
signal where and how much space they'd like the user to free up.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 37325923, 35812899, 35806020
Change-Id: I8421b126d680f69141a361c1e77223fe2bf4a325
/frameworks/base/core/java/android/os/storage/StorageManager.java
24403ff054f5c3086d297cafb8e928f3ac7c2f5b 04-Apr-2017 Jeff Sharkey <jsharkey@android.com> Just round up the data partition size.

Instead of trying to be clever by poking at underlying flash part
sizes, rely on the fact that device storage printed on retail
packaging is a power-of-two value.

For a typical device with a 23GiB data partition, this will return
a value of "32GB" which matches the retail packaging.

Test: builds, boots
Bug: 34827187
Change-Id: Ib4cf7f637dffc9238252e1fedcd86dc8b5cf656d
/frameworks/base/core/java/android/os/storage/StorageManager.java
812c95d37dccf8a1fcef55c6999c6d69ecbac400 08-Feb-2017 Daichi Hirono <hirono@google.com> Allow apps to process ProxyFDCallback asynchrnously.

Previously callback methods of ProxyFileDescriptorCallback were invoked
on a background thread prepared in the framework. So all methods were
invoked and processed synchronously. This was problem because if it took
time to fetch bytes of one file, operations for other files were also
blocked.

The CL changes ProxyFileDescriptorCallback methods to be invoked on
Handler passed by apps. Now application can prepare a Handler per file
so that one file does not block others.

Bug: 35229514
Test: cts-tradefed run cts -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest#testOpenProxyFileDescriptor_async
Change-Id: Ibadc4aad4c0373a3da586459a8f775e40288c895
(cherry picked from commit 4f156065c860d916b649e2b464e9405cafc732e9)
/frameworks/base/core/java/android/os/storage/StorageManager.java
e53e2d9576cbcf6fc2bd9c8674e162bef7297226 26-Mar-2017 Jeff Sharkey <jsharkey@android.com> Add a new "virtual disk" feature.

It's extremely difficult to test storage related logic on devices
that don't have physical SD card slots. So to support better
debugging and testing, add a new "virtual disk" feature which mounts
a 512MB file through loop device.

Also move ParcelFileDescriptor.open() over to using Os.open() so
that it gets StrictMode treatment.

Bug: 34903607
Test: builds, boots, virtual disk works
Change-Id: I072a3a412cfcc8a2a3472919b7273a1ed794fd98
/frameworks/base/core/java/android/os/storage/StorageManager.java
b5a35b8181fc1fc0d854b69e42d277b89d87ad53 23-Mar-2017 Jeff Sharkey <jsharkey@android.com> Refactor cache behavior from "atmoic" to "group".

Using the word "atomic" has too much baggage relating to locking
guarantees, so move to something softer.

Add isQuotaSupported() for CTS tests.

Move CacheQuotaStrategy over to using SparseLongArray, which has a
more efficient memory footprint inside the system server.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.StorageHostTest
Bug: 35812899, 35684969, 36482620
Change-Id: I894f53e6f3bc76c77d1bb18c51db14833df14a49
/frameworks/base/core/java/android/os/storage/StorageManager.java
2277480ef2b2263c4418f9096f88a8edb0408efa 08-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Add metric for openProxyFileDescriptor."
d61817e07fc6dc6911ab097697dcae698e832b7a 13-Feb-2017 Daichi Hirono <hirono@google.com> Add metric for openProxyFileDescriptor.

Bug: 35300828
Test: None
Change-Id: I5175a8ab51ef4d93d032777a71295874a1189969
/frameworks/base/core/java/android/os/storage/StorageManager.java
09734df8bc5a2b788c923ec1a8b78e4cb67f5e70 08-Mar-2017 Jeff Sharkey <jsharkey@android.com> Grumble, nobody likes kibibytes.

All the cool kids are using storage in increments of 1000 instead
of 1024, so find a balance somewhere between the two. We still round
to nice values like 32GB, 64GB, etc, but we represent them using
kilobytes under the hood.

Test: runtest -x frameworks/base/core/tests/coretests/src/android/os/FileUtilsTest.java
Bug: 28327846
Change-Id: I573aea43790816291e2b5c784b344b51b4444c06
/frameworks/base/core/java/android/os/storage/StorageManager.java
458428ea6633e6000b453ef272c13823f5d02fe5 22-Feb-2017 Jeff Sharkey <jsharkey@android.com> Split cache clearing into two phases.

Use newly defined "V2_DEFY_QUOTA" flag to split cache clearing into
two phases: clearing data for apps above their quotas, and then
pushing deeper by clearing data for apps below their quotas.

Add placeholder comments for other data types that we're planning to
add shortly. Route all clearing behavior through this new method,
which remains guarded behind a flag for now.

Test: builds, boots
Bug: 34692014
Change-Id: I678d7b4e2bf6c837dd8a9adbc36a53015907f75f
/frameworks/base/core/java/android/os/storage/StorageManager.java
d5d5e926eb8ff2541a845d6a5657cee5e5c6e7b6 21-Feb-2017 Jeff Sharkey <jsharkey@android.com> Clear cache space when allocating bytes.

Fleshes out remainder of allocation implementation, where we offer
to clear cached data to satisfy the allocation request. To prevent
abuse, we never let apps allocate into either the minimum cache space
or low storage space.

Clean up quota APIs to require the caller to pass in the path they're
interested in, and we resolve the underlying filesystem for them.

Defines settings that can be used to tweak the minimum cache space.

Test: builds, boots
Bug: 34690590
Change-Id: I85bc07399f91ee4aa568a8a54c615646bf748ad4
/frameworks/base/core/java/android/os/storage/StorageManager.java
500ce9ea58a6c3465703257eab03f9bad76b1e0a 12-Feb-2017 Jeff Sharkey <jsharkey@android.com> Explicit API for allocating disk space.

Now that we're giving apps better guidance around how much cached
disk space they can use, we also need to provide a way to help clear
some of those cached files. The final logic is coming in a future
CL, but it will be designed to prevent abuse.

Test: newly added CTS tests
Bug: 34690590
Change-Id: I1e46ade0cdabbc33162fc7bfa76abec711992f92
/frameworks/base/core/java/android/os/storage/StorageManager.java
9bed070b0910aad8c5800cec731058911d20c3d3 24-Jan-2017 Jeff Sharkey <jsharkey@android.com> More APIs for cache status and behavior.

Add APIs for apps to query their cache usage compared to their
currently allocated quota. Since an app's private storage may live
on a different storage volume than the primary shared/external
storage, offer APIs to retrieve those values separately.

Add APIs to control two new cache purging behaviors:

-- setCacheBehaviorAtomic() which causes a marked directory and its
contents to be treated as an atomic unit.
-- setCacheBehaviorTombstone() which causes the OS to truncate
files instead of deleting them.

Test: builds, boots
Bug: 33811826, 33965858, 27948817
Change-Id: I45de165623775c359f78b4ee544c2b5831b8d483
/frameworks/base/core/java/android/os/storage/StorageManager.java
baa011685404ab5512e0b0724f07e7c98648d8ab 16-Nov-2016 Daichi Hirono <hirono@google.com> Remove StorageManager#mountAppFuse hidden API.

The API should be replaced with StorageManager#openProxyFileDescriptor.

Bug: 32891253
Test: build
Change-Id: Ibbf8b64f3a39900a1f05a52132aa931491d6fd48
/frameworks/base/core/java/android/os/storage/StorageManager.java
500bffdba9e3b08abd26627af49ecc89a58c07ff 17-Jan-2017 Daichi Hirono <hirono@google.com> Publish StorageManager#openProxyFileDescriptor API.

Bug: 29970149
Test: Build succeeded
Change-Id: I1606b184968839fb99744387dcc058f15f6521c8
/frameworks/base/core/java/android/os/storage/StorageManager.java
9fb00183a04036a58ee208f5bfd6c9768982f0aa 08-Nov-2016 Daichi Hirono <hirono@google.com> Add StorageManager#openProxyFileDescriptor.

The CL:

* Adds StorageManager#openProxyFileDescriptor API.
* Turns IProxyFileDescriptorCallback into a class so that it can provides
default implementations.
* Removes mActive state from FuseAppLoop, because the state will be managed at
the MountService side.
* Adds StorageManagerIntegrationTest to check if FUSE is correctly mounted or
not. Since it's implementation details, CTS does not help to test the
behavior.

Test: StorageManagerIntegrationTest
Bug: 29970149

Change-Id: Id78dd4abcf9325820e9c77c264f54bfa77b85a92
/frameworks/base/core/java/android/os/storage/StorageManager.java
bede012069321f7e1a264ac3ed55f45f39102627 09-Jan-2017 Alex Naidis <alex.naidis@linux.com> Merge "StorageManager: Improve exception handling" am: cf3a4a68bd am: 545cf37844 am: edca8aa3a8
am: 32dfe8c611

Change-Id: I5faf99bd2b4425f1615419de43f247f78d74108b
19d9c2d03c478c755eddbe7ac55d0dc778f332fd 04-Jan-2017 Alex Naidis <alex.naidis@linux.com> StorageManager: Improve exception handling

When "getPrimaryStorageSize" provides a path
to "readLong", the option that the path
doesn't exist is expected, since it tries
all paths from "INTERNAL_STORAGE_SIZE_PATHS"
until there is success.

This patch makes us catch the "FileNotFoundException"
and "NumberFormatException" seperately.

For the above reason a "FileNotFoundException"
is now treated as an information only.
The "NumberFormatException" and other exceptions
are now treated as error since those are not
expected to happen.

Change-Id: I5316f9c3108e36c31b27dc5df8bf8ac4d4257629
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
/frameworks/base/core/java/android/os/storage/StorageManager.java
c0d3f0ed524bad773f6d61082a07f062d53b27a0 11-Oct-2016 Felipe Leme <felipeal@google.com> Dumps total size of primary storage.

BUG: 32069168
Test: manual verification

(cherry picked from commit 281389ac5475e483d10a2e8aa31195b9e9875246)

Change-Id: If5dee52a99c03a00dada22736c09d953dc0b66d1
/frameworks/base/core/java/android/os/storage/StorageManager.java
31d0b7043d9077ad8a0ebfbd6ff2f98621e6f413 21-Nov-2016 Jeff Sharkey <jsharkey@android.com> Add 'fstrim' command for use from shell.

Test: builds, boots, new command works
Bug: 20948199
Change-Id: If7b122a6c98a4ce2a2f38e545015a22decd1b516
/frameworks/base/core/java/android/os/storage/StorageManager.java
2250d56a0b47b93016018340c8f4040325aa5611 08-Nov-2016 Sudheer Shanka <sudheersai@google.com> Rename MountService to StorageManagerService.

Bug: 30977067
Test: Existing tests pass
Change-Id: Ieac0f11c2b249dcd60441b14c1f391e6f8131d42
/frameworks/base/core/java/android/os/storage/StorageManager.java
428868c1f04fa1a6d9220afac5117d0207355fb1 28-Oct-2016 Sudheer Shanka <sudheersai@google.com> Merge "Move IMountService to aidl."
f73411428046e1a380d242274d7191ce602a38be 19-Oct-2016 Sudheer Shanka <sudheersai@google.com> Move IMountService to aidl.

Bug: 30977067
Test: Existing tests passing.
Change-Id: Icadfdcbc79708d3826b4e11afe35f5963aabcd4c
/frameworks/base/core/java/android/os/storage/StorageManager.java
281389ac5475e483d10a2e8aa31195b9e9875246 11-Oct-2016 Felipe Leme <felipeal@google.com> Dumps total size of primary storage.

BUG: 32069168
Test: manual verification
Change-Id: Id319730182eb1e35cd515ab89a14b97654ace599
/frameworks/base/core/java/android/os/storage/StorageManager.java
aa67f684ff43c81e3280c846245ec6ebe907787e 20-Sep-2016 John Reck <jreck@google.com> Fix a bunch of repeated reads of a ro.* property

SystemProperties.get() is not particularly fast,
especially if a string is returned. Since ro.* values
are unable to be changed, there's no need to
continously re-query them. Cache the value at
static init time to trivially fix this.

Test: refactoring CL.
Change-Id: Iccb021d3cb2ba3a4a1d0048ddec6811bb7409eec
/frameworks/base/core/java/android/os/storage/StorageManager.java
49ca529a850e60482ddcc8c0762105b4aa10f35f 10-May-2016 Jeff Sharkey <jsharkey@android.com> Avoid caching services with missing binders.

When fetching system services early during boot, if the underlying
binder interface hasn't been published yet, we end up caching a
manager class that is broken for the remainder of the process
lifetime, and innocent downstream callers end up using the broken
cached manager.

Fix this by using an explicit exception to quickly abort manager
creation when the underlying binder is missing. The exception is
only used to skip the remainder of the manager creation, and it
doesn't actually crash the process.

Bug: 28634953
Change-Id: I0cb62261e6d6833660704b93a11185aa11a2ac97
/frameworks/base/core/java/android/os/storage/StorageManager.java
179923a6117ebea8be46520ef5d63eacbc3465fd 19-Jul-2016 Felipe Leme <felipeal@google.com> Improved storage size detection.

The total storage size was calculating by reading and multiplying the
contents of /sys/block/mmcblk0/size and
/sys/block/mmcblk0/queue/hw_sector_size.

On some devices, such calculation doesn't work because:

1.The primary block is not /sys/block/mmcblk0 .
2.The sector size is not the right value to use.

These 2 issues are temporarily addressed by providing alternative
primary blocks and hardcoding the size (512 bytes). In the long term,
the size should be calculated by vold, so each device could provide its
own calculation if necessary.

BUG: 30216622
Change-Id: I8f9a9f4f753d3c92bab9257062b61ed2b9d665c5
Fixes: 24128505
/frameworks/base/core/java/android/os/storage/StorageManager.java
690346b145b77b13951fbf27cbc792195f975b6a 17-Jun-2016 Daniel Nishi <dhnishi@google.com> Use the Deletion Helper when system storage is low.

A notification is posted when the system storage gets too low.
Currently, it redirects into the Storage Settings. Instead,
it should redirect into the Deletion Helper to directly let the
user clear out their storage.

Bug: 29437277
Change-Id: I4e35adf300d5e479d4171f1e6f090f2a757400f2
/frameworks/base/core/java/android/os/storage/StorageManager.java
18202e00bd2f8bc6e197cbad02d17ab0510b68cd 12-May-2016 Felipe Leme <felipeal@google.com> Added a getPrimaryStorageSize() method.

BUG: 24128505

Change-Id: I0b75d3c5505dadedf5d06868614b3a01765cc5d3

** Cherrypicked from master **
/frameworks/base/core/java/android/os/storage/StorageManager.java
4815ed4500ac5480a6843a8cd7a6a3518ffddf4a 26-May-2016 Jeff Sharkey <jsharkey@android.com> Cache IMountService for isUserKeyUnlocked() calls.

This avoids doing a ServiceManager lookup for every call through
this hot code-path.

Bug: 28946245
Change-Id: I210ce34b33e5b40a5ab4e92ddce87fc5e9964be2
/frameworks/base/core/java/android/os/storage/StorageManager.java
ce18c8167766f92856f94a8e88e19de4698960e6 28-Apr-2016 Jeff Sharkey <jsharkey@android.com> Introduce "unlocking" vs "unlocked" nuance.

There is a narrow window of time during user unlock where we're
reconciling user storage and dispatching the "unlock" status to
various internal system services. While in this "unlocking" state,
apps need to be told that the user still isn't actually "unlocked"
so they don't try making calls to AccountManager, etc.

The majority of internal services are interested in merging together
both the "unlocking" and "unlocked" state, so update them.

Clarify naming in AccountManagerService to make it clear that a local
list is being used, which mirrors the naming in MountService.

To match UX/PM requested behavior, move PRE_BOOT_COMPLETED dispatch
after the user is unlocked, but block BOOT_COMPLETED dispatch until
after all PRE_BOOT receivers are finished to avoid ANRs.

Bug: 28040947, 28164677
Change-Id: I57af2351633d9159f4483f19657ce0b62118d1ce
/frameworks/base/core/java/android/os/storage/StorageManager.java
fcf1e55821b694df3b8434f40aa3b6d3c3e7ea50 15-Apr-2016 Jeff Sharkey <jsharkey@android.com> Consistent creation/destruction of user data.

Preparing and destroying users currently needs to be split across
installd, system_server, and vold, since no single party has all the
required SELinux permissions.

When preparing user directories on a storage device, always enforce
the serial number and destroy data if we run into a mismatch. When
deleting a user, write the updated user list first before we start
destroying data. Also start reconciling users on internal storage
at boot, so we can recover from stale data left behind from partially
destroyed users.

Check both CE and DE user directories when reconciling user storage
on a newly mounted storage device.

Bug: 27896918
Change-Id: I4536c82b0196e2720628c4f73fccb742c233350b
/frameworks/base/core/java/android/os/storage/StorageManager.java
cadfc77d0355ef57308ef1bf8bf43560d2b2e245 13-Apr-2016 Jeff Sharkey <jsharkey@google.com> Merge "Fix broken javadoc." into nyc-dev
f82c2f08541481cae814e88a2b35f6d59d8d42aa 12-Apr-2016 Jeff Sharkey <jsharkey@android.com> Fix broken javadoc.

Change-Id: I9f2050fd6040234bb1d759ab346f79fc41247aa9
/frameworks/base/core/java/android/os/storage/StorageManager.java
c250e45eda7ab38c88b3e5e7e302917cd001d3af 12-Apr-2016 Felipe Leme <felipeal@google.com> Make getStorageVolume(File file) public.

BUG: 27951594
Change-Id: I354f6a29b3fa3374ea07bcbe14096e9673d282c5
/frameworks/base/core/java/android/os/storage/StorageManager.java
8b704d4474caf9fa0c7a734582fb6cce55248de4 07-Apr-2016 Jeff Sharkey <jsharkey@google.com> Merge "Revert "Remove old FUSE bypass now that we have sdcardfs."" into nyc-dev
8575da1cc0e3c9449e21bae270b489b8e815fccb 07-Apr-2016 Jeff Sharkey <jsharkey@google.com> Revert "Remove old FUSE bypass now that we have sdcardfs."

This reverts commit feef8b62ee60c8418bd7238522c06098e61eecff.

Change-Id: I90a3b8edf95cb5b631a85168671cf8b5a406d9ea
/frameworks/base/core/java/android/os/storage/StorageManager.java
33dd156ed0ed839c5e77beb116f6f1a9566416e3 07-Apr-2016 Jeff Sharkey <jsharkey@android.com> Give users and devices control over sdcardfs.

Instead of relying only on kernel support for sdcardfs, give each
device the ability to quickly toggle between sdcardfs and FUSE. Also
add the ability to users to explicitly enable/disable the behavior
for testing and debugging purposes.

Bug: 27991427
Change-Id: Ia57f12f6ead888ab85101004bdd8c8003537b116
/frameworks/base/core/java/android/os/storage/StorageManager.java
feef8b62ee60c8418bd7238522c06098e61eecff 06-Apr-2016 Jeff Sharkey <jsharkey@android.com> Remove old FUSE bypass now that we have sdcardfs.

This forces everyone to go through sdcardfs, instead of letting them
around the back door.

Bug: 27992761
Change-Id: If1d4d5daa4b32bb3be7de10102bab24d63552b65
/frameworks/base/core/java/android/os/storage/StorageManager.java
c02bfae73e139f2a1c56cc6b051bfc7877b8cf1d 27-Mar-2016 Jeff Sharkey <jsharkey@android.com> Include "invisible" volumes in new storage API.

The purpose of the new StorageVolume API is to grant access to
volumes that aren't typically "visible" to a developer, so include
them in the returned results.

Also return the real mounted state instead of augmenting based on
the caller's storage permissions. Clean up API naming slightly and
return as List.

Bug: 27615770
Change-Id: Ida921a4b91e5af81e418e76f672d9108f45a9781
/frameworks/base/core/java/android/os/storage/StorageManager.java
cf3f0a11a83e7a798e0586a78efdafc82a7f3d08 18-Mar-2016 Jeff Sharkey <jsharkey@android.com> Update direct boot related documentation.

Also hide a few APIs as requested by council. Add a method to
easily determine if a given File would already be encrypted at rest
by the OS.

Bug: 27531029
Change-Id: Icad5f1cd56411ad3ac707db85fd7449acdcc4b94
/frameworks/base/core/java/android/os/storage/StorageManager.java
20be5d62471d520eed3a52d90c11944464a71c07 26-Feb-2016 Paul Lawrence <paullawrence@google.com> Add API to IMountService to get encryption state

Bug: 18002358
Change-Id: If7d9c9a5ed38ac37849fcf638ec10c76d2f419a1
/frameworks/base/core/java/android/os/storage/StorageManager.java
f8880561e67e1da246970b49b14285efd4164ab1 26-Feb-2016 Jeff Sharkey <jsharkey@android.com> When system server goes down, crash apps more.

Similar to first patch, but now using new "rethrowFromSystemServer()"
method which internally translates DeadObjectException into
DeadSystemException. New logic over in Log.printlns() now
suppresses the DeadSystemException stack traces, since they're
misleading and just added pressure to the precious log buffer space.

Add some extra RuntimeInit checks to suppress logging-about-logging
when the system server is dead.

Bug: 27364859
Change-Id: I05316b3e8e42416b30a56a76c09cd3113a018123
/frameworks/base/core/java/android/os/storage/StorageManager.java
04a5d40cf35fb2c2fca2c1bfd573e5916d804ef6 09-Feb-2016 Felipe Leme <felipeal@google.com> Initial implementation of StorageManager.getVolumesList().

This change makes StorageManager.getVolumesList(),
StorageManager.getPrimaryVolume(), and StorageVolume public and adds a
buildAccessIntent() in the latter to automatically generate the
ACTION_OPEN_EXTERNAL_DIRECTORY intent, but it doesn't change the
ACTION_OPEN_EXTERNAL_DIRECTORY implementation yet (i.e., it still takes an URI with the physical path of the directory, instead of a StorageVolume and
a directorny name).

BUG: 26742218

Change-Id: I36c59c42b6579e125ec7f03c3af141260875a491
/frameworks/base/core/java/android/os/storage/StorageManager.java
faeb3eb0ba190e6d6cfe2b82ce20af587848de57 08-Feb-2016 Paul Crowley <paulcrowley@google.com> Password security for FBE disk encryption keys

Add the means to protect FBE keys with a combination of an auth token
from Gatekeeper, and a hash of the password. Both of these must be
passed to unlock_user_key. Keys are created unprotected, and
change_user_key changes the way they are protected.

Bug: 22950892
Change-Id: Ie13bc6f82059ce941b0e664a5b60355e52b45f30
/frameworks/base/core/java/android/os/storage/StorageManager.java
47f7108c1270a9e81d9560b6b0570c659bb93a71 02-Feb-2016 Jeff Sharkey <jsharkey@android.com> Prepare user storage just before using it.

Wire up preparing of user-specific app storage to existing user
lifecycle hooks. This way we're sure the storage is ready to roll
just before we start reconciling app data directories.

This also has the nice property that we only prepare storage when
we know that keys are unlocked.

Bug: 25796509
Change-Id: Ic7df9ddbcfb1e20649d11b6cf68d424e3c365ee1
/frameworks/base/core/java/android/os/storage/StorageManager.java
cd65448ccd13c4c2d0fe9e9623fec3a898ab9372 09-Jan-2016 Jeff Sharkey <jsharkey@android.com> Even more PackageManager caller triage.

Finish moving all UID/GID callers to single AIDL method that requires
callers to provide flags.

Triage AppWidgets and PrintServices, which currently can only live on
internal storage; we should revisit that later.

Fix two bugs where we'd drop pending install sessions and persisted
Uri grants for apps installed on external storage.

Bug: 26471205
Change-Id: I66fdfc737fda0042050d81ff8839de55c2b4effd
/frameworks/base/core/java/android/os/storage/StorageManager.java
c5967e9862489024c932b0c7fcb84ed0af2a7fd7 08-Jan-2016 Jeff Sharkey <jsharkey@android.com> More progress on triaging PackageManager callers.

Catch a bunch of simple cases where the PackageManager flags are
obvious. Add the ability to use the MATCH_SYSTEM_ONLY flag on
PackageInfo and ApplicationInfo queries.

Re-examine recent tasks after a user is unlocked, since some of the
activities may now be available and runnable.

Bug: 26471205, 26253870
Change-Id: I989d9f8409070e5cae13202b47e2c7de85bf4a5b
/frameworks/base/core/java/android/os/storage/StorageManager.java
c4dd021322d38ea32ac49930e904b6d08ce6490c 18-Nov-2015 Lenka Trochtova <ltrochtova@google.com> Introduce ephemeral users.

BUG: 24883058

Change-Id: I2e1d6aa184142c2a3dc0415c0cd407573453cf41
/frameworks/base/core/java/android/os/storage/StorageManager.java
ce14cd01411c384b3b979a9f662bf3cd5f9e7183 07-Dec-2015 Jeff Sharkey <jsharkey@android.com> Mount storage after unlock, fix leaving emulation.

Delay mounting of storage devices until after the user is unlocked,
which means any emulated storage areas will be ready for use. Track
separate per-user unlocked states for local versus system lifecycle
state.

Switch to explicitly lock or unlock user keys during boot of a
device without native FBE support. This allows us to recover when
the user has disabled emulated FBE.

Force reboot when changing FBE emulation state.

Bug: 26010607, 26027473
Change-Id: Idaf8b63e69f886ddbd848a9fab6d143a5fd10500
/frameworks/base/core/java/android/os/storage/StorageManager.java
ba51235ef5c598d845b77fcf14491329493da34f 13-Nov-2015 Jeff Sharkey <jsharkey@android.com> More file-based encryption work.

Add new "am unlock-user" command so we can trigger changes from the
command line.

Move FBE check to static method so it can safely be called early
during boot before the mount service is ready. Move FBE emulation
to persisted system property, and start reading/writing that value.

Change default permission grants to ignore current encryption-aware
flags, since many of the target apps aren't crypto aware.

Always prepare package data directories, which is how we create the
new "user_de" paths during boot.

Bug: 22358539
Change-Id: I6f58ea2d34b3a466d3775d614f8a13de92272621
/frameworks/base/core/java/android/os/storage/StorageManager.java
9e8d9e250b4e3fe8e57072072ed84b5dea0a19d3 13-Nov-2015 Daichi Hirono <hirono@google.com> Add a mehtod definition to StorageManager for appfuse.

BUG=25091416

Change-Id: Id4d4a000daf89fab4917528fcd0d1270547fbfa4
/frameworks/base/core/java/android/os/storage/StorageManager.java
f9fc6d6cc05595241bc7ced6d4cab97b45f9b901 09-Nov-2015 Jeff Sharkey <jsharkey@android.com> More file-based encryption work.

Add granular StorageManager APIs for key creation/destruction and
unlocking/locking. Start passing through an opaque token as part
of the unlock command, but leave it empty for now. We now have a
separate "prepare" method that sanity checks that user directories
are correctly setup.

Define a handful of system properties used for marking devices that
should be operating in FBE mode, and if they're emulating FBE. Wire
a command to "sm", but persisting will come later.

Start using new "encryptionAware" flag on apps previously marked with
coreApp flag, which were apps running in the legacy CryptKeeper
model. Small tweaks to handle non-encryptionAware voice interaction
services. Switch PackageManager to consult StorageManager about the
unlocked state of a user.

Bug: 22358539
Change-Id: Ic2865f9b81c10ea39369c441422f7427a3c3c3d6
/frameworks/base/core/java/android/os/storage/StorageManager.java
965da39942f9a8736f785f7c57a6c351a8c89d6b 28-Oct-2015 Clara Bayarri <clarabayarri@google.com> Create a File Based Encryption check API

Change-Id: Ibf41f98818ea801b9f690200c340be80c3b9bf31
/frameworks/base/core/java/android/os/storage/StorageManager.java
acfaa947f45ce1ea8140c2dc52d5f750dbc0a94d 29-Jul-2015 Jeff Sharkey <jsharkey@google.com> am b8040265: Merge "Give secondary users read-only physical cards." into mnc-dev

* commit 'b8040265dd0d5a2a96e0850623647dad2f528db1':
Give secondary users read-only physical cards.
4634987668eb7e1fa1434bddbde969ef43de6b40 28-Jul-2015 Jeff Sharkey <jsharkey@android.com> Give secondary users read-only physical cards.

Long ago, we mounted secondary physical cards as readable by all
users on the device, which enabled the use-case of loading media on
a card and viewing it from all users.

More recently, we started giving write access to these secondary
physical cards, but this created a one-directional channel for
communication across user boundaries; something that CDD disallows.

This change is designed to give us the best of both worlds: the
package-specific directories are writable for the user that mounted
the card, but access to those "Android" directories are blocked for
all other users. Other users remain able to read content elsewhere
on the card.

Bug: 22787184
Change-Id: Ied8c98995fec1b7b50ff7d930550feabb4398582
/frameworks/base/core/java/android/os/storage/StorageManager.java
eb16e1fb2225f2cf84f5c56242a187fba59e39f8 16-Jul-2015 Svetoslav <svetoslavganov@google.com> am 08dda27b: Merge "Make sure we get valid package name or fail." into mnc-dev

* commit '08dda27be4678f2ab5bdc7e210d511ec105c158c':
Make sure we get valid package name or fail.
7395cbf07048abdad24b056f30a46f5b67920cd8 16-Jul-2015 Svetoslav <svetoslavganov@google.com> Make sure we get valid package name or fail.

bug:22492225

Change-Id: I7b7dce9a8e398c4615bcb700de80241e94c4320c
/frameworks/base/core/java/android/os/storage/StorageManager.java
c7a607496aa5ba368524dd334877a9c428ab5f78 14-Jul-2015 Jeff Sharkey <jsharkey@android.com> am d3719ab0: Merge "Better handling of storage paths." into mnc-dev

* commit 'd3719ab07a0ba66c019979ce19c45b77c4aae92e':
Better handling of storage paths.
983294596e65a0226aa69e42bda9db322727fee5 13-Jul-2015 Jeff Sharkey <jsharkey@android.com> Better handling of storage paths.

Give more details about why we failed to create storage paths, and
search for underlying volumes using canonical paths.

Bug: 22135060
Change-Id: I75d3584403ece310438b05f5b9fe72d94c9096c6
/frameworks/base/core/java/android/os/storage/StorageManager.java
c56668eb223fe45ff5c1e399d99943838320c407 14-Jul-2015 Marco Nelissen <marcone@google.com> am 3ced9617: Merge "Use original path if translated path doesn\'t exist" into mnc-dev

* commit '3ced96178b1b132705e773736cbb707a3a0cd951':
Use original path if translated path doesn't exist
aa4110366813f29f6a71dbdee090ba823feb2efe 14-Jul-2015 Marco Nelissen <marcone@google.com> Use original path if translated path doesn't exist

Bug: 22376538
Change-Id: I2f6af4fa31c097e2e2d619a068cf83721091c450
/frameworks/base/core/java/android/os/storage/StorageManager.java
d7be214ca469c593d8a59cf7404020f4ad1aaed9 14-Jul-2015 Ian Pedowitz <ijpedowitz@google.com> resolved conflicts for merge of 8cee6587 to mnc-dr-dev

Change-Id: I0b2ed52214bb097d7fd69434afd0c6c890b5afb3
6ee871e59812fea4525c50231f677c4bd10c74b8 10-Jul-2015 Svet Ganov <svetoslavganov@google.com> Teach storage appops.

For modern apps targeting M SDK and up the external storage state
is deterined by granted permissions. For apps targeting older SDK
the storage access is determined by app ops correspning to the
storage permissions as the latter are always granted.

When app ops change we do not remount as we kill the app process
in both cases enabling and disabling an app op since legacy code
is not prepared for dynamic behavior where an operation that failed
may next succeed. Hence, we remount when we start the app.

For modern apps we don't kill the app process on a permission
grant, therefore we synchronously remount the app storage.

bug:22104923

Change-Id: I601c19c764a74c2d15bea6630d0f5fdc52bf6a5a
/frameworks/base/core/java/android/os/storage/StorageManager.java
7ec733fad39ff9e439a67c9cf51b88bc84cdfda0 19-May-2015 Paul Crowley <paulcrowley@google.com> Delete the user key when deleting a user.

Bug: 19706593

(cherry-picked from commit 85e4e818d83dbc65b1e6e3ed9d39c656188acaec)

Change-Id: Icc6d53a99558317b2ec154f931e481ad9fe64aa3
/frameworks/base/core/java/android/os/storage/StorageManager.java
bcf48ed2262d655ebf59153dea645ca761b73db5 22-Apr-2015 Paul Crowley <paulcrowley@google.com> Use mount service to create user dirs.

Bug: 19704432

(cherry-picked from commit 9102f5d953fbde03e12f385b2225004edc43d202)

Change-Id: I64a2c85beef115158feed3953deae32f692e750f
/frameworks/base/core/java/android/os/storage/StorageManager.java
ef10ee014594d800f5f5ca31ea93f1cab2880d05 05-Jul-2015 Jeff Sharkey <jsharkey@android.com> Handle missing migration source volume.

Users can try migrating primary storage while the current location
is missing/unmounted. Fail gracefully instead of runtime restarting.

Bug: 21927076
Change-Id: I40645f8ccea05154e7cbacd188f6cba5f4dbbdc4
/frameworks/base/core/java/android/os/storage/StorageManager.java
6dce4964b4d1a13d276d95730b8fb09d6a5a8d04 04-Jul-2015 Jeff Sharkey <jsharkey@android.com> Reconcile private volumes when mounted.

Many things can happen while a private volume is ejected, so we need
to reconcile newly mounted volumes against known state.

First, user IDs can be recycled, so we store the serial number in the
extended attributes of the /data/user/[id] directory inode. Since a
serial number is always unique, we can quickly determine if a user
directory "10" really belongs to the current user "10". When we
detect a mismatched serial number, we destroy all data belonging to
that user. Gracefully handles upgrade case and assumes current serial
number is valid when none is defined.

Second, we destroy apps that we find no record of, either due to
uninstallation while the volume was unmounted, or reinstallation on
another volume.

When mounting a volume, ensure that data directories exist for all
current users. Similarly, create data directories on all mounted
volumes when creating a user. When forgetting a volume, gracefully
uninstall any apps that had been installed on that volume.

Bug: 20674082, 20275572
Change-Id: I4e3448837f7c03daf00d71681ebdc96e3d8b9cc9
/frameworks/base/core/java/android/os/storage/StorageManager.java
9527b223a9d4a4d149bb005afc77148dbeeff785 25-Jun-2015 Jeff Sharkey <jsharkey@android.com> Let's reinvent storage, yet again!

Now that we're treating storage as a runtime permission, we need to
grant read/write access without killing the app. This is really
tricky, since we had been using GIDs for access control, and they're
set in stone once Zygote drops privileges.

The only thing left that can change dynamically is the filesystem
itself, so let's do that. This means changing the FUSE daemon to
present itself as three different views:

/mnt/runtime_default/foo - view for apps with no access
/mnt/runtime_read/foo - view for apps with read access
/mnt/runtime_write/foo - view for apps with write access

There is still a single location for all the backing files, and
filesystem permissions are derived the same way for each view, but
the file modes are masked off differently for each mountpoint.

During Zygote fork, it wires up the appropriate storage access into
an isolated mount namespace based on the current app permissions. When
the app is granted permissions dynamically at runtime, the system
asks vold to jump into the existing mount namespace and bind mount
the newly granted access model into place.

Bug: 21858077
Change-Id: I62fb25d126dd815aea699b33d580e3afb90f8fd2
/frameworks/base/core/java/android/os/storage/StorageManager.java
9dc575d63c5f0d7511308bd2cd3d5dbd20c15e17 13-Jun-2015 Makoto Onuki <omakoto@google.com> Add StorageEventListener.onDiskDestroyed()

Bug 21336042

Change-Id: I226cf205191dd302ff8d5156f9ae0fe8fc5b2c2b
/frameworks/base/core/java/android/os/storage/StorageManager.java
d8fdb338918e63bbab2e65bdb2f4d12320a1b24a 18-May-2015 Paul Lawrence <paullawrence@google.com> Honor password visible setting in CryptKeeper

Bug: 20184626

Change-Id: Ida0f34299947a5d4067406cc6e029fb841077804
/frameworks/base/core/java/android/os/storage/StorageManager.java
4c099d0c49c8366efd3c26854465b3ceef49b627 15-May-2015 Jeff Sharkey <jsharkey@android.com> Command to change force adoptable state.

Since user builds can't setprop, add an explicit "sm" verb to change
the force adoptable state.

Bug: 21191915
Change-Id: I719d9b18c1a98c97442a5ddb1cc5512e8e4d3d3f
/frameworks/base/core/java/android/os/storage/StorageManager.java
9756d75ec28844f5ca30fda786a117c1a0ee88da 15-May-2015 Jeff Sharkey <jsharkey@android.com> Initial pass at storage benchmarks.

Offer an interface for Settings to invoke benchmarks on various
attached volumes.

Bug: 21172095
Change-Id: I847ddc87c58285457d1324be87f70ce10507accb
/frameworks/base/core/java/android/os/storage/StorageManager.java
0d838a0fad500a3c446df501d8aa7656c2c3a7a2 13-May-2015 Jeff Sharkey <jsharkey@android.com> Determine if we have adoptable disks.

Bug: 19993667
Change-Id: I9b21b05736c22d34ca22f5ad6e1a6ebec440cfb6
/frameworks/base/core/java/android/os/storage/StorageManager.java
c840681dbd42978745274e7c44d8c37a1f68a746 04-May-2015 Jeff Sharkey <jsharkey@android.com> Avoid NPE when fsUuid is null.

Bug: 20822962
Change-Id: I6340b70dba5a4f94a0f08ddfbda0190db97746f1
/frameworks/base/core/java/android/os/storage/StorageManager.java
50a05454795c93ac483f5cb6819e74cb17be1b5b 29-Apr-2015 Jeff Sharkey <jsharkey@android.com> Returning to wizard, split move events.

Finish wiring up notifications to jump back into in-progress wizard
flow, using moveId as identifier.

Split move events back into separate creation and progress events,
and pass details as bundle to pass extra stuff like UUID. Null
package still means moving primary storage.

Add explicit "volume forgotten" event for PackageManager to clean
up internal state with.

Plumb through internal path reported by vold, and bring back FUSE
bypass rewriting optimization.

Bug: 19993667
Change-Id: I0f43edbba36c58c5cd33550022c54c4eb9f01a48
/frameworks/base/core/java/android/os/storage/StorageManager.java
b42d694691e73d094df616fe78627ada7e1239ef 29-Apr-2015 Jeff Sharkey <jsharkey@android.com> Method to wipe all adoptable disks.

Will be used by various classes doing factory reset.

Bug: 9433509
Change-Id: I0701abe00abc2fb9085ce1ffe6e28fb27c91ab51
/frameworks/base/core/java/android/os/storage/StorageManager.java
b36586a7c9b7718f33961406537e27bbd9b16211 27-Apr-2015 Jeff Sharkey <jsharkey@android.com> Split some VolumeInfo state into VolumeRecord.

VolumeRecord is a historical record of a volume that we've seen in
the past. It's now surfaced outside the framework for SystemUI to
drive the notifications that bug users to reinsert missing private
volumes.

Show progress notifications for both storage and package movement
operations. Notify when an empty disk is inserted (no usable volumes)
which launches into the normal format flow.

Add API to forget volumes.

Bug: 20275424, 20275424
Change-Id: I75602c17fdcd4d1f1f62324e1a08c4a33093eefa
/frameworks/base/core/java/android/os/storage/StorageManager.java
275e3e43f2fba72fa99001cafa2a70e5478fc545 25-Apr-2015 Jeff Sharkey <jsharkey@android.com> Migrate primary external storage.

Wire up through MountService to call down into vold. Watch for
unsolicited events that report progress, including special value "82"
that signals that copy has finished. We use this value to persist
the volumeUuid in case of unexpected reboot, since it indicates the
new volume is ready.

Wire progress updates through existing callback pipeline.

Update the volume mounting code to match against the persisted UUID
when selecting the primary external storage.

Bug: 19993667
Change-Id: Id46957610fb43517bbfbc368f29b7d430664590d
/frameworks/base/core/java/android/os/storage/StorageManager.java
620b32b316fd4f1bab4eef55ec8802d14a55e7dd 24-Apr-2015 Jeff Sharkey <jsharkey@android.com> Package and storage movement callbacks.

Since package and primary storage movement can take quite awhile,
we want to have SystemUI surface progress and allow the Settings
app to be torn down while the movement proceeds in the background.

Movement requests now return a unique ID that identifies an ongoing
operation, and interested parties can observe ongoing progress and
final status. Internally, progress and status are overloaded so
the values 0-100 are progress, and any values outside that range
are terminal status.

Add explicit constants for special-cased volume UUIDs, and change
the APIs to accept VolumeInfo to reduce confusion. Internally the
UUID value "null" means internal storage, and "primary_physical"
means the current primary physical volume. These values are used
for both package and primary storage movement destinations.

Persist the current primary storage location in MountService
metadata, since it can be moved over time.

Surface disk scanned events with separate volume count so we can
determine when it's partitioned successfully. Also send broadcast
to support TvSettings launching into adoption flow.

Bug: 19993667
Change-Id: Ic8a4034033c3cb3262023dba4a642efc6795af10
/frameworks/base/core/java/android/os/storage/StorageManager.java
74acbbb2cd367c6e78db7de5118ff9dd56da61d0 21-Apr-2015 Jeff Sharkey <jsharkey@android.com> Blend in force adoptable flag when set.

Bug: 19993667
Change-Id: Ic7f348d171a89e889281b7efb1aa0cbade048975
/frameworks/base/core/java/android/os/storage/StorageManager.java
27de30d31c3e79bc429cb71aed9681c55243f18d 19-Apr-2015 Jeff Sharkey <jsharkey@android.com> Wire up non-visible volumes, more states.

Adds logic to ExternalStorageProvider to scan non-visible volumes,
such as USB OTG devices. We use internal paths when surfacing these
volumes, which also optimizes around the FUSE daemon for public
devices. Also dumps internal state when requested.

VolumeInfo now directly contains DiskInfo, which means it's
snapshotted when sending events, avoiding teardown races. Switch
notifications to use this DiskInfo directly.

Finish wiring up new volume state, including helper methods to make
it readable/writable state clearer. Handle disks and volumes with
spaces in their labels.

Bug: 19993667
Change-Id: I5c75e5658a6415976811477aebafee7694bde0f4
/frameworks/base/core/java/android/os/storage/StorageManager.java
7e92ef3a1146102806fa0543ef12e09231c55639 18-Apr-2015 Jeff Sharkey <jsharkey@android.com> Volumes know parent disks; unsupported disks.

This is cleaner and more direct than the reverse of having the disk
publish child volume membership. Rename state constants to match
public API. Add state representing bad removal. Make it clear that
volume flags are related to mounting.

Send new unsupported disk event when we finish scanning an entire
disk and have no meaningful volumes.

Splice disk labels into description when known. Only adoptable
slots are directly visible to apps.

Bug: 19993667
Change-Id: I12fda95be0d82781f70c3d85c039749052dc936b
/frameworks/base/core/java/android/os/storage/StorageManager.java
d95d3bfb2b28a4f21f3fdcd740160c9a61eb0363 15-Apr-2015 Jeff Sharkey <jsharkey@android.com> Persist nickname and flags for volumes.

StorageManager now offers to persist a nickname and user flags for
active volumes. This metadata is kept around and spliced into
any future VolumeInfo when the same UUID is present. Current user
flags indicate "initialized" and "snoozed" states to control how
notifications are shown.

Notify listeners when metadata changes, and kick public notification
after a volume is initialized. Make unique PendingIntents when
multiple volumes are active.

Beginnings of plumbing to ask for missing volumes.

Offer explicit accessors for VolumeInfo and DiskInfo to give better
path to documentation and deprecation.

Bug: 19993667
Change-Id: I3d8b68be83f43ba992d21d51cad5b775776d681c
/frameworks/base/core/java/android/os/storage/StorageManager.java
56bd3129138b525b0f2eba52bd4fa140f23e792c 14-Apr-2015 Jeff Sharkey <jsharkey@android.com> Checkpoint of storage notifications.

Rewrite of storage notifications to support multiple disks/volumes,
handling the state of each independently. Update strings to match
spec. Include actions to jump into wizard when adoptable, otherwise
browse or eject.

Move browse intent creation to common place on VolumeInfo. Also add
well-formed extra names. VolumeInfo now carries the parent disk ID
along with it to avoid races when unmounting.

Bug: 19993667
Change-Id: I236ddc7f8112490355f438b828bec8d40c331fdd
/frameworks/base/core/java/android/os/storage/StorageManager.java
59d577a518333f4b4514315b6d10e8dba160abcd 12-Apr-2015 Jeff Sharkey <jsharkey@android.com> Browse mode for DocumentsUI, removed volume state.

The existing management mode is too specific, and requires that
storage backends add queryChildDocumentsForManage(), etc. Instead,
to offer more natural browsing support, add a new BROWSE_ROOT intent.

It behaves mostly like MANAGE_ROOT, except that it doesn't mutate
its Uris with setManageMode(), and it shortcuts straight to VIEW on
clicked documents.

It can be launched like this:

$ adb shell am start -a android.provider.action.BROWSE_ROOT
-d content://com.android.externalstorage.documents/root/8405-1DFB
-c android.intent.category.DEFAULT

Also rename a MetricsConstants to make it clearer, and don't
auto-mount all emulated volumes.

Fix bugs around parceling of DiskInfo/VolumeInfo. Method to resolve
the best description for a VolumeInfo, which might need to fall
back to DiskInfo.

Add back "removed" volume state so we send broadcast when a volume
is destroyed, matching the expected public API behavior.

Bug: 19993667
Change-Id: I13aff32c5e11dfc63da44aee9e93a27f4690a43f
/frameworks/base/core/java/android/os/storage/StorageManager.java
b2b9ab8354da1485178cd8d8e9d89ac915b3f269 06-Apr-2015 Jeff Sharkey <jsharkey@android.com> Installing packages to expanded storage.

PackageManager now offers to load/unload packages when expanded
volumes are mounted/unmounted. Expanded storage volumes are still
treated as FLAG_EXTERNAL_STORAGE from a public API point-of-view,
but this change starts treating the INSTALL_EXTERNAL flag as
exclusively meaning ASEC containers.

Start tracking the UUID of the volume where a package is installed,
giving us a quick way to find relevant packages. When resolving an
install location, look across all expanded volumes and pick the one
with the largest free space. When upgrading an existing package,
continue preferring the existing volume. PackageInstaller now knows
how to stage on these volumes.

Add new movePackage() variant that accepts a target volume UUID
as destination, it will eventually move data too. Expose this
move command through "pm" command for testing.

Automount expanded volumes when they appear.

Bug: 19993667
Change-Id: I9ca2aa328b9977d34e8b3e153db4bea8b8d6f8e3
/frameworks/base/core/java/android/os/storage/StorageManager.java
7151a9a887051542c6da9f380376f3b306184e5c 05-Apr-2015 Jeff Sharkey <jsharkey@android.com> Storage methods using IDs, update listeners.

Add StorageManager methods that work with Disk and Volume IDs instead
of paths which can change over time. For example, a freshly formatted
volume has a different UUID and mount point, even though it's the same
volume.

Update StorageEventListener to be all one-way calls to avoid blocking
while dispatching events. Add new listener method for Volume-level
state changes. The existing state method will remain focused on the
per-user state reflected by StorageVolume. Switch listeners over to
using the more robust RemoteCallbackList pattern under the hood.

Change external ASEC scanning logic in PackageManagerService to be
driven by listener events, instead of explicit MountService calls.

Bug: 19993667
Change-Id: I57c505de260ff1762a78d70d15f1892f40229210
/frameworks/base/core/java/android/os/storage/StorageManager.java
1b8ef7e3165ff9aa52a4905dafc8d0f83e7403f9 04-Apr-2015 Jeff Sharkey <jsharkey@android.com> Parcelable objects for Disk/Volume.

Will eventually be used by SystemUI and/or Settings.

Also fix SettingsProvider NPE.

Bug: 19993667, 19909433
Change-Id: Ie326849ac5f43ee35f728d9cc0e332b72292db70
/frameworks/base/core/java/android/os/storage/StorageManager.java
4887789e44cdb16b042a35e8ec03983213e88ac6 18-Mar-2015 Jeff Sharkey <jsharkey@android.com> Progress towards dynamic storage support.

Storage devices are no longer hard-coded, and instead bubble up from
whatever Disk and VolumeBase that vold uncovered, turning into
sibling Java objects in MountService. We now treat vold events as
the source-of-truth for state, and synchronize our state by asking
vold to "reset" whenever we reconnect.

We've now moved to a model where all storage devices are mounted in
the root mount namespace (user boundaries protected with GIDs), so
we no longer need app-to-vold path translation. This also means that
zygote only needs to bind mount the user-specific /mnt/user/n/ path
onto /storage/self/ to make legacy paths like /sdcard work. This
grealy simplifies a lot of system code.

Many parts of the platform depend on a primary storage device always
being present, so we hack together a stub StorageVolume when vold
doesn't have a volume ready yet.

StorageVolume isn't really a volume anymore; it's the user-specific
view onto a volume, so MountService now filters and builds them
based on the calling user. StorageVolume is now immutable, making
it easier to reason about.

Environment now builds all of its paths dynamically based on active
volumes. Adds utility methods to turn int types and flags into
user-readable strings for debugging purposes.

Remove UMS sharing support for now, since no current devices support
it; MTP is the recommended solution going forward because it offers
better multi-user support.

Simplify unmount logic, since vold will now gladly trigger EJECTING
broadcast and kill stubborn processes.

Bug: 19993667
Change-Id: I9842280e61974c91bae15d764e386969aedcd338
/frameworks/base/core/java/android/os/storage/StorageManager.java
f839b4fcb6b179529585765517895a8c90fe315b 26-Sep-2014 Elliott Hughes <enh@google.com> Set the system locale correctly even on an encrypted device.

Bug: 17659622
Change-Id: Ibbbd5b959bfab5345f20b556c4720d0910b50084
/frameworks/base/core/java/android/os/storage/StorageManager.java
742e790294b3441b79f715fe447069b63c6065db 17-Aug-2014 Jeff Sharkey <jsharkey@android.com> Progress towards staging ASECs.

Move location selection logic into shared PackageHelper location,
and share it between DCS and PackageInstaller. Fix bugs related to
installed footprint calculation; always count unpacked native libs.

Have PMS do its own threshold checking, since it's fine to stat
devices. PMS only ever deleted staging ASECs, so move that logic
into installer and nuke unclaimed staging ASECs. Allocate legacy
ASEC names using PackageInstaller to make sure they don't conflict
with sessions.

Start wiring up session to allocate ASEC and pass through staged
container for installation.

Fix bug to actually delete invalid cluster-style installs.

Bug: 16514385
Change-Id: I325e0c4422fc128398c921ba45fd73ecf05fc2a9
/frameworks/base/core/java/android/os/storage/StorageManager.java
e8fdc541dc8c4388dc3c6d52aff70f290d7fb985 28-May-2014 Paul Lawrence <paullawrence@google.com> Hide crypto consts from docs

@bug 15192967

Change-Id: I134b2cb2d2841bc101e63a8a4dbd86f7b7bdca14
/frameworks/base/core/java/android/os/storage/StorageManager.java
0a18029075fbe5e5da396c66ef26cfa7e7f1a082 13-Feb-2014 Paul Lawrence <paullawrence@google.com> Clean up a few minor issues

Make public some constants, remove unused imports.

See https://googleplex-android-review.git.corp.google.com/#/c/412885/
for when these were introduced.

Change-Id: I90d0e33a411ebdd84c36e3d9afae70d2f2847538
/frameworks/base/core/java/android/os/storage/StorageManager.java
8e39736f91a08961cf59c87075e61d9026833b50 28-Jan-2014 Paul Lawrence <paullawrence@google.com> Support default, pattern, pin and password encryption types

Java plumbing to expose methods to get/set encryption type in
IMountService, and hooking up of those methods to the Settings app
so the type is set correctly.

Needs matching vold changes from
https://googleplex-android-review.googlesource.com/#/c/412649/

Bug: 8769627
Change-Id: I70c0ed72d11f5ab6f0958a7f9c101b6822b13baa
/frameworks/base/core/java/android/os/storage/StorageManager.java
be72215c39916af9ae42332260c04b696bc73d7f 16-Feb-2013 Jeff Sharkey <jsharkey@android.com> Better API for low disk space warnings.

Provides uniform interface to ask about low disk thresholds; can
be mocked by other tests. Opens door to adjust thresholds based on
disk type.

Switch monitor service to using new API, and use filesystem paths
from Environment instead of hard-coding.

Change-Id: Ifdb536e36a453f1b67bc65849037ec3cc0232cf2
/frameworks/base/core/java/android/os/storage/StorageManager.java
4fbbda4cecb078bd3867f416b02cc75f5455284f 25-Sep-2012 Jeff Sharkey <jsharkey@android.com> Handle multi-user mountObb() requests.

Since emulated external storage paths differ based on execution
context, carefully fix up paths for various use-cases:

1. When sending paths to DefaultContainerService, always scope
OBB paths as belonging to USER_OWNER.
2. When sending paths to vold, always build emulated storage paths
visible to root.
3. Always use the original untouched path when talking with apps.

Mount OBB containers using shared app GID, so that an app can read
the mount point across users.

Handle legacy paths like "/sdcard" by resolving the canonical path
before sending to MountService. Move tests to servicestests, and
add tests for new path generation logic.

Bug: 7212801
Change-Id: I078c52879cd08d9c8a52cc8c83ac7ced1e8035e7
/frameworks/base/core/java/android/os/storage/StorageManager.java
b049e212ab7fe8967893c202efcb30fecfdb82fb 08-Sep-2012 Jeff Sharkey <jsharkey@android.com> Include user identifier in external storage paths.

When building external storage paths, always include user in path
to enable cross-user paths and aid debugging.

Each Zygote process continues to only have access to the appropriate
user-specific emulated storage through bind mounts. A second set of
mounts continue supporting legacy /sdcard-style paths. For example,
a process running as owner has these mount points:

/storage/emulated_legacy
/storage/emulated_legacy/Android/obb
/storage/emulated/0
/storage/emulated/obb

Since Environment is created before Zygote forks, we need to update
its internal paths after each process launches.

Bug: 7131382
Change-Id: I6f8c6971f2a8edfb415c14cb4ed05ff97e587a21
/frameworks/base/core/java/android/os/storage/StorageManager.java
cb80cb700d15319c20686998e822aed32a56adf5 10-Aug-2012 Jean-Baptiste Queru <jbq@google.com> am 37548994: Merge "StorageManager: fix issue that GREF has increased to 2011 in system server with intel stress test."

* commit '37548994e69292932e9e2fafb7cba6c53e3a2bcd':
StorageManager: fix issue that GREF has increased to 2011 in system server with intel stress test.
6614bb657929c70dad988fb14b4b91f3b9d4f7fc 28-May-2012 Chuanxia Dong <chuanxiao.dong@intel.com> StorageManager: fix issue that GREF has increased to 2011 in system server with intel stress test.

Issue description:
When run ICS stress test, always meet GREF issue. one of contributor is MountService$MountServiceBinderListener.
log info
19:21:11.609 222 24316 W dalvikvm: 24 of com.android.server.am.ActivityManagerService$AppDeathRecipient (24 unique instances)
19:21:11.609 222 24316 W dalvikvm: 479 of com.android.server.MountService$MountServiceBinderListener (479 unique instances)
19:21:11.619 222 24316 W dalvikvm: 7 of com.android.server.accessibility.AccessibilityManagerService$6 (7 unique instances)
Note: PID 222 is system server.

Issue alaysis:
Everyone can call getSystemService(Context.STORAGE_SERVICE) to get service.
When other service get StorageManager, StorageManager will new MountServiceBinderLister and
register a listener in MountService, which won't be unregistered. It's easy to generate a lot of
instance of unused MountService$MountServiceBinderListener in system server.

Issue fix:
So change the policy to be:
1. Doesn't new MountServiceBinderLister in construction.
2. when other service needs to register listener in StorageManager,
StorageManager will register listener with MountService.
3. When other service needs to unregister listener in StorageManager,
if there is no more other listeners in StorageManager, StorageManager
will unregister listener in MountService.

Change-Id: Iaaf889f44a1a5f62b9f65b3ab1b486c9b7dcaf7f
Author: Chuanxiao Dong <chuanxiao.dong@intel.com>
Signed-off-by: Bo Huang <bo.b.huang@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
/frameworks/base/core/java/android/os/storage/StorageManager.java
a45746efadd11bb7dfab026fb3c81a25fae74ca4 19-Jul-2012 Jeff Smith <whydoubt@yahoo.com> Fix several cases of broken droiddoc syntax
external issue 35214

patch contributed by Jeff Smith <whydoubt@yahoo.com>

Change-Id: I70dcee88a140699bf3e1ab369bed6dcd2fdd3d83
/frameworks/base/core/java/android/os/storage/StorageManager.java
cba928cef7d614d375253246f014c4a52bb8b913 18-Aug-2011 Mike Lockwood <lockwood@android.com> SystemServer: Add support for disabling AudioService and MountService

Using the same convention in system_init.cpp, you can disable these
services by setting system properties:

system_init.startaudioservice=0
system_init.startmountservice=0

Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/storage/StorageManager.java
37051cdd8624c4821bb68169be427061c48ad837 26-May-2011 Gilles Debunne <debunne@google.com> ExternalStorageFormatter takes an optional StorageVolume target.

Change-Id: Ic85689659dbf49a7fcc1b7aaf25e4a94e62848b9
/frameworks/base/core/java/android/os/storage/StorageManager.java
2f6a3885533a52758c2cd4f81f6123a712be8ae6 10-May-2011 Mike Lockwood <lockwood@android.com> StorageManager: Clean up and generalize storage configuration resources

Replace config_emulateExternalStorage, config_externalStorageRemovable,
config_externalStoragePaths, config_externalStorageDescriptions and
config_mtpReserveSpaceMegabytes resources with an XML resource file
to describe the external storages that are available.

Add android.os.storage.StorageVolume class

StorageManager.getVolumeList() now returns an array of StorageVolume

Change-Id: I06ce1451ebf08b82f0ee825d56d59ebf72eacd3d
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/storage/StorageManager.java
d967f4664f40f9a4c5262a44b19df9bbdf457d8a 24-Mar-2011 Mike Lockwood <lockwood@android.com> DO NOT MERGE StorageManager: Add getVolumeList() and getVolumeState() methods

Change-Id: I43d5c1730b340f1288b58012234b38f801001b71
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/storage/StorageManager.java
ec7c9ff0bb1c98cb8bec3ec7bdacbae3a434fa53 17-Jan-2011 Kenny Root <kroot@google.com> Hide USB mass storage APIs in StorageManager

They appear to have been unhidden in a bad merge from gingerbread.

Change-Id: Ice0fc865425d5d885af3c2e90a7ffeaa1d623b80
/frameworks/base/core/java/android/os/storage/StorageManager.java
0a9b54e88b9cbb30748b5f0b331aec3f3ef8d639 14-Oct-2010 Kenny Root <kroot@google.com> resolved conflicts for merge of 8bb7a1df to master

Change-Id: Ieec036f494a54eab74a27b954d1423bf981dd3f9
af9d667ccf3e24058214cf4cc0a8aa8bc5100e3c 08-Oct-2010 Kenny Root <kroot@google.com> OBB: rearrange to be entirely asynchronous

Rearrange structure of MountService handling of OBBs to be entirely
asynchronous so we don't rely on locking as much. We still need the
locking to support dumpsys which has been improved to output all the
data structures for OBBs.

Added more tests to cover more of the error return codes.

Oh and fix a logic inversion bug.

Change-Id: I34f541192dbbb1903b24825889b8fa8f43e6e2a9
/frameworks/base/core/java/android/os/storage/StorageManager.java
9e95468bbb4b4cb48d817cee2960681aa876b12a 01-Oct-2010 Kenny Root <kroot@google.com> am 6ce5f60c: am 38cf8867: Remove OBBs from state list when volume unmounted

Merge commit '6ce5f60c791401ed0faf5d36baf4fc6612358676'

* commit '6ce5f60c791401ed0faf5d36baf4fc6612358676':
Remove OBBs from state list when volume unmounted
38cf8867a8d3e8d5159abd0bd0e6a3b0b8348b94 26-Sep-2010 Kenny Root <kroot@google.com> Remove OBBs from state list when volume unmounted

Don't keep tracking OBBs when the volume they're located on goes away.
Remove them from our state tracking maps and then send a notification to
any listener that is still around.

Add a dump handler to MountService so the state of the mount lists
can be inspected.

Change the API to just make a callback directly to the change listener
when mount is called when it's already mounted or unmount called when
it's already unmounted.

Change-Id: Idb4afbb943ca5ca775825f908bff334e3ce1cfcc
/frameworks/base/core/java/android/os/storage/StorageManager.java
bff405f91001237ec94ec64f86fa2370c4509559 29-Sep-2010 Kenny Root <kroot@google.com> resolved conflicts for merge of d8e8186c to master

Change-Id: Ica3f6cd958717ea7033cab8b4bf9cd3425c1e1c5
05105f7abe02b2dff91d6260b3628c8b97816bab 23-Sep-2010 Kenny Root <kroot@google.com> Update OBB API to include callbacks

Add a callback for users of the StorageManager API to be able to receive
notifications when the requested operation completes for mountObb and
unmountObb.

Add NDK API to get to ObbInfo like the Java API has.

Also update the docs for the API and remove the "STOPSHIP" comments.

Change-Id: I23a4409c7f8b74d3169614beba920b4d667990a4
/frameworks/base/core/java/android/os/storage/StorageManager.java
e49564e0f710ba4a1405cfdfde068cb776ee474e 21-Aug-2010 Kenny Root <kroot@google.com> am 821afa9a: am 54d41379: Merge "Add OBB flags to support overlays" into gingerbread

Merge commit '821afa9aec8d3a4ffd2e72ce797d8097eaf13973'

* commit '821afa9aec8d3a4ffd2e72ce797d8097eaf13973':
Add OBB flags to support overlays
02ca31fbae9f35dd30f79de6927fae11b549391a 12-Aug-2010 Kenny Root <kroot@google.com> Add OBB flags to support overlays

* Add flags field in OBB footer to support overlays.

* Remove unused 'crypto' and 'filesystem' fields in obbtool (could
later be supported in the "flags" field of the OBB footer).

* Add notes to document OBB classes before shipping.

Change-Id: I386b43c32c5edef55210acb5d3322639c08010ba
/frameworks/base/core/java/android/os/storage/StorageManager.java
bf0cb26a1c6305f2a7795c2498591b6189cc5b79 11-Aug-2010 Kenny Root <kroot@google.com> am f5ee5358: am ac9717ab: Merge "Move OBB file reading to DefaultContainerService" into gingerbread

Merge commit 'f5ee5358c187107b2e5a1e1fbcb5a648d793c798'

* commit 'f5ee5358c187107b2e5a1e1fbcb5a648d793c798':
Move OBB file reading to DefaultContainerService
a02b8b05dd1e8b8cf169e1f89542ef835b11fc13 06-Aug-2010 Kenny Root <kroot@google.com> Move OBB file reading to DefaultContainerService

The system_server shouldn't touch files on the SD card. This change
moves the things that touch the SD card out to the
DefaultContainerService so that it will get killed if the SD card goes
away instead of the system_server.

Change-Id: I0aefa085be4b194768527195532ee6dddc801cfc
/frameworks/base/core/java/android/os/storage/StorageManager.java
fb4e1e24a93c7e6bc0fcdb3f5cfadfbc19503cd8 16-Jul-2010 Kenny Root <kroot@google.com> resolved conflicts for merge of 181bb0ab to master

Change-Id: I2284e7c671d127da0d124fbabae8d887727fd5bf
02c8730c1bf19daf48bec8c6995df676a00a73b1 01-Jul-2010 Kenny Root <kroot@google.com> Add API to call to vold for mounting OBBs

* Unhide StorageService class; hide all the USB-related items

* Add application-visible API to StorageManager for OBB files

* Add class for parceling OBB info across binders (ObbInfo)

* Add a JNI glue class to libutils/ObbFile (ObbScanner)

* Add API to MountService to deal with calling into vold and checking
permissions

Change-Id: I33ecf9606b8ff535f3a2ada83931da6bbef41cfd
/frameworks/base/core/java/android/os/storage/StorageManager.java
6f63dd5dc8ae38f866e297883435dd1fd3a5cdfd 30-Mar-2010 San Mehat <san@google.com> framework: Hide StorageManager for froyo - do not merge

Change-Id: I9a871e49cc9e1accb28c7e4b76bb0796eaf26d7b
/frameworks/base/core/java/android/os/storage/StorageManager.java
0eec21d97d9dc4eb4fdbad0e4c0fc53703452d02 26-Feb-2010 Suchi Amalapurapu <asuchitra@google.com> Add dialog to display storage users when enabling/disabling ums

Some error dialogs and related strings
MountService changes to follow unmount path when enabling ums.

Please note that MountService api setUmsEnabled does not return
error codes for now. This is a known limitation.
/frameworks/base/core/java/android/os/storage/StorageManager.java
b104340496e3a531e26c8f428c808eca0e039f50 05-Feb-2010 San Mehat <san@google.com> Framework: Clean up / Refactor Mount APIs

- Move android.storage.* -> android.os.storage.* and refactor users
- Refactor generic shares back to explicit ums enable/disable/isEnabled
- Remove media insert/removed event callbacks (not ready for Froyo)
- Remove 'label' from volume state change callbacks
- Add public API functions for enabling/disabling USB mass storage (permissions enforced
in MountSevice)
- Remove some stray un-needed import lines
- Move android.os.IMountService / android.os.IMountServiceListener -> android.os.storage
- Improve code comments

Updated:
MountService: Add dup state check and move debugging behind a conditional
UsbStorageActivity: Fix review comments + a TODO
StorageNotification: Add @Override tags
StorageManager: Don't use a static Listener list
MountService: Reduce bloat and fix == where I meant .equals()
PackageManagerTests: Update for new API

Signed-off-by: San Mehat <san@google.com>
/frameworks/base/core/java/android/os/storage/StorageManager.java