History log of /frameworks/base/services/core/java/com/android/server/MountService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a7892486c2100d99abef355f2bd2c919e6516a6d 07-Aug-2015 Amith Yamasani <yamasani@google.com> Fix partial user cleanup on restart

Internal volume was not available during PackageManagerService creation,
which resulted in a zombie user's folder not being cleaned after a reboot.

Add the internal volume earlier in the boot cycle so that it can be accessed
for user cleanup.

Bug: 22483086
Change-Id: I8f3ffbb25f3902d00a96d1ee2d7a79373c5e35b7
/frameworks/base/services/core/java/com/android/server/MountService.java
abc3e85b3c84c8fce37b4622d1f7c986a72a3961 03-Aug-2015 Jeff Sharkey <jsharkey@android.com> Avoid deadlock by broadcasting outside lock.

We can end up in a rare tangled mess when sending broadcasts while
PackageManager is still trying to deal with scanAvailableAsecs().

Long-term solution is to make Environment.isExternalStorageEmulated()
more robust, but for now we just send these internal broadcasts
after we drop the MountService lock.

Bug: 22858403
Change-Id: I7b43865782f48a679882fd1675b7b961e1292df4
/frameworks/base/services/core/java/com/android/server/MountService.java
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/services/core/java/com/android/server/MountService.java
2e606d7be5275f2bff4c5755351bc3191ecb1bf1 27-Jul-2015 Jeff Sharkey <jsharkey@android.com> Enforce DISALLOW_MOUNT_PHYSICAL_MEDIA.

Bug: 22697024
Change-Id: Ib7277e8850a49909e5d8d5ad5502cd9315cddf0b
/frameworks/base/services/core/java/com/android/server/MountService.java
2bd5cff7c639ed4bba2fc7ba3a545f4c764f0019 22-Jul-2015 Amith Yamasani <yamasani@google.com> Avoid a deadlock between PMS and AppOpsService

Don't check for external storage access rights from MountService
for system server. Otherwise there's a case where AppOpsService
is locked and PackageManagerService calls into AppOps with its
own lock held and is unable to do an AppOps check via this path.

Bug: 22522725
Change-Id: Ib4cf914638905de391384aa5122e691c5a7140ec
/frameworks/base/services/core/java/com/android/server/MountService.java
b3cf95334551e55e068bf6f9d7640681cdc05e07 18-Jul-2015 Jeff Sharkey <jsharkey@android.com> Clear identity when killing media provider.

Otherwise various shell "sm" commands fail because they don't hold
the right permissions.

Bug: 22564405
Change-Id: I88081e8a9b27ee43904d3ea6f745aba3af4e2150
/frameworks/base/services/core/java/com/android/server/MountService.java
38c3dbb2092e153109503aa9487b15b11192d5c6 14-Jul-2015 Svetoslav <svetoslavganov@google.com> Clear binder id when determining external storage state

bug:22472435

Change-Id: I5badd51cb9fb2244395880eb1bbff8f4aa0abb8c
/frameworks/base/services/core/java/com/android/server/MountService.java
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/services/core/java/com/android/server/MountService.java
edcdaf64637163dd2a96fe4ad274f9a16d2f9e90 09-Jul-2015 Jeff Sharkey <jsharkey@android.com> Timeout when partitioning takes too long.

Otherwise we leave user hanging in wizard forever, instead of
telling them that something went wrong.

Bug: 20914299
Change-Id: Ib9ff3a8c316976c6a1dfdaffa10762abbea0c229
/frameworks/base/services/core/java/com/android/server/MountService.java
14cbe52150bad38ab7c14c868e25a68d354f8282 08-Jul-2015 Jeff Sharkey <jsharkey@android.com> Kill MediaProvider during drastic changes.

Sadly MediaProvider makes a ton of assumptions about storage paths
not changing. To ensure that it picks up radical storage changes,
kill it and let it restart to pick up new paths.

Also give ourselves a longer timeout when benchmarking.

Bug: 20275423
Change-Id: I9971c4667dabdc685cb23528443f085f152c461d
/frameworks/base/services/core/java/com/android/server/MountService.java
5af1835d678031d4a6615edc96ba58c82304b31d 08-Jul-2015 Jeff Sharkey <jsharkey@android.com> Generate stable MTP storage IDs.

It ends up that MediaProvider is persisting MTP storage IDs in its
database, so we need to make sure we generate stable IDs over time,
otherwise we can end up looking into a black hole.

Bug: 22256092
Change-Id: I6a75c239aac1b71fd5f6df0df69b24971079a086
/frameworks/base/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
e8a4b66960056c2dc2c8dbb5f8df00710645cc64 28-Jun-2015 Jeff Sharkey <jsharkey@android.com> Better handling of trim/benchmark results.

