/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.os.storage;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.storage.StorageVolume;
/**
* WARNING! Update IMountService.h and IMountService.cpp if you change this
* file. In particular, the ordering of the methods below must match the
* _TRANSACTION enum in IMountService.cpp
*
* @hide - Applications should use android.os.storage.StorageManager to access
* storage functions.
*/
public interface IMountService extends IInterface {
/** Local-side IPC implementation stub class. */
public static abstract class Stub extends Binder implements IMountService {
private static class Proxy implements IMountService {
private final IBinder mRemote;
Proxy(IBinder remote) {
mRemote = remote;
}
public IBinder asBinder() {
return mRemote;
}
public String getInterfaceDescriptor() {
return DESCRIPTOR;
}
/**
* Registers an IMountServiceListener for receiving async
* notifications.
*/
public void registerListener(IMountServiceListener listener) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeStrongBinder((listener != null ? listener.asBinder() : null));
mRemote.transact(Stub.TRANSACTION_registerListener, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
/**
* Unregisters an IMountServiceListener
*/
public void unregisterListener(IMountServiceListener listener) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeStrongBinder((listener != null ? listener.asBinder() : null));
mRemote.transact(Stub.TRANSACTION_unregisterListener, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
/**
* Returns true if a USB mass storage host is connected
*/
public boolean isUsbMassStorageConnected() throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_isUsbMassStorageConnected, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
/**
* Enables / disables USB mass storage. The caller should check
* actual status of enabling/disabling USB mass storage via
* StorageEventListener.
*/
public void setUsbMassStorageEnabled(boolean enable) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt((enable ? 1 : 0));
mRemote.transact(Stub.TRANSACTION_setUsbMassStorageEnabled, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
/**
* Returns true if a USB mass storage host is enabled (media is
* shared)
*/
public boolean isUsbMassStorageEnabled() throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
mRemote.transact(Stub.TRANSACTION_isUsbMassStorageEnabled, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
/**
* Mount external storage at given mount point. Returns an int
* consistent with MountServiceResultCode
*/
public int mountVolume(String mountPoint) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
int _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeString(mountPoint);
mRemote.transact(Stub.TRANSACTION_mountVolume, _data, _reply, 0);
_reply.readException();
_result = _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
/**
* Safely unmount external storage at given mount point. The unmount
* is an asynchronous operation. Applications should register
* StorageEventListener for storage related status changes.
*/
public void unmountVolume(String mountPoint, boolean force, boolean removeEncryption)
throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeString(mountPoint);
_data.writeInt((force ? 1 : 0));
_data.writeInt((removeEncryption ? 1 : 0));
mRemote.transact(Stub.TRANSACTION_unmountVolume, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
/**
* Format external storage given a mount point. Returns an int
* consistent with MountServiceResultCode
*/
public int formatVolume(String mountPoint) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
int _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeString(mountPoint);
mRemote.transact(Stub.
没有合适的资源?快使用搜索试试~ 我知道了~
Android 下通过反射调用加载/卸载(mount/unmount) 外置SD卡
共5个文件
aidl:3个
java:2个
4星 · 超过85%的资源 需积分: 49 260 下载量 70 浏览量
2014-12-17
15:10:23
上传
评论
收藏 8KB RAR 举报
温馨提示
Android 下通过反射调用加载/卸载(mount/unmount) 外置SD卡
资源推荐
资源详情
资源评论
收起资源包目录
storage.rar (5个子文件)
IMountService.java 53KB
StorageVolume.java 7KB
IMountServiceListener.aidl 1KB
IMountShutdownObserver.aidl 1023B
IObbActionListener.aidl 1KB
共 5 条
- 1
wangxinxxx
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页