Fixed the IllegalStateException on removing account
We display a dialog in AccountManager.removeAccountAsUser() callback, but at that
time fragment is onstop() which causes the IllegalStateException.
Fixes: 133253227
Fixes: 135004255
Test: make RunSettingsRoboTests -j56 ROBOTEST_FILTER=com.android.settings.accounts
make RunSettingsRoboTests -j56 ROBOTEST_FILTER=com.android.settings.core
make RunSettingsRoboTests -j56 ROBOTEST_FILTER=com.android.settings.dashboard
Change-Id: I8534e8f7118234f6346607415698f9f91c3e5ffb
(cherry picked from commit d843ee85de
)
This commit is contained in:
@@ -191,7 +191,11 @@ public class RemoveAccountPreferenceController extends AbstractPreferenceControl
|
|||||||
}
|
}
|
||||||
final RemoveAccountFailureDialog dialog = new RemoveAccountFailureDialog();
|
final RemoveAccountFailureDialog dialog = new RemoveAccountFailureDialog();
|
||||||
dialog.setTargetFragment(parent, 0);
|
dialog.setTargetFragment(parent, 0);
|
||||||
dialog.show(parent.getFragmentManager(), FAILED_REMOVAL_DIALOG);
|
try {
|
||||||
|
dialog.show(parent.getFragmentManager(), FAILED_REMOVAL_DIALOG);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
Log.w(TAG, "Can't show RemoveAccountFailureDialog. " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user