Request benchmarking of devices once per week during normal fstrim
maintenance window. Tunable parameter gives us the ability to change
frequency through global setting.

Track individual benchmark and trim results for each volume, and
use scrubbed volume identifier (based on adoptiong age) when logging
stats to drop box. Track last benchmark and trim time for each
volume separately.

Bug: 21831325
Change-Id: I53b3ed788f7820c2e5bceb2840339f5b4aada3f0
/frameworks/base/services/core/java/com/android/server/MountService.java
462ac3a2aa5e1c974d056dc7221805e2b8ac7823 30-Jun-2015 Amith Yamasani <yamasani@google.com> Don't allow non-admins to adopt sd card for internal storage

Bug: 21883016
Change-Id: I9af3eeffd860b076e69bb02a3dc06edba5f95898
/frameworks/base/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
e16ee482a6f1a44267e31193b1d61e5098694756 24-Jun-2015 Tony Mantler <nicoya@google.com> Merge "Notify on BAD_REMOVAL and pass fsUuid in broadcast" into mnc-dev
f0d710578ee23c1152ad5aadb2eabc96b5e29c08 24-Jun-2015 Tony Mantler <nicoya@google.com> Notify on BAD_REMOVAL and pass fsUuid in broadcast

b/21328721

Change-Id: I6d2fd18468bcde72e4c050b975fd7286716fbc50
/frameworks/base/services/core/java/com/android/server/MountService.java
c00398948811690728ed4909f87d01c24a8a0938 23-Jun-2015 Todd Kennedy <toddke@google.com> Merge "Handle volume benchmark timeout" into mnc-dev
8101ee6884e9fe954aeaf3c08afd01ab1714f306 23-Jun-2015 Todd Kennedy <toddke@google.com> Handle volume benchmark timeout

If a volume benchmark operation times out, we don't want to show
a cryptic toast message. Instead, we return a very large integer
[eg Long.MAX_INT]. The storage wizard can then use this value
to show an appropriate dialog if it chooses.

Bug: 21376364
Change-Id: I3d97336e19c93511cfff2cbdb2f07ab033a1143d
/frameworks/base/services/core/java/com/android/server/MountService.java
5cc0df214bbe2b169150c9060dc5288bb8aaf338 18-Jun-2015 Jeff Sharkey <jsharkey@android.com> Forget private partition keys.

When we forget a private partition, ask vold to also forget the key
for that partition GUID. This means we need to track both the
filesystem UUID and the partition GUID for a private volume.

Bug: 21782268
Change-Id: Icda1cbb65539d61dacc663428daf3d1a2e4c313e
/frameworks/base/services/core/java/com/android/server/MountService.java
80b34d7b9da0e0738a4a1db78d83cd804372594b 13-Jun-2015 Makoto Onuki <omakoto@google.com> Merge "Add StorageEventListener.onDiskDestroyed()" into mnc-dev
c7acac6798e12780194af33d5a9fdf382ab17155 13-Jun-2015 Jeff Sharkey <jsharkey@android.com> More useful extras in disk/volume broadcasts.

Change-Id: I594166cff332aaf72b2b6357ac6ed3e6e42cbc49
/frameworks/base/services/core/java/com/android/server/MountService.java
9dc575d63c5f0d7511308bd2cd3d5dbd20c15e17 13-Jun-2015 Makoto Onuki <omakoto@google.com> Add StorageEventListener.onDiskDestroyed()

Bug 21336042

Change-Id: I226cf205191dd302ff8d5156f9ae0fe8fc5b2c2b
/frameworks/base/services/core/java/com/android/server/MountService.java
e9b64f97350a0661cc7d5e79216d75374c37581f 12-Jun-2015 Jeff Sharkey <jsharkey@android.com> Send along the disk ID that we just scanned.

Change-Id: I33f1a5363ed171f715b2f6c5690fcee586a8a58c
/frameworks/base/services/core/java/com/android/server/MountService.java
c7c8af6726eda245288ab1af720297c60cd1be54 10-Jun-2015 Jeff Sharkey <jsharkey@android.com> Merge "Send added user serial numbers to vold." into mnc-dev
bcd262da4b2698cd7a7cde066c76bfff32843e4d 10-Jun-2015 Jeff Sharkey <jsharkey@android.com> Send added user serial numbers to vold.

vold will eventually use the serial numbers to clean up stale user
directories when mounting private storage devices.

