use of android.os.storage.IMountService in project android_frameworks_base by DirtyUnicorns.
the class LockSettingsService method addUserKeyAuth.
private void addUserKeyAuth(int userId, byte[] token, byte[] secret) throws RemoteException {
final UserInfo userInfo = UserManager.get(mContext).getUserInfo(userId);
final IMountService mountService = getMountService();
final long callingId = Binder.clearCallingIdentity();
try {
mountService.addUserKeyAuth(userId, userInfo.serialNumber, token, secret);
} finally {
Binder.restoreCallingIdentity(callingId);
}
}
use of android.os.storage.IMountService in project android_frameworks_base by ParanoidAndroid.
the class ExternalStorageFormatter method onCancel.
@Override
public void onCancel(DialogInterface dialog) {
IMountService mountService = getMountService();
String extStoragePath = mStorageVolume == null ? Environment.getLegacyExternalStorageDirectory().toString() : mStorageVolume.getPath();
try {
mountService.mountVolume(extStoragePath);
} catch (RemoteException e) {
Log.w(TAG, "Failed talking with mount service", e);
}
stopSelf();
}
use of android.os.storage.IMountService in project android_frameworks_base by ParanoidAndroid.
the class PackageHelper method createSdDir.
public static String createSdDir(int sizeMb, String cid, String sdEncKey, int uid, boolean isExternal) {
// Create mount point via MountService
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 ParanoidAndroid.
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);
}
}
}
use of android.os.storage.IMountService in project android_frameworks_base by AOSPA.
the class UserController method unlockUserCleared.
boolean unlockUserCleared(final int userId, byte[] token, byte[] secret, IProgressListener listener) {
UserState uss;
synchronized (mService) {
// 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();
try {
// We always want to unlock user storage, even user is not started yet
mountService.unlockUserKey(userId, userInfo.serialNumber, token, secret);
} catch (RemoteException | RuntimeException e) {
Slog.w(TAG, "Failed to unlock: " + e.getMessage());
}
}
// Bail if user isn't actually running, otherwise register the given
// listener to watch for unlock progress
uss = mStartedUsers.get(userId);
if (uss == null) {
notifyFinished(userId, listener);
return false;
} else {
uss.mUnlockProgress.addListener(listener);
uss.tokenProvided = (token != null);
}
}
finishUserUnlocking(uss);
final ArraySet<Integer> childProfilesToUnlock = new ArraySet<>();
synchronized (mService) {
// managed profiles under that user.
for (int i = 0; i < mStartedUsers.size(); i++) {
final int testUserId = mStartedUsers.keyAt(i);
final UserInfo parent = getUserManager().getProfileParent(testUserId);
if (parent != null && parent.id == userId && testUserId != userId) {
Slog.d(TAG, "User " + testUserId + " (parent " + parent.id + "): attempting unlock because parent was just unlocked");
childProfilesToUnlock.add(testUserId);
}
}
}
final int size = childProfilesToUnlock.size();
for (int i = 0; i < size; i++) {
maybeUnlockUser(childProfilesToUnlock.valueAt(i));
}
return true;
}
Aggregations