diff options
author | Jim Miller <jaggies@google.com> | 2010-05-06 14:55:38 -0700 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2010-05-06 16:11:15 -0700 |
commit | 55b16fce30bac6ba207d671757f1f3eb75739cb5 (patch) | |
tree | f5ed609d7c0498428b0a37f799f1441a5fb41af0 | |
parent | cddfd77b45662d7316aaed3d0159d0f42d284cfc (diff) | |
download | base-55b16fce30bac6ba207d671757f1f3eb75739cb5.tar.gz |
Fix 2662816: Move UI update from async callback to ui thread. DO NOT MERGEHEADandroid-sdk-tools_r6android-sdk-2.2_r2android-sdk-2.2_r1android-cts-2.2_r8android-cts-2.2_r7android-cts-2.2_r6android-cts-2.2_r5android-cts-2.2_r4android-cts-2.2_r3android-cts-2.2_r2android-cts-2.2_r1android-2.2_r1.3android-2.2_r1.2android-2.2_r1.1android-2.2_r1android-2.2.3_r2.1android-2.2.3_r2android-2.2.3_r1android-2.2.2_r1android-2.2.1_r2android-2.2.1_r1mastermainfroyo-releasefroyo
This fixes a bug where the view hierarchy in AccountUnlockScreen was being
modified by the async callback thread from AccountManager.
DO NOT MERGE because path has changed.
Change-Id: I32a7b5df8ade3dca376a342b4e5aee53d0c204f2
-rw-r--r-- | phone/com/android/internal/policy/impl/AccountUnlockScreen.java | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/phone/com/android/internal/policy/impl/AccountUnlockScreen.java b/phone/com/android/internal/policy/impl/AccountUnlockScreen.java index cb88916..840c5e1 100644 --- a/phone/com/android/internal/policy/impl/AccountUnlockScreen.java +++ b/phone/com/android/internal/policy/impl/AccountUnlockScreen.java @@ -174,28 +174,33 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree } } - private void onCheckPasswordResult(boolean success) { - if (success) { - // clear out forgotten password - mLockPatternUtils.setPermanentlyLocked(false); - mLockPatternUtils.setLockPatternEnabled(false); - mLockPatternUtils.saveLockPattern(null); - - // launch the 'choose lock pattern' activity so - // the user can pick a new one if they want to - Intent intent = new Intent(); - intent.setClassName(LOCK_PATTERN_PACKAGE, LOCK_PATTERN_CLASS); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - mContext.startActivity(intent); - mCallback.reportSuccessfulUnlockAttempt(); - - // close the keyguard - mCallback.keyguardDone(true); - } else { - mInstructions.setText(R.string.lockscreen_glogin_invalid_input); - mPassword.setText(""); - mCallback.reportFailedUnlockAttempt(); - } + private void postOnCheckPasswordResult(final boolean success) { + // ensure this runs on UI thread + mLogin.post(new Runnable() { + public void run() { + if (success) { + // clear out forgotten password + mLockPatternUtils.setPermanentlyLocked(false); + mLockPatternUtils.setLockPatternEnabled(false); + mLockPatternUtils.saveLockPattern(null); + + // launch the 'choose lock pattern' activity so + // the user can pick a new one if they want to + Intent intent = new Intent(); + intent.setClassName(LOCK_PATTERN_PACKAGE, LOCK_PATTERN_CLASS); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + mContext.startActivity(intent); + mCallback.reportSuccessfulUnlockAttempt(); + + // close the keyguard + mCallback.keyguardDone(true); + } else { + mInstructions.setText(R.string.lockscreen_glogin_invalid_input); + mPassword.setText(""); + mCallback.reportFailedUnlockAttempt(); + } + } + }); } @Override @@ -270,7 +275,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree final String password = mPassword.getText().toString(); Account account = findIntendedAccount(login); if (account == null) { - onCheckPasswordResult(false); + postOnCheckPasswordResult(false); return; } getProgressDialog().show(); @@ -283,18 +288,13 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree mCallback.pokeWakelock(AWAKE_POKE_MILLIS); final Bundle result = future.getResult(); final boolean verified = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT); - // ensure on UI thread - mLogin.post(new Runnable() { - public void run() { - onCheckPasswordResult(verified); - } - }); + postOnCheckPasswordResult(verified); } catch (OperationCanceledException e) { - onCheckPasswordResult(false); + postOnCheckPasswordResult(false); } catch (IOException e) { - onCheckPasswordResult(false); + postOnCheckPasswordResult(false); } catch (AuthenticatorException e) { - onCheckPasswordResult(false); + postOnCheckPasswordResult(false); } finally { mLogin.post(new Runnable() { public void run() { |