Bug: 20275572
Change-Id: I37f6c10026608dfa6484598420db5a5870330d25
/frameworks/base/services/core/java/com/android/server/MountService.java
05487618c1b1da86a0313c9a89eecd7372f6c96c 09-Jun-2015 Paul Lawrence <paullawrence@google.com> Remove hex encoding and password adjusting now that patterns are '1' based

Bug: 21606650
Change-Id: Id2b01d43edcb995a9bffbc990e6297940e81f20e
/frameworks/base/services/core/java/com/android/server/MountService.java
4e83cc9fc15fa4795a41d4d8dfd2b00c1ad966fd 27-May-2015 Jeff Sharkey <jsharkey@android.com> Format volumes with "auto" filesystem type.

Bug: 20275581
Change-Id: Id4c7e1ad83f28110a77fecf563e1bcb8ca4d4d9a
/frameworks/base/services/core/java/com/android/server/MountService.java
1c62cbbdfe7cb524b70685150e74c9a52fcee088 03-Jun-2015 Paul Lawrence <paullawrence@google.com> Move crypt commands to a different listener in vold

In order to prevent this bug from happening, we must allow vold cryptfs
commands to complete while a long running mount is underway.

While waiting for vold to be changed to a binder interface, we will simply
create two listeners, one for cryptfs and one for everything else.

Bug: 19197175
Change-Id: I8c40211dc1ef5ecec765ab587f093e757f1173d3
/frameworks/base/services/core/java/com/android/server/MountService.java
f5a6bd7538a6800c2a43ace5ad67d65b1f8f697a 19-May-2015 Jeff Sharkey <jsharkey@android.com> Push initial disk state, handle empty media.

Stash volume count from last scan, and use it to push initial storage
notifications state when listener is first attached.

Also omit disks with invalid size, which usually means they're an
empty slot with no media.

Bug: 20503551
Change-Id: I75097035aebaad70ba32437179a863f6a0910aa5
/frameworks/base/services/core/java/com/android/server/MountService.java
2177ed407b8323e6f50d2aa64a62fbdc773e1859 15-May-2015 Jeff Sharkey <jsharkey@android.com> Merge changes from topic 'bench' into mnc-dev

* changes:
Command to change force adoptable state.
Initial pass at storage benchmarks.
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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
9e9e2e73c6ec7bece20268196dc89ad0c8bafad4 08-May-2015 Wojciech Staszkiewicz <staszkiewicz@google.com> Pass charset to XmlPullParser.setInput instead of null

Passing null to XmlPullParser.setInput forces it to do additional
work, which can be easily avoided if we know the charset beforehand.

bug: b/20849543

Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
/frameworks/base/services/core/java/com/android/server/MountService.java
7d2af54a98358e9dea96f879ebd1ea915263522b 13-May-2015 Jeff Sharkey <jsharkey@android.com> New "sm" shell tool to call StorageManager.

Surface basic StorageManager commands through shell tool, like
simple listing of disks and volumes, and commands like mounting and
partitioning.

The output is designed to be parsed by host-side testing tools,
instead of relying on fragile dumpsys parsing.

Bug: 19993667
Change-Id: I993e92ecf57996678965945f0ae648b392a77ea2
/frameworks/base/services/core/java/com/android/server/MountService.java
fced534dec1088bdd7da1495d76b73996dc8a1a1 10-May-2015 Jeff Sharkey <jsharkey@android.com> Fix devices with primary physical storage.

Always assume the factory-reset default primary storage before parsing
storage settings. Without this, we'd always default to picking
internal emulated storage during first boot or upgrade.

Bump version code to re-evaluate this for devices that default to
physical storage as primary.

Also restrict available move targets when storage is physical, since
we can't really translate between multi-user and non-multi-user aware
storage.

Bug: 20836019
Change-Id: I186ded1aa3dd9cea67497a4f53b0973031174ccd
/frameworks/base/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
7618db10380feb6036d0d742fcb19c6cd1b62940 29-Apr-2015 Christopher Tate <ctate@google.com> Don't ostensibly back off fstrim but then do it anyway

When the mount service isn't up yet, we schedule a retry in the near
future, but then mistakenly go ahead and try (unsuccessfully) to do the
fstrim immediately anyway. Don't do that. Furthermore, when in this
situation make sure to preserve knowledge of any completion callback
that may be expecting to hear back about the [eventual] fstrim operation.

Change-Id: Ic7cba37b4f850540f6e448168be0c42418039b01
/frameworks/base/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
f8d26e24af8a3ad98fdf1016fd2ac62e927c8fda 24-Apr-2015 Rubin Xu <rubinxu@google.com> Merge "Add missing permission check in MountService"
cd7a014981d956580fb0aeaa5e31bd00882f1432 18-Apr-2015 Rubin Xu <rubinxu@google.com> Add missing permission check in MountService

