Revert "Revert "Add Credential Manager settings""
This reverts commit 7a231eaba0
.
Reason for revert: Adding in fix for issue that caused initial revert
Change-Id: I395c13fb46fc570a6b8a663d4b4e5537866325ce
This commit is contained in:
@@ -22,9 +22,11 @@ import static com.android.settings.accounts.AccountDashboardFragment.buildAutofi
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.credentials.CredentialManager;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.applications.autofill.PasswordsPreferenceController;
|
||||
import com.android.settings.applications.credentials.CredentialManagerPreferenceController;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
|
||||
import com.android.settings.users.AutoSyncDataPreferenceController;
|
||||
@@ -34,9 +36,7 @@ import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Account Setting page for work profile.
|
||||
*/
|
||||
/** Account Setting page for work profile. */
|
||||
public class AccountWorkProfileDashboardFragment extends DashboardFragment {
|
||||
|
||||
private static final String TAG = "AccountWorkProfileFrag";
|
||||
@@ -53,6 +53,9 @@ public class AccountWorkProfileDashboardFragment extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
if (CredentialManager.isServiceEnabled()) {
|
||||
return R.xml.accounts_work_dashboard_settings_credman;
|
||||
}
|
||||
return R.xml.accounts_work_dashboard_settings;
|
||||
}
|
||||
|
||||
@@ -64,6 +67,13 @@ public class AccountWorkProfileDashboardFragment extends DashboardFragment {
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
|
||||
if (CredentialManager.isServiceEnabled()) {
|
||||
CredentialManagerPreferenceController cmpp =
|
||||
use(CredentialManagerPreferenceController.class);
|
||||
cmpp.setParentFragment(this);
|
||||
}
|
||||
|
||||
getSettingsLifecycle().addObserver(use(PasswordsPreferenceController.class));
|
||||
}
|
||||
|
||||
@@ -77,11 +87,13 @@ public class AccountWorkProfileDashboardFragment extends DashboardFragment {
|
||||
}
|
||||
|
||||
private static void buildAccountPreferenceControllers(
|
||||
Context context, DashboardFragment parent, String[] authorities,
|
||||
Context context,
|
||||
DashboardFragment parent,
|
||||
String[] authorities,
|
||||
List<AbstractPreferenceController> controllers) {
|
||||
final AccountPreferenceController accountPrefController =
|
||||
new AccountPreferenceController(context, parent, authorities,
|
||||
ProfileSelectFragment.ProfileType.WORK);
|
||||
new AccountPreferenceController(
|
||||
context, parent, authorities, ProfileSelectFragment.ProfileType.WORK);
|
||||
if (parent != null) {
|
||||
parent.getSettingsLifecycle().addObserver(accountPrefController);
|
||||
}
|
||||
@@ -91,15 +103,15 @@ public class AccountWorkProfileDashboardFragment extends DashboardFragment {
|
||||
}
|
||||
|
||||
// TODO: b/141601408. After featureFlag settings_work_profile is launched, unmark this
|
||||
// public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
// new BaseSearchIndexProvider(R.xml.accounts_work_dashboard_settings) {
|
||||
//
|
||||
// @Override
|
||||
// public List<AbstractPreferenceController> createPreferenceControllers(
|
||||
// Context context) {
|
||||
// ..Add autofill here too..
|
||||
// return buildPreferenceControllers(
|
||||
// context, null /* parent */, null /* authorities*/);
|
||||
// }
|
||||
// };
|
||||
// public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
// new BaseSearchIndexProvider(R.xml.accounts_work_dashboard_settings) {
|
||||
//
|
||||
// @Override
|
||||
// public List<AbstractPreferenceController> createPreferenceControllers(
|
||||
// Context context) {
|
||||
// ..Add autofill here too..
|
||||
// return buildPreferenceControllers(
|
||||
// context, null /* parent */, null /* authorities*/);
|
||||
// }
|
||||
// };
|
||||
}
|
||||
|
Reference in New Issue
Block a user