Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12feb8f2 authored by Raj Yengisetty's avatar Raj Yengisetty Committed by Matt Garnes
Browse files

Reset Pattern:

 - If user cancels while creating new pattern, old pattern is restored

Change-Id: I55955b1ffadca2ba712c40c7d443c4fc4b0f528c
parent 6c7a2871
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import java.util.List;

public class LockPatternActivity extends Activity {
    public static final String PATTERN_LOCK_PROTECTED_APPS = "pattern_lock_protected_apps";
    public static final String RECREATE_PATTERN = "recreate_pattern_lock";

    private static final int MIN_PATTERN_SIZE = 4;
    private static final int MAX_PATTERN_RETRY = 5;
@@ -107,6 +108,9 @@ public class LockPatternActivity extends Activity {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        String pattern = prefs.getString(PATTERN_LOCK_PROTECTED_APPS, null);
        mCreate = pattern == null;
        if (RECREATE_PATTERN.equals(getIntent().getAction())) {
            mCreate = true;
        }

        if (pattern != null) {
            mPatternHash = Base64.decode(pattern, Base64.DEFAULT);
+7 −11
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import java.util.concurrent.ConcurrentHashMap;

public class ProtectedAppsActivity extends Activity {
    private static final int REQ_ENTER_PATTERN = 1;
    private static final int REQ_RESET_PATTERN = 2;

    private ListView mListView;

@@ -147,6 +148,8 @@ public class ProtectedAppsActivity extends Activity {
                        break;
                }
                break;
            case REQ_RESET_PATTERN:
                mWaitUserAuth = true;
        }
    }

@@ -172,17 +175,10 @@ public class ProtectedAppsActivity extends Activity {
    }

    private void resetLock() {
        // Clear out the saved pattern lock
        SharedPreferences prefs = PreferenceManager
                .getDefaultSharedPreferences(getApplicationContext());
        SharedPreferences.Editor editor = prefs.edit();
        editor.remove(LockPatternActivity.PATTERN_LOCK_PROTECTED_APPS);
        editor.commit();

        // Reset this activity
        Intent intent = getIntent();
        finish();
        startActivity(intent);
        mWaitUserAuth = false;
        Intent lockPattern = new Intent(LockPatternActivity.RECREATE_PATTERN, null,
                this, LockPatternActivity.class);
        startActivityForResult(lockPattern, REQ_RESET_PATTERN);
    }

    private List<AppEntry> refreshApps() {