Merge "Use a queried package name for the IME settings activity."
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 80c9766..97fbaec 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -189,7 +189,7 @@
 
         <activity android:name=".vpn.VpnSettings"
                 android:configChanges="orientation|keyboardHidden"
-                android:launchMode="singleTask">
+                android:clearTaskOnLaunch="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="android.net.vpn.SETTINGS" />
diff --git a/CleanSpec.mk b/CleanSpec.mk
new file mode 100644
index 0000000..b84e1b6
--- /dev/null
+++ b/CleanSpec.mk
@@ -0,0 +1,49 @@
+# Copyright (C) 2007 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.
+#
+
+# If you don't need to do a full clean build but would like to touch
+# a file or delete some intermediate files, add a clean step to the end
+# of the list.  These steps will only be run once, if they haven't been
+# run before.
+#
+# E.g.:
+#     $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
+#     $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
+#
+# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
+# files that are missing or have been moved.
+#
+# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
+# Use $(OUT_DIR) to refer to the "out" directory.
+#
+# If you need to re-do something that's already mentioned, just copy
+# the command and add it to the bottom of the list.  E.g., if a change
+# that you made last week required touching a file and a change you
+# made today requires touching the same file, just copy the old
+# touch step and add it to the end of the list.
+#
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
+
+# For example:
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
+#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
+#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
+#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
+
+# ************************************************
+# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
+# ************************************************
diff --git a/res/values/strings.xml b/res/values/strings.xml
index edf0ddc..4499cc1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -726,8 +726,6 @@
     <string name="bluetooth_dock_settings_remember">Remember settings</string>
 
     <!-- Wi-Fi Settings --> <skip />
-    <!-- Used in the 2nd-level settings screen to turn on Wi-Fi -->
-    <string name="wifi">Wi-Fi</string>
     <!-- Used in the 1st-level settings screen to turn on Wi-Fi -->
     <string name="wifi_quick_toggle_title">Wi-Fi</string>
     <!-- Used in the 1st-level settings screen as the turn-on summary -->
@@ -1398,11 +1396,6 @@
     <!-- Thethering help button - calls up a web view with general tethering info -->
     <string name="tethering_help_button_text">Tethering help</string>
 
-    <!-- Tethered notification text - shown in the notification bar when tethering is active -->
-    <string name="tethered_notifcation_title">Tethering active</string>
-    <!-- Tethered notification message - shown under the notification title -->
-    <string name="tethered_notification_message">Touch to configure</string>
-
     <!-- Wireless controls, item title to go into the network settings -->
     <string name="network_settings_title">Mobile networks</string>
     <!-- Wireless controls, the item summary for the user to go into the network settings -->
diff --git a/res/xml-zh-rTW/timezones.xml b/res/xml-zh-rTW/timezones.xml
index f9a2fb9..2ab820c 100644
--- a/res/xml-zh-rTW/timezones.xml
+++ b/res/xml-zh-rTW/timezones.xml
@@ -12,73 +12,73 @@
     <timezone id="America/Chicago">中部時間 (芝加哥)</timezone>
     <timezone id="America/Mexico_City">中部時間 (墨西哥市)</timezone>
     <timezone id="America/Regina">中部時間 (利宅那)</timezone>
-    <timezone id="America/Bogota">哥伦比亚时间 (哥倫比亞)</timezone>
+    <timezone id="America/Bogota">哥倫比亞</timezone>
     <timezone id="America/New_York">東部時間 (紐約)</timezone>
-    <timezone id="America/Caracas">委内瑞拉时间 (卡拉卡斯)</timezone>
+    <timezone id="America/Caracas">卡拉卡斯</timezone>
     <timezone id="America/Barbados">大西洋時間 (巴貝多)</timezone>
-    <timezone id="America/Manaus">亚马逊时间 (瑪瑙斯)</timezone>
+    <timezone id="America/Manaus">亞馬遜時間 (瑪瑙斯)</timezone>
     <timezone id="America/Santiago">聖地牙哥</timezone>
-    <timezone id="America/St_Johns">纽芬兰标准时间 (聖約翰)</timezone>
-    <timezone id="America/Sao_Paulo">聖保羅</timezone>
+    <timezone id="America/St_Johns">紐芬蘭標準時間 (St. John's)</timezone>
+    <timezone id="America/Araguaina">阿拉圭那</timezone>
     <timezone id="America/Argentina/Buenos_Aires">阿根廷時間 (布宜諾斯艾利斯)</timezone>
     <timezone id="America/Godthab">高特哈市</timezone>
-    <timezone id="America/Montevideo">乌拉圭时间 (烏拉圭)</timezone>
+    <timezone id="America/Montevideo">烏拉圭</timezone>
     <timezone id="Atlantic/South_Georgia">南喬治亞與南三明治島</timezone>
     <timezone id="Atlantic/Azores">亞速爾群島</timezone>
     <timezone id="Atlantic/Cape_Verde">維德角</timezone>
     <timezone id="Africa/Casablanca">卡薩布蘭卡</timezone>
-    <timezone id="Europe/London">格林尼治标准时间 (倫敦)</timezone>
-    <timezone id="Europe/Amsterdam">中欧标准时间 (荷蘭)</timezone>
-    <timezone id="Europe/Belgrade">中欧标准时间 (塞爾維亞)</timezone>
-    <timezone id="Europe/Brussels">中欧标准时间 (布魯塞爾)</timezone>
-    <timezone id="Europe/Sarajevo">中欧标准时间 (沙拉耶佛)</timezone>
+    <timezone id="Europe/London">格林威治標準時間 (倫敦)</timezone>
+    <timezone id="Europe/Amsterdam">中歐標準時間 (荷蘭)</timezone>
+    <timezone id="Europe/Belgrade">中歐標準時間 (塞爾維亞)</timezone>
+    <timezone id="Europe/Brussels">中歐標準時間 (布魯塞爾)</timezone>
+    <timezone id="Europe/Sarajevo">中歐標準時間 (沙拉耶佛)</timezone>
     <timezone id="Africa/Windhoek">溫荷克</timezone>
-    <timezone id="Africa/Brazzaville">西部非洲时间 (剛果共和國)</timezone>
-    <timezone id="Asia/Amman">东欧标准时间 (約旦)</timezone>
-    <timezone id="Europe/Athens">东欧标准时间 (希臘)</timezone>
-    <timezone id="Asia/Beirut">东欧标准时间 (貝鲁特特)</timezone>
-    <timezone id="Africa/Cairo">东欧标准时间 (埃及)</timezone>
-    <timezone id="Europe/Helsinki">东欧标准时间 (芬蘭)</timezone>
-    <timezone id="Asia/Jerusalem">以色列标准时间 (耶路撒冷)</timezone>
+    <timezone id="Africa/Brazzaville">西非時間 (剛果共和國)</timezone>
+    <timezone id="Asia/Amman">東歐標準時間 (約旦)</timezone>
+    <timezone id="Europe/Athens">東歐標準時間 (希臘)</timezone>
+    <timezone id="Asia/Beirut">東歐標準時間 (貝鲁特特)</timezone>
+    <timezone id="Africa/Cairo">東歐標準時間 (埃及)</timezone>
+    <timezone id="Europe/Helsinki">東歐標準時間 (芬蘭)</timezone>
+    <timezone id="Asia/Jerusalem">以色列標準時間 (耶路撒冷)</timezone>
     <timezone id="Europe/Minsk">白俄羅斯</timezone>
-    <timezone id="Africa/Harare">非洲中部时间 (辛巴威)</timezone>
+    <timezone id="Africa/Harare">中非時間 (辛巴威)</timezone>
     <timezone id="Asia/Baghdad">阿拉伯時間 (伊拉克)</timezone>
     <timezone id="Europe/Moscow">莫斯科</timezone>
     <timezone id="Asia/Kuwait">阿拉伯時間 (科威特)</timezone>
-    <timezone id="Africa/Nairobi">非洲东部时间 (奈洛比)</timezone>
-    <timezone id="Asia/Tehran">伊朗标准时间 (伊朗)</timezone>
+    <timezone id="Africa/Nairobi">東非時間 (奈洛比)</timezone>
+    <timezone id="Asia/Tehran">伊朗</timezone>
     <timezone id="Asia/Baku">亞塞拜然</timezone>
     <timezone id="Asia/Tbilisi">喬治亞</timezone>
     <timezone id="Asia/Yerevan">亞美尼亞</timezone>
     <timezone id="Asia/Dubai">GT (杜拜)</timezone>
-    <timezone id="Asia/Kabul">阿富汗时间 (阿富汗)</timezone>
+    <timezone id="Asia/Kabul">阿富汗</timezone>
     <timezone id="Asia/Karachi">喀拉蚩</timezone>
     <timezone id="Asia/Oral">奧拉爾</timezone>
     <timezone id="Asia/Yekaterinburg">葉卡捷林堡</timezone>
     <timezone id="Asia/Calcutta">印度</timezone>
     <timezone id="Asia/Colombo">可倫坡</timezone>
-    <timezone id="Asia/Katmandu">尼泊尔时间 (尼泊爾)</timezone>
+    <timezone id="Asia/Katmandu">尼泊爾</timezone>
     <timezone id="Asia/Almaty">阿拉木圖</timezone>
-    <timezone id="Asia/Rangoon">缅甸时间 (緬甸)</timezone>
+    <timezone id="Asia/Rangoon">緬甸</timezone>
     <timezone id="Asia/Krasnoyarsk">克拉斯諾雅斯克</timezone>
     <timezone id="Asia/Bangkok">泰國</timezone>
-    <timezone id="Asia/Shanghai">中国标准时间 (北京)</timezone>
-    <timezone id="Asia/Hong_Kong">香港时间 (中華人民共和國香港特別行政區)</timezone>
-    <timezone id="Asia/Irkutsk">伊尔库茨克时间 (伊爾庫次克)</timezone>
+    <timezone id="Asia/Shanghai">中國標準時間 (上海)</timezone>
+    <timezone id="Asia/Hong_Kong">中華人民共和國香港特別行政區</timezone>
+    <timezone id="Asia/Irkutsk">伊爾庫次克</timezone>
     <timezone id="Asia/Kuala_Lumpur">吉隆坡</timezone>
     <timezone id="Australia/Perth">伯斯</timezone>
-    <timezone id="Asia/Taipei">中国标准时间 (台灣)</timezone>
+    <timezone id="Asia/Taipei">台北標準時間 (台北)</timezone>
     <timezone id="Asia/Seoul">首爾</timezone>
-    <timezone id="Asia/Tokyo">日本時間 (東京)</timezone>
-    <timezone id="Asia/Yakutsk">雅库茨克时间 (雅庫次克)</timezone>
+    <timezone id="Asia/Tokyo">日本標準時間 (東京)</timezone>
+    <timezone id="Asia/Yakutsk">雅庫次克</timezone>
     <timezone id="Australia/Adelaide">阿得雷德</timezone>
     <timezone id="Australia/Darwin">達爾文</timezone>
     <timezone id="Australia/Brisbane">布利斯班</timezone>
     <timezone id="Australia/Hobart">荷巴特</timezone>
     <timezone id="Australia/Sydney">雪梨</timezone>
-    <timezone id="Asia/Vladivostok">海参崴时间 (海參崴)</timezone>
+    <timezone id="Asia/Vladivostok">海參崴</timezone>
     <timezone id="Pacific/Guam">關島</timezone>
-    <timezone id="Asia/Magadan">马加丹时间 (馬加丹)</timezone>
+    <timezone id="Asia/Magadan">馬加丹</timezone>
     <timezone id="Pacific/Auckland">奧克蘭</timezone>
     <timezone id="Pacific/Fiji">斐濟</timezone>
     <timezone id="Pacific/Tongatapu">東加</timezone>
diff --git a/res/xml/tether_prefs.xml b/res/xml/tether_prefs.xml
index bdf693f..d9ba2c5 100644
--- a/res/xml/tether_prefs.xml
+++ b/res/xml/tether_prefs.xml
@@ -22,26 +22,20 @@
         android:title="@string/usb_tethering_button_text"
         android:persistent="false" />
 
-    <PreferenceCategory
-        android:key="wifi_category"
-        android:title="@string/wifi">
+    <CheckBoxPreference
+        android:key="enable_wifi_ap"
+        android:title="@string/wifi_tether_checkbox_text"
+        android:persistent="false" />
 
-        <CheckBoxPreference
-            android:key="enable_wifi_ap"
-            android:title="@string/wifi_tether_checkbox_text"
-            android:persistent="false" />
-
-        <PreferenceScreen
-            android:key="wifi_ap_settings"
-            android:dependency="enable_wifi_ap"
-            android:title="@string/wifi_tether_settings_text"
-            android:summary="@string/wifi_tether_settings_subtext" >
-            <intent
-                android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.wifi.WifiApSettings" />
-        </PreferenceScreen>
-
-    </PreferenceCategory>
+    <PreferenceScreen
+        android:key="wifi_ap_settings"
+        android:dependency="enable_wifi_ap"
+        android:title="@string/wifi_tether_settings_text"
+        android:summary="@string/wifi_tether_settings_subtext" >
+        <intent
+            android:action="android.intent.action.MAIN"
+            android:targetPackage="com.android.settings"
+            android:targetClass="com.android.settings.wifi.WifiApSettings" />
+    </PreferenceScreen>
 
 </PreferenceScreen>
diff --git a/res/xml/wifi_settings.xml b/res/xml/wifi_settings.xml
index 35f1173..9433c05 100644
--- a/res/xml/wifi_settings.xml
+++ b/res/xml/wifi_settings.xml
@@ -19,7 +19,7 @@
 
     <CheckBoxPreference
             android:key="enable_wifi"
-            android:title="@string/wifi"
+            android:title="@string/wifi_quick_toggle_title"
             android:summary="@string/wifi_quick_toggle_summary"
             android:persistent="false" />
 
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index a30f522..9b83379 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -143,7 +143,6 @@
         boolean massStorageActive =
                 Environment.MEDIA_SHARED.equals(Environment.getExternalStorageState());
         boolean wifiErrored = false;
-
         for (Object o : available) {
             String s = (String)o;
             for (String regex : mUsbRegexs) {
@@ -182,15 +181,14 @@
             }
         }
 
-        if (usbTethered || wifiTethered) {
-//            showTetheredNotification();
-        }
         if (usbTethered) {
             mUsbTether.setSummary(R.string.usb_tethering_active_subtext);
             mUsbTether.setEnabled(true);
+            mUsbTether.setChecked(true);
         } else if (massStorageActive) {
             mUsbTether.setSummary(R.string.usb_tethering_storage_active_subtext);
             mUsbTether.setEnabled(false);
+            mUsbTether.setChecked(false);
         } else if (usbAvailable) {
             if (usbError == ConnectivityManager.TETHER_ERROR_NO_ERROR) {
                 mUsbTether.setSummary(R.string.usb_tethering_available_subtext);
@@ -198,12 +196,15 @@
                 mUsbTether.setSummary(R.string.usb_tethering_errored_subtext);
             }
             mUsbTether.setEnabled(true);
+            mUsbTether.setChecked(false);
         } else if (usbErrored) {
             mUsbTether.setSummary(R.string.usb_tethering_errored_subtext);
             mUsbTether.setEnabled(false);
+            mUsbTether.setChecked(false);
         } else {
             mUsbTether.setSummary(R.string.usb_tethering_unavailable_subtext);
             mUsbTether.setEnabled(false);
+            mUsbTether.setChecked(false);
         }
     }
 
