Merge "Added IMEI status activity." into lmp-mr1-dev
diff --git a/res/layout/crypt_keeper_emergency_button.xml b/res/layout/crypt_keeper_emergency_button.xml
index d0004de..0b6f810 100644
--- a/res/layout/crypt_keeper_emergency_button.xml
+++ b/res/layout/crypt_keeper_emergency_button.xml
@@ -19,15 +19,21 @@
 
 <!-- Emergency call button.
      Text is set by CryptKeeper.updateEmergencyCallButtonState() -->
-<Button
+<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/emergencyCallButton"
-    android:layout_width="wrap_content"
+    android:layout_width="match_parent"
     android:layout_height="0dp"
-    android:layout_gravity="center_horizontal"
-    android:textSize="14sp"
-    android:fontFamily="sans-serif"
-    android:textColor="#FFFFFF"
     android:layout_weight="1"
-    android:gravity="bottom"
-    style="?android:attr/borderlessButtonStyle" />
+    android:orientation="vertical"
+    android:gravity="bottom">
+    <Button
+        android:id="@+id/emergencyCallButton"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_horizontal"
+        android:textSize="14sp"
+        android:fontFamily="sans-serif"
+        android:textColor="#FFFFFF"
+        style="?android:attr/borderlessButtonStyle" />
+
+</LinearLayout>
diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java
index 074176b..2d8b70e 100644
--- a/src/com/android/settings/accounts/ManageAccountsSettings.java
+++ b/src/com/android/settings/accounts/ManageAccountsSettings.java
@@ -99,8 +99,8 @@
     }
 
     @Override
-    public void onStart() {
-        super.onStart();
+    public void onResume() {
+        super.onResume();
         mAuthenticatorHelper.listenToAccountUpdates();
         updateAuthDescriptions();
         showAccountsIfNeeded();
@@ -134,10 +134,15 @@
     }
 
     @Override
+    public void onPause() {
+        super.onPause();
+        mAuthenticatorHelper.stopListeningToAccountUpdates();
+    }
+
+    @Override
     public void onStop() {
         super.onStop();
         final Activity activity = getActivity();
-        mAuthenticatorHelper.stopListeningToAccountUpdates();
         activity.getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_CUSTOM);
         activity.getActionBar().setCustomView(null);
     }
@@ -231,7 +236,7 @@
 
     private void showSyncState() {
         // Catch any delayed delivery of update messages
-        if (getActivity() == null) return;
+        if (getActivity() == null || getActivity().isFinishing()) return;
 
         final int userId = mUserHandle.getIdentifier();
 
@@ -377,10 +382,8 @@
         if (mAccountType != null && mFirstAccount != null) {
             addAuthenticatorSettings();
         } else {
-            // There's no account, reset to top-level of settings
-            Intent settingsTop = new Intent(android.provider.Settings.ACTION_SETTINGS);
-            settingsTop.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-            getActivity().startActivity(settingsTop);
+            // There's no account, close activity
+            finish();
         }
     }
 
diff --git a/src/com/android/settings/notification/ZenModeConditionSelection.java b/src/com/android/settings/notification/ZenModeConditionSelection.java
index 856a7f6..2f86f63 100644
--- a/src/com/android/settings/notification/ZenModeConditionSelection.java
+++ b/src/com/android/settings/notification/ZenModeConditionSelection.java
@@ -26,6 +26,7 @@
 import android.service.notification.Condition;
 import android.service.notification.IConditionListener;
 import android.service.notification.ZenModeConfig;
+import android.text.TextUtils;
 import android.util.Log;
 import android.widget.CompoundButton;
 import android.widget.RadioButton;
