Merge "Show disable dialog box when none is selected" into udc-dev am: 1742524dd3
am: 728b1b8337
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23139605 Change-Id: I6ed8ede29cd4bc43039081864a020b36b1e9117c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -10306,7 +10306,16 @@
|
|||||||
<string name="credman_confirmation_message_title">Turn off %1$s\?</string>
|
<string name="credman_confirmation_message_title">Turn off %1$s\?</string>
|
||||||
|
|
||||||
<!-- Message of the warning dialog for disabling the credential provider. [CHAR_LIMIT=NONE] -->
|
<!-- Message of the warning dialog for disabling the credential provider. [CHAR_LIMIT=NONE] -->
|
||||||
<string name="credman_confirmation_message">Saved info like addresses or payment methods won\'t be filled in when you sign in. To keep your saved info filled in, set enable a password, passkey and data/or service.</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] -->
|
<!-- Title of the warning dialog for enabling the credential provider. [CHAR_LIMIT=NONE] -->
|
||||||
<string name="credman_enable_confirmation_message_title">Use %1$s\?</string>
|
<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);
|
mPrefs.get(packageName).setChecked(true);
|
||||||
}
|
}
|
||||||
return 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 {
|
} else {
|
||||||
togglePackageNameDisabled(packageName);
|
togglePackageNameDisabled(packageName);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
@@ -682,35 +670,6 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
|||||||
return new ErrorDialogFragment(host);
|
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() {
|
protected int getUser() {
|
||||||
if (mIsWorkProfile) {
|
if (mIsWorkProfile) {
|
||||||
UserHandle workProfile = Utils.getManagedProfile(UserManager.get(mContext));
|
UserHandle workProfile = Utils.getManagedProfile(UserManager.get(mContext));
|
||||||
@@ -800,46 +759,6 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
|||||||
public void onClick(DialogInterface dialog, int which) {}
|
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
|
* Confirmation dialog fragment shows a dialog to the user to confirm that they would like to
|
||||||
* enable the new provider.
|
* enable the new provider.
|
||||||
|
@@ -273,8 +273,13 @@ public class DefaultCombinedPicker extends DefaultAppPickerFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CharSequence getConfirmationMessage(CandidateInfo appInfo) {
|
protected CharSequence getConfirmationMessage(CandidateInfo appInfo) {
|
||||||
|
// If we are selecting none then show a warning label.
|
||||||
if (appInfo == null) {
|
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 CharSequence appName = appInfo.loadLabel();
|
||||||
final String message =
|
final String message =
|
||||||
|
Reference in New Issue
Block a user