am 0f2ef34b: Merge "Update encryption commands." into honeycomb
* commit '0f2ef34b5a7158ab105edfb0d6c5904ae23e89fa': Update encryption commands.
This commit is contained in:
@@ -1644,13 +1644,30 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mConnector.doCommand(String.format("cryptfs checkpw %s", password));
|
ArrayList<String> rsp = mConnector.doCommand("cryptfs checkpw " + password);
|
||||||
|
String []tok = rsp.get(0).split(" ");
|
||||||
|
|
||||||
|
if (tok == null || tok.length != 2) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int code = Integer.parseInt(tok[1]);
|
||||||
|
|
||||||
|
if (code == 0) {
|
||||||
|
// Decrypt was successful. Post a delayed message before restarting in order
|
||||||
|
// to let the UI to clear itself
|
||||||
|
mHandler.postDelayed(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
mConnector.doCommand(String.format("cryptfs restart"));
|
||||||
|
}
|
||||||
|
}, 2000); // 2 seconds
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
} catch (NativeDaemonConnectorException e) {
|
} catch (NativeDaemonConnectorException e) {
|
||||||
// Decryption failed
|
// Decryption failed
|
||||||
return e.getCode();
|
return e.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int encryptStorage(String password) {
|
public int encryptStorage(String password) {
|
||||||
@@ -1667,7 +1684,7 @@ class MountService extends IMountService.Stub implements INativeDaemonConnectorC
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mConnector.doCommand(String.format("cryptfs enablecrypto wipe %s", password));
|
mConnector.doCommand(String.format("cryptfs enablecrypto inplace %s", password));
|
||||||
} catch (NativeDaemonConnectorException e) {
|
} catch (NativeDaemonConnectorException e) {
|
||||||
// Encryption failed
|
// Encryption failed
|
||||||
return e.getCode();
|
return e.getCode();
|
||||||
|
|||||||
Reference in New Issue
Block a user