Show disable dialog box when none is selected
Also remove from CMPP since that will be hidden. Test: ondevice Bug: 281147573 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:16d3b54aaf802c66be439bf65c877cba60c4390d) Merged-In: Ic2b59c42ed4ddbc83a770b8bb99c641d2f1a383d Change-Id: Ic2b59c42ed4ddbc83a770b8bb99c641d2f1a383d
This commit is contained in:
@@ -10304,7 +10304,16 @@
|
||||
<string name="credman_confirmation_message_title">Turn off %1$s\?</string>
|
||||
|
||||
<!-- Message of the warning dialog for disabling the credential provider. [CHAR_LIMIT=NONE] -->
|
||||
<string name="credman_confirmation_message">Saved info like passkeys and passwords may not be available when you sign in</string>
|
||||
<string name="credman_confirmation_message">
|
||||
<![CDATA[
|
||||
<b>Turn off this service?</b>
|
||||
<br/>
|
||||
<br/>
|
||||
Save info like passwords, passkeys, payment methods, and other info won\'t be filled
|
||||
in when you sign in. To use your saved info, choose a password, passkey, or data
|
||||
service.
|
||||
]]>
|
||||
</string>
|
||||
|
||||
<!-- Title of the warning dialog for enabling the credential provider. [CHAR_LIMIT=NONE] -->
|
||||
<string name="credman_enable_confirmation_message_title">Use %1$s\?</string>
|
||||
|
@@ -553,21 +553,9 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
mPrefs.get(packageName).setChecked(true);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// If we are disabling the last enabled provider then show a warning.
|
||||
if (mEnabledPackageNames.size() <= 1) {
|
||||
final DialogFragment fragment =
|
||||
newConfirmationDialogFragment(packageName, title, pref);
|
||||
|
||||
if (fragment == null || mFragmentManager == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
fragment.show(mFragmentManager, ConfirmationDialogFragment.TAG);
|
||||
} else {
|
||||
togglePackageNameDisabled(packageName);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
@@ -682,35 +670,6 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
return new ErrorDialogFragment(host);
|
||||
}
|
||||
|
||||
private @Nullable ConfirmationDialogFragment newConfirmationDialogFragment(
|
||||
@NonNull String packageName,
|
||||
@NonNull CharSequence appName,
|
||||
@NonNull SwitchPreference pref) {
|
||||
DialogHost host =
|
||||
new DialogHost() {
|
||||
@Override
|
||||
public void onDialogClick(int whichButton) {
|
||||
if (whichButton == DialogInterface.BUTTON_POSITIVE) {
|
||||
// Since the package is now enabled then we
|
||||
// should remove it from the enabled list.
|
||||
togglePackageNameDisabled(packageName);
|
||||
} else if (whichButton == DialogInterface.BUTTON_NEGATIVE) {
|
||||
// Set the checked back to true because we
|
||||
// backed out of turning this off.
|
||||
pref.setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
// If we dismiss the dialog then re-enable.
|
||||
pref.setChecked(true);
|
||||
}
|
||||
};
|
||||
|
||||
return new ConfirmationDialogFragment(host, packageName, appName);
|
||||
}
|
||||
|
||||
protected int getUser() {
|
||||
if (mIsWorkProfile) {
|
||||
UserHandle workProfile = Utils.getManagedProfile(UserManager.get(mContext));
|
||||
@@ -800,46 +759,6 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
||||
public void onClick(DialogInterface dialog, int which) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirmation dialog fragment shows a dialog to the user to confirm that they are disabling a
|
||||
* provider.
|
||||
*/
|
||||
public static class ConfirmationDialogFragment extends CredentialManagerDialogFragment {
|
||||
|
||||
ConfirmationDialogFragment(
|
||||
DialogHost dialogHost, @NonNull String packageName, @NonNull CharSequence appName) {
|
||||
super(dialogHost);
|
||||
|
||||
final Bundle argument = new Bundle();
|
||||
argument.putString(PACKAGE_NAME_KEY, packageName);
|
||||
argument.putCharSequence(APP_NAME_KEY, appName);
|
||||
setArguments(argument);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Bundle bundle = getArguments();
|
||||
final String title =
|
||||
getContext()
|
||||
.getString(
|
||||
R.string.credman_confirmation_message_title,
|
||||
bundle.getCharSequence(
|
||||
CredentialManagerDialogFragment.APP_NAME_KEY));
|
||||
|
||||
return new AlertDialog.Builder(getActivity())
|
||||
.setTitle(title)
|
||||
.setMessage(getContext().getString(R.string.credman_confirmation_message))
|
||||
.setPositiveButton(R.string.credman_confirmation_message_positive_button, this)
|
||||
.setNegativeButton(android.R.string.cancel, this)
|
||||
.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
getDialogHost().onDialogClick(which);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirmation dialog fragment shows a dialog to the user to confirm that they would like to
|
||||
* enable the new provider.
|
||||
|
@@ -273,8 +273,13 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
||||
|
||||
@Override
|
||||
protected CharSequence getConfirmationMessage(CandidateInfo appInfo) {
|
||||
// If we are selecting none then show a warning label.
|
||||
if (appInfo == null) {
|
||||
return null;
|
||||
final String message =
|
||||
getContext()
|
||||
.getString(
|
||||
R.string.credman_confirmation_message);
|
||||
return Html.fromHtml(message);
|
||||
}
|
||||
final CharSequence appName = appInfo.loadLabel();
|
||||
final String message =
|
||||
|
Reference in New Issue
Block a user