Hide unsupported lab prefs on phones

Change-Id: Iec2fd0a99595de707b6b70f77abb3468ca347ab5
diff --git a/res/xml-xlarge/lab_preferences.xml b/res/xml-xlarge/lab_preferences.xml
new file mode 100644
index 0000000..87383b0
--- /dev/null
+++ b/res/xml-xlarge/lab_preferences.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen
+        xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <CheckBoxPreference
+        android:key="enable_quick_controls"
+        android:defaultValue="false"
+        android:title="@string/pref_lab_quick_controls"
+        android:summary="@string/pref_lab_quick_controls_summary" />
+
+    <CheckBoxPreference
+        android:key="use_most_visited_homepage"
+        android:defaultValue="false"
+        android:title="@string/pref_lab_most_visited_homepage"
+        android:summary="@string/pref_lab_most_visited_homepage_summary" />
+
+    <CheckBoxPreference
+        android:key="use_instant_search"
+        android:defaultValue="false"
+        android:title="@string/pref_use_instant_search"
+        android:summary="@string/pref_use_instant_search_summary" />
+</PreferenceScreen>
diff --git a/res/xml/lab_preferences.xml b/res/xml/lab_preferences.xml
index 87383b0..3a384f1 100644
--- a/res/xml/lab_preferences.xml
+++ b/res/xml/lab_preferences.xml
@@ -16,22 +16,9 @@
 
 <PreferenceScreen
         xmlns:android="http://schemas.android.com/apk/res/android" >
-
-    <CheckBoxPreference
-        android:key="enable_quick_controls"
-        android:defaultValue="false"
-        android:title="@string/pref_lab_quick_controls"
-        android:summary="@string/pref_lab_quick_controls_summary" />
-
     <CheckBoxPreference
         android:key="use_most_visited_homepage"
         android:defaultValue="false"
         android:title="@string/pref_lab_most_visited_homepage"
         android:summary="@string/pref_lab_most_visited_homepage_summary" />
-
-    <CheckBoxPreference
-        android:key="use_instant_search"
-        android:defaultValue="false"
-        android:title="@string/pref_use_instant_search"
-        android:summary="@string/pref_use_instant_search_summary" />
 </PreferenceScreen>
diff --git a/src/com/android/browser/preferences/LabPreferencesFragment.java b/src/com/android/browser/preferences/LabPreferencesFragment.java
index a06dc3e..88a9690 100644
--- a/src/com/android/browser/preferences/LabPreferencesFragment.java
+++ b/src/com/android/browser/preferences/LabPreferencesFragment.java
@@ -42,21 +42,25 @@
         addPreferencesFromResource(R.xml.lab_preferences);
 
         Preference e = findPreference(BrowserSettings.PREF_QUICK_CONTROLS);
-        e.setOnPreferenceChangeListener(this);
+        if (e != null) {
+            e.setOnPreferenceChangeListener(this);
+        }
         useInstantPref = findPreference(BrowserSettings.PREF_USE_INSTANT);
     }
 
     @Override
     public void onResume() {
         super.onResume();
-        useInstantPref.setEnabled(false);
+        if (useInstantPref != null) {
+            useInstantPref.setEnabled(false);
 
-        // Enable the "use instant" preference only if the selected
-        // search engine is google.
-        if (mBrowserSettings.getSearchEngine() != null) {
-            final String currentName = mBrowserSettings.getSearchEngine().getName();
-            if (SearchEngine.GOOGLE.equals(currentName)) {
-                useInstantPref.setEnabled(true);
+            // Enable the "use instant" preference only if the selected
+            // search engine is google.
+            if (mBrowserSettings.getSearchEngine() != null) {
+                final String currentName = mBrowserSettings.getSearchEngine().getName();
+                if (SearchEngine.GOOGLE.equals(currentName)) {
+                    useInstantPref.setEnabled(true);
+                }
             }
         }
     }