core/java/android/os/IUpdateLock.aidl \
core/java/android/os/IUserManager.aidl \
core/java/android/os/IVibratorService.aidl \
- core/java/android/os/storage/IMountService.aidl \
- core/java/android/os/storage/IMountServiceListener.aidl \
- core/java/android/os/storage/IMountShutdownObserver.aidl \
+ core/java/android/os/storage/IStorageManager.aidl \
+ core/java/android/os/storage/IStorageEventListener.aidl \
+ core/java/android/os/storage/IStorageShutdownObserver.aidl \
core/java/android/os/storage/IObbActionListener.aidl \
core/java/android/security/IKeystoreService.aidl \
core/java/android/security/keymaster/IKeyAttestationApplicationIdProvider.aidl \
$(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/APPS/FeatureSplit1_intermediates/src/com/android/test/split/feature/R.java)
$(call add-clean-step, rm -f $(OUT_DIR)/target/common/obj/APPS/FeatureSplit2_intermediates/src/com/android/test/split/feature/R.java)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/hardware)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/core/java/android/os/storage/*)
# ******************************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.os.storage.DiskInfo;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
import android.util.Log;
public final class Sm {
private static final String TAG = "Sm";
- IMountService mSm;
+ IStorageManager mSm;
private String[] mArgs;
private int mNextArg;
throw new IllegalArgumentException();
}
- mSm = IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ mSm = IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
if (mSm == null) {
throw new RemoteException("Failed to find running mount service");
}
android.os.health.SystemHealthManager
android.os.storage.DiskInfo
android.os.storage.DiskInfo$1
-android.os.storage.IMountService
-android.os.storage.IMountService$Stub
-android.os.storage.IMountService$Stub$Proxy
-android.os.storage.IMountServiceListener
-android.os.storage.IMountServiceListener$Stub
-android.os.storage.IMountServiceListener$Stub$Proxy
-android.os.storage.IMountShutdownObserver
+android.os.storage.IStorageManager
+android.os.storage.IStorageManager$Stub
+android.os.storage.IStorageManager$Stub$Proxy
+android.os.storage.IStorageEventListener
+android.os.storage.IStorageEventListener$Stub
+android.os.storage.IStorageEventListener$Stub$Proxy
+android.os.storage.IStorageShutdownObserver
android.os.storage.IObbActionListener
android.os.storage.IObbActionListener$Stub
-android.os.storage.MountServiceInternal
-android.os.storage.MountServiceInternal$ExternalStorageMountPolicy
+android.os.storage.StorageManagerInternal
+android.os.storage.StorageManagerInternal$ExternalStorageMountPolicy
android.os.storage.StorageEventListener
android.os.storage.StorageManager
android.os.storage.StorageManager$ObbActionListener
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
if (!dir.exists()) {
// Failing to mkdir() may be okay, since we might not have
// enough permissions; ask vold to create on our behalf.
- final IMountService mount = IMountService.Stub.asInterface(
+ final IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
try {
- final int res = mount.mkdirs(getPackageName(), dir.getAbsolutePath());
+ final int res = storageManager.mkdirs(
+ getPackageName(), dir.getAbsolutePath());
if (res != 0) {
Log.w(TAG, "Failed to ensure " + dir + ": " + res);
dir = null;
/**
* Update status of external media on the package manager to scan and
* install packages installed on the external media. Like say the
- * MountService uses this to call into the package manager to update
+ * StorageManagerService uses this to call into the package manager to update
* status of sdcard.
*/
void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
package android.os.storage;
/**
- * Callback class for receiving events from MountService about Opaque Binary
+ * Callback class for receiving events from StorageManagerService about Opaque Binary
* Blobs (OBBs).
*
* Don't change the existing transaction Ids as they could be used in the native code.
import android.os.storage.VolumeRecord;
/**
- * Callback class for receiving events from MountService.
+ * Callback class for receiving events from StorageManagerService.
*
* Don't change the existing transaction Ids as they could be used in the native code.
* When adding a new method, assign the next available transaction id.
*
- * @hide - Applications should use IStorageEventListener for storage event
- * callbacks.
+ * @hide - Applications should use {@link android.os.storage.StorageEventListener} class for
+ * storage event callbacks.
*/
-oneway interface IMountServiceListener {
+oneway interface IStorageEventListener {
/**
* Detection state of USB Mass Storage has changed
*
import android.content.pm.IPackageMoveObserver;
import android.os.ParcelFileDescriptor;
import android.os.storage.DiskInfo;
-import android.os.storage.IMountServiceListener;
-import android.os.storage.IMountShutdownObserver;
+import android.os.storage.IStorageEventListener;
+import android.os.storage.IStorageShutdownObserver;
import android.os.storage.IObbActionListener;
import android.os.storage.StorageVolume;
import android.os.storage.VolumeInfo;
* @hide - Applications should use android.os.storage.StorageManager to access
* storage functions.
*/
-interface IMountService {
+interface IStorageManager {
/**
- * Registers an IMountServiceListener for receiving async notifications.
+ * Registers an IStorageEventListener for receiving async notifications.
*/
- void registerListener(IMountServiceListener listener) = 0;
+ void registerListener(IStorageEventListener listener) = 0;
/**
- * Unregisters an IMountServiceListener
+ * Unregisters an IStorageEventListener
*/
- void unregisterListener(IMountServiceListener listener) = 1;
+ void unregisterListener(IStorageEventListener listener) = 1;
/**
* Returns true if a USB mass storage host is connected
*/
boolean isUsbMassStorageEnabled() = 4;
/**
* Mount external storage at given mount point. Returns an int consistent
- * with MountServiceResultCode
+ * with StorageResultCode
*/
int mountVolume(in String mountPoint) = 5;
/**
void unmountVolume(in String mountPoint, boolean force, boolean removeEncryption) = 6;
/**
* Format external storage given a mount point. Returns an int consistent
- * with MountServiceResultCode
+ * with StorageResultCode
*/
int formatVolume(in String mountPoint) = 7;
/**
String getVolumeState(in String mountPoint) = 9;
/*
* Creates a secure container with the specified parameters. Returns an int
- * consistent with MountServiceResultCode
+ * consistent with StorageResultCode
*/
int createSecureContainer(in String id, int sizeMb, in String fstype, in String key,
int ownerUid, boolean external) = 10;
/*
* Finalize a container which has just been created and populated. After
* finalization, the container is immutable. Returns an int consistent with
- * MountServiceResultCode
+ * StorageResultCode
*/
int finalizeSecureContainer(in String id) = 11;
/*
* Destroy a secure container, and free up all resources associated with it.
* NOTE: Ensure all references are released prior to deleting. Returns an
- * int consistent with MountServiceResultCode
+ * int consistent with StorageResultCode
*/
int destroySecureContainer(in String id, boolean force) = 12;
/*
* Mount a secure container with the specified key and owner UID. Returns an
- * int consistent with MountServiceResultCode
+ * int consistent with StorageResultCode
*/
int mountSecureContainer(in String id, in String key, int ownerUid, boolean readOnly) = 13;
/*
* Unount a secure container. Returns an int consistent with
- * MountServiceResultCode
+ * StorageResultCode
*/
int unmountSecureContainer(in String id, boolean force) = 14;
/*
boolean isSecureContainerMounted(in String id) = 15;
/*
* Rename an unmounted secure container. Returns an int consistent with
- * MountServiceResultCode
+ * StorageResultCode
*/
int renameSecureContainer(in String oldId, in String newId) = 16;
/*
*/
String[] getSecureContainerList() = 18;
/**
- * Shuts down the MountService and gracefully unmounts all external media.
+ * Shuts down the StorageManagerService and gracefully unmounts all external media.
* Invokes call back once the shutdown is complete.
*/
- void shutdown(IMountShutdownObserver observer) = 19;
+ void shutdown(IStorageShutdownObserver observer) = 19;
/**
- * Call into MountService by PackageManager to notify that its done
+ * Call into StorageManagerService by PackageManager to notify that its done
* processing the media status update request.
*/
void finishMediaUpdate() = 20;
/**
* Mounts an Opaque Binary Blob (OBB) with the specified decryption key and
* only allows the calling process's UID access to the contents.
- * MountService will call back to the supplied IObbActionListener to inform
+ * StorageManagerService will call back to the supplied IObbActionListener to inform
* it of the terminal state of the call.
*/
void mountObb(in String rawPath, in String canonicalPath, in String key,
/**
* Unmounts an Opaque Binary Blob (OBB). When the force flag is specified,
* any program using it will be forcibly killed to unmount the image.
- * MountService will call back to the supplied IObbActionListener to inform
+ * StorageManagerService will call back to the supplied IObbActionListener to inform
* it of the terminal state of the call.
*/
void unmountObb(in String rawPath, boolean force, IObbActionListener token, int nonce) = 22;
int verifyEncryptionPassword(in String password) = 32;
/*
* Fix permissions in a container which has just been created and populated.
- * Returns an int consistent with MountServiceResultCode
+ * Returns an int consistent with StorageResultCode
*/
int fixPermissionsSecureContainer(in String id, int gid, in String filename) = 33;
/**
*
* @hide - For internal consumption only.
*/
-interface IMountShutdownObserver {
+interface IStorageShutdownObserver {
/**
- * This method is called when the shutdown of MountService completed.
+ * This method is called when the shutdown of StorageManagerService completed.
*
* @param statusCode indicates success or failure of the shutdown.
*/
/** @hide Underlying data is corrupt */
public static final int ENCRYPTION_STATE_ERROR_CORRUPT = -4;
- private static volatile IMountService sMountService = null;
+ private static volatile IStorageManager sStorageManager = null;
// TODO: the location of the primary storage block varies from device to device, so we need to
// try the most likely candidates - a long-term solution would be a device-specific vold
private final Context mContext;
private final ContentResolver mResolver;
- private final IMountService mMountService;
+ private final IStorageManager mStorageManager;
private final Looper mLooper;
private final AtomicInteger mNextNonce = new AtomicInteger(0);
private final ArrayList<StorageEventListenerDelegate> mDelegates = new ArrayList<>();
- private static class StorageEventListenerDelegate extends IMountServiceListener.Stub implements
+ private static class StorageEventListenerDelegate extends IStorageEventListener.Stub implements
Handler.Callback {
private static final int MSG_STORAGE_STATE_CHANGED = 1;
private static final int MSG_VOLUME_STATE_CHANGED = 2;
mContext = context;
mResolver = context.getContentResolver();
mLooper = looper;
- mMountService = IMountService.Stub.asInterface(ServiceManager.getServiceOrThrow("mount"));
+ mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getServiceOrThrow("mount"));
}
/**
final StorageEventListenerDelegate delegate = new StorageEventListenerDelegate(listener,
mLooper);
try {
- mMountService.registerListener(delegate);
+ mStorageManager.registerListener(delegate);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
final StorageEventListenerDelegate delegate = i.next();
if (delegate.mCallback == listener) {
try {
- mMountService.unregisterListener(delegate);
+ mStorageManager.unregisterListener(delegate);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
try {
final String canonicalPath = new File(rawPath).getCanonicalPath();
final int nonce = mObbActionListener.addListener(listener);
- mMountService.mountObb(rawPath, canonicalPath, key, mObbActionListener, nonce);
+ mStorageManager.mountObb(rawPath, canonicalPath, key, mObbActionListener, nonce);
return true;
} catch (IOException e) {
throw new IllegalArgumentException("Failed to resolve path: " + rawPath, e);
try {
final int nonce = mObbActionListener.addListener(listener);
- mMountService.unmountObb(rawPath, force, mObbActionListener, nonce);
+ mStorageManager.unmountObb(rawPath, force, mObbActionListener, nonce);
return true;
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
Preconditions.checkNotNull(rawPath, "rawPath cannot be null");
try {
- return mMountService.isObbMounted(rawPath);
+ return mStorageManager.isObbMounted(rawPath);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
Preconditions.checkNotNull(rawPath, "rawPath cannot be null");
try {
- return mMountService.getMountedObbPath(rawPath);
+ return mStorageManager.getMountedObbPath(rawPath);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public @NonNull List<DiskInfo> getDisks() {
try {
- return Arrays.asList(mMountService.getDisks());
+ return Arrays.asList(mStorageManager.getDisks());
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public @NonNull List<VolumeInfo> getVolumes() {
try {
- return Arrays.asList(mMountService.getVolumes(0));
+ return Arrays.asList(mStorageManager.getVolumes(0));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
public @NonNull List<VolumeInfo> getWritablePrivateVolumes() {
try {
final ArrayList<VolumeInfo> res = new ArrayList<>();
- for (VolumeInfo vol : mMountService.getVolumes(0)) {
+ for (VolumeInfo vol : mStorageManager.getVolumes(0)) {
if (vol.getType() == VolumeInfo.TYPE_PRIVATE && vol.isMountedWritable()) {
res.add(vol);
}
/** {@hide} */
public @NonNull List<VolumeRecord> getVolumeRecords() {
try {
- return Arrays.asList(mMountService.getVolumeRecords(0));
+ return Arrays.asList(mStorageManager.getVolumeRecords(0));
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void mount(String volId) {
try {
- mMountService.mount(volId);
+ mStorageManager.mount(volId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void unmount(String volId) {
try {
- mMountService.unmount(volId);
+ mStorageManager.unmount(volId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void format(String volId) {
try {
- mMountService.format(volId);
+ mStorageManager.format(volId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public long benchmark(String volId) {
try {
- return mMountService.benchmark(volId);
+ return mStorageManager.benchmark(volId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void partitionPublic(String diskId) {
try {
- mMountService.partitionPublic(diskId);
+ mStorageManager.partitionPublic(diskId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void partitionPrivate(String diskId) {
try {
- mMountService.partitionPrivate(diskId);
+ mStorageManager.partitionPrivate(diskId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void partitionMixed(String diskId, int ratio) {
try {
- mMountService.partitionMixed(diskId, ratio);
+ mStorageManager.partitionMixed(diskId, ratio);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
try {
// TODO: switch to explicit wipe command when we have it,
// for now rely on the fact that vfat format does a wipe
- mMountService.partitionPublic(diskId);
+ mStorageManager.partitionPublic(diskId);
} catch (Exception e) {
Slog.w(TAG, "Failed to wipe " + diskId + ", but soldiering onward", e);
}
/** {@hide} */
public void setVolumeNickname(String fsUuid, String nickname) {
try {
- mMountService.setVolumeNickname(fsUuid, nickname);
+ mStorageManager.setVolumeNickname(fsUuid, nickname);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void setVolumeInited(String fsUuid, boolean inited) {
try {
- mMountService.setVolumeUserFlags(fsUuid, inited ? VolumeRecord.USER_FLAG_INITED : 0,
+ mStorageManager.setVolumeUserFlags(fsUuid, inited ? VolumeRecord.USER_FLAG_INITED : 0,
VolumeRecord.USER_FLAG_INITED);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
/** {@hide} */
public void setVolumeSnoozed(String fsUuid, boolean snoozed) {
try {
- mMountService.setVolumeUserFlags(fsUuid, snoozed ? VolumeRecord.USER_FLAG_SNOOZED : 0,
+ mStorageManager.setVolumeUserFlags(fsUuid, snoozed ? VolumeRecord.USER_FLAG_SNOOZED : 0,
VolumeRecord.USER_FLAG_SNOOZED);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
/** {@hide} */
public void forgetVolume(String fsUuid) {
try {
- mMountService.forgetVolume(fsUuid);
+ mStorageManager.forgetVolume(fsUuid);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public String getPrimaryStorageUuid() {
try {
- return mMountService.getPrimaryStorageUuid();
+ return mStorageManager.getPrimaryStorageUuid();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
*/
public void setPrimaryStorageUuid(String volumeUuid, IPackageMoveObserver callback) {
try {
- mMountService.setPrimaryStorageUuid(volumeUuid, callback);
+ mStorageManager.setPrimaryStorageUuid(volumeUuid, callback);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public static @NonNull StorageVolume[] getVolumeList(int userId, int flags) {
- final IMountService mountService = IMountService.Stub.asInterface(
+ final IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
try {
String packageName = ActivityThread.currentOpPackageName();
if (uid <= 0) {
return new StorageVolume[0];
}
- return mountService.getVolumeList(uid, packageName, flags);
+ return storageManager.getVolumeList(uid, packageName, flags);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void createUserKey(int userId, int serialNumber, boolean ephemeral) {
try {
- mMountService.createUserKey(userId, serialNumber, ephemeral);
+ mStorageManager.createUserKey(userId, serialNumber, ephemeral);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void destroyUserKey(int userId) {
try {
- mMountService.destroyUserKey(userId);
+ mStorageManager.destroyUserKey(userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void unlockUserKey(int userId, int serialNumber, byte[] token, byte[] secret) {
try {
- mMountService.unlockUserKey(userId, serialNumber, token, secret);
+ mStorageManager.unlockUserKey(userId, serialNumber, token, secret);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void lockUserKey(int userId) {
try {
- mMountService.lockUserKey(userId);
+ mStorageManager.lockUserKey(userId);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void prepareUserStorage(String volumeUuid, int userId, int serialNumber, int flags) {
try {
- mMountService.prepareUserStorage(volumeUuid, userId, serialNumber, flags);
+ mStorageManager.prepareUserStorage(volumeUuid, userId, serialNumber, flags);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public void destroyUserStorage(String volumeUuid, int userId, int flags) {
try {
- mMountService.destroyUserStorage(volumeUuid, userId, flags);
+ mStorageManager.destroyUserStorage(volumeUuid, userId, flags);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** {@hide} */
public static boolean isUserKeyUnlocked(int userId) {
- if (sMountService == null) {
- sMountService = IMountService.Stub
+ if (sStorageManager == null) {
+ sStorageManager = IStorageManager.Stub
.asInterface(ServiceManager.getService("mount"));
}
- if (sMountService == null) {
+ if (sStorageManager == null) {
Slog.w(TAG, "Early during boot, assuming locked");
return false;
}
final long token = Binder.clearCallingIdentity();
try {
- return sMountService.isUserKeyUnlocked(userId);
+ return sStorageManager.isUserKeyUnlocked(userId);
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
} finally {
}
try {
- IMountService mountService = IMountService.Stub.asInterface(
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
- return mountService.getPasswordType() != CRYPT_TYPE_DEFAULT;
+ return storageManager.getPasswordType() != CRYPT_TYPE_DEFAULT;
} catch (RemoteException e) {
Log.e(TAG, "Error getting encryption type");
return false;
/** {@hide} */
public static File maybeTranslateEmulatedPathToInternal(File path) {
- final IMountService mountService = IMountService.Stub.asInterface(
+ final IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
try {
- final VolumeInfo[] vols = mountService.getVolumes(0);
+ final VolumeInfo[] vols = storageManager.getVolumes(0);
for (VolumeInfo vol : vols) {
if ((vol.getType() == VolumeInfo.TYPE_EMULATED
|| vol.getType() == VolumeInfo.TYPE_PUBLIC) && vol.isMountedReadable()) {
/** {@hide} */
public ParcelFileDescriptor mountAppFuse(String name) {
try {
- return mMountService.mountAppFuse(name);
+ return mStorageManager.mountAppFuse(name);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
/** @hide */
public static final int CRYPT_TYPE_PIN = 3;
- // Constants for the data available via MountService.getField.
+ // Constants for the data available via StorageManagerService.getField.
/** @hide */
public static final String SYSTEM_LOCALE_KEY = "SystemLocale";
/** @hide */
*
* @hide Only for use within the system server.
*/
-public abstract class MountServiceInternal {
+public abstract class StorageManagerInternal {
/**
* Policy that influences how external storage is mounted and reported.
/**
* Class that provides access to constants returned from StorageManager
- * and lower level MountService APIs.
+ * and lower level StorageManagerService APIs.
*
* @hide
*/
"search_per_source_concurrent_query_limit";
/**
- * Whether or not alert sounds are played on MountService events. (0 = false, 1 = true)
+ * Whether or not alert sounds are played on StorageManagerService events.
+ * (0 = false, 1 = true)
* @hide
*/
public static final String MOUNT_PLAY_NOTIFICATION_SND = "mount_play_not_snd";
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.os.storage.StorageResultCode;
import android.os.storage.StorageVolume;
/**
* Constants used internally between the PackageManager
* and media container service transports.
- * Some utility methods to invoke MountService api.
+ * Some utility methods to invoke StorageManagerService api.
*/
public class PackageHelper {
public static final int RECOMMEND_INSTALL_INTERNAL = 1;
public static final int APP_INSTALL_INTERNAL = 1;
public static final int APP_INSTALL_EXTERNAL = 2;
- public static IMountService getMountService() throws RemoteException {
+ public static IStorageManager getStorageManager() throws RemoteException {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
} else {
- Log.e(TAG, "Can't get mount service");
- throw new RemoteException("Could not contact mount service");
+ Log.e(TAG, "Can't get storagemanager service");
+ throw new RemoteException("Could not contact storagemanager service");
}
}
// Round up to nearest MB, plus another MB for filesystem overhead
final int sizeMb = (int) ((sizeBytes + MB_IN_BYTES) / MB_IN_BYTES) + 1;
try {
- IMountService mountService = getMountService();
+ IStorageManager storageManager = getStorageManager();
if (localLOGV)
Log.i(TAG, "Size of container " + sizeMb + " MB");
- int rc = mountService.createSecureContainer(cid, sizeMb, "ext4", sdEncKey, uid,
+ int rc = storageManager.createSecureContainer(cid, sizeMb, "ext4", sdEncKey, uid,
isExternal);
if (rc != StorageResultCode.OperationSucceeded) {
Log.e(TAG, "Failed to create secure container " + cid);
return null;
}
- String cachePath = mountService.getSecureContainerPath(cid);
+ String cachePath = storageManager.getSecureContainerPath(cid);
if (localLOGV) Log.i(TAG, "Created secure container " + cid +
" at " + cachePath);
return cachePath;
} catch (RemoteException e) {
- Log.e(TAG, "MountService running?");
+ Log.e(TAG, "StorageManagerService running?");
}
return null;
}
// Round up to nearest MB, plus another MB for filesystem overhead
final int sizeMb = (int) ((sizeBytes + MB_IN_BYTES) / MB_IN_BYTES) + 1;
try {
- IMountService mountService = getMountService();
- int rc = mountService.resizeSecureContainer(cid, sizeMb, sdEncKey);
+ IStorageManager storageManager = getStorageManager();
+ int rc = storageManager.resizeSecureContainer(cid, sizeMb, sdEncKey);
if (rc == StorageResultCode.OperationSucceeded) {
return true;
}
} catch (RemoteException e) {
- Log.e(TAG, "MountService running?");
+ Log.e(TAG, "StorageManagerService running?");
}
Log.e(TAG, "Failed to create secure container " + cid);
return false;
public static String mountSdDir(String cid, String key, int ownerUid, boolean readOnly) {
try {
- int rc = getMountService().mountSecureContainer(cid, key, ownerUid, readOnly);
+ int rc = getStorageManager().mountSecureContainer(cid, key, ownerUid, readOnly);
if (rc != StorageResultCode.OperationSucceeded) {
Log.i(TAG, "Failed to mount container " + cid + " rc : " + rc);
return null;
}
- return getMountService().getSecureContainerPath(cid);
+ return getStorageManager().getSecureContainerPath(cid);
} catch (RemoteException e) {
- Log.e(TAG, "MountService running?");
+ Log.e(TAG, "StorageManagerService running?");
}
return null;
}
public static boolean unMountSdDir(String cid) {
try {
- int rc = getMountService().unmountSecureContainer(cid, true);
+ int rc = getStorageManager().unmountSecureContainer(cid, true);
if (rc != StorageResultCode.OperationSucceeded) {
Log.e(TAG, "Failed to unmount " + cid + " with rc " + rc);
return false;
}
return true;
} catch (RemoteException e) {
- Log.e(TAG, "MountService running?");
+ Log.e(TAG, "StorageManagerService running?");
}
return false;
}
public static boolean renameSdDir(String oldId, String newId) {
try {
- int rc = getMountService().renameSecureContainer(oldId, newId);
+ int rc = getStorageManager().renameSecureContainer(oldId, newId);
if (rc != StorageResultCode.OperationSucceeded) {
Log.e(TAG, "Failed to rename " + oldId + " to " +
newId + "with rc " + rc);
public static String getSdDir(String cid) {
try {
- return getMountService().getSecureContainerPath(cid);
+ return getStorageManager().getSecureContainerPath(cid);
} catch (RemoteException e) {
Log.e(TAG, "Failed to get container path for " + cid +
" with exception " + e);
public static String getSdFilesystem(String cid) {
try {
- return getMountService().getSecureContainerFilesystemPath(cid);
+ return getStorageManager().getSecureContainerFilesystemPath(cid);
} catch (RemoteException e) {
Log.e(TAG, "Failed to get container path for " + cid +
" with exception " + e);
public static boolean finalizeSdDir(String cid) {
try {
- int rc = getMountService().finalizeSecureContainer(cid);
+ int rc = getStorageManager().finalizeSecureContainer(cid);
if (rc != StorageResultCode.OperationSucceeded) {
Log.i(TAG, "Failed to finalize container " + cid);
return false;
public static boolean destroySdDir(String cid) {
try {
if (localLOGV) Log.i(TAG, "Forcibly destroying container " + cid);
- int rc = getMountService().destroySecureContainer(cid, true);
+ int rc = getStorageManager().destroySecureContainer(cid, true);
if (rc != StorageResultCode.OperationSucceeded) {
Log.i(TAG, "Failed to destroy container " + cid);
return false;
public static String[] getSecureContainerList() {
try {
- return getMountService().getSecureContainerList();
+ return getStorageManager().getSecureContainerList();
} catch (RemoteException e) {
Log.e(TAG, "Failed to get secure container list with exception" +
e);
public static boolean isContainerMounted(String cid) {
try {
- return getMountService().isSecureContainerMounted(cid);
+ return getStorageManager().isSecureContainerMounted(cid);
} catch (RemoteException e) {
Log.e(TAG, "Failed to find out if container " + cid + " mounted");
}
public static boolean fixSdPermissions(String cid, int gid, String filename) {
try {
- int rc = getMountService().fixPermissionsSecureContainer(cid, gid, filename);
+ int rc = getStorageManager().fixPermissionsSecureContainer(cid, gid, filename);
if (rc != StorageResultCode.OperationSucceeded) {
Log.i(TAG, "Failed to fixperms container " + cid);
return false;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.text.TextUtils;
return;
}
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
Log.d(TAG, "Setting owner info");
- mountService.setField(StorageManager.OWNER_INFO_KEY, ownerInfo);
+ storageManager.setField(StorageManager.OWNER_INFO_KEY, ownerInfo);
} catch (RemoteException e) {
Log.e(TAG, "Error changing user info", e);
}
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... dummy) {
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
- mountService.changeEncryptionPassword(type, password);
+ storageManager.changeEncryptionPassword(type, password);
} catch (RemoteException e) {
Log.e(TAG, "Error changing encryption password", e);
}
return;
}
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
- mountService.setField(StorageManager.PATTERN_VISIBLE_KEY, enabled ? "1" : "0");
+ storageManager.setField(StorageManager.PATTERN_VISIBLE_KEY, enabled ? "1" : "0");
} catch (RemoteException e) {
Log.e(TAG, "Error changing pattern visible state", e);
}
return;
}
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
- mountService.setField(StorageManager.PASSWORD_VISIBLE_KEY, enabled ? "1" : "0");
+ storageManager.setField(StorageManager.PASSWORD_VISIBLE_KEY, enabled ? "1" : "0");
} catch (RemoteException e) {
Log.e(TAG, "Error changing password visible state", e);
}
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.test.AndroidTestCase;
import android.util.Log;
private static final boolean localLOGV = true;
public static final String TAG = "PackageHelperTests";
protected final String PREFIX = "android.content.pm";
- private IMountService mMs;
+ private IStorageManager mSm;
private String fullId;
private String fullId2;
- private IMountService getMs() {
+ private IStorageManager getSm() {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
} else {
Log.e(TAG, "Can't get mount service");
}
private void cleanupContainers() throws RemoteException {
Log.d(TAG,"cleanUp");
- IMountService ms = getMs();
- String[] containers = ms.getSecureContainerList();
+ IStorageManager sm = getSm();
+ String[] containers = sm.getSecureContainerList();
for (int i = 0; i < containers.length; i++) {
if (containers[i].startsWith(PREFIX)) {
Log.d(TAG,"cleaing up "+containers[i]);
- ms.destroySecureContainer(containers[i], true);
+ sm.destroySecureContainer(containers[i], true);
}
}
}
import android.os.StatFs;
import android.os.SystemClock;
import android.os.UserManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageListener;
import android.os.storage.StorageManager;
import android.os.storage.StorageResultCode;
}
}
- IMountService getMs() {
+ IStorageManager getSm() {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
} else {
- Log.e(TAG, "Can't get mount service");
+ Log.e(TAG, "Can't get storagemanager service");
}
return null;
}
try {
// Wait on observer
synchronized (observer) {
- int ret = getMs().mountVolume(path);
+ int ret = getSm().mountVolume(path);
if (ret != StorageResultCode.OperationSucceeded) {
throw new Exception("Could not mount the media");
}
try {
// Wait on observer
synchronized (observer) {
- getMs().unmountVolume(path, true, false);
+ getSm().unmountVolume(path, true, false);
long waitTime = 0;
while ((!observer.isDone()) && (waitTime < MAX_WAIT_TIME)) {
observer.wait(WAIT_TIME_INCR);
}
}
- /* This test creates a stale container via MountService and then installs
+ /* This test creates a stale container via StorageManagerService and then installs
* a package and verifies that the stale container is cleaned up and install
* is successful.
* Please note that this test is very closely tied to the framework's
}
private void cleanupContainers() throws RemoteException {
- IMountService ms = getMs();
- String[] containers = ms.getSecureContainerList();
+ IStorageManager sm = getSm();
+ String[] containers = sm.getSecureContainerList();
for (int i = 0; i < containers.length; i++) {
if (containers[i].startsWith(SECURE_CONTAINER_PREFIX)) {
if (localLOGV)
Log.i(TAG, "Cleaning: " + containers[i]);
- ms.destroySecureContainer(containers[i], true);
+ sm.destroySecureContainer(containers[i], true);
}
}
}
private boolean containerExists(String localId) throws RemoteException {
- IMountService ms = getMs();
- String[] containers = ms.getSecureContainerList();
+ IStorageManager sm = getSm();
+ String[] containers = sm.getSecureContainerList();
String fullId = SECURE_CONTAINER_PREFIX + localId;
for (int i = 0; i < containers.length; i++) {
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.createSecureContainer(fullId, size, filesystem, key, android.os.Process.myUid(),
+ IStorageManager sm = getSm();
+ return sm.createSecureContainer(fullId, size, filesystem, key, android.os.Process.myUid(),
isExternal);
}
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.mountSecureContainer(fullId, key, android.os.Process.myUid(), true);
+ IStorageManager sm = getSm();
+ return sm.mountSecureContainer(fullId, key, android.os.Process.myUid(), true);
}
private int renameContainer(String localId1, String localId2) throws Exception {
String fullId1 = SECURE_CONTAINER_PREFIX + localId1;
String fullId2 = SECURE_CONTAINER_PREFIX + localId2;
- IMountService ms = getMs();
- return ms.renameSecureContainer(fullId1, fullId2);
+ IStorageManager sm = getSm();
+ return sm.renameSecureContainer(fullId1, fullId2);
}
private int unmountContainer(String localId, boolean force) throws Exception {
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.unmountSecureContainer(fullId, force);
+ IStorageManager sm = getSm();
+ return sm.unmountSecureContainer(fullId, force);
}
private int destroyContainer(String localId, boolean force) throws Exception {
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.destroySecureContainer(fullId, force);
+ IStorageManager sm = getSm();
+ return sm.destroySecureContainer(fullId, force);
}
private boolean isContainerMounted(String localId) throws Exception {
assertTrue("Media should be mounted", isMediaMounted());
String fullId = SECURE_CONTAINER_PREFIX + localId;
- IMountService ms = getMs();
- return ms.isSecureContainerMounted(fullId);
+ IStorageManager sm = getSm();
+ return sm.isSecureContainerMounted(fullId);
}
- private IMountService getMs() {
+ private IStorageManager getSm() {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
} else {
- Log.e(TAG, "Can't get mount service");
+ Log.e(TAG, "Can't get storagemanager service");
}
return null;
}
private boolean isMediaMounted() throws Exception {
String mPath = Environment.getExternalStorageDirectory().toString();
- String state = getMs().getVolumeState(mPath);
+ String state = getSm().getVolumeState(mPath);
return Environment.MEDIA_MOUNTED.equals(state);
}
return;
}
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testUnmountBusyContainer", 4, "none", FS_FAT, true));
- String path = ms.getSecureContainerPath(SECURE_CONTAINER_PREFIX
+ String path = sm.getSecureContainerPath(SECURE_CONTAINER_PREFIX
+ "testUnmountBusyContainer");
File f = new File(path, "reference");
return;
}
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testDestroyBusyContainer", 4, "none", FS_FAT, true));
- String path = ms.getSecureContainerPath(SECURE_CONTAINER_PREFIX
+ String path = sm.getSecureContainerPath(SECURE_CONTAINER_PREFIX
+ "testDestroyBusyContainer");
File f = new File(path, "reference");
return;
}
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testContainerSize", 1, "none", FS_FAT, true));
- String path = ms.getSecureContainerPath(SECURE_CONTAINER_PREFIX + "testContainerSize");
+ String path = sm.getSecureContainerPath(SECURE_CONTAINER_PREFIX + "testContainerSize");
byte[] buf = new byte[4096];
File f = new File(path, "reference");
}
public void testGetSecureContainerPath_NonExistPath_Failure() throws Exception {
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
assertNull("Getting the path for an invalid container should return null",
- ms.getSecureContainerPath("jparks.broke.it"));
+ sm.getSecureContainerPath("jparks.broke.it"));
}
/*------------ Tests for unmounting volume ---*/
boolean getMediaState() throws Exception {
String mPath = Environment.getExternalStorageDirectory().toString();
- String state = getMs().getVolumeState(mPath);
+ String state = getSm().getVolumeState(mPath);
return Environment.MEDIA_MOUNTED.equals(state);
}
}
String mPath = Environment.getExternalStorageDirectory().toString();
- int ret = getMs().mountVolume(mPath);
+ int ret = getSm().mountVolume(mPath);
return ret == StorageResultCode.OperationSucceeded;
}
try {
// Wait on observer
synchronized(observer) {
- getMs().unmountVolume(path, false, false);
+ getSm().unmountVolume(path, false, false);
long waitTime = 0;
while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) {
observer.wait(WAIT_TIME_INCR);
// Wait on observer
synchronized(observer) {
for (int i = 0; i < 5; i++) {
- getMs().unmountVolume(path, false, false);
+ getSm().unmountVolume(path, false, false);
}
long waitTime = 0;
while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) {
}
}
- class ShutdownObserver extends IMountShutdownObserver.Stub{
+ class ShutdownObserver extends IStorageShutdownObserver.Stub{
private boolean doneFlag = false;
int statusCode;
}
void invokeShutdown() throws Exception {
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
ShutdownObserver observer = new ShutdownObserver();
synchronized (observer) {
- ms.shutdown(observer);
+ sm.shutdown(observer);
}
}
if (!getMediaState()) {
mountMedia();
}
- IMountService ms = getMs();
+ IStorageManager sm = getSm();
ShutdownObserver observer = new ShutdownObserver();
synchronized (observer) {
- ms.shutdown(observer);
+ sm.shutdown(observer);
for (int i = 0; i < 4; i++) {
- ms.shutdown(null);
+ sm.shutdown(null);
}
}
} finally {
}
};
-IMPLEMENT_META_INTERFACE(MountService, "android.os.storage.IMountService")
+IMPLEMENT_META_INTERFACE(MountService, "android.os.storage.IStorageManager")
// ----------------------------------------------------------------------
const String16& /* oldState */, const String16& /* newState */) { }
};
-IMPLEMENT_META_INTERFACE(MountServiceListener, "android.os.storage.IMountServiceListener")
+IMPLEMENT_META_INTERFACE(MountServiceListener, "android.os.storage.IStorageEventListener")
// ----------------------------------------------------------------------
virtual void onShutDownComplete(const int32_t /* statusCode */) {}
};
-IMPLEMENT_META_INTERFACE(MountShutdownObserver, "android.os.storage.IMountShutdownObserver")
+IMPLEMENT_META_INTERFACE(MountShutdownObserver, "android.os.storage.IStorageShutdownObserver")
status_t BnMountShutdownObserver::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.text.Editable;
import android.text.TextWatcher;
Handler mHandler;
IBackupManager mBackupManager;
- IMountService mMountService;
+ IStorageManager mStorageManager;
FullObserver mObserver;
int mToken;
boolean mIsEncrypted;
}
mBackupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
- mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
mHandler = new ObserverHandler(getApplicationContext());
final Object oldObserver = getLastNonConfigurationInstance();
boolean deviceIsEncrypted() {
try {
- return mMountService.getEncryptionState()
+ return mStorageManager.getEncryptionState()
!= StorageManager.ENCRYPTION_STATE_NONE
- && mMountService.getPasswordType()
+ && mStorageManager.getPasswordType()
!= StorageManager.CRYPT_TYPE_DEFAULT;
} catch (Exception e) {
- // If we can't talk to the mount service we have a serious problem; fail
+ // If we can't talk to the storagemanager service we have a serious problem; fail
// "secure" i.e. assuming that the device is encrypted.
- Slog.e(TAG, "Unable to communicate with mount service: " + e.getMessage());
+ Slog.e(TAG, "Unable to communicate with storagemanager service: " + e.getMessage());
return true;
}
}
if (upgradeVersion == 45) {
/*
- * New settings for MountService
+ * New settings for StorageManagerService
*/
db.beginTransaction();
try {
android.os.Vibrator
android.os.ZygoteStartFailedEx
android.os.health.SystemHealthManager
-android.os.storage.IMountService
-android.os.storage.IMountService$Stub
-android.os.storage.IMountService$Stub$Proxy
+android.os.storage.IStorageManager
+android.os.storage.IStorageManager$Stub
+android.os.storage.IStorageManager$Stub$Proxy
android.os.storage.StorageManager
android.os.storage.StorageVolume
android.os.storage.StorageVolume$1
import android.os.UserHandle;
import android.os.WorkSource;
import android.os.Environment.UserEnvironment;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.system.ErrnoException;
private IActivityManager mActivityManager;
private PowerManager mPowerManager;
private AlarmManager mAlarmManager;
- private IMountService mMountService;
+ private IStorageManager mStorageManager;
IBackupManager mBackupManagerBinder;
boolean mEnabled; // access to this is synchronized on 'this'
mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
- mMountService = IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
mBackupManagerBinder = Trampoline.asInterface(parent.asBinder());
boolean deviceIsEncrypted() {
try {
- return mMountService.getEncryptionState()
+ return mStorageManager.getEncryptionState()
!= StorageManager.ENCRYPTION_STATE_NONE
- && mMountService.getPasswordType()
+ && mStorageManager.getPasswordType()
!= StorageManager.CRYPT_TYPE_DEFAULT;
} catch (Exception e) {
- // If we can't talk to the mount service we have a serious problem; fail
+ // If we can't talk to the storagemanager service we have a serious problem; fail
// "secure" i.e. assuming that the device is encrypted.
- Slog.e(TAG, "Unable to communicate with mount service: " + e.getMessage());
+ Slog.e(TAG, "Unable to communicate with storagemanager service: " + e.getMessage());
return true;
}
}
import android.os.ShellCallback;
import android.os.ShellCommand;
import android.os.UserHandle;
-import android.os.storage.MountServiceInternal;
+import android.os.storage.StorageManagerInternal;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.AtomicFile;
}
}
- MountServiceInternal mountServiceInternal = LocalServices.getService(
- MountServiceInternal.class);
- mountServiceInternal.addExternalStoragePolicy(
- new MountServiceInternal.ExternalStorageMountPolicy() {
+ StorageManagerInternal storageManagerInternal = LocalServices.getService(
+ StorageManagerInternal.class);
+ storageManagerInternal.addExternalStoragePolicy(
+ new StorageManagerInternal.ExternalStorageMountPolicy() {
@Override
public int getMountMode(int uid, String packageName) {
if (Process.isIsolated(uid)) {
51501 idle_maintenance_window_finish (time|2|3), (lastUserActivity|2|3), (batteryLevel|1|6), (batteryCharging|1|5)
# ---------------------------
-# MountService.java
+# StorageManagerService.java
# ---------------------------
2755 fstrim_start (time|2|3)
2756 fstrim_finish (time|2|3)
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ShellCallback;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.os.ServiceManager;
import android.os.StrictMode;
private void addUserKeyAuth(int userId, byte[] token, byte[] secret)
throws RemoteException {
final UserInfo userInfo = UserManager.get(mContext).getUserInfo(userId);
- final IMountService mountService = getMountService();
+ final IStorageManager storageManager = getStorageManager();
final long callingId = Binder.clearCallingIdentity();
try {
- mountService.addUserKeyAuth(userId, userInfo.serialNumber, token, secret);
+ storageManager.addUserKeyAuth(userId, userInfo.serialNumber, token, secret);
} finally {
Binder.restoreCallingIdentity(callingId);
}
private void fixateNewestUserKeyAuth(int userId)
throws RemoteException {
- final IMountService mountService = getMountService();
+ final IStorageManager storageManager = getStorageManager();
final long callingId = Binder.clearCallingIdentity();
try {
- mountService.fixateNewestUserKeyAuth(userId);
+ storageManager.fixateNewestUserKeyAuth(userId);
} finally {
Binder.restoreCallingIdentity(callingId);
}
// we should, within the first minute of decrypting the phone if this
// service can't connect to vold, it restarts, and then the new instance
// does successfully connect.
- final IMountService service = getMountService();
+ final IStorageManager service = getStorageManager();
String password;
long identity = Binder.clearCallingIdentity();
try {
Secure.LOCK_SCREEN_OWNER_INFO
};
- private IMountService getMountService() {
+ private IStorageManager getStorageManager() {
final IBinder service = ServiceManager.getService("mount");
if (service != null) {
- return IMountService.Stub.asInterface(service);
+ return IStorageManager.Stub.asInterface(service);
}
return null;
}
// that lets us cleanly end our idle timeslice. It's safe to call
// finishIdle() from any thread.
mJobParams = params;
- MountService ms = MountService.sSelf;
+ StorageManagerService ms = StorageManagerService.sSelf;
if (ms != null) {
synchronized (mFinishCallback) {
mStarted = true;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.storage.DiskInfo;
-import android.os.storage.IMountService;
-import android.os.storage.IMountServiceListener;
-import android.os.storage.IMountShutdownObserver;
+import android.os.storage.IStorageEventListener;
+import android.os.storage.IStorageShutdownObserver;
import android.os.storage.IObbActionListener;
-import android.os.storage.MountServiceInternal;
+import android.os.storage.IStorageManager;
+import android.os.storage.StorageManagerInternal;
import android.os.storage.OnObbStateChangeListener;
import android.os.storage.StorageManager;
import android.os.storage.StorageResultCode;
* watch for and manage dynamically added storage, such as SD cards and USB mass
* storage. Also decides how storage should be presented to users on the device.
*/
-class MountService extends IMountService.Stub
+class StorageManagerService extends IStorageManager.Stub
implements INativeDaemonConnectorCallbacks, Watchdog.Monitor {
// Static direct instance pointer for the tightly-coupled idle service to use
- static MountService sSelf = null;
+ static StorageManagerService sSelf = null;
public static class Lifecycle extends SystemService {
- private MountService mMountService;
+ private StorageManagerService mStorageManagerService;
public Lifecycle(Context context) {
super(context);
@Override
public void onStart() {
- mMountService = new MountService(getContext());
- publishBinderService("mount", mMountService);
- mMountService.start();
+ mStorageManagerService = new StorageManagerService(getContext());
+ publishBinderService("mount", mStorageManagerService);
+ mStorageManagerService.start();
}
@Override
public void onBootPhase(int phase) {
if (phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) {
- mMountService.systemReady();
+ mStorageManagerService.systemReady();
} else if (phase == SystemService.PHASE_BOOT_COMPLETED) {
- mMountService.bootCompleted();
+ mStorageManagerService.bootCompleted();
}
}
@Override
public void onSwitchUser(int userHandle) {
- mMountService.mCurrentUserId = userHandle;
+ mStorageManagerService.mCurrentUserId = userHandle;
}
@Override
public void onUnlockUser(int userHandle) {
- mMountService.onUnlockUser(userHandle);
+ mStorageManagerService.onUnlockUser(userHandle);
}
@Override
public void onCleanupUser(int userHandle) {
- mMountService.onCleanupUser(userHandle);
+ mStorageManagerService.onCleanupUser(userHandle);
}
}
*/
private static final boolean EMULATE_FBE_SUPPORTED = true;
- private static final String TAG = "MountService";
+ private static final String TAG = "StorageManagerService";
private static final String TAG_STORAGE_BENCHMARK = "storage_benchmark";
private static final String TAG_STORAGE_TRIM = "storage_trim";
final private Map<String, ObbState> mObbPathToStateMap = new HashMap<String, ObbState>();
// Not guarded by a lock.
- private final MountServiceInternalImpl mMountServiceInternal = new MountServiceInternalImpl();
+ private final StorageManagerInternalImpl mStorageManagerInternal
+ = new StorageManagerInternalImpl();
class ObbState implements IBinder.DeathRecipient {
public ObbState(String rawPath, String canonicalPath, int callingUid,
private static final int H_PARTITION_FORGET = 9;
private static final int H_RESET = 10;
- class MountServiceHandler extends Handler {
- public MountServiceHandler(Looper looper) {
+ class StorageManagerServiceHandler extends Handler {
+ public StorageManagerServiceHandler(Looper looper) {
super(looper);
}
break;
}
case H_SHUTDOWN: {
- final IMountShutdownObserver obs = (IMountShutdownObserver) msg.obj;
+ final IStorageShutdownObserver obs = (IStorageShutdownObserver) msg.obj;
boolean success = false;
try {
success = mConnector.execute("volume", "shutdown").isClassOk();
}
/**
- * Constructs a new MountService instance
+ * Constructs a new StorageManagerService instance
*
* @param context Binder context for this service
*/
- public MountService(Context context) {
+ public StorageManagerService(Context context) {
sSelf = this;
mContext = context;
HandlerThread hthread = new HandlerThread(TAG);
hthread.start();
- mHandler = new MountServiceHandler(hthread.getLooper());
+ mHandler = new StorageManagerServiceHandler(hthread.getLooper());
- // Add OBB Action Handler to MountService thread.
+ // Add OBB Action Handler to StorageManagerService thread.
mObbActionHandler = new ObbActionHandler(IoThread.get().getLooper());
// Initialize the last-fstrim tracking if necessary
readSettingsLocked();
}
- LocalServices.addService(MountServiceInternal.class, mMountServiceInternal);
+ LocalServices.addService(StorageManagerInternal.class, mStorageManagerInternal);
/*
* Create the connection to vold with a maximum queue of twice the
*/
@Override
- public void registerListener(IMountServiceListener listener) {
+ public void registerListener(IStorageEventListener listener) {
mCallbacks.register(listener);
}
@Override
- public void unregisterListener(IMountServiceListener listener) {
+ public void unregisterListener(IStorageEventListener listener) {
mCallbacks.unregister(listener);
}
@Override
- public void shutdown(final IMountShutdownObserver observer) {
+ public void shutdown(final IStorageShutdownObserver observer) {
enforcePermission(android.Manifest.permission.SHUTDOWN);
Slog.i(TAG, "Shutting down");
final long token = Binder.clearCallingIdentity();
try {
userKeyUnlocked = isUserKeyUnlocked(userId);
- storagePermission = mMountServiceInternal.hasExternalStorage(uid, packageName);
+ storagePermission = mStorageManagerInternal.hasExternalStorage(uid, packageName);
} finally {
Binder.restoreCallingIdentity(token);
}
for (final ObbState o : obbStates) {
if (o.rawPath.equals(obbState.rawPath)) {
throw new IllegalStateException("Attempt to add ObbState twice. "
- + "This indicates an error in the MountService logic.");
+ + "This indicates an error in the StorageManagerService logic.");
}
}
}
try {
mObbState.token.onObbResult(mObbState.rawPath, mObbState.nonce, status);
} catch (RemoteException e) {
- Slog.w(TAG, "MountServiceListener went away while calling onObbStateChanged");
+ Slog.w(TAG, "StorageEventListener went away while calling onObbStateChanged");
}
}
}
private static final int MSG_DISK_SCANNED = 5;
private static final int MSG_DISK_DESTROYED = 6;
- private final RemoteCallbackList<IMountServiceListener>
+ private final RemoteCallbackList<IStorageEventListener>
mCallbacks = new RemoteCallbackList<>();
public Callbacks(Looper looper) {
super(looper);
}
- public void register(IMountServiceListener callback) {
+ public void register(IStorageEventListener callback) {
mCallbacks.register(callback);
}
- public void unregister(IMountServiceListener callback) {
+ public void unregister(IStorageEventListener callback) {
mCallbacks.unregister(callback);
}
final SomeArgs args = (SomeArgs) msg.obj;
final int n = mCallbacks.beginBroadcast();
for (int i = 0; i < n; i++) {
- final IMountServiceListener callback = mCallbacks.getBroadcastItem(i);
+ final IStorageEventListener callback = mCallbacks.getBroadcastItem(i);
try {
invokeCallback(callback, msg.what, args);
} catch (RemoteException ignored) {
args.recycle();
}
- private void invokeCallback(IMountServiceListener callback, int what, SomeArgs args)
+ private void invokeCallback(IStorageEventListener callback, int what, SomeArgs args)
throws RemoteException {
switch (what) {
case MSG_STORAGE_STATE_CHANGED: {
}
}
- private final class MountServiceInternalImpl extends MountServiceInternal {
+ private final class StorageManagerInternalImpl extends StorageManagerInternal {
// Not guarded by a lock.
private final CopyOnWriteArrayList<ExternalStorageMountPolicy> mPolicies =
new CopyOnWriteArrayList<>();
import android.os.UserHandle;
import android.os.UserManager;
import android.os.WorkSource;
-import android.os.storage.IMountService;
-import android.os.storage.MountServiceInternal;
+import android.os.storage.IStorageManager;
+import android.os.storage.StorageManagerInternal;
import android.os.storage.StorageManager;
import android.provider.Settings;
import android.service.voice.IVoiceInteractionSession;
try {
Locale l = (Locale) msg.obj;
IBinder service = ServiceManager.getService("mount");
- IMountService mountService = IMountService.Stub.asInterface(service);
+ IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
Log.d(TAG, "Storing locale " + l.toLanguageTag() + " for decryption UI");
- mountService.setField(StorageManager.SYSTEM_LOCALE_KEY, l.toLanguageTag());
+ storageManager.setField(StorageManager.SYSTEM_LOCALE_KEY, l.toLanguageTag());
} catch (RemoteException e) {
Log.e(TAG, "Error storing locale for decryption UI", e);
}
final IPackageManager pm = AppGlobals.getPackageManager();
permGids = pm.getPackageGids(app.info.packageName,
MATCH_DEBUG_TRIAGED_MISSING, app.userId);
- MountServiceInternal mountServiceInternal = LocalServices.getService(
- MountServiceInternal.class);
- mountExternal = mountServiceInternal.getExternalStorageMountMode(uid,
+ StorageManagerInternal storageManagerInternal = LocalServices.getService(
+ StorageManagerInternal.class);
+ mountExternal = storageManagerInternal.getExternalStorageMountMode(uid,
app.info.packageName);
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManagerInternal;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.util.ArraySet;
import android.util.IntArray;
}
}
- private IMountService getMountService() {
- return IMountService.Stub.asInterface(ServiceManager.getService("mount"));
+ private IStorageManager getStorageManager() {
+ return IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
}
/**
// TODO Move this block outside of synchronized if it causes lock contention
if (!StorageManager.isUserKeyUnlocked(userId)) {
final UserInfo userInfo = getUserInfo(userId);
- final IMountService mountService = getMountService();
+ final IStorageManager storageManager = getStorageManager();
try {
// We always want to unlock user storage, even user is not started yet
- mountService.unlockUserKey(userId, userInfo.serialNumber, token, secret);
+ storageManager.unlockUserKey(userId, userInfo.serialNumber, token, secret);
} catch (RemoteException | RuntimeException e) {
Slog.w(TAG, "Failed to unlock: " + e.getMessage());
}
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManagerInternal;
-import android.os.storage.IMountService;
-import android.os.storage.MountServiceInternal;
+import android.os.storage.IStorageManager;
+import android.os.storage.StorageManagerInternal;
import android.os.storage.StorageEventListener;
import android.os.storage.StorageManager;
import android.os.storage.VolumeInfo;
}
if (reportStatus) {
try {
- if (DEBUG_SD_INSTALL) Log.i(TAG, "Invoking MountService call back");
- PackageHelper.getMountService().finishMediaUpdate();
+ if (DEBUG_SD_INSTALL) Log.i(TAG,
+ "Invoking StorageManagerService call back");
+ PackageHelper.getStorageManager().finishMediaUpdate();
} catch (RemoteException e) {
- Log.e(TAG, "MountService not running?");
+ Log.e(TAG, "StorageManagerService not running?");
}
}
} break;
final long token = Binder.clearCallingIdentity();
try {
if (sUserManager.isInitialized(userId)) {
- MountServiceInternal mountServiceInternal = LocalServices.getService(
- MountServiceInternal.class);
- mountServiceInternal.onExternalStoragePolicyChanged(uid, packageName);
+ StorageManagerInternal storageManagerInternal = LocalServices.getService(
+ StorageManagerInternal.class);
+ storageManagerInternal.onExternalStoragePolicyChanged(uid, packageName);
}
} finally {
Binder.restoreCallingIdentity(token);
// Before everything else, see whether we need to fstrim.
try {
- IMountService ms = PackageHelper.getMountService();
- if (ms != null) {
+ IStorageManager sm = PackageHelper.getStorageManager();
+ if (sm != null) {
boolean doTrim = false;
final long interval = android.provider.Settings.Global.getLong(
mContext.getContentResolver(),
android.provider.Settings.Global.FSTRIM_MANDATORY_INTERVAL,
DEFAULT_MANDATORY_FSTRIM_INTERVAL);
if (interval > 0) {
- final long timeSinceLast = System.currentTimeMillis() - ms.lastMaintenance();
+ final long timeSinceLast = System.currentTimeMillis() - sm.lastMaintenance();
if (timeSinceLast > interval) {
doTrim = true;
Slog.w(TAG, "No disk maintenance in " + timeSinceLast
} catch (RemoteException e) {
}
}
- ms.runMaintenance();
+ sm.runMaintenance();
}
} else {
- Slog.e(TAG, "Mount service unavailable!");
+ Slog.e(TAG, "storageManager service unavailable!");
}
} catch (RemoteException e) {
- // Can't happen; MountService is local
+ // Can't happen; StorageManagerService is local
}
}
}
/**
- * Extract the MountService "container ID" from the full code path of an
+ * Extract the StorageManagerService "container ID" from the full code path of an
* .apk.
*/
static String cidFromCodePath(String fullCodePath) {
mInstallerService.systemReady();
mPackageDexOptimizer.systemReady();
- MountServiceInternal mountServiceInternal = LocalServices.getService(
- MountServiceInternal.class);
- mountServiceInternal.addExternalStoragePolicy(
- new MountServiceInternal.ExternalStorageMountPolicy() {
+ StorageManagerInternal StorageManagerInternal = LocalServices.getService(
+ StorageManagerInternal.class);
+ StorageManagerInternal.addExternalStoragePolicy(
+ new StorageManagerInternal.ExternalStorageMountPolicy() {
@Override
public int getMountMode(int uid, String packageName) {
if (Process.isIsolated(uid)) {
}
/**
- * Called by MountService when the initial ASECs to scan are available.
+ * Called by StorageManagerService when the initial ASECs to scan are available.
* Should block until all the ASEC containers are finished being scanned.
*/
public void scanAvailableAsecs() {
import android.os.UserManager;
import android.os.Vibrator;
import android.os.SystemVibrator;
-import android.os.storage.IMountService;
-import android.os.storage.IMountShutdownObserver;
+import android.os.storage.IStorageShutdownObserver;
+import android.os.storage.IStorageManager;
import android.system.ErrnoException;
import android.system.Os;
sInstance.setRebootProgress(RADIO_STOP_PERCENT, null);
}
- // Shutdown MountService to ensure media is in a safe state
- IMountShutdownObserver observer = new IMountShutdownObserver.Stub() {
+ // Shutdown StorageManagerService to ensure media is in a safe state
+ IStorageShutdownObserver observer = new IStorageShutdownObserver.Stub() {
public void onShutDownComplete(int statusCode) throws RemoteException {
- Log.w(TAG, "Result code " + statusCode + " from MountService.shutdown");
+ Log.w(TAG, "Result code " + statusCode + " from StorageManagerService.shutdown");
actionDone();
}
};
- Log.i(TAG, "Shutting down MountService");
+ Log.i(TAG, "Shutting down StorageManagerService");
// Set initial variables and time out time.
mActionDone = false;
final long endShutTime = SystemClock.elapsedRealtime() + MAX_SHUTDOWN_WAIT_TIME;
synchronized (mActionDoneSync) {
try {
- final IMountService mount = IMountService.Stub.asInterface(
+ final IStorageManager storageManager = IStorageManager.Stub.asInterface(
ServiceManager.checkService("mount"));
- if (mount != null) {
- mount.shutdown(observer);
+ if (storageManager != null) {
+ storageManager.shutdown(observer);
} else {
- Log.w(TAG, "MountService unavailable for shutdown");
+ Log.w(TAG, "StorageManagerService unavailable for shutdown");
}
} catch (Exception e) {
- Log.e(TAG, "Exception during MountService shutdown", e);
+ Log.e(TAG, "Exception during StorageManagerService shutdown", e);
}
while (!mActionDone) {
long delay = endShutTime - SystemClock.elapsedRealtime();
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
-import android.os.storage.IMountService;
+import android.os.storage.IStorageManager;
import android.provider.Settings;
import android.util.DisplayMetrics;
import android.util.EventLog;
"com.android.server.job.JobSchedulerService";
private static final String LOCK_SETTINGS_SERVICE_CLASS =
"com.android.server.LockSettingsService$Lifecycle";
- private static final String MOUNT_SERVICE_CLASS =
- "com.android.server.MountService$Lifecycle";
+ private static final String STORAGE_MANAGER_SERVICE_CLASS =
+ "com.android.server.StorageManagerService$Lifecycle";
private static final String SEARCH_MANAGER_SERVICE_CLASS =
"com.android.server.search.SearchManagerService$Lifecycle";
private static final String THERMAL_OBSERVER_CLASS =
private void startOtherServices() {
final Context context = mSystemContext;
VibratorService vibrator = null;
- IMountService mountService = null;
+ IStorageManager storageManager = null;
NetworkManagementService networkManagement = null;
NetworkStatsService networkStats = null;
NetworkPolicyManagerService networkPolicy = null;
if (mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL) {
if (!disableStorage &&
!"0".equals(SystemProperties.get("system_init.startmountservice"))) {
- traceBeginAndSlog("StartMountService");
+ traceBeginAndSlog("StartStorageManagerService");
try {
/*
- * NotificationManagerService is dependant on MountService,
- * (for media / usb notifications) so we must start MountService first.
+ * NotificationManagerService is dependant on StorageManagerService,
+ * (for media / usb notifications) so we must start StorageManagerService first.
*/
- mSystemServiceManager.startService(MOUNT_SERVICE_CLASS);
- mountService = IMountService.Stub.asInterface(
+ mSystemServiceManager.startService(STORAGE_MANAGER_SERVICE_CLASS);
+ storageManager = IStorageManager.Stub.asInterface(
ServiceManager.getService("mount"));
} catch (Throwable e) {
- reportWtf("starting Mount Service", e);
+ reportWtf("starting StorageManager Service", e);
}
traceEnd();
}
}
/*
- * MountService has a few dependencies: Notification Manager and
- * AppWidget Provider. Make sure MountService is completely started
+ * StorageManagerService has a few dependencies: Notification Manager and
+ * AppWidget Provider. Make sure StorageManagerService is completely started
* first before continuing.
*/
- if (mountService != null && !mOnlyCore) {
+ if (storageManager != null && !mOnlyCore) {
traceBeginAndSlog("WaitForAsecScan");
try {
- mountService.waitForAsecScan();
+ storageManager.waitForAsecScan();
} catch (RemoteException ignored) {
}
traceEnd();