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

Commit d59150ec authored by Ilya Matyukhin's avatar Ilya Matyukhin
Browse files

Add generateChallenge() in onResume()

Fixes: 133498264
Fixes: 133440610
Test: open FaceSettings from Settings with and without an enrolled face
Test: open FaceSettings from the notification that asks to re-enroll
Change-Id: I80ca7644f96a538614962232fb3951d1a91d87c7
parent b49bfe3b
Loading
Loading
Loading
Loading
+11 −14
Original line number Original line Diff line number Diff line
@@ -145,7 +145,11 @@ public class FaceSettings extends DashboardFragment {
        if (savedInstanceState != null) {
        if (savedInstanceState != null) {
            mToken = savedInstanceState.getByteArray(KEY_TOKEN);
            mToken = savedInstanceState.getByteArray(KEY_TOKEN);
        }
        }
    }


    @Override
    public void onResume() {
        super.onResume();
        if (mToken == null) {
        if (mToken == null) {
            final long challenge = mFaceManager.generateChallenge();
            final long challenge = mFaceManager.generateChallenge();
            ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
            ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
@@ -155,13 +159,7 @@ public class FaceSettings extends DashboardFragment {
                Log.e(TAG, "Password not set");
                Log.e(TAG, "Password not set");
                finish();
                finish();
            }
            }
        }
        } else {
    }

    @Override
    public void onResume() {
        super.onResume();
        if (mToken != null) {
            mAttentionController.setToken(mToken);
            mAttentionController.setToken(mToken);
            mEnrollController.setToken(mToken);
            mEnrollController.setToken(mToken);
        }
        }
@@ -196,15 +194,14 @@ public class FaceSettings extends DashboardFragment {
    }
    }


    @Override
    @Override
    public void onDestroy() {
    public void onStop() {
        super.onDestroy();
        super.onStop();
        if (getActivity().isFinishing()) {
        mToken = null;
        final int result = mFaceManager.revokeChallenge();
        final int result = mFaceManager.revokeChallenge();
        if (result < 0) {
        if (result < 0) {
            Log.w(TAG, "revokeChallenge failed, result: " + result);
            Log.w(TAG, "revokeChallenge failed, result: " + result);
        }
        }
    }
    }
    }


    @Override
    @Override
    protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
    protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {