Merge "Implement "show received files" preference item." into honeycomb
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e07f38e..334a9d9 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1064,6 +1064,7 @@
 
         <activity android:name="com.android.settings.accounts.AddAccountSettings"
             android:theme="@android:style/Theme.Translucent.NoTitleBar"
+            android:configChanges="orientation|keyboardHidden"
             android:label="@string/header_add_an_account">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
diff --git a/assets/html/en_us/tethering_bluetooth_help.html b/assets/html/en_us/tethering_bluetooth_help.html
new file mode 100644
index 0000000..eb181f8
--- /dev/null
+++ b/assets/html/en_us/tethering_bluetooth_help.html
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html>
+<head>
+<style>
+P {
+    font-size: 14 px;
+    }
+B {
+	font-size: 16px;
+}
+A {
+	color: #OOC;
+}
+.style1 {
+	font-size: 16px;
+}
+</style>
+</head>
+<body>
+<p><b>Bluetooth tethering</b></p>
+<span class="style1">You can tether your Android device to your computer via a Bluetooth connection, to share your device's Internet connection with your computer</span>
+<ul>
+<li>Bluetooth tethering works with any computer or other device that can obtain an Internet connection via Bluetooth</li><br>
+<li>For more information, see <a href="http://www.android.com/tether#bluetooth">http://www.android.com/tether#bluetooth</a></li><br>
+</ul>
+</body>
+</html>
diff --git a/assets/html/en_us/tethering_help.html b/assets/html/en_us/tethering_help.html
index dfff700..e980b20 100644
--- a/assets/html/en_us/tethering_help.html
+++ b/assets/html/en_us/tethering_help.html
@@ -18,16 +18,24 @@
 </head>
 <body>
 <p><b>USB tethering</b></p>
-<span class="style1">You can tether your phone to your computer with a USB cable, to share your phone's internet connection with your computer</span>
+<span class="style1">You can tether your Android device to your computer with a USB cable, to share your device's Internet connection with your computer</span>
 <ul>
-<li>Tethering works with Windows Vista, Windows 7, and Linux</li><br>
-<li>You can't mount your phone's SD card on your computer when USB tethered</li><br>
+<li>USB tethering works with Windows Vista, Windows 7, and Linux</li><br>
+<li>If your device has an SD card or USB storage, you can't mount it on your computer when USB tethered</li><br>
 <li>For more information, including using USB tethering with other OSs, see <a href="http://www.android.com/tether#usb">http://www.android.com/tether#usb</a></li><br>
 </ul>
-<p><b>Portable Wi-Fi hotspot</b></p>
-<span class="style1">You can turn your phone into a portable Wi-Fi hotspot, to share your phone's internet connection with one or more computers or other devices</span>
+
+<p><b>Bluetooth tethering</b></p>
+<span class="style1">You can tether your Android device to your computer via a Bluetooth connection, to share your device's Internet connection with your computer</span>
 <ul>
-<li>When your phone is serving as a Wi-Fi hotspot, you can't use your phone's applications to access the internet via its Wi-Fi connection</li><br>
+<li>Bluetooth tethering works with any computer or other device that can obtain an Internet connection via Bluetooth</li><br>
+<li>For more information, see <a href="http://www.android.com/tether#bluetooth">http://www.android.com/tether#bluetooth</a></li><br>
+</ul>
+
+<p><b>Portable Wi-Fi hotspot</b></p>
+<span class="style1">You can turn your Android device into a portable Wi-Fi hotspot, to share your Android device's Internet connection with one or more computers or other devices</span>
+<ul>
+<li>When your device is serving as a Wi-Fi hotspot, you can't use your phone's applications to access the Internet via its Wi-Fi connection (but of course you remain connected to the Internet via your mobile data network)</li><br>
 <li>You configure the hotspot with the Wi-Fi hotspot settings</li><br>
 <li>For more information, visit <a href="http://www.android.com/tether#wifi">http://www.android.com/tether#wifi</a></li><br>
 </ul>
diff --git a/assets/html/en_us/tethering_usb_help.html b/assets/html/en_us/tethering_usb_help.html
index 23f39e5..b3dbf58 100644
--- a/assets/html/en_us/tethering_usb_help.html
+++ b/assets/html/en_us/tethering_usb_help.html
@@ -18,10 +18,10 @@
 </head>
 <body>
 <p><b>USB tethering</b></p>
-<span class="style1">You can tether your phone to your computer with a USB cable, to share your phone's internet connection with your computer</span>
+<span class="style1">You can tether your Android device to your computer with a USB cable, to share your device's Internet connection with your computer</span>
 <ul>
