Fix for crash in TetherSettings when monkey is running.

Bug: 3407666

onCreateView can get called on returning from another fragment. Moved the
relevant code to onCreate().

Change-Id: Icf08c18a3981051cce4eca2d07334d0a9f3c0116
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index 085a089..4ccd598 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -86,12 +86,6 @@
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         addPreferencesFromResource(R.xml.tether_prefs);
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        View view = super.onCreateView(inflater, container, savedInstanceState);
 
         final Activity activity = getActivity();
         mBluetoothPan = new BluetoothPan(activity);
@@ -109,17 +103,19 @@
         mWifiRegexs = cm.getTetherableWifiRegexs();
         mBluetoothRegexs = cm.getTetherableBluetoothRegexs();
 
-        boolean usbAvailable = mUsbRegexs.length != 0;
-        boolean wifiAvailable = mWifiRegexs.length != 0;
-        boolean bluetoothAvailable = mBluetoothRegexs.length != 0;
+        final boolean usbAvailable = mUsbRegexs.length != 0;
+        final boolean wifiAvailable = mWifiRegexs.length != 0;
+        final boolean bluetoothAvailable = mBluetoothRegexs.length != 0;
 
         if (!usbAvailable || Utils.isMonkeyRunning()) {
             getPreferenceScreen().removePreference(mUsbTether);
         }
+
         if (!wifiAvailable) {
             getPreferenceScreen().removePreference(mEnableWifiAp);
             getPreferenceScreen().removePreference(mWifiApSettings);
         }
+
         if (!bluetoothAvailable) {
             getPreferenceScreen().removePreference(mBluetoothTether);
         } else {
@@ -129,27 +125,9 @@
                 mBluetoothTether.setChecked(false);
             }
         }
-        /* Don't change the title for two-pane settings
-        if (wifiAvailable && usbAvailable && bluetoothAvailable){
-            activity.setTitle(R.string.tether_settings_title_all);
-        } else if (wifiAvailable && usbAvailable){
-            activity.setTitle(R.string.tether_settings_title_all);
-        } else if (wifiAvailable && bluetoothAvailable){
-            activity.setTitle(R.string.tether_settings_title_all);
-        } else if (wifiAvailable) {
-            activity.setTitle(R.string.tether_settings_title_wifi);
-        } else if (usbAvailable && bluetoothAvailable) {
-            activity.setTitle(R.string.tether_settings_title_usb_bluetooth);
-        } else if (usbAvailable) {
-            activity.setTitle(R.string.tether_settings_title_usb);
-        } else {
-            activity.setTitle(R.string.tether_settings_title_bluetooth);
-        }
-        */
+
         mWifiApEnabler = new WifiApEnabler(activity, mEnableWifiAp);
         mView = new WebView(activity);
-
-        return view;
     }
 
     @Override