• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_IMOUNTSERVICE_H
18 #define ANDROID_IMOUNTSERVICE_H
19 
20 #include <storage/IMountServiceListener.h>
21 #include <storage/IMountShutdownObserver.h>
22 #include <storage/IObbActionListener.h>
23 #include <storage/ObbInfo.h>
24 
25 #include <utils/String8.h>
26 
27 #include <binder/IInterface.h>
28 #include <binder/Parcel.h>
29 
30 namespace android {
31 
32 class IMountService: public IInterface {
33 public:
34     DECLARE_META_INTERFACE(MountService);
35 
36     virtual void registerListener(const sp<IMountServiceListener>& listener) = 0;
37     virtual void
38             unregisterListener(const sp<IMountServiceListener>& listener) = 0;
39     virtual bool isUsbMassStorageConnected() = 0;
40     virtual void setUsbMassStorageEnabled(const bool enable) = 0;
41     virtual bool isUsbMassStorageEnabled() = 0;
42     virtual int32_t mountVolume(const String16& mountPoint) = 0;
43     virtual int32_t unmountVolume(
44             const String16& mountPoint, const bool force, const bool removeEncryption) = 0;
45     virtual int32_t formatVolume(const String16& mountPoint) = 0;
46     virtual int32_t
47             getStorageUsers(const String16& mountPoint, int32_t** users) = 0;
48     virtual int32_t getVolumeState(const String16& mountPoint) = 0;
49     virtual int32_t createSecureContainer(const String16& id,
50             const int32_t sizeMb, const String16& fstype, const String16& key,
51             const int32_t ownerUid) = 0;
52     virtual int32_t finalizeSecureContainer(const String16& id) = 0;
53     virtual int32_t destroySecureContainer(const String16& id) = 0;
54     virtual int32_t mountSecureContainer(const String16& id,
55             const String16& key, const int32_t ownerUid) = 0;
56     virtual int32_t
57             unmountSecureContainer(const String16& id, const bool force) = 0;
58     virtual bool isSecureContainerMounted(const String16& id) = 0;
59     virtual int32_t renameSecureContainer(const String16& oldId,
60             const String16& newId) = 0;
61     virtual bool getSecureContainerPath(const String16& id, String16& path) = 0;
62     virtual int32_t getSecureContainerList(const String16& id,
63             String16*& containers) = 0;
64     virtual void shutdown(const sp<IMountShutdownObserver>& observer) = 0;
65     virtual void finishMediaUpdate() = 0;
66     virtual void mountObb(const String16& rawPath, const String16& canonicalPath,
67             const String16& key, const sp<IObbActionListener>& token,
68             const int32_t nonce, const sp<ObbInfo>& obbInfo) = 0;
69     virtual void unmountObb(const String16& filename, const bool force,
70             const sp<IObbActionListener>& token, const int32_t nonce) = 0;
71     virtual bool isObbMounted(const String16& filename) = 0;
72     virtual bool getMountedObbPath(const String16& filename, String16& path) = 0;
73     virtual int32_t decryptStorage(const String16& password) = 0;
74     virtual int32_t encryptStorage(const String16& password) = 0;
75 };
76 
77 // ----------------------------------------------------------------------------
78 
79 class BnMountService: public BnInterface<IMountService> {
80 public:
81     virtual status_t onTransact(uint32_t code, const Parcel& data,
82             Parcel* reply, uint32_t flags = 0);
83 };
84 
85 }
86 ; // namespace android
87 
88 #endif // ANDROID_IMOUNTSERVICE_H
89