Merge "Rename Night display to Night Light" into nyc-mr1-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 3a3f567..cd988b0 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1708,7 +1708,7 @@
             <meta-data android:name="com.android.settings.require_feature"
                 android:value="android.hardware.fingerprint" />
             <meta-data android:name="com.android.settings.title"
-                android:resource="@string/suggested_lock_settings_title" />
+                android:resource="@string/suggested_fingerprint_lock_settings_title" />
             <meta-data android:name="com.android.settings.summary"
                 android:resource="@string/suggested_fingerprint_lock_settings_summary" />
         </activity>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 81476f1..77c9f9a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -988,11 +988,14 @@
     <!-- Security Picker --><skip />
 
     <!-- Title for suggested actions for screen lock -->
-    <string name="suggested_lock_settings_title">Screen lock</string>
+    <string name="suggested_lock_settings_title">Set screen lock</string>
 
     <!-- Summary for suggested actions for screen lock -->
     <string name="suggested_lock_settings_summary">Protect your device</string>
 
+    <!-- Title for suggested actions for settings up a fingerprint lock -->
+    <string name="suggested_fingerprint_lock_settings_title">Use fingerprint</string>
+
     <!-- Summary for suggested actions for settings up a fingerprint lock -->
     <string name="suggested_fingerprint_lock_settings_summary">Unlock with your fingerprint</string>
 
@@ -3059,8 +3062,8 @@
     <string name="manual">Manual</string>
     <!-- About phone settings screen, setting option name to show regulatory labels [CHAR LIMIT=25] -->
     <string name="regulatory_labels">Regulatory labels</string>
-    <!-- About phone settings screen, setting option name to show safety and regulatory information [CHAR LIMIT=40] -->
-    <string name="safety_and_regulatory_info">Safety &amp; regulatory information</string>
+    <!-- About phone settings screen, setting option name to show the safety and regulatory manual [CHAR LIMIT=40] -->
+    <string name="safety_and_regulatory_info">Safety &amp; regulatory manual</string>
     <!-- Note: this may be replaced by a more-specific title of the activity that will get launched --> <skip />
     <!-- About phone settings screen, setting option name to see copyright-related info -->
     <string name="copyright_title">Copyright</string>
@@ -7399,7 +7402,7 @@
     <string name="suggestion_additional_fingerprints">Add another fingerprint</string>
 
     <!-- Summary for suggestion adding more fingerprints [CHAR LIMIT=60] -->
-    <string name="suggestion_additional_fingerprints_summary">Unlock with a different fingerprint</string>
+    <string name="suggestion_additional_fingerprints_summary">Unlock with a different finger</string>
 
     <!-- Summary of battery saver when on [CHAR LIMIT=NONE] -->
     <string name="battery_saver_on_summary">On / <xliff:g name="automatic_state" example="Never turn on automatically">%1$s</xliff:g></string>
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index e96a050..a3305a2 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -81,10 +81,15 @@
         <PreferenceScreen
                 android:key="doze"
                 android:title="@string/doze_title"
-                android:summary="@string/doze_summary"
-                android:fragment="com.android.settings.gestures.GestureSettings" >
+                android:summary="@string/doze_summary" >
                 <extra android:name="gesture_scroll_to_preference"
                        android:value="gesture_pick_up_and_nudge" />
+                <intent
+                    android:targetPackage="com.android.settings"
+                    android:targetClass="com.android.settings.Settings$GestureSettingsActivity" >
+                    <extra android:name="show_drawer_menu"
+                           android:value="true" />
+                </intent>
         </PreferenceScreen>
 
         <SwitchPreference
diff --git a/src/com/android/settings/dashboard/SupportItemAdapter.java b/src/com/android/settings/dashboard/SupportItemAdapter.java
index 714e7bc..d0c5398 100644
--- a/src/com/android/settings/dashboard/SupportItemAdapter.java
+++ b/src/com/android/settings/dashboard/SupportItemAdapter.java
@@ -148,7 +148,7 @@
     public void setHasInternet(boolean hasInternet) {
         if (mHasInternet != hasInternet) {
             mHasInternet = hasInternet;
-            refreshData();
+            refreshEscalationCards();
         }
     }
 
@@ -156,7 +156,7 @@
         if (!Objects.equals(mAccount, account)) {
             mAccount = account;
             mSupportFeatureProvider.refreshOperationRules();
-            refreshData();
+            refreshEscalationCards();
         }
     }
 
@@ -170,18 +170,42 @@
      */
     private void refreshData() {
         mSupportData.clear();
-        if (mAccount == null) {
-            addSignInPromo();
-        } else if (mHasInternet) {
-            addEscalationCards();
-        } else {
-            addOfflineEscalationCards();
-        }
+        addEscalationCards();
         addMoreHelpItems();
         notifyDataSetChanged();
     }
 
+    /**
+     * Adds 1 escalation card. Based on current phone state, the escalation card can display
+     * different content.
+     */
     private void addEscalationCards() {
+        if (mAccount == null) {
+            addSignInPromo();
+        } else if (mHasInternet) {
+            addOnlineEscalationCards();
+        } else {
+            addOfflineEscalationCards();
+        }
+    }
+
+    /**
+     * Finds and refreshes escalation card data.
+     */
+    private void refreshEscalationCards() {
+        if (getItemCount() > 0) {
+            final int itemType = getItemViewType(0 /* position */);
+            if (itemType == TYPE_SIGN_IN_BUTTON
+                    || itemType == TYPE_ESCALATION_OPTIONS
+                    || itemType == TYPE_ESCALATION_OPTIONS_OFFLINE) {
+                mSupportData.remove(0 /* position */);
+                addEscalationCards();
+                notifyItemChanged(0 /* position */);
+            }
+        }
+    }
+
+    private void addOnlineEscalationCards() {
         final boolean hasPhoneOperation =
                 mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE);
         final boolean hasChatOperation =
@@ -218,7 +242,7 @@
                     .setSummary2(mSupportFeatureProvider.getEstimatedWaitTime(mActivity, CHAT))
                     .setEnabled2(mSupportFeatureProvider.isOperatingNow(CHAT));
         }
-        mSupportData.add(builder.build());
+        mSupportData.add(0 /* index */, builder.build());
     }
 
     private void addOfflineEscalationCards() {
@@ -231,7 +255,7 @@
             operatingHours = mSupportFeatureProvider.getOperationHours(mActivity,
                     PHONE, mSelectedCountry, false /* hasInternet */);
         }
-        mSupportData.add(new OfflineEscalationData.Builder(mActivity)
+        mSupportData.add(0 /* index */, new OfflineEscalationData.Builder(mActivity)
                 .setCountries(mSupportFeatureProvider.getPhoneSupportCountries())
                 .setTollFreePhone(mSupportFeatureProvider.getSupportPhones(
                         mSelectedCountry, true /* isTollFree */))
@@ -245,7 +269,7 @@
     }
 
     private void addSignInPromo() {
-        mSupportData.add(new EscalationData.Builder(mActivity, TYPE_SIGN_IN_BUTTON)
+        mSupportData.add(0 /* index */, new EscalationData.Builder(mActivity, TYPE_SIGN_IN_BUTTON)
                 .setText1(R.string.support_sign_in_button_text)
                 .setText2(R.string.support_sign_in_required_help)
                 .setTileTitle(R.string.support_sign_in_required_title)
@@ -439,7 +463,7 @@
             final String selectedCountry = countryCodes.get(position);
             if (!TextUtils.equals(selectedCountry, mSelectedCountry)) {
                 mSelectedCountry = selectedCountry;
-                refreshData();
+                refreshEscalationCards();
             }
         }