Backout rev f1028e173331 (bug 892094). r=ckitching, a=akeybl
authorChenxia Liu <liuche@mozilla.com>
Fri, 16 Aug 2013 00:44:35 -0700
changeset 153751 6a1a48886f7eede0addecdafcf34511b999862ed
parent 153750 f66f82f71f6c91015ebcf448d0f2665e0193c460
child 153752 97e2b45e1c744a85292258643fd1f7ff2c4928df
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckitching, akeybl
bugs892094
milestone25.0a2
Backout rev f1028e173331 (bug 892094). r=ckitching, a=akeybl
mobile/android/base/Makefile.in
mobile/android/base/preferences/SearchPreferenceCategory.java
mobile/android/base/resources/values/dimens.xml
mobile/android/base/resources/xml-v11/preferences_customize_tablet.xml
mobile/android/base/resources/xml/preferences_customize.xml
mobile/android/base/resources/xml/preferences_customize.xml.in
mobile/android/base/resources/xml/preferences_search.xml
mobile/android/base/tests/testSettingsMenuItems.java.in
--- a/mobile/android/base/Makefile.in
+++ b/mobile/android/base/Makefile.in
@@ -228,17 +228,16 @@ FENNEC_JAVA_FILES = \
   menu/GeckoMenuInflater.java \
   menu/GeckoMenuItem.java \
   menu/GeckoSubMenu.java \
   menu/MenuItemActionBar.java \
   menu/MenuItemActionView.java \
   menu/MenuItemDefault.java \
   menu/MenuPanel.java \
   menu/MenuPopup.java \
-  preferences/SearchPreferenceCategory.java \
   widget/AboutHome.java \
   widget/AboutHomeView.java \
   widget/AboutHomeSection.java \
   widget/ActivityChooserModel.java \
   widget/AddonsSection.java \
   widget/ButtonToast.java \
   widget/ArrowPopup.java \
   widget/DateTimePicker.java \
@@ -305,17 +304,16 @@ FENNEC_PP_JAVA_FILES = \
   AppConstants.java \
   SysInfo.java \
   WebApp.java \
   WebApps.java \
   $(NULL)
 
 FENNEC_PP_XML_FILES = \
   res/xml/preferences.xml \
-  res/xml/preferences_customize.xml \
   res/xml/searchable.xml \
   $(NULL)
 
 ifneq (,$(findstring -march=armv7,$(OS_CFLAGS)))
 MIN_CPU_VERSION=7
 else
 MIN_CPU_VERSION=5
 endif
@@ -567,26 +565,25 @@ RES_VALUES_XLARGE_V11 = \
   res/values-xlarge-v11/styles.xml \
   $(NULL)
 
 RES_VALUES_V14 = \
   res/values-v14/styles.xml \
   $(NULL)
 
 RES_XML = \
+  res/xml/preferences_customize.xml \
   res/xml/preferences_display.xml \
-  res/xml/preferences_search.xml \
   res/xml/preferences_privacy.xml \
   res/xml/preferences_vendor.xml \
   res/xml/preferences_devtools.xml \
   $(SYNC_RES_XML) \
   $(NULL)
 
 RES_XML_V11 = \
-  res/xml-v11/preferences_customize.xml \
   res/xml-v11/preference_headers.xml \
   res/xml-v11/preferences_customize_tablet.xml \
   res/xml-v11/preferences.xml \
   $(NULL)
 
 RES_ANIM = \
   res/anim/awesomebar_fade_in.xml \
   res/anim/popup_show.xml \
