summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroaki Kuriyama <hiroaki.kuriyama@sonymobile.com>2012-11-16 18:46:49 +0900
committerTakeshi Aimi <takeshi.aimi@sonymobile.com>2013-07-12 15:42:35 +0900
commit1ebf13ef20fea56f55094a3744c9813500a55b17 (patch)
treeaf9887ef6a40d56a6383ea56b2d7e7e14658f87d
parentc5de9c3509e6f91f1a6fca4541c5a2dfc9878dcc (diff)
downloadbase-1ebf13ef20fea56f55094a3744c9813500a55b17.tar.gz
PreferenceActivity should not leave message in looper when destroyed
When a PreferenceActivity is destroyed as soon as created, there is a problematic case that messages for the activity are sometimes left in the looper even after the activity is destroyed. For example, by clearing user data of the selecting IME on Settings apk, com.android.settings.Settings is re-launched 2 times successively. (Destory->Create->Destroy->Create) Due to the left message, application crash can happen. (NullPointerException at BackStackRecord.getBreadCrumbTitle()) Two cases have been found to observe this issue. [Case 1] 1,Launch IME in advance. 2,Go to Settings >Apps > All and choose the IME package. 3,Click "Clear data" 4,Application crash occurs on com.android.settings. [Case 2] 1,Go to Settings > Language&input > Language. 2,ListView dialog to choose language is shown. 3,Rotate the tablet 180 degree so that 90 degree rotation occurs twice. 4,Application crash occurs on com.android.settings. Change-Id: I5ce36ea7a40ab7bc7737b7dca6641a4c3d77a480
-rw-r--r--core/java/android/preference/PreferenceActivity.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index 09ff7bec739b..d4e85edf7bdf 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -895,6 +895,8 @@ public abstract class PreferenceActivity extends ListActivity implements
@Override
protected void onDestroy() {
+ mHandler.removeMessages(MSG_BIND_PREFERENCES);
+ mHandler.removeMessages(MSG_BUILD_HEADERS);
super.onDestroy();
if (mPreferenceManager != null) {