Fix crash when changing encrypt with credential

Bug: 27173979
Change-Id: If8ef7a9342bcb1b0602791df1dc7634b3e980ee7
This commit is contained in:
Adrian Roos
2016-02-25 15:43:24 -08:00
parent b671780528
commit 77181e9478
3 changed files with 7 additions and 2 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -70,7 +71,10 @@ abstract class SaveChosenLockWorkerBase extends Fragment {
mUtils.setSeparateProfileChallengeEnabled(mUserId, true);
mWasSecureBefore = mUtils.isSecure(mUserId);
if (UserManager.get(getContext()).getUserInfo(mUserId).isPrimary()) {
Context context = getContext();
// If context is null, we're being invoked to change the setCredentialRequiredToDecrypt,
// and we made sure that this is the primary user already.
if (context == null || UserManager.get(context).getUserInfo(mUserId).isPrimary()) {
mUtils.setCredentialRequiredToDecrypt(credentialRequired);
}