@@ -257,42 +258,4 @@
         }
         return null;
     }
-
-//    private showTetheredNotification() {
-//        NotificationManager notificationManager = (NotificationManager)mContext.
-//                getSystemService(Context.NOTIFICATION_SERVICE);
-//        if (notificationManager == null) {
-//            return;
-//        }
-//
-//        Intent intent = new Intent();
-//
-//        PendingIntent pi = PendingIntent.getActivity(mContext, 0, intent, 0);
-//
-//        Resources r = Resources.getSystem();
-//        CharSequence title = r.getText(com.android.internal.R.string.
-//                tether_stop_notification_title);
-//        CharSequence message = r.getText(com.android.internal.R.string.
-//                tether_stop_notification_message);
-//
-//        if(mTetheringNotification == null) {
-//            mTetheringNotification = new Notification();
-//            mTetheringNotification.when = 0;
-//        }
-//        mTetheringNotification.icon = com.android.internal.R.drawable.stat_sys_tether_usb;
-//
-//        boolean playSounds = false;
-//        //playSounds = SystemProperties.get("persist.service.mount.playsnd", "1").equals("1");
-//        if (playSounds) {
-//            mTetheringNotification.defaults |= Notification.DEFAULT_SOUND;
-//        } else {
-//            mTetheringNotification.defaults &= ~Notification.DEFAULT_SOUND;
-//        }
-//        mTetheringNotification.flags = Notification.FLAG_ONGOING_EVENT;
-//        mTetheringNotification.tickerText = title;
-//        mTetheringNotification.setLatestEventInfo(mContext, title, message, pi);
-//
-//        notificationManager.notify(mTetheringNotification.icon, mTetheringNotification);
-//    }
-
 }