@@ -59,7 +60,8 @@
         b.setText(mContext.getString(com.android.internal.R.string.zen_mode_forever));
         b.setChecked(true);
         for (int i = ZenModeConfig.MINUTE_BUCKETS.length - 1; i >= 0; --i) {
-            handleCondition(ZenModeConfig.toTimeCondition(ZenModeConfig.MINUTE_BUCKETS[i]));
+            handleCondition(ZenModeConfig.toTimeCondition(mContext,
+                    ZenModeConfig.MINUTE_BUCKETS[i]));
         }
     }
 
@@ -114,7 +116,7 @@
             }
         }
         if (v != null) {
-            v.setText(c.summary);
+            v.setText(!TextUtils.isEmpty(c.line1) ? c.line1 : c.summary);
             v.setEnabled(c.state == Condition.STATE_TRUE);
         }
         mConditions.add(c);
diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java
index 8e71819..9afab4b 100644
--- a/src/com/android/settings/wifi/AccessPoint.java
+++ b/src/com/android/settings/wifi/AccessPoint.java
@@ -444,8 +444,9 @@
             if (bssid != null) {
                 visibility.append(" ").append(bssid);
             }
-            visibility.append(" score=").append(mInfo.score);
+            visibility.append(" rssi=").append(mInfo.getRssi());
             visibility.append(" ");
+            visibility.append(" score=").append(mInfo.score);
             visibility.append(String.format("tx=%.1f,", mInfo.txSuccessRate));
             visibility.append(String.format("%.1f,", mInfo.txRetriesRate));
             visibility.append(String.format("%.1f ", mInfo.txBadRate));
@@ -490,7 +491,7 @@
                     }
                     if (n5 < 4) {
                         if (scans5GHz == null) scans5GHz = new StringBuilder();
-                        scans5GHz.append(" {").append(result.BSSID);
+                        scans5GHz.append(" \n{").append(result.BSSID);
                         if (bssid != null && result.BSSID.equals(bssid)) scans5GHz.append("*");
                         scans5GHz.append("=").append(result.frequency);
                         scans5GHz.append(",").append(result.level);
@@ -510,7 +511,7 @@
                     }
                     if (n24 < 4) {
                         if (scans24GHz == null) scans24GHz = new StringBuilder();
-                        scans24GHz.append(" {").append(result.BSSID);
+                        scans24GHz.append(" \n{").append(result.BSSID);
                         if (bssid != null && result.BSSID.equals(bssid)) scans24GHz.append("*");
                         scans24GHz.append("=").append(result.frequency);
                         scans24GHz.append(",").append(result.level);
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index 6c58bc1..1ef9cce 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -145,6 +145,9 @@
     // this boolean extra specifies whether to disable the Next button when not connected. Used by
     // account creation outside of setup wizard.
     private static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
+    // This string extra specifies a network to open the connect dialog on, so the user can enter
+    // network credentials.  This is used by quick settings for secured networks.
+    private static final String EXTRA_START_CONNECT_SSID = "wifi_start_connect_ssid";
 
     // should Next button only be enabled when we have a connection?
     private boolean mEnableNextOnConnection;
@@ -326,6 +329,23 @@
         mEmptyView = initEmptyView();
         registerForContextMenu(getListView());
         setHasOptionsMenu(true);
+
+        if (intent.hasExtra(EXTRA_START_CONNECT_SSID)) {
+            String ssid = intent.getStringExtra(EXTRA_START_CONNECT_SSID);
+            updateAccessPoints();
+            PreferenceScreen preferenceScreen = getPreferenceScreen();
+            for (int i = 0; i < preferenceScreen.getPreferenceCount(); i++) {
+                Preference preference = preferenceScreen.getPreference(i);
+                if (preference instanceof AccessPoint) {
+                    AccessPoint accessPoint = (AccessPoint) preference;
+                    if (ssid.equals(accessPoint.ssid) && accessPoint.networkId == -1
+                            && accessPoint.security != AccessPoint.SECURITY_NONE) {
+                        onPreferenceTreeClick(preferenceScreen, preference);
+                        break;
+                    }
+                }
+            }
+        }
     }
 
     @Override