[New RemoveAccount API in Settings App]:
Modify Settings app to use the new account remove API Bug: 18292092 Change-Id: I5f02d71bc0c7ca3e38157d38dea077c6fe6eb34e
This commit is contained in:
@@ -91,20 +91,20 @@ public class AccountSyncSettings extends AccountPreferenceBase {
|
|||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
// TODO: We need an API to remove an account from a different user.
|
Activity activity = getActivity();
|
||||||
// See: http://b/15466880
|
AccountManager.get(activity)
|
||||||
AccountManager.get(AccountSyncSettings.this.getActivity())
|
.removeAccountAsUser(mAccount, activity,
|
||||||
.removeAccountAsUser(mAccount,
|
new AccountManagerCallback<Bundle>() {
|
||||||
new AccountManagerCallback<Boolean>() {
|
|
||||||
@Override
|
@Override
|
||||||
public void run(AccountManagerFuture<Boolean> future) {
|
public void run(AccountManagerFuture<Bundle> future) {
|
||||||
// If already out of this screen, don't proceed.
|
// If already out of this screen, don't proceed.
|
||||||
if (!AccountSyncSettings.this.isResumed()) {
|
if (!AccountSyncSettings.this.isResumed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean failed = true;
|
boolean failed = true;
|
||||||
try {
|
try {
|
||||||
if (future.getResult() == true) {
|
if (future.getResult()
|
||||||
|
.getBoolean(AccountManager.KEY_BOOLEAN_RESULT)) {
|
||||||
failed = false;
|
failed = false;
|
||||||
}
|
}
|
||||||
} catch (OperationCanceledException e) {
|
} catch (OperationCanceledException e) {
|
||||||
|
Reference in New Issue
Block a user