summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Paul Lawrence <paullawrence@google.com> 2014-04-03 09:10:26 -0700
committer Paul Lawrence <paullawrence@google.com> 2014-04-03 12:44:32 -0700
commit46791e752ca1eca35e6a882c47d7de7f4f66687c (patch)
treec3acda8378f729e3768f051078f274b6a5be71f4
parent9316082809196acd126a1e502d4b26d7b5f98216 (diff)
Allow encryption when keyguard is set to pattern or no protection
Add type parameter to encryptStorage so we can set type when we encrypt Depends on https://googleplex-android-review.git.corp.google.com/#/c/444056/ Circular dependency on: https://googleplex-android-review.git.corp.google.com/#/c/444201/ Bug: 13749169 Change-Id: I52034ec25de35f12f1bbfdd1b0f8584923a0be2e
-rw-r--r--core/java/android/os/storage/IMountService.java8
-rw-r--r--services/core/java/com/android/server/MountService.java7
2 files changed, 9 insertions, 6 deletions
diff --git a/core/java/android/os/storage/IMountService.java b/core/java/android/os/storage/IMountService.java
index 41808603356c..5b027c259d87 100644
--- a/core/java/android/os/storage/IMountService.java
+++ b/core/java/android/os/storage/IMountService.java
@@ -625,12 +625,13 @@ public interface IMountService extends IInterface {
return _result;
}
- public int encryptStorage(String password) throws RemoteException {
+ public int encryptStorage(int type, String password) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
int _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeInt(type);
_data.writeString(password);
mRemote.transact(Stub.TRANSACTION_encryptStorage, _data, _reply, 0);
_reply.readException();
@@ -1175,8 +1176,9 @@ public interface IMountService extends IInterface {
}
case TRANSACTION_encryptStorage: {
data.enforceInterface(DESCRIPTOR);
+ int type = data.readInt();
String password = data.readString();
- int result = encryptStorage(password);
+ int result = encryptStorage(type, password);
reply.writeNoException();
reply.writeInt(result);
return true;
@@ -1444,7 +1446,7 @@ public interface IMountService extends IInterface {
/**
* Encrypts storage.
*/
- public int encryptStorage(String password) throws RemoteException;
+ public int encryptStorage(int type, String password) throws RemoteException;
/**
* Changes the encryption password.
diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java
index c1d9fbd3f15f..25e756845930 100644
--- a/services/core/java/com/android/server/MountService.java
+++ b/services/core/java/com/android/server/MountService.java
@@ -52,6 +52,7 @@ import android.os.storage.IMountServiceListener;
import android.os.storage.IMountShutdownObserver;
import android.os.storage.IObbActionListener;
import android.os.storage.OnObbStateChangeListener;
+import android.os.storage.StorageManager;
import android.os.storage.StorageResultCode;
import android.os.storage.StorageVolume;
import android.text.TextUtils;
@@ -2144,8 +2145,8 @@ class MountService extends IMountService.Stub
}
}
- public int encryptStorage(String password) {
- if (TextUtils.isEmpty(password)) {
+ public int encryptStorage(int type, String password) {
+ if (TextUtils.isEmpty(password) && type != StorageManager.CRYPT_TYPE_DEFAULT) {
throw new IllegalArgumentException("password cannot be empty");
}
@@ -2159,7 +2160,7 @@ class MountService extends IMountService.Stub
}
try {
- mConnector.execute("cryptfs", "enablecrypto", "inplace",
+ mConnector.execute("cryptfs", "enablecrypto", "inplace", CRYPTO_TYPES[type],
new SensitiveArg(toHex(password)));
} catch (NativeDaemonConnectorException e) {
// Encryption failed