Protect MountService.getPassword() with ACCESS_KEYGUARD_SECURE_STORAGE
permission. Protect finishMediaUpdate() which is only called by
PackageManagerService. Also fix a lock issue in MountService.

Bug: 19961359
Change-Id: I50ec806fb37724ef239ef83f4e33265133b51d0b
/frameworks/base/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
74acbbb2cd367c6e78db7de5118ff9dd56da61d0 21-Apr-2015 Jeff Sharkey <jsharkey@android.com> Blend in force adoptable flag when set.

Bug: 19993667
Change-Id: Ic7f348d171a89e889281b7efb1aa0cbade048975
/frameworks/base/services/core/java/com/android/server/MountService.java
eba260d6d361dcfb749ce390320257c28c474ae1 19-Apr-2015 Jeff Sharkey <jsharkey@android.com> Wait for first scan before partitioning is done.

This means newly created volumes are at least created for other
platform components to start poking with.

Bug: 19993667
Change-Id: I561a5d0e3659ff9146832aeb6a31ab78fd9da580
/frameworks/base/services/core/java/com/android/server/MountService.java
e6c04f9417cc4bff0f5f9e72f0d6d66d2aab6e80 19-Apr-2015 Jeff Sharkey <jsharkey@android.com> Broadcast hidden volumes, notification polish.

Send limited broadcast intent when certain volume state changes
occur; the only customer for now is ExternalStorageProvider.

Change notification flow to be less bumpy. Pick USB icon based on
disk type, and avoid using "generic" disk labels.

Bug: 19993667
Change-Id: I263bc9e9aae2ae57eb4d1afe76da686aee5475fb
/frameworks/base/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
1783f149c73e1d78265981965b8c8475e6e0c3bd 17-Apr-2015 Jeff Sharkey <jsharkey@android.com> Avoid deadlock when FSTRIM requested at boot.

When PackageManager decides that FSTRIM is required at boot, we
can end up in deadlock. Work around this for now by kicking the
requested FSTRIM can down the road for a few seconds until we're
connected to vold.

Bug: 20228019
Change-Id: I47e422e618d99e59aed8a8b79227821a3012eb9f
/frameworks/base/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
56e629322f0739a04c8ff48915226ecf36a13b44 22-Mar-2015 Jeff Sharkey <jsharkey@android.com> Bring MountService into the SystemService world.

Change-Id: I7f7db49ff373b199f7b81f184a7c62bee682af67
/frameworks/base/services/core/java/com/android/server/MountService.java
00e821a8608efdc19041bdda1e832d3d4b3c29e2 12-Feb-2015 Narayan Kamath <narayan@google.com> am c7e48719: Merge "Remove references to persist.sys.language/country."
automerge: 8be3724

* commit '8be3724a06f7b2d28c6664ca11a03f91f97f0972':
Remove references to persist.sys.language/country.
b61db8229a8f220f23b22b7ccde72e5cf73e0e07 12-Feb-2015 Narayan Kamath <narayan@google.com> Remove references to persist.sys.language/country.

Addresses a couple of TODOs now that all usages have been
removed and fixes a doc that specifies how the emulator locale
can be set.

bug: 17691569

Change-Id: I802ea1e12448a5442840cad1fdc0956d3e2c7a8c
/frameworks/base/services/core/java/com/android/server/MountService.java
1194e754a95e1fa5d4eba6d0bca109156dd4df94 22-Jan-2015 Narayan Kamath <narayan@google.com> Merge "Add support for persist.sys.locale." automerge: dca2332
automerge: 117f161

* commit '117f161fee52dfa200f89282c487d58c29b41d4f':
Add support for persist.sys.locale.
d30dbb8ae12e6e83e3035f12dd291f92e1f22c18 15-Jan-2015 Narayan Kamath <narayan@google.com> Add support for persist.sys.locale.

AndroidRuntime has been changed to read "ro.product.locale" and
"persist.sys.locale" instead of "ro.product.locale.language" etc.
This is passed down as "-Duser.locale" to the runtime.

The system_server has been changed to write out persist.sys.locale
on locale changes.

bug: 17691569

Change-Id: I93360c8795c9620a133656dc491d13d7b6ed162e
/frameworks/base/services/core/java/com/android/server/MountService.java
91bf111aef4a0fe1cd11f08d09d0e53c8278e51e 07-Jan-2015 Paul Lawrence <paullawrence@google.com> am 53d1022e: am a15d6402: Merge "Fix crash caused by toHex returning exception"

