Merge changes I4c4d257e,I4cc4cc22 into udc-dev
* changes: Warn earlier about 5 provider limit Fix credman provider not showing
This commit is contained in:
committed by
Android (Google) Code Review
commit
f6eab0c9de
@@ -533,16 +533,9 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
boolean isChecked = pref.isChecked();
|
||||
|
||||
if (isChecked) {
|
||||
if (togglePackageNameEnabled(packageName)) {
|
||||
// Enable all prefs.
|
||||
if (mPrefs.containsKey(packageName)) {
|
||||
mPrefs.get(packageName).setChecked(true);
|
||||
}
|
||||
} else {
|
||||
// Since we failed to show toggle the switch back to off.
|
||||
pref.setChecked(false);
|
||||
|
||||
if (mEnabledPackageNames.size() >= MAX_SELECTABLE_PROVIDERS) {
|
||||
// Show the error if too many enabled.
|
||||
pref.setChecked(false);
|
||||
final DialogFragment fragment = newErrorDialogFragment();
|
||||
|
||||
if (fragment == null || mFragmentManager == null) {
|
||||
@@ -550,8 +543,15 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
}
|
||||
|
||||
fragment.show(mFragmentManager, ErrorDialogFragment.TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
togglePackageNameEnabled(packageName);
|
||||
|
||||
// Enable all prefs.
|
||||
if (mPrefs.containsKey(packageName)) {
|
||||
mPrefs.get(packageName).setChecked(true);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// If we are disabling the last enabled provider then show a warning.
|
||||
|
@@ -16,12 +16,9 @@
|
||||
|
||||
package com.android.settings.applications.credentials;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settingslib.applications.DefaultAppInfo;
|
||||
@@ -47,25 +44,6 @@ public class DefaultWorkCombinedPreferenceController extends DefaultCombinedPref
|
||||
return "default_credman_autofill_main_work";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultAppInfo getDefaultAppInfo() {
|
||||
final String flattenComponent =
|
||||
Settings.Secure.getStringForUser(
|
||||
mContext.getContentResolver(),
|
||||
DefaultCombinedPicker.AUTOFILL_SETTING,
|
||||
mUserHandle.getIdentifier());
|
||||
if (!TextUtils.isEmpty(flattenComponent)) {
|
||||
DefaultAppInfo appInfo =
|
||||
new DefaultAppInfo(
|
||||
mContext,
|
||||
mPackageManager,
|
||||
mUserHandle.getIdentifier(),
|
||||
ComponentName.unflattenFromString(flattenComponent));
|
||||
return appInfo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getSettingIntent(DefaultAppInfo info) {
|
||||
if (info == null) {
|
||||
|
Reference in New Issue
Block a user