IMountService.h revision d6332552761fcce700adb465ff540d30a671403c
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
24#include <binder/IInterface.h>
25#include <binder/Parcel.h>
26
27namespace android {
28
29class IMountService: public IInterface {
30public:
31    DECLARE_META_INTERFACE(MountService);
32
33    virtual void registerListener(const sp<IMountServiceListener>& listener) = 0;
34    virtual void
35            unregisterListener(const sp<IMountServiceListener>& listener) = 0;
36    virtual bool isUsbMassStorageConnected() = 0;
37    virtual void setUsbMassStorageEnabled(const bool enable) = 0;
38    virtual bool isUsbMassStorageEnabled() = 0;
39    virtual int32_t mountVolume(const String16& mountPoint) = 0;
40    virtual int32_t
41            unmountVolume(const String16& mountPoint, const bool force) = 0;
42    virtual int32_t formatVolume(const String16& mountPoint) = 0;
43    virtual int32_t
44            getStorageUsers(const String16& mountPoint, int32_t** users) = 0;
45    virtual int32_t getVolumeState(const String16& mountPoint) = 0;
46    virtual int32_t createSecureContainer(const String16& id,
47            const int32_t sizeMb, const String16& fstype, const String16& key,
48            const int32_t ownerUid) = 0;
49    virtual int32_t finalizeSecureContainer(const String16& id) = 0;
50    virtual int32_t destroySecureContainer(const String16& id) = 0;
51    virtual int32_t mountSecureContainer(const String16& id,
52            const String16& key, const int32_t ownerUid) = 0;
53    virtual int32_t
54            unmountSecureContainer(const String16& id, const bool force) = 0;
55    virtual bool isSecureContainerMounted(const String16& id) = 0;
56    virtual int32_t renameSecureContainer(const String16& oldId,
57            const String16& newId) = 0;
58    virtual bool getSecureContainerPath(const String16& id, String16& path) = 0;
59    virtual int32_t getSecureContainerList(const String16& id,
60            String16*& containers) = 0;
61    virtual void shutdown(const sp<IMountShutdownObserver>& observer) = 0;
62    virtual void finishMediaUpdate() = 0;
63    virtual void mountObb(const String16& filename, const String16& key,
64            const sp<IObbActionListener>& token, const int32_t nonce) = 0;
65    virtual void unmountObb(const String16& filename, const bool force,
66            const sp<IObbActionListener>& token, const int32_t nonce) = 0;
67    virtual bool isObbMounted(const String16& filename) = 0;
68    virtual bool getMountedObbPath(const String16& filename, String16& path) = 0;
69    virtual int32_t decryptStorage(const String16& password) = 0;
70    virtual int32_t encryptStorage(const String16& password) = 0;
71};
72
73// ----------------------------------------------------------------------------
74
75class BnMountService: public BnInterface<IMountService> {
76public:
77    virtual status_t onTransact(uint32_t code, const Parcel& data,
78            Parcel* reply, uint32_t flags = 0);
79};
80
81}
82; // namespace android
83
84#endif // ANDROID_IMOUNTSERVICE_H
85