diff --git a/src/com/android/settings/vpn/VpnSettings.java b/src/com/android/settings/vpn/VpnSettings.java
index d380375..8880780 100644
--- a/src/com/android/settings/vpn/VpnSettings.java
+++ b/src/com/android/settings/vpn/VpnSettings.java
@@ -90,7 +90,7 @@
     private static final String PREF_ADD_VPN = "add_new_vpn";
     private static final String PREF_VPN_LIST = "vpn_list";
 
-    private static final String PROFILES_ROOT = VpnManager.PROFILES_PATH + "/";
+    private static final String PROFILES_ROOT = VpnManager.getProfilePath() + "/";
     private static final String PROFILE_OBJ_FILE = ".pobj";
 
     private static final int REQUEST_ADD_OR_EDIT_PROFILE = 1;
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
index 4ec5b82..005fc13 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -435,6 +435,7 @@
                     brightness = MAXIMUM_BACKLIGHT;
                 } else {
                     brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
+                    brightness = MINIMUM_BACKLIGHT;
                 }
 
                 if (context.getResources().getBoolean(
@@ -443,6 +444,9 @@
                     Settings.System.putInt(context.getContentResolver(),
                             Settings.System.SCREEN_BRIGHTNESS_MODE,
                             brightnessMode);
+                } else {
+                    // Make sure we set the brightness if automatic mode isn't available
+                    brightnessMode = Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
                 }
                 if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL) {
                     power.setBacklightBrightness(brightness);