Search in sources :

Example 61 with LockPatternUtils

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 */);
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Example 62 with LockPatternUtils

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);
    }
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Example 63 with LockPatternUtils

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) {
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) LockPatternUtils(com.android.internal.widget.LockPatternUtils) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream)

Example 64 with LockPatternUtils

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();
}
Also used : DataOutputStream(java.io.DataOutputStream) LockPatternUtils(com.android.internal.widget.LockPatternUtils) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Example 65 with LockPatternUtils

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();
    }
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils) Cursor(android.database.Cursor)

Aggregations

LockPatternUtils (com.android.internal.widget.LockPatternUtils)96 ComponentName (android.content.ComponentName)24 UserInfo (android.content.pm.UserInfo)24 DevicePolicyManager (android.app.admin.DevicePolicyManager)19 UserManager (android.os.UserManager)16 IOException (java.io.IOException)11 IntentFilter (android.content.IntentFilter)10 Intent (android.content.Intent)9 View (android.view.View)9 Cursor (android.database.Cursor)6 RemoteException (android.os.RemoteException)6 ArrayList (java.util.ArrayList)6 ContentResolver (android.content.ContentResolver)5 Configuration (android.content.res.Configuration)5 Rect (android.graphics.Rect)5 SoundPool (android.media.SoundPool)5 IBinder (android.os.IBinder)5 IVrManager (android.service.vr.IVrManager)5 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)5 KeyguardDisplayManager (com.android.keyguard.KeyguardDisplayManager)5