deleted file mode 100644
--- a/mobile/android/base/preferences/SearchPreferenceCategory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.mozilla.gecko.preferences;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.os.Build;
-import android.preference.Preference;
-import android.preference.PreferenceCategory;
-import android.util.AttributeSet;
-import android.util.Log;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.mozilla.gecko.GeckoAppShell;
-import org.mozilla.gecko.GeckoEvent;
-import org.mozilla.gecko.R;
-import org.mozilla.gecko.gfx.BitmapUtils;
-import org.mozilla.gecko.util.GeckoEventListener;
-
-public class SearchPreferenceCategory extends PreferenceCategory implements GeckoEventListener {
-    public static final String LOGTAG = "SearchPrefCategory";
-
-    private static int sIconSize;
-
-    public SearchPreferenceCategory(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-        init();
-    }
-    public SearchPreferenceCategory(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        init();
-    }
-
-    public SearchPreferenceCategory(Context context) {
-        super(context);
-        init();
-    }
-
-    private void init() {
-        sIconSize = getContext().getResources().getDimensionPixelSize(R.dimen.searchpreferences_icon_size);
-    }
-
-    @Override
-    protected void onAttachedToActivity() {
-        super.onAttachedToActivity();
-
-        // Request list of search engines from Gecko
-        GeckoAppShell.registerEventListener("SearchEngines:Data", this);
-        GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Get", null));
-    }
-
-    @Override
-    public void handleMessage(String event, final JSONObject data) {
-        if (event.equals("SearchEngines:Data")) {
-            JSONArray engines;
-            try {
-                engines = data.getJSONArray("searchEngines");
-            } catch (JSONException e) {
-                Log.e(LOGTAG, "Unable to decode search engine data from Gecko.", e);
-                return;
-            }
-
-            // Create an element in this PreferenceCategory for each engine.
-            for (int i = 0; i < engines.length(); i++) {
-                try {
-                    JSONObject engineJSON = engines.getJSONObject(i);
-                    final String engineName = engineJSON.getString("name");
-
-                    Preference engine = new Preference(getContext());
-                    engine.setTitle(engineName);
-                    engine.setKey(engineName);
-
-                    // The setIcon feature is not available prior to API 11.
-                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
-                        String iconURI = engineJSON.getString("iconURI");
-                        Bitmap iconBitmap = BitmapUtils.getBitmapFromDataURI(iconURI);
-                        Bitmap scaledIconBitmap = Bitmap.createScaledBitmap(iconBitmap, sIconSize, sIconSize, false);
-                        BitmapDrawable drawable = new BitmapDrawable(scaledIconBitmap);
-                        engine.setIcon(drawable);
-                    }
-                    addPreference(engine);
-                    // TODO: Bug 892113 - Add event listener here for tapping on each element. Produce a dialog to provide options.
-                } catch (JSONException e) {
-                    Log.e(LOGTAG, "JSONException parsing engine at index " + i, e);
-                }
-            }
-        }
-    }
-}
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -60,17 +60,16 @@
     <dimen name="prompt_service_icon_size">72dp</dimen>
     <dimen name="prompt_service_icon_text_padding">10dp</dimen>
     <dimen name="prompt_service_inputs_padding">16dp</dimen>
     <dimen name="prompt_service_left_right_text_with_icon_padding">10dp</dimen>
     <dimen name="prompt_service_top_bottom_text_with_icon_padding">8dp</dimen>
     <dimen name="prompt_service_min_list_item_height">48dp</dimen>
     <dimen name="remote_tab_child_row_height">64dp</dimen>
     <dimen name="remote_tab_group_row_height">26dp</dimen>
-    <dimen name="searchpreferences_icon_size">32dp</dimen>
     <dimen name="tab_thumbnail_height">90dp</dimen>
     <dimen name="tab_thumbnail_width">160dp</dimen>
     <dimen name="tabs_counter_size">22sp</dimen>
     <dimen name="tabs_panel_indicator_width">60dp</dimen>
     <dimen name="tabs_panel_list_padding">16dip</dimen>
     <dimen name="tabs_list_divider_height">2dp</dimen>
     <dimen name="tabs_sidebar_width">200dp</dimen>
     <dimen name="tabs_tray_horizontal_height">156dp</dimen>
--- a/mobile/android/base/resources/xml-v11/preferences_customize_tablet.xml
+++ b/mobile/android/base/resources/xml-v11/preferences_customize_tablet.xml
@@ -10,32 +10,31 @@
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:gecko="http://schemas.android.com/apk/res-auto"
                   android:title="@string/pref_category_customize"
                   android:enabled="false">
 
     <org.mozilla.gecko.SyncPreference android:title="@string/pref_sync"
                                       android:persistent="false" />
 
-    <PreferenceScreen android:title="@string/pref_category_search"
-                      android:fragment="org.mozilla.gecko.GeckoPreferenceFragment" >
-        <extra android:name="resource"
-               android:value="preferences_search"/>
-    </PreferenceScreen>
-
     <org.mozilla.gecko.AndroidImportPreference
             android:key="android.not_a_preference.import_android"
             gecko:entries="@array/pref_import_android_entries"
             gecko:entryKeys="@array/pref_import_android_keys"
             gecko:initialValues="@array/pref_import_android_values"
             android:title="@string/pref_import_android"
             android:positiveButtonText="@string/bookmarkhistory_button_import"
             android:negativeButtonText="@string/button_cancel"
             android:persistent="false" />
 
