summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2014-05-22 18:29:40 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-22 18:29:40 +0000
commit27ed053b7666edea8f4c5ecec5987a05dc3be20e (patch)
tree4c5ee2df7abe4ec5f5098f172de3687cb73cc215 /src
parent9c71fcc5357a75743a5d284aa5b4297eb0277cc0 (diff)
parent53d76860a53c1463d182d4f3d28ce8e9f48454f3 (diff)
downloadpackages_apps_Settings-27ed053b7666edea8f4c5ecec5987a05dc3be20e.tar.gz
packages_apps_Settings-27ed053b7666edea8f4c5ecec5987a05dc3be20e.tar.bz2
packages_apps_Settings-27ed053b7666edea8f4c5ecec5987a05dc3be20e.zip
Merge "Fix bug #15161058 Stability: ISE in Settings:Fragment DashboardSummary{588de71} not attached to Activity"
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/dashboard/DashboardSummary.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index 73dcd1780..4aee7be8c 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -49,12 +49,12 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
private AuthenticatorHelper mAuthHelper;
private boolean mAccountListenerAdded;
- private static final int MSG_BUILD_CATEGORIES = 1;
+ private static final int MSG_REBUILD_UI = 1;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
- case MSG_BUILD_CATEGORIES: {
+ case MSG_REBUILD_UI: {
final Context context = getActivity();
rebuildUI(context);
} break;
@@ -80,6 +80,11 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
}
private void rebuildUI(Context context) {
+ if (!isAdded()) {
+ Log.w(LOG_TAG, "Cannot build the DashboardSummary UI yet as the Fragment is not added");
+ return;
+ }
+
long start = System.currentTimeMillis();
final Resources res = getResources();
@@ -131,7 +136,7 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
mAccountListenerAdded = true;
}
- rebuildCategories();
+ sendRebuildUI();
}
@Override
@@ -176,9 +181,9 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
}
}
- private void rebuildCategories() {
- if (!mHandler.hasMessages(MSG_BUILD_CATEGORIES)) {
- mHandler.sendEmptyMessage(MSG_BUILD_CATEGORIES);
+ private void sendRebuildUI() {
+ if (!mHandler.hasMessages(MSG_REBUILD_UI)) {
+ mHandler.sendEmptyMessage(MSG_REBUILD_UI);
}
}
@@ -186,6 +191,6 @@ public class DashboardSummary extends Fragment implements OnAccountsUpdateListen
public void onAccountsUpdated(Account[] accounts) {
final SettingsActivity sa = (SettingsActivity) getActivity();
sa.setNeedToRebuildCategories(true);
- rebuildCategories();
+ sendRebuildUI();
}
}