1/* //device/java/android/android/os/IUsb.aidl
2**
3** Copyright 2007, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9**     http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18package android.os.storage;
19
20import android.os.storage.IMountServiceListener;
21import android.os.storage.IMountShutdownObserver;
22
23/** WARNING! Update IMountService.h and IMountService.cpp if you change this file.
24 * In particular, the ordering of the methods below must match the
25 * _TRANSACTION enum in IMountService.cpp
26 * @hide - Applications should use android.os.storage.StorageManager to access
27 * storage functions.
28 */
29interface IMountService
30{
31    /**
32     * Registers an IMountServiceListener for receiving async
33     * notifications.
34     */
35    void registerListener(IMountServiceListener listener);
36
37    /**
38     * Unregisters an IMountServiceListener
39     */
40    void unregisterListener(IMountServiceListener listener);
41
42    /**
43     * Returns true if a USB mass storage host is connected
44     */
45    boolean isUsbMassStorageConnected();
46
47    /**
48     * Enables / disables USB mass storage.
49     * The caller should check actual status of enabling/disabling
50     * USB mass storage via StorageEventListener.
51     */
52    void setUsbMassStorageEnabled(boolean enable);
53
54    /**
55     * Returns true if a USB mass storage host is enabled (media is shared)
56     */
57    boolean isUsbMassStorageEnabled();
58
59    /**
60     * Mount external storage at given mount point.
61     * Returns an int consistent with MountServiceResultCode
62     */
63    int mountVolume(String mountPoint);
64
65    /**
66     * Safely unmount external storage at given mount point.
67     * The unmount is an asynchronous operation. Applications
68     * should register StorageEventListener for storage related
69     * status changes.
70     *
71     */
72    void unmountVolume(String mountPoint, boolean force);
73
74    /**
75     * Format external storage given a mount point.
76     * Returns an int consistent with MountServiceResultCode
77     */
78    int formatVolume(String mountPoint);
79
80    /**
81     * Returns an array of pids with open files on
82     * the specified path.
83     */
84    int[] getStorageUsers(String path);
85
86    /**
87     * Gets the state of a volume via its mountpoint.
88     */
89    String getVolumeState(String mountPoint);
90
91    /*
92     * Creates a secure container with the specified parameters.
93     * Returns an int consistent with MountServiceResultCode
94     */
95    int createSecureContainer(String id, int sizeMb, String fstype, String key, int ownerUid);
96
97    /*
98     * Finalize a container which has just been created and populated.
99     * After finalization, the container is immutable.
100     * Returns an int consistent with MountServiceResultCode
101     */
102    int finalizeSecureContainer(String id);
103
104    /*
105     * Destroy a secure container, and free up all resources associated with it.
106     * NOTE: Ensure all references are released prior to deleting.
107     * Returns an int consistent with MountServiceResultCode
108     */
109    int destroySecureContainer(String id, boolean force);
110
111    /*
112     * Mount a secure container with the specified key and owner UID.
113     * Returns an int consistent with MountServiceResultCode
114     */
115    int mountSecureContainer(String id, String key, int ownerUid);
116
117    /*
118     * Unount a secure container.
119     * Returns an int consistent with MountServiceResultCode
120     */
121    int unmountSecureContainer(String id, boolean force);
122
123    /*
124     * Returns true if the specified container is mounted
125     */
126    boolean isSecureContainerMounted(String id);
127
128    /*
129     * Rename an unmounted secure container.
130     * Returns an int consistent with MountServiceResultCode
131     */
132    int renameSecureContainer(String oldId, String newId);
133
134    /*
135     * Returns the filesystem path of a mounted secure container.
136     */
137    String getSecureContainerPath(String id);
138
139    /**
140     * Gets an Array of currently known secure container IDs
141     */
142    String[] getSecureContainerList();
143
144    /**
145     * Shuts down the MountService and gracefully unmounts all external media.
146     * Invokes call back once the shutdown is complete.
147     */
148    void shutdown(IMountShutdownObserver observer);
149
150    /**
151     * Call into MountService by PackageManager to notify that its done
152     * processing the media status update request.
153     */
154    void finishMediaUpdate();
155}
156