* commit '53d1022e835f0556095dee168f5bb491a29fd0ac':
Fix crash caused by toHex returning exception
24063b5ebd9124e27ea1dbd06ba6a3dd31944643 06-Jan-2015 Paul Lawrence <paullawrence@google.com> Fix crash caused by toHex returning exception

toHex was changed to throw an exception in
I4986a8e806d9066129f696ab9f2e80655424e723, but its caller was not adjusted
accordingly, causing a crash whenever an unencrypted device was booted.

Bug: 18886749
Change-Id: If0505f617001cf5e0d99cf14c8b09e6a6a377167
/frameworks/base/services/core/java/com/android/server/MountService.java
bf0c614d33673a0a037e317c8c25ad2e6c24e77d 29-Dec-2014 Narayan Kamath <narayan@google.com> am c97d1fbb: am 5106dd44: Merge "Throw IllegalArgumentException on invalid hex-strings."

* commit 'c97d1fbbe00a91b1a67b7c526d9cf11ffec741fa':
Throw IllegalArgumentException on invalid hex-strings.
25c29c19474e5cb359473d3d36fdb1eddb90f50b 17-Dec-2014 Narayan Kamath <narayan@google.com> am 6d41504d: Merge "Move frameworks users over to libcore hex encoding API."
automerge: 681e6df1

* commit '681e6df1221ca7671f574d368d428f62184448b0':
Move frameworks users over to libcore hex encoding API.
1653b1dd69a3af0d8acc4121e5b8e743a2e491b7 17-Dec-2014 Narayan Kamath <narayan@google.com> Throw IllegalArgumentException on invalid hex-strings.

Beats returning null since there's let's chance it will be interpreted
as the lack of a password.

Change-Id: I4986a8e806d9066129f696ab9f2e80655424e723
/frameworks/base/services/core/java/com/android/server/MountService.java
78108a3e52c20ad0a481a8419c2d2c9722b53400 16-Dec-2014 Narayan Kamath <narayan@google.com> Move frameworks users over to libcore hex encoding API.

Removes dependency on apache-http.

bug: 18027885
Change-Id: I508db016747985ecdd68e02d5d4efcd0ddd694df
/frameworks/base/services/core/java/com/android/server/MountService.java
7265abe77a76f848a316640b5da106e882bdbc8a 21-Nov-2014 Christopher Tate <ctate@google.com> Be increasingly aggressive about fstrim if it isn't being run

The current heuristics depend on devices being alive at midnight+ in
order to run periodic background fstrim operations. This unfortunately
means that people who routinely turn their devices off overnight wind
up with their devices *never* running fstrim, and this causes major
performance and disk-life problems.

We now backstop this very-friendly schedule with an increasingly
aggressive one. If the device goes a defined time without a background
fstrim, we then force the fstrim at the next reboot. Once the
device hits the midnight+ idle fstrim request time, then we already
aggressively attempt to fstrim at the first available moment
thereafter, even if it's days/weeks later without a reboot.

'Available' here means charging + device idle. If the device never
becomes idle then we can't do much without rendering an in-use device
inoperable for some number of minutes -- but we have no evidence of
devices ever failing to run fstrim due to this usage pattern.

A new Settings.Global element (type 'long', called
"fstrim_mandatory_interval") is the source of the backstop time. If
this element is zero or negative, no mandatory boot-time fstrim will
ever be performed. If the element is not supplied on a given device,
the default backstop is 3 days.

Adds a new string to display in the upgrading dialog when doing
the fstrim. Note it is too late for this to be localized, but since
this operation can take a long time it is probably better to have
it show *something* even if not localized, rather than just sit there.

Bug 18486922

Change-Id: I5b265ca0a65570fb8931251aa1ac37b530635a2c
/frameworks/base/services/core/java/com/android/server/MountService.java
c220d8e57ca97c70db1fd72f040bd6c6f70bbf13 24-Oct-2014 Paul Lawrence <paullawrence@google.com> Stop crypto UI from crashing during encryption

Don't try to read crypto meta data during this time

Bug: 18037893
Change-Id: I3628572b3b90e6fc0a7c71089b447fb0e5303ee9
/frameworks/base/services/core/java/com/android/server/MountService.java
a6711ff6f09cc25c693cbb50452e3f807c6122f5 17-Oct-2014 Svetoslav <svetoslavganov@google.com> Accessibility no longer overrides strong encryption.

Updating the accessibility layer behavior to reflect the new
model where accessibility no longer overrides strong encryption.
Now enabling an accessibility service lowers the encryption
level but the user can bump it up in settings if desired.

bug:17881324

