use of android.os.storage.IMountService in project android_frameworks_base by AOSPA.
the class PackageHelper method createSdDir.
public static String createSdDir(long sizeBytes, String cid, String sdEncKey, int uid, boolean isExternal) {
// 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();
if (localLOGV)
Log.i(TAG, "Size of container " + sizeMb + " MB");
int rc = mountService.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);
if (localLOGV)
Log.i(TAG, "Created secure container " + cid + " at " + cachePath);
return cachePath;
} catch (RemoteException e) {
Log.e(TAG, "MountService running?");
}
return null;
}
use of android.os.storage.IMountService in project android_frameworks_base by AOSPA.
the class LockPatternUtils method updateCryptoUserInfo.
private void updateCryptoUserInfo(int userId) {
if (userId != UserHandle.USER_SYSTEM) {
return;
}
final String ownerInfo = isOwnerInfoEnabled(userId) ? getOwnerInfo(userId) : "";
IBinder service = ServiceManager.getService("mount");
if (service == null) {
Log.e(TAG, "Could not find the mount service to update the user info");
return;
}
IMountService mountService = IMountService.Stub.asInterface(service);
try {
Log.d(TAG, "Setting owner info");
mountService.setField(StorageManager.OWNER_INFO_KEY, ownerInfo);
} catch (RemoteException e) {
Log.e(TAG, "Error changing user info", e);
}
}
use of android.os.storage.IMountService in project android_frameworks_base by AOSPA.
the class LockPatternUtils method updateEncryptionPassword.
/** Update the encryption password if it is enabled **/
private void updateEncryptionPassword(final int type, final String password) {
if (!isDeviceEncryptionEnabled()) {
return;
}
final IBinder service = ServiceManager.getService("mount");
if (service == null) {
Log.e(TAG, "Could not find the mount service to update the encryption password");
return;
}
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... dummy) {
IMountService mountService = IMountService.Stub.asInterface(service);
try {
mountService.changeEncryptionPassword(type, password);
} catch (RemoteException e) {
Log.e(TAG, "Error changing encryption password", e);
}
return null;
}
}.execute();
}
use of android.os.storage.IMountService in project android_frameworks_base by crdroidandroid.
the class PackageHelper method resizeSdDir.
public static boolean resizeSdDir(long sizeBytes, String cid, String sdEncKey) {
// 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);
if (rc == StorageResultCode.OperationSucceeded) {
return true;
}
} catch (RemoteException e) {
Log.e(TAG, "MountService running?");
}
Log.e(TAG, "Failed to create secure container " + cid);
return false;
}
use of android.os.storage.IMountService in project android_frameworks_base by crdroidandroid.
the class PackageHelperTests method cleanupContainers.
private void cleanupContainers() throws RemoteException {
Log.d(TAG, "cleanUp");
IMountService ms = getMs();
String[] containers = ms.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);
}
}
}
Aggregations