-<li>Tethering works with Windows Vista, Windows 7, and Linux</li><br>
-<li>You can't mount your phone's SD card on your computer when USB tethered</li><br>
+<li>USB tethering works with Windows Vista, Windows 7, and Linux</li><br>
+<li>If your device has an SD card or USB storage, you can't mount it on your computer when USB tethered</li><br>
 <li>For more information, including using USB tethering with other OSs, see <a href="http://www.android.com/tether#usb">http://www.android.com/tether#usb</a></li><br>
 </ul>
 </body>
diff --git a/assets/html/en_us/tethering_wifi_help.html b/assets/html/en_us/tethering_wifi_help.html
index fac231b..621f869 100644
--- a/assets/html/en_us/tethering_wifi_help.html
+++ b/assets/html/en_us/tethering_wifi_help.html
@@ -18,9 +18,9 @@
 </head>
 <body>
 <p><b>Portable Wi-Fi hotspot</b></p>
-<span class="style1">You can turn your phone into a portable Wi-Fi hotspot, to share your phone's internet connection with one or more computers or other devices</span>
+<span class="style1">You can turn your Android device into a portable Wi-Fi hotspot, to share your Android device's Internet connection with one or more computers or other devices</span>
 <ul>
-<li>When your phone is serving as a Wi-Fi hotspot, you can't use your phone's applications to access the internet via its Wi-Fi connection</li><br>
+<li>When your device is serving as a Wi-Fi hotspot, you can't use your phone's applications to access the Internet via its Wi-Fi connection (but of course you remain connected to the Internet via your mobile data network)</li><br>
 <li>You configure the hotspot with the Wi-Fi hotspot settings</li><br>
 <li>For more information, visit <a href="http://www.android.com/tether#wifi">http://www.android.com/tether#wifi</a></li><br>
 </ul>
diff --git a/src/com/android/settings/AirplaneModeEnabler.java b/src/com/android/settings/AirplaneModeEnabler.java
index ccfe541..00c416f 100644
--- a/src/com/android/settings/AirplaneModeEnabler.java
+++ b/src/com/android/settings/AirplaneModeEnabler.java
@@ -20,6 +20,7 @@
 
 import android.content.Context;
 import android.content.Intent;
+import android.database.ContentObserver;
 import android.os.Handler;
 import android.os.Message;
 import android.os.SystemProperties;
@@ -51,6 +52,13 @@
         }
     };
 
+    private ContentObserver mAirplaneModeObserver = new ContentObserver(new Handler()) {
+        @Override
+        public void onChange(boolean selfChange) {
+            onAirplaneModeChanged();
+        }
+    };
+
     public AirplaneModeEnabler(Context context, CheckBoxPreference airplaneModeCheckBoxPreference) {
         
         mContext = context;
@@ -68,13 +76,17 @@
 
         mPhoneStateReceiver.registerIntent();
         mCheckBoxPref.setOnPreferenceChangeListener(this);
+        mContext.getContentResolver().registerContentObserver(
+                Settings.System.getUriFor(Settings.System.AIRPLANE_MODE_ON), true,
+                mAirplaneModeObserver);
     }
     
     public void pause() {
         mPhoneStateReceiver.unregisterIntent();
         mCheckBoxPref.setOnPreferenceChangeListener(null);
+        mContext.getContentResolver().unregisterContentObserver(mAirplaneModeObserver);
     }
-    
+
     public static boolean isAirplaneModeOn(Context context) {
         return Settings.System.getInt(context.getContentResolver(),
                 Settings.System.AIRPLANE_MODE_ON, 0) != 0;
@@ -84,7 +96,7 @@
         
         mCheckBoxPref.setSummary(enabling ? R.string.airplane_mode_turning_on
                 : R.string.airplane_mode_turning_off);
-        
+
         // Change the system setting
         Settings.System.putInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 
                                 enabling ? 1 : 0);
@@ -106,8 +118,8 @@
      * - mobile does not send failure notification, fail on timeout.
      */
     private void onAirplaneModeChanged() {
-        ServiceState serviceState = mPhoneStateReceiver.getServiceState();
-        boolean airplaneModeEnabled = serviceState.getState() == ServiceState.STATE_POWER_OFF;
+        boolean airplaneModeEnabled = isAirplaneModeOn(mContext);
+        mCheckBoxPref.setChecked(isAirplaneModeOn(mContext));
         mCheckBoxPref.setSummary(airplaneModeEnabled ? null : 
                 mContext.getString(R.string.airplane_mode_summary));            
     }
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index 8ddeef5..db20411 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -111,8 +111,10 @@
                     " newProfileState " + newProfileState);
         }
 
-        int newState = LocalBluetoothProfileManager.getProfileManager(mLocalManager,
-                profile).convertState(newProfileState);
+        final LocalBluetoothProfileManager pm =
+                LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
+        if (pm == null) return;
+        int newState = pm.convertState(newProfileState);
 
         if (newState == SettingsBtStatus.CONNECTION_STATUS_CONNECTED) {
             if (!mProfiles.contains(profile)) {