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