Bug 9629047 - Default search engines are not displayed after turning on search suggestions. r=margaret, a=lsblakk
authorChenxia Liu <liuche@mozilla.com>
Tue, 28 Jan 2014 15:33:39 -0800
changeset 176055 cff3be00c86d51fb00673f44cfe8b5f7d2eb3338
parent 176054 f607a137eb27393f5d89866b89803cfe570a4fae
child 176056 d1517e677805dca80d326ac119a0d258eb62e636
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, lsblakk
bugs9629047
milestone28.0a2
Bug 9629047 - Default search engines are not displayed after turning on search suggestions. r=margaret, a=lsblakk
mobile/android/base/preferences/SearchEnginePreference.java
--- a/mobile/android/base/preferences/SearchEnginePreference.java
+++ b/mobile/android/base/preferences/SearchEnginePreference.java
@@ -144,21 +144,28 @@ public class SearchEnginePreference exte
      * Set if this object's UI should show that this is the default engine. To ensure proper ordering,
      * this method should only be called after this Preference is added to the PreferenceCategory.
      * @param isDefault Flag indicating if this represents the default engine.
      */
     public void setIsDefaultEngine(boolean isDefault) {
         mIsDefaultEngine = isDefault;
         if (isDefault) {
             setOrder(0);
-            setSummary(LABEL_IS_DEFAULT);
         } else {
             setOrder(1);
-            setSummary("");
         }
+
+        final String summary = isDefault ? LABEL_IS_DEFAULT : "";
+        // Set the View text on the UI thread, because this may be called from the Gecko thread.
+        ThreadUtils.postToUiThread(new Runnable() {
+            @Override
+            public void run() {
+                SearchEnginePreference.this.setSummary(summary);
+            }
+        });
     }
 
     /**
      * Display the AlertDialog providing options to reconfigure this search engine. Sets an event
      * listener to disable buttons in the dialog as appropriate after they have been constructed by
      * Android.
      * @see this.configureShownDialog
      * @see this.hideDialog