+    <CheckBoxPreference android:key="browser.search.suggest.enabled"
+                        android:title="@string/pref_search_suggestions"
+                        android:defaultValue="true"
+                        android:persistent="false" />
+
     <ListPreference android:key="android.not_a_preference.restoreSession2"
                     android:title="@string/pref_restore"
                     android:defaultValue="crash"
                     android:entries="@array/pref_restore_entries"
                     android:entryValues="@array/pref_restore_values"
                     android:persistent="true" />
 
     <ListPreference android:key="app.update.autodownload"
rename from mobile/android/base/resources/xml/preferences_customize.xml.in
rename to mobile/android/base/resources/xml/preferences_customize.xml
--- a/mobile/android/base/resources/xml/preferences_customize.xml.in
+++ b/mobile/android/base/resources/xml/preferences_customize.xml
@@ -1,37 +1,32 @@
-#filter substitution
 <?xml version="1.0" encoding="utf-8"?>
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:gecko="http://schemas.android.com/apk/res-auto"
                   android:enabled="false">
-    <PreferenceScreen android:title="@string/pref_category_search" >
-        <intent android:action="android.intent.action.VIEW"
-                android:targetPackage="@ANDROID_PACKAGE_NAME@"
-                android:targetClass="org.mozilla.gecko.GeckoPreferences" >
-            <extra
-                android:name="resource"
-                android:value="preferences_search" />
-        </intent>
-    </PreferenceScreen>
 
     <org.mozilla.gecko.AndroidImportPreference
                   android:key="android.not_a_preference.import_android"
                   gecko:entries="@array/pref_import_android_entries"
                   gecko:entryKeys="@array/pref_import_android_keys"
                   gecko:initialValues="@array/pref_import_android_values"
                   android:title="@string/pref_import_android"
                   android:positiveButtonText="@string/bookmarkhistory_button_import"
                   android:negativeButtonText="@string/button_cancel"
                   android:persistent="false" />
 
+    <CheckBoxPreference android:key="browser.search.suggest.enabled"
+                        android:title="@string/pref_search_suggestions"
+                        android:defaultValue="false"
+                        android:persistent="false" />
+
     <ListPreference android:key="android.not_a_preference.restoreSession2"
                     android:title="@string/pref_restore"
                     android:defaultValue="crash"
                     android:entries="@array/pref_restore_entries"
                     android:entryValues="@array/pref_restore_values"
                     android:persistent="true" />
 
    <ListPreference android:key="app.update.autodownload"
deleted file mode 100644
--- a/mobile/android/base/resources/xml/preferences_search.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
-                  xmlns:gecko="http://schemas.android.com/apk/res-auto"
-                  android:title="@string/pref_category_search"
-                  android:enabled="false">
-
-    <CheckBoxPreference android:key="browser.search.suggest.enabled"
-                        android:title="@string/pref_search_suggestions"
-                        android:defaultValue="false"
-                        android:persistent="false" />
-
-    <org.mozilla.gecko.preferences.SearchPreferenceCategory
-                        android:title="@string/pref_category_installed_search_engines"/>
-</PreferenceScreen>
--- a/mobile/android/base/tests/testSettingsMenuItems.java.in
+++ b/mobile/android/base/tests/testSettingsMenuItems.java.in
@@ -19,18 +19,18 @@ public class testSettingsMenuItems exten
     // Each String[] (array) represents the menu items/choices in the following order:
     //
     //     itemTitle { defaultValue [options] }
     //
     // where defaultValue is optional, and there can be multiple options.
     //
     // This test assumes menu items are in order (scrolling down for off-screen items).
     String[][] OPTIONS_CUSTOMIZE = {
-         { "Search settings", "", "Show search suggestions", "Installed search engines" },
          { "Import from Android", "", "Bookmarks", "History", "Import" },
+         { "Show search suggestions" },
          { "Tabs", "Restore after a crash", "Always restore", "Restore after a crash", "Never restore" },
          { "Automatic updates", "Only over Wi-Fi", "Enabled", "Only over Wi-Fi", "Disabled" },
      };
 
     String[][] OPTIONS_DISPLAY = {
         { "Text size" },
         { "Title bar", "Show page title", "Show page title", "Show page address" },
         { "Advanced" },