Calling isServiceEnabled with the context in credential manager settings

Test: Built and deployed locally

Change-Id: I22d3fe863fa31c2601cedbde10907c79469a75f4
This commit is contained in:
Reema Bajwa
2022-12-20 22:09:15 +00:00
parent 5ba7d67b42
commit dbd9904c0a
4 changed files with 19 additions and 15 deletions

View File

@@ -38,7 +38,6 @@ import java.util.List;
/** Account Setting page for work profile. */
public class AccountWorkProfileDashboardFragment extends DashboardFragment {
private static final String TAG = "AccountWorkProfileFrag";
@Override
@@ -53,7 +52,7 @@ public class AccountWorkProfileDashboardFragment extends DashboardFragment {
@Override
protected int getPreferenceScreenResId() {
if (CredentialManager.isServiceEnabled()) {
if (this.getContext() != null && CredentialManager.isServiceEnabled(this.getContext())) {
return R.xml.accounts_work_dashboard_settings_credman;
}
return R.xml.accounts_work_dashboard_settings;
@@ -67,8 +66,7 @@ public class AccountWorkProfileDashboardFragment extends DashboardFragment {
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (CredentialManager.isServiceEnabled()) {
if (CredentialManager.isServiceEnabled(context)) {
CredentialManagerPreferenceController cmpp =
use(CredentialManagerPreferenceController.class);
cmpp.setParentFragment(this);