Merge "Honor hide pattern on crypto screen" into lmp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ee2a85c7c8
@@ -133,6 +133,9 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
|||||||
// how long we wait to clear a wrong pattern
|
// how long we wait to clear a wrong pattern
|
||||||
private static final int WRONG_PATTERN_CLEAR_TIMEOUT_MS = 1500;
|
private static final int WRONG_PATTERN_CLEAR_TIMEOUT_MS = 1500;
|
||||||
|
|
||||||
|
// how long we wait to clear a right pattern
|
||||||
|
private static final int RIGHT_PATTERN_CLEAR_TIMEOUT_MS = 500;
|
||||||
|
|
||||||
private Runnable mClearPatternRunnable = new Runnable() {
|
private Runnable mClearPatternRunnable = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
mLockPatternView.clearPattern();
|
mLockPatternView.clearPattern();
|
||||||
@@ -167,6 +170,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
|||||||
if (failedAttempts == 0) {
|
if (failedAttempts == 0) {
|
||||||
// The password was entered successfully. Simply do nothing
|
// The password was entered successfully. Simply do nothing
|
||||||
// and wait for the service restart to switch to surfacefligner
|
// and wait for the service restart to switch to surfacefligner
|
||||||
|
if (mLockPatternView != null) {
|
||||||
|
mLockPatternView.removeCallbacks(mClearPatternRunnable);
|
||||||
|
mLockPatternView.postDelayed(mClearPatternRunnable, RIGHT_PATTERN_CLEAR_TIMEOUT_MS);
|
||||||
|
}
|
||||||
} else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
|
} else if (failedAttempts == MAX_FAILED_ATTEMPTS) {
|
||||||
// Factory reset the device.
|
// Factory reset the device.
|
||||||
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
|
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
|
||||||
@@ -409,6 +416,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
|||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
int type = StorageManager.CRYPT_TYPE_PASSWORD;
|
int type = StorageManager.CRYPT_TYPE_PASSWORD;
|
||||||
String owner_info;
|
String owner_info;
|
||||||
|
boolean pattern_visible;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void doInBackground(Void... v) {
|
public Void doInBackground(Void... v) {
|
||||||
@@ -416,6 +424,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
|||||||
final IMountService service = getMountService();
|
final IMountService service = getMountService();
|
||||||
type = service.getPasswordType();
|
type = service.getPasswordType();
|
||||||
owner_info = service.getField("OwnerInfo");
|
owner_info = service.getField("OwnerInfo");
|
||||||
|
pattern_visible = !("0".equals(service.getField("PatternVisible")));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Error calling mount service " + e);
|
Log.e(TAG, "Error calling mount service " + e);
|
||||||
}
|
}
|
||||||
@@ -445,6 +454,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
|
|||||||
|
|
||||||
passwordEntryInit();
|
passwordEntryInit();
|
||||||
|
|
||||||
|
if (mLockPatternView != null) {
|
||||||
|
mLockPatternView.setInStealthMode(!pattern_visible);
|
||||||
|
}
|
||||||
|
|
||||||
if (mCooldown > 0) {
|
if (mCooldown > 0) {
|
||||||
setBackFunctionality(false);
|
setBackFunctionality(false);
|
||||||
cooldown(); // in case we are cooling down and coming back from emergency dialler
|
cooldown(); // in case we are cooling down and coming back from emergency dialler
|
||||||
|
@@ -25,6 +25,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.os.storage.IMountService;
|
import android.os.storage.IMountService;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -32,6 +33,8 @@ import android.view.View;
|
|||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
|
|
||||||
public class CryptKeeperConfirm extends Fragment {
|
public class CryptKeeperConfirm extends Fragment {
|
||||||
|
|
||||||
public static class Blank extends Activity {
|
public static class Blank extends Activity {
|
||||||
@@ -90,6 +93,27 @@ public class CryptKeeperConfirm extends Fragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* WARNING - nasty hack!
|
||||||
|
Settings for the lock screen are not available to the crypto
|
||||||
|
screen (CryptKeeper) at boot. We duplicate the ones that
|
||||||
|
CryptKeeper needs to the crypto key/value store when they are
|
||||||
|
modified (see LockPatternUtils).
|
||||||
|
However, prior to encryption, the crypto key/value store is not
|
||||||
|
persisted across reboots, thus modified settings are lost to
|
||||||
|
CryptKeeper.
|
||||||
|
In order to make sure CryptKeeper had the correct settings after
|
||||||
|
first encrypting, we thus need to rewrite them, which ensures the
|
||||||
|
crypto key/value store is up to date. On encryption, this store
|
||||||
|
is then persisted, and the settings will be there on future
|
||||||
|
reboots.
|
||||||
|
*/
|
||||||
|
LockPatternUtils utils = new LockPatternUtils(getActivity());
|
||||||
|
utils.setVisiblePatternEnabled(utils.isVisiblePatternEnabled());
|
||||||
|
if (utils.isOwnerInfoEnabled()) {
|
||||||
|
utils.setOwnerInfo(utils.getOwnerInfo(UserHandle.USER_OWNER),
|
||||||
|
UserHandle.USER_OWNER);
|
||||||
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(getActivity(), Blank.class);
|
Intent intent = new Intent(getActivity(), Blank.class);
|
||||||
intent.putExtras(getArguments());
|
intent.putExtras(getArguments());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user