use of com.android.internal.widget.LockPatternUtils in project android_frameworks_base by AOSPA.
the class KeyguardHostView method onFinishInflate.
@Override
protected void onFinishInflate() {
mSecurityContainer = (KeyguardSecurityContainer) findViewById(R.id.keyguard_security_container);
mLockPatternUtils = new LockPatternUtils(mContext);
mSecurityContainer.setLockPatternUtils(mLockPatternUtils);
mSecurityContainer.setSecurityCallback(this);
mSecurityContainer.showPrimarySecurityScreen(false);
// mSecurityContainer.updateSecurityViews(false /* not bouncing */);
}
use of com.android.internal.widget.LockPatternUtils in project android_frameworks_base by AOSPA.
the class KeyguardAbsKeyInputView method onFinishInflate.
@Override
protected void onFinishInflate() {
mLockPatternUtils = new LockPatternUtils(mContext);
mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this);
mEcaView = findViewById(R.id.keyguard_selector_fade_container);
mMaxCountdownTimes = mContext.getResources().getInteger(R.integer.config_max_unlock_countdown_times);
EmergencyButton button = (EmergencyButton) findViewById(R.id.emergency_call_button);
if (button != null) {
button.setCallback(this);
}
}
use of com.android.internal.widget.LockPatternUtils in project android_frameworks_base by AOSPA.
the class SettingsBackupAgent method restoreLockSettings.
/**
* Restores the owner info enabled and owner info settings in LockSettings.
*
* @param buffer
* @param nBytes
*/
private void restoreLockSettings(byte[] buffer, int nBytes) {
final LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
ByteArrayInputStream bais = new ByteArrayInputStream(buffer, 0, nBytes);
DataInputStream in = new DataInputStream(bais);
try {
String key;
// Read until empty string marker
while ((key = in.readUTF()).length() > 0) {
final String value = in.readUTF();
if (DEBUG_BACKUP) {
Log.v(TAG, "Restoring lock_settings " + key + " = " + value);
}
switch(key) {
case KEY_LOCK_SETTINGS_OWNER_INFO_ENABLED:
lockPatternUtils.setOwnerInfoEnabled("1".equals(value), UserHandle.myUserId());
break;
case KEY_LOCK_SETTINGS_OWNER_INFO:
lockPatternUtils.setOwnerInfo(value, UserHandle.myUserId());
break;
}
}
in.close();
} catch (IOException ioe) {
}
}
use of com.android.internal.widget.LockPatternUtils in project android_frameworks_base by AOSPA.
the class SettingsBackupAgent method getLockSettings.
/**
* Serialize the owner info settings
*/
private byte[] getLockSettings() {
final LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
final boolean ownerInfoEnabled = lockPatternUtils.isOwnerInfoEnabled(UserHandle.myUserId());
final String ownerInfo = lockPatternUtils.getOwnerInfo(UserHandle.myUserId());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(baos);
try {
out.writeUTF(KEY_LOCK_SETTINGS_OWNER_INFO_ENABLED);
out.writeUTF(ownerInfoEnabled ? "1" : "0");
if (ownerInfo != null) {
out.writeUTF(KEY_LOCK_SETTINGS_OWNER_INFO);
out.writeUTF(ownerInfo != null ? ownerInfo : "");
}
// End marker
out.writeUTF("");
out.flush();
} catch (IOException ioe) {
}
return baos.toByteArray();
}
use of com.android.internal.widget.LockPatternUtils in project android_frameworks_base by AOSPA.
the class DatabaseHelper method upgradeLockPatternLocation.
private void upgradeLockPatternLocation(SQLiteDatabase db) {
Cursor c = db.query(TABLE_SYSTEM, new String[] { "_id", "value" }, "name='lock_pattern'", null, null, null, null);
if (c.getCount() > 0) {
c.moveToFirst();
String lockPattern = c.getString(1);
if (!TextUtils.isEmpty(lockPattern)) {
// Convert lock pattern
try {
LockPatternUtils lpu = new LockPatternUtils(mContext);
List<LockPatternView.Cell> cellPattern = LockPatternUtils.stringToPattern(lockPattern);
lpu.saveLockPattern(cellPattern, null, UserHandle.USER_SYSTEM);
} catch (IllegalArgumentException e) {
// Don't want corrupted lock pattern to hang the reboot process
}
}
c.close();
db.delete(TABLE_SYSTEM, "name='lock_pattern'", null);
} else {
c.close();
}
}
Aggregations