Change-Id: Ic60d760c267d3f934040a42e1963b179bd8b9f5f
/frameworks/base/services/core/java/com/android/server/MountService.java
9c33f28d912c9b51bff69e3eaad7090a6b8a3ec3 13-Oct-2014 Elliott Hughes <enh@google.com> Ensure that the SIM language doesn't override the user language on the encryption UI.

Bug: 17945169
Change-Id: I51e4f47c7cd925f3701f292b9022e467ccf95a17
/frameworks/base/services/core/java/com/android/server/MountService.java
16e4a1aade2b73edfdaa42aa86a3893fd039fc62 30-Sep-2014 Svetoslav <svetoslavganov@google.com> Use default encryption password if an accessibility service is enabled.

When device is encrypted the user has to authenticate in order to decrypt
the data partition which is required for running accessibility services
and Text-To-Speech. In order to address this issue we are falling back
to use the default password if there is an enabled accessibility service
and the user has secure lock. This will enable the user to authenticate
when accessibility layer is completely functional.

bug:17671790

Change-Id: Iafffe7bcd234008cf91ffb5011b21b803dca227a
/frameworks/base/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
941a8ba1a6043cf84a7bf622e44a0b4f7abd0178 21-Aug-2014 Jeff Sharkey <jsharkey@android.com> Installing splits into ASECs!

Sessions can now zero-copy data directly into pre-allocated ASEC
containers. Then at commit time, we compute the total size of the
final app, including any inherited APKs and unpacked libraries, and
resize the container in one step.

This supports both brand new ASEC installs and inheriting from
existing ASEC installs. To keep things simple, it currently requires
copying any inherited ASEC contents, but this could be optimized in
the future.

Expose new vold resize command, and allow read-write mounting of ASEC
containers. Move native library extraction into the installer flow,
since it needs to happen before ASEC is sealed. Move multiArch flag
into NativeLibraryHelper, instead of making everyone pass it
around. Migrate size calculation to shared location.

Separate "other" package name in public API, provide a path to a
storage device when relevant, and add more docs.

Bug: 16514385
Change-Id: I06c6ce588d312ee7e64cce02733895d640b88456
/frameworks/base/services/core/java/com/android/server/MountService.java
5f054cea32eb2e87aeaa03138341eb887cda5e0c 25-Jul-2014 JP Abgrall <jpa@google.com> MountService: Fix android.process.media crash repeatedly problem

When the framework restarts because of certain exception, the
external volume id will disappear. At this time, mount service
will issue "volume list" command to vold to get the status of
each storage.

The fix is to re-broadcast the uuid and user label again via
vold "volume list broadcast" command.

Bug: 16253597
Bug: 16306775
Change-Id: I227e8bc597a4f5338035d3401036490f14557211
/frameworks/base/services/core/java/com/android/server/MountService.java
92aa5a2f15032f3e5a5394ca96d0b6fd03f0b405 07-Jul-2014 Emily Bernier <ember@google.com> Re-commit of reverted change 458959

Using correct parameters for Slog.w().

Change-Id: I0ab7a1b114431f15fe3652e98c75e7baab7a2d95
/frameworks/base/services/core/java/com/android/server/MountService.java
a35add68827c4d817066efa9e54657c830b52c98 03-Jul-2014 Narayan Kamath <narayan@google.com> Revert "Enforce USB and storage restrictions"

This reverts commit 39e53714ede48fcb464733834d7d9ccb868efe8a.

Change-Id: I81199fea8ca4b48516792bb02c1c3e90e5916c1f
/frameworks/base/services/core/java/com/android/server/MountService.java
59f77c32dc6e5378053d57a887d404831463d78c 02-May-2014 Emily Bernier <ember@google.com> Enforce USB and storage restrictions

When DISALLOW_MOUNT_PHYSICAL_MEDIA is true, prevent user from mounting any
external media. When DISALLOW_USB_FILE_TRANSFER is true, prevent user from
enabling USB mass storage.

Change-Id: Ia4accec4fb0b7aad6350cf0059244f6329204796
/frameworks/base/services/core/java/com/android/server/MountService.java
115afdadb5863a02f0b0daefcc0511bfd35b531e 07-Jun-2014 Christopher Tate <ctate@google.com> Switch framework to using new scheduled-work API

Also add the intended permission-use enforcement to said API.

Bug 14994893
Bug 14993295

Change-Id: I5a3ffd32d0702c68f4ef6da68f7fa6e9de674380
/frameworks/base/services/core/java/com/android/server/MountService.java
2ee3c1e189819cc6efb4d7de24f1438bdb824087 31-May-2014 Jeff Sharkey <jsharkey@android.com> Per-app media directories on external storage.

This change defines per-app directories on external storage that
will be scanned and included in MediaStore. This gives apps a way
to write content to secondary shared storage in a way that can
easily be surfaced to other apps.

Bug: 14382377
Change-Id: I4cb367c870509e76f0c2c598f01e2f699780030a
/frameworks/base/services/core/java/com/android/server/MountService.java
dfad99ad9fd5953b9d726715c40197a3e70e7dd0 08-May-2014 Brian Carlstrom <bdc@google.com> resolved conflicts for merge of 0b5598c9 to master

Change-Id: Ie911d6b0b5e2b87e2b4669fa2465a82bb5807893
0b5598c924fc140db5cfee08c17fd91e630b1c9e 07-May-2014 Brian Carlstrom <bdc@google.com> am 691079dd: am a21ba5be: Merge "Add BackgroundDexOptService"

* commit '691079ddc0055fac9b82dccaf35b4591978b2a55':
Add BackgroundDexOptService
9502f990899ef576879048ec5147d403158ad89d 10-Apr-2014 Paul Lawrence <paullawrence@google.com> Merge "Allow encryption when keyguard is set to pattern or no protection"
46791e752ca1eca35e6a882c47d7de7f4f66687c 03-Apr-2014 Paul Lawrence <paullawrence@google.com> Allow encryption when keyguard is set to pattern or no protection

Add type parameter to encryptStorage so we can set type when we encrypt

Depends on
https://googleplex-android-review.git.corp.google.com/#/c/444056/

Circular dependency on:
https://googleplex-android-review.git.corp.google.com/#/c/444201/

Bug: 13749169
Change-Id: I52034ec25de35f12f1bbfdd1b0f8584923a0be2e
/frameworks/base/services/core/java/com/android/server/MountService.java
e51dcf98a4ddb1340cffba88059ad89f0b90909a 18-Mar-2014 Paul Lawrence <paullawrence@google.com> Save OwnerInfo so CryptKeeper can display at boot time

Requires vold change from
https://googleplex-android-review.git.corp.google.com/#/c/435164/

Bug: 13526708
Change-Id: I33153df9961832f72c3b8103bd5e1d3a17e77df3
/frameworks/base/services/core/java/com/android/server/MountService.java
945490c12e32b1c13b9097c00702558260b2011f 27-Mar-2014 Paul Lawrence <paullawrence@google.com> Don't double prompt on booting encrypted device

vold will store password securely until KeyGuard requests it
and hands it on to KeyStore.

This is a revision of

https://googleplex-android-review.git.corp.google.com/#/c/418123/

which was reverted. It had two bugs in LockSettingsService.checkVoldPassword.
1) We were not checking password for null, which caused an exception
2) checkPattern/checkPassword return true if there is no saved pattern or password.
This leads to situations where we get true returned even when the password
doesn't match. Call the correct one based on what is there, not what vold
thinks ought to be there.

Bug: 12990752
Change-Id: I05315753387b1e508de5aa79b5a68ad7315791d4
/frameworks/base/services/core/java/com/android/server/MountService.java
6ee7d25010d4f23b44a151f3953225ba253de8af 26-Mar-2014 Paul Lawrence <paullawrence@google.com> Revert "Don't prompt at boot if we already did that when decrypting"

This reverts commit 493e3e7e6523fd94cc1acae3e45935a1227d58c3.

Should fixes

Bug: 13611885
Bug: 13656830
Change-Id: I117c988bb6679f44f8add4fcc18f45cb8238dfb4
/frameworks/base/services/core/java/com/android/server/MountService.java
493e3e7e6523fd94cc1acae3e45935a1227d58c3 06-Feb-2014 Paul Lawrence <paullawrence@google.com> Don't prompt at boot if we already did that when decrypting

vold will store password securely until KeyGuard requests it
and hands it on to KeyStore.

Needs matching vold changes from
https://googleplex-android-review.git.corp.google.com/#/c/432050/

Bug: 12990752
Change-Id: I930ed8180cf0b8feb1e58db043d5fb6dff1bab20
/frameworks/base/services/core/java/com/android/server/MountService.java
2bc68575325ab7bf082de24f5f095f20ea63f877 10-Mar-2014 Paul Lawrence <paullawrence@google.com> Merge "Clean up a few minor issues"
77b987f1a1bb6028a871de01065b94c4cfff0b5c 27-Feb-2014 Dianne Hackborn <hackbod@google.com> Hold a wake lock while dispatching network activity events.

Also add new API for determining whether the current data network
is active, and thus better scheduling network operations. This
API is designed to not be tied to a mobile network -- regardless
of the network, apps can use it to determine whether they should
initiate activity or wait. On non-mobile networks, it simply always
reports as the network being active.

