summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/MountService.java
AgeCommit message (Collapse)Author
2013-12-19Move some system services to separate directoriesAmith Yamasani
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
2013-10-17Include external storage devices in DocumentsUI.Jeff Sharkey
Include volume UUID in generated document IDs to uniquely identify volumes over time. Show volume label to users. Watch for mount changes to update available roots. Bug: 11175082 Change-Id: Ia151bde768587468efde0c1d97a740b5353d1582
2013-10-16Plumb through physical device UUID and label.Jeff Sharkey
vold now parse out UUID and label for inserted physical devices, and reports them to framework. Add these to hidden StorageVolume class for use by DocumentsUI and MediaProvider. Remove last JNI method in FileUtils! Bug: 11175082 Change-Id: I1cfcd1ade61767b103f693319ea2600008ee2e3c
2013-10-08Add secondary external storage support.Jeff Sharkey
When SECONDARY_STORAGE is defined by the hardware configuration, include those paths in the new getExternalCacheDirs() and getExternalFilesDirs() APIs. Give secondary volumes valid state until vold reports back. Bug: 10330128, 10330229 Change-Id: Ifa55bfda47fd7c750f462dd26c98792ad462ab91
2013-10-03Fix mount path prefix checking.Jeff Sharkey
Uncovered as part of writing CTS tests. Bug: 10577541 Change-Id: I7832bcd551bedeea0b2ee5d6926aba6ac9bd0fd2
2013-09-20Delegate mkdirs() to vold when lacking perms.Jeff Sharkey
Apps without sdcard_r or sdcard_rw are still able to write to their package-specific directory, but someone needs to first make that directory on their behalf. This change will delegate the mkdirs() call through to vold when an app fails to create directly. MountService validates that the path belongs to the calling user, and that it's actually on external storage, before passing to vold. Update Environment to make app-vs-vold paths clearer. Bug: 10577808 Change-Id: I43b4a77fd6d2b9af2a0d899790da8d9d89386776
2013-08-11APIs for multiple external storage devices.Jeff Sharkey
Provide developer APIs to discover application-specific paths on secondary external storage devices. Covers files, cache, and OBB directories. Apps will not have write access outside their package- specific directories on secondary devices, so only primary storage is exposed through Environment. Creation of .nomedia files will be handled by FUSE daemon in future change. Change-Id: Ifcce6201a686d80269d7285adb597c008cf8fa7c
2013-06-10resolved conflicts for merge of e96a8207 to masterKenny Root
Change-Id: I90801b35ed0c00078a47faadc7fbb05d2e5fe381
2013-06-09am 56cd646a: Avoid logging sensitive data.Jeff Sharkey
* commit '56cd646abeae51e806791f82ab0995fe047b1fe4': Avoid logging sensitive data.
2013-06-07Avoid logging sensitive data.Jeff Sharkey
When building commands to send across NativeDaemonConnector, scrub sensitive arguments to prevent them from being logged. Bug: 8609800 Change-Id: I84b16791749264a010f7e59f9918f68d71bac6b9
2013-05-28am 2c4b0905: am ab4a0541: am e4c29de9: Merge "Add missing ↵Jeff Sharkey
ACTION_MEDIA_UNMOUNTED intent" * commit '2c4b0905513b73c9e0435632cbaa00320480a857': Add missing ACTION_MEDIA_UNMOUNTED intent
2013-05-28am e4c29de9: Merge "Add missing ACTION_MEDIA_UNMOUNTED intent"Jeff Sharkey
* commit 'e4c29de9c69d332d65d2eb490961faffab4467fd': Add missing ACTION_MEDIA_UNMOUNTED intent
2013-05-20Add missing ACTION_MEDIA_UNMOUNTED intentChristian Beck
When an SD card is removed without the user unmounting, the intent ACTION_MEDIA_BAD_REMOVAL is fired but is missing the preceeding ACTION_MEDIA_UNMOUNTED which is needed to keep UI consistency. Now when bad media removal is detected an ACTION_MEDIA_UNMOUNTED intent is sent before the ACTION_MEDIA_BAD_REMOVAL. Change-Id: I133300f42bafab141351e796d7cfc13c15d133e0
2013-05-07Cleanup some of the thread merging.Dianne Hackborn
Adds an optimization for checking whether a looper is stuck, with a new Looper method to see if its thread is currently idle. This will allow us to put a large number of loopers in the monitor efficiently, since we generally won't have to do a context switch on each of them (since most looper threads spend most of their time idle waiting for work). Also change things so the system process's main thread is actually running on the main thread. Because Jeff asked for this, and who am I to argue? :) Change-Id: I12999e6f9c4b056c22dd652cb78c2453c391061f
2013-05-03Merge "Start combining threads in system process."Dianne Hackborn
2013-05-02Start combining threads in system process.Dianne Hackborn
This introduces four generic thread that services can use in the system process: - Background: part of the framework for all processes, for work that is purely background (no timing constraint). - UI: for time-critical display of UI. - Foreground: normal foreground work. - IO: performing IO operations. I went through and moved services into these threads in the places I felt relatively comfortable about understanding what they are doing. There are still a bunch more we need to look at -- lots of networking stuff left, 3 or so different native daemon connectors which I didn't know how much would block, audio stuff, etc. Also updated Watchdog to be aware of and check these new threads, with a new API for other threads to also participate in this checking. Change-Id: Ie2f11061cebde5f018d7383b3a910fbbd11d5e11
2013-04-30Removing a debug check when logging fstrim events.Svetoslav
This change is removing the check for debuggable build to log fstrim events. While this was done everywhere else, one place was overlooked. bug:8688454 Change-Id: I354e1deebfd801f971dd91b9e7972c6ebfd093f3
2013-04-30Perform idle maintenance when the device is charging.Svetoslav
Added the precondition that the device should be charging to the existing ones of the device not being used for awhile and the battery level being high enough. Note that even if the device is charging, we have to check the battery level since the user can unplug it at any time. bug:8688454 Change-Id: I709b1620571301743dc3504a6a625e2018951bfa
2013-03-26It helps to catch the right exception.Jeff Sharkey
Bug: 7238149 Change-Id: I7b60ec44d1d1d5ece8a871cb089f811b611f4a4a
2013-03-26It helps to catch the right exception.Jeff Sharkey
Bug: 7238149 Change-Id: I7b60ec44d1d1d5ece8a871cb089f811b611f4a4a
2013-03-22[DO NOT MERGE] Notify vold when to start fstrim.Svetoslav
Since using the discard option for mounting an Ext4 file system could lead to unpredictable slowdowns of I/O we will explicitly control when to perform fstrim, i.e. discard unused blocks of the mounted volume. We are using the idle maintenance intents sent by the system which specify a window that one can use to perform expensive maintenance tasks while the user does not use the device. This change is adding a broadcast receiver for the idle maintenance start intent to the mount services which then notifies vold when to start fstrim. Since fstrim will be run on a daily basis we do not expect fstrim to be too long, so it is not interruptible. We will implement interruption only in case we see issues. bug:8056794 Change-Id: I1438479d2956b61b82d3a130854376f7a144aaf3
2012-11-27Quiet down a lot of logging.Dianne Hackborn
Also fix a little problem where the USER_STARTED broadcasts were not being sent as ordered broadcasts(!). Change-Id: I3aa3e0a9b3900967cdd2d115ee103371b0a50c41
2012-11-15Merge "Useful annotations for code documentation." into jb-mr1.1-devJeff Sharkey
2012-11-14Avoid runtime restart after vold reconnects.Jeff Sharkey
Rely on behavior of already-released CountDownLatch instead of clearing the reference. Bug: 7290521 Change-Id: I787e673b97d18be412d5b37e279fbf1275b49151
2012-11-12Useful annotations for code documentation.Jeff Sharkey
Bug: 6537978 Change-Id: I806c3c09e3255f8789455f13bf37c1dde2a93f1f
2012-09-30Handle ISE when physical volume isn't mounted.Jeff Sharkey
Bug: 7238149 Change-Id: I85081225a1a43a2c1b6f70b6275c6bbca0b3764e
2012-09-25Handle multi-user mountObb() requests.Jeff Sharkey
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
2012-09-20Query users excluding any being removedAmith Yamasani
Keep track of user creation and last logged-in time. adb shell dumpsys users User switcher shouldn't show users about to be removed. No need to check for singleton for activities. Bug: 7194894 Change-Id: Ic9a59ea5bd544920479e191d1a1e8a77f8b6ddcf
2012-09-18Multi-user MTP.Jeff Sharkey
The current MTP kernel driver at /dev/mtp_usb is exclusive, meaning only one process can have it open. In addition, each MTP session with a desktop requires unique object IDs, which doesn't hold true across users on the device. To solve these two issues, when switching users we cycle the USB host stack to disconnect both local and remote MTP connections, giving the new user's media process a chance to claim /dev/mtp_usb, and causing the desktop to initiate a new MTP session. This change also allows BroadcastReceivers to registerReceiver() allow retrieval of a current sticky broadcast. Adds a system property to override maximum users. Removes MOUNTED broadcasts for secondary users. Allows INTERACT_ACROSS_USERS to getCurrentUser(). Bug: 6925114 Change-Id: I02b4a1b535af95fb2142655887b6d15a8068d18a
2012-09-11Include user identifier in external storage paths.Jeff Sharkey
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
2012-09-06Include primary flag in StorageVolume.Jeff Sharkey
Bug: 7003520 Change-Id: Iaae2ae22253820c954c51e0199c31087bc825f3f
2012-08-30Improve multi-user broadcasts.Dianne Hackborn
You can now use ALL and CURRENT when sending broadcasts, to specify where the broadcast goes. Sticky broadcasts are now correctly separated per user, and registered receivers are filtered based on the requested target user. New Context APIs for more kinds of sending broadcasts as users. Updating a bunch of system code that sends broadcasts to explicitly specify which user the broadcast goes to. Made a single version of the code for interpreting the requested target user ID that all entries to activity manager (start activity, send broadcast, start service) use. Change-Id: Ie29f02dd5242ef8c8fa56c54593a315cd2574e1c
2012-08-16Rename UserId to UserHandle.Dianne Hackborn
This is the start of turning this into a formal public API. Change-Id: I5786d2c320f1de41a06ed5d0f65adb68967287a0
2012-06-08am 60c77212: am 2a393a99: Merge "MountService: unlink death notification ↵Jean-Baptiste Queru
when unregistering listeners" * commit '60c7721210d327a464fdc95dbbe504e8eb10525c': MountService: unlink death notification when unregistering listeners
2012-05-23Fix bug #6522190 MountService should respond to configuration changes ↵Fabrice Di Meglio
("INTERNAL STORAGE" string should be translated dynamically) - use an ID instead of a String for StorageVolume description - use this ID for getting the correct localized version of the description string Change-Id: I30f3080fce2c889be38bfdf9f5121dffcf8a99e8
2012-05-17Wait for ASECs to be scanned before proceedingKenny Root
Move MountService up the list, then pause waiting for MountService to finish scanning ASECs before the services that require those packages to be ready. Additionally, don't automatically mark all ASEC apps as FLAG_EXTERNAL on reboot. This prevents AppWidgets and other things from being used with ASECs which are on internal storage. Bug: 6445613 Change-Id: I3e0b3e244fec966814d7a5ea93de5d337aea79bd
2012-04-25Allow forward locked apps to be in ASECsKenny Root
We couldn't put forward-locked apps in ASEC containers before since we didn't have any permissioned filesystems. This adds the ability for forward-locked applications to be in ASEC containers. This means that forward locked applications will be able to be on the SD card now. This change also removes the old type of forward-locking that placed parts of apps in /data/app-private. Now all forward-locked applications will be in ASEC containers. Change-Id: I17ae0b0d65a4a965ef33c0ac2c47e990e55707ad
2012-03-22Package restrictions per userAmith Yamasani
Packages can be enabled/disabled per user. This requires maintaining stopped/launched states and enabled / disabled components and packages per user. Refactored pm.Settings and PackageSettingsBase to keep track of states per user. Migrated the stopped-packages.xml to users/<u>/package-restrictions.xml Changed intent resolution to handle individual user restrictions. Bunch of IPackageManager calls now have a userId argument. Make AppWidgetService handle removals of packages. Added some tests for pm.Settings and PackageManager. Change-Id: Ia83b529e1df88dbcb3bd55ebfc952a6e9b20e861
2012-01-24MountService: unlink death notification when unregistering listenersVairavan Srinivasan
Change-Id: I09045cfe67f7da84bc68a50fc5440ea2c6b754e5
2012-01-20Log netd traffic nicely.Robert Greenwalt
Create a LocalLog class for logging within a service for dumping in dumps. Use it in the NativeDaemonConnector so we can get some insight into what is happening in these lockups. bug:5864209 Change-Id: I68ddc58847f3c8de613be9528570f8c3157d8274
2011-12-20Test the correct return code from call to cryptfs.Fredrik Roubert
This was broken in commit dd519fac9b79f36a27909149a90fce4321ed1c20 (certainly by mistake), in which Integer.parseInt(tokens[1]) was errornously replaced with event.getCode(). Change-Id: Ic5af5a2ec5f321da21a4a5db25f6908462f6cae8
2011-12-02Move native vold calls to varargs.Jeff Sharkey
Uses argument escaping inside NativeDaemonConnector, using varargs to separate boundaries. Bug: 5472606 Change-Id: Ie107a90df7e2b3bd3eaaf04c8367248ab40136f4
2011-11-29Move NativeDaemonConnector to varargs.Jeff Sharkey
Perform uniform argument escaping inside NativeDaemonConnector, using varargs to separate boundaries. Also move to parsed NativeDaemonEvent instances instead of raw Strings. Bug: 5472606 Change-Id: I1270733e2b2eeb2f6b810240df82ab24d38ebf40
2011-10-13Require device encryption password to perform adb backup/restoreChristopher Tate
This supersedes any backup-password that the user might supply. Per design, the device encryption password is also always used to encrypt the backup archive. The CL introduces two new strings, used for prompting the user for their device encryption password rather than their settings-defined "backup password" when confirming a full backup or restore operation. Bug 5382487 Change-Id: I0b03881b45437c944eaf636b6209278e1bba7a9f
2011-09-09Revert encryption mapping for device wipes.Ben Komalo
External storage volumes that were emulated+encrypted needed to have their encryption mapping removed so that it doesn't try to encrypt the volume after formatting them. This just wires through an argument through vold, and assumes that vold will do the right thing even if there is no encryption mapping set. Bug: 5017638 Change-Id: I858fae3d12cb415bc34637f520f71220ad9daaad
2011-09-06Expose getting encryptstate through IMountServiceBen Komalo
- this really just calls cryptfs cryptocomplete - needed so that UI logic can present a factory reset option if encryption screwed up Bug: 3384231 Change-Id: I553de87f0d03a65851030c9c5266e85866d30fa6
2011-08-17Default disable watchdog for vold connectionKenny Root
cryptfs has long-running operations that cause the Watchdog to fire reliably when encrypting the filesystem. Disable Watchdog on MountService for this reason. Change-Id: Id03f5f60c704dcd74a8696ad9f32b5fba5381731
2011-08-10Add NativeDaemonConnector users to watchdog.Jeff Sharkey
To catch instances where NativeDaemonConnector hangs while executing commands, add users to system_server watchdog. Also moved qtaguid enabler to separate thread to prevent blocking systemReady(). Bug: 5145437 Change-Id: I4c6c1dc09864a1c05f9486a31faa1b366548e911
2011-07-15During encryption, don't throw exceptions for unknown vold stateKen Sumrall
This is a temporary fix until we get something better. During the encryption process, vold does not respond to commands because it is blocked doing the encryption. Because it doesn't respond, this code times out, sets the state to null, and thows an exception. For now, just don't throw an exception if the device is encrypting. Change-Id: I7e821ec2addd60475fb10834df533beccb2650fe
2011-07-13Add StorageVolume list to MountService dumpKenny Root
Change-Id: If2be6e420d9671032d2e7a66c71a6733e6e48ac8