OSDN Git Service

Fix account deletion not updating account display
authorAntony Sargent <asargent@google.com>
Thu, 20 Sep 2018 23:35:06 +0000 (16:35 -0700)
committerAntony Sargent <asargent@google.com>
Fri, 21 Sep 2018 20:11:54 +0000 (13:11 -0700)
commite0202b219b273c7be4661bd2995e4bb5f7251ebf
tree39b80530fb51ae5474c714d99d3f7c5551a75f83
parent744cb8b18f1dff22fbf18c8549555686fbe8f7f6
Fix account deletion not updating account display

The visible symptom of this problem is that when deleting an account, if
a screen lock is set, after confirming the removal and entering the
credentials, you end up back on the account details for the page and it
looks like the deletion failed (even though it didn't).

There were two problems here:

-We were expecting the AccountDetailDashboardFragment to be in a resumed
state at the end of the confirmation dialog, but it wasn't if we had
launched the activity to have the user enter their screen lock
credentials. In the past trying to finish an activity that wasn't in
resumed state seemed to have generated a crash (b/6494527), but that
isn't the case anymore from some tests I ran.

-The AccountDetailDashboardFragment doesn't check in onResume that the
 account still exists.

This CL fixes the bug in 2 ways - we'll always try to finish the
AccountDetailDashboardFragment if the account removal succeeded, and
when AccountDetailDashboardFragment's onResume is called we'll always
check for the account existence. Either approach would be sufficient on
its own.

Change-Id: Iaa65e97fca5dfc8b1251968142e47315e3b590c2
Fixes: 112845988
Test: make RunSettingsRoboTests
src/com/android/settings/accounts/AccountDetailDashboardFragment.java
src/com/android/settings/accounts/RemoveAccountPreferenceController.java
tests/robotests/src/com/android/settings/accounts/AccountDetailDashboardFragmentTest.java
tests/robotests/src/com/android/settings/accounts/RemoveAccountPreferenceControllerTest.java