This changed involved reworking how the idle timers are done so
that we only register an idle timer with the current default
network. This way, we can know whether we currently expect to
get callbacks about the network being active, or should just always
report that it is active. (Ultimately we need to be getting this
radio active data from the radio itself.)

Change-Id: Iaf6cc91a960d7542a70b72f87a7db26d12c4ea8e
/frameworks/base/services/core/java/com/android/server/MountService.java
9a41b24c8f7768d3402256dbd876024f33b1f36b 18-Feb-2014 Jeff Sharkey <jsharkey@android.com> am 392ee12f: am 96190f1c: am e6d256c5: am 234b0b03: Merge "Fix, MountService now only sends one onShutDownComplete"

* commit '392ee12fd57870e1e8f0777d03295b0435babd1f':
Fix, MountService now only sends one onShutDownComplete
96190f1c054e2e34ac741de1d7afb2f6645d218c 18-Feb-2014 Jeff Sharkey <jsharkey@android.com> am e6d256c5: am 234b0b03: Merge "Fix, MountService now only sends one onShutDownComplete"

* commit 'e6d256c50b0709378a5bfff0ae27eb7cf6cc3894':
Fix, MountService now only sends one onShutDownComplete
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/services/core/java/com/android/server/MountService.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/services/core/java/com/android/server/MountService.java
d417d625d244356bc770e2692fd59e754a72f59f 20-Aug-2013 Christopher Tate <ctate@google.com> Introduce "IdleService" API to expose idle-time maintenance to apps

When an application wishes to do low-priority background work when the
device is otherwise idle (e.g. in a desk dock overnight), it declares
a service in its manifest that requires this permission:

android:permission="android.permission.BIND_IDLE_SERVICE

to launch, and which publishes this intent filter:

<intent-filter>
<action android:name="android.service.idle.IdleService" />
</intent-filter>

This string is declared in the API as IdleService.SERVICE_INTERFACE.

The service must be implemented by extending the new "IdleService"
class, which provides the API through which the system will communicate
with the app.

IdleService declares three methods, two of which are lifecycle callbacks
to the service, and the third of which is for the service itself to
invoke when appropriate. The lifecycle callbacks are

public abstract boolean onIdleStart();
public abstract void onIdleStop();

The first of these is a notification to the service that an idle
maintenance interval has begun. The service can then spin off
whatever non-UI work it wishes. When the interval is over, or if
the OS determines that idle services should be shut down immediately,
the onIdleStop() method will be invoked. The service must shut down
any background processing immediately when this method is called.

Both of these methods must return immediately. However, the OS
holds a wakelock on the application's behalf for the entire period
between the onIdleStart() and onIdleStop() callbacks. This means
that for system-arbitrated idle-time operation, the application does
not need to do any of its own wakelock management, and does not need
to hold any wakelock permissions.

The third method in IdleService is

public final void finishIdle();

Calling this method notifies the OS that the application has finished
whatever idle-time operation it needed to perform, and the OS is thus
free to release the wakelock and return to normal operation (or to
allow other apps to run their own idle services).

Currently the idle window granted to each idle service is ten minutes.
The OS is rather conservative about when these services are run; low
battery or any user activity will suppress them, and the OS will not
choose to run them particularly often.

Idle services are granted their execution windows in round-robin
fashion.

Bug 9680213

Change-Id: Idd6f35940c938c31b94aa4269a67870abf7125b6
/frameworks/base/services/core/java/com/android/server/MountService.java
222496f82fb78473a876da5dc395714b0fa5b99c 23-Jan-2014 Christopher Tate <ctate@android.com> am 5d734dbc: am e1d18f6e: am 0e3df216: am cc81bcec: Merge "Only send storage intents after boot complete"

* commit '5d734dbc56cd2d4350f4a35f1bedbb6b40247e5c':
Only send storage intents after boot complete
38c65b1f70042bc8e37e91106692158f0ce98703 13-Jan-2014 Jeff Sharkey <jsharkey@android.com> am 6fba240b: am 6d3700b3: am 47235e8b: am 90cadb35: Merge "MountService listeners can not be unregistered"

* commit '6fba240b72e9ae2bc66c98b058e78aecd568ae3f':
MountService listeners can not be unregistered
9158825f9c41869689d6b1786d7c7aa8bdd524ce 22-Nov-2013 Amith Yamasani <yamasani@google.com> Move some system services to separate directories

Refactored the directory structure so that services can be optionally
excluded. This is step 1. Will be followed by another change that makes
it possible to remove services from the build.

Change-Id: Ideacedfd34b5e213217ad3ff4ebb21c4a8e73f85
/frameworks/base/services/core/java/com/android/server/MountService.java