Merge "Update escalation cards layout and data binding." into nyc-mr1-dev
diff --git a/res/drawable/fallback_home_unprovisioned_background.xml b/res/drawable/fallback_home_unprovisioned_background.xml
new file mode 100644
index 0000000..9ec3874
--- /dev/null
+++ b/res/drawable/fallback_home_unprovisioned_background.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2016 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
+  -->
+
+<color xmlns:android="http://schemas.android.com/apk/res/android"
+    android:color="#000000" />
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f83c621..5073893 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5621,6 +5621,8 @@
     <string name="help_url_remote_display" translatable="false"></string>
     <!-- Help URL, Fingerprint [DO NOT TRANSLATE] -->
     <string name="help_url_fingerprint" translatable="false"></string>
+    <!-- Help URL, Gesture settings -->
+    <string name="help_url_gestures" translatable="false"></string>
 
     <!-- User account title [CHAR LIMIT=30] -->
     <string name="user_account_title">Account for content</string>
@@ -7624,7 +7626,7 @@
     <string name="bluetooth_talkback_bluetooth">Bluetooth</string>
 
     <!-- Used as title on the automatic storage manager settings. [CHAR LIMIT=60] -->
-    <string name="automatic_storage_manager_settings">Storage manager</string>
+    <string name="automatic_storage_manager_settings">Manage storage</string>
 
     <!-- Used as wall of text to describe the feature. [CHAR LIMIT=NONE] -->
     <string name="automatic_storage_manager_text">To help free up storage space, storage manager removes backed up photos and videos from your device.</string>
@@ -7642,7 +7644,7 @@
     <string name="deletion_helper_manual_title">Manual</string>
 
     <!-- Preference menu title for accessing the deletion helper from the storage manager settings. [CHAR LIMIT=30]-->
-    <string name="deletion_helper_preference_title">Free space now</string>
+    <string name="deletion_helper_preference_title">Free up space now</string>
 
     <!-- Preference title for gesture settings [CHAR LIMIT=25]-->
     <string name="gesture_preference_title">Gestures</string>
@@ -7681,4 +7683,7 @@
     <string name="oem_unlock_enable_disabled_summary_connectivity">Connect to the Internet first</string>
     <!-- setting enable OEM unlock Checkbox's summary to explain this Checkbox is disabled because this setting is unavailable on sim-locked devices. [CHAR_LIMIT=60] -->
     <string name="oem_unlock_enable_disabled_summary_sim_locked_device">Unavailable on carrier-locked devices</string>
+
+    <string name="automatic_storage_manager_freed_bytes"><xliff:g id="size" example="3.25MB">%1$s</xliff:g> total made available\n\nLast ran on <xliff:g id="date" example="Jan 12">%2$s</xliff:g></string>
+
 </resources>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 43bb55c..e09a02d 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -293,4 +293,13 @@
         <item name="android:navigationBarColor">#00000000</item>
     </style>
 
+    <style name="FallbackHome.SetupWizard" parent="@android:style/Theme.Material.NoActionBar.Fullscreen">
+        <item name="android:windowBackground">@drawable/fallback_home_unprovisioned_background</item>
+        <item name="android:colorBackgroundCacheHint">@null</item>
+        <item name="android:windowNoTitle">true</item>
+        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
+        <item name="android:statusBarColor">#00000000</item>
+        <item name="android:navigationBarColor">#00000000</item>
+    </style>
+
 </resources>
diff --git a/res/xml/automatic_storage_management_settings.xml b/res/xml/automatic_storage_management_settings.xml
index 282f89a..2320257 100644
--- a/res/xml/automatic_storage_management_settings.xml
+++ b/res/xml/automatic_storage_management_settings.xml
@@ -27,12 +27,21 @@
             android:title="@string/automatic_storage_manager_preference_title"
             android:summary="@string/automatic_storage_manager_text"/>
 
+
+        <com.android.settings.fuelgauge.WallOfTextPreference
+            android:key="freed_bytes"
+            android:persistent="false"
+            android:selectable="false"
+            settings:allowDividerAbove="false"
+            settings:allowDividerBelow="true" />
+
         <DropDownPreference
             android:key="days"
             android:summary="%s"
             android:title="@string/automatic_storage_manager_days_title"
             android:entries="@array/automatic_storage_management_days"
-            android:entryValues="@array/automatic_storage_management_days_values"/>
+            android:entryValues="@array/automatic_storage_management_days_values"
+            settings:allowDividerAbove="true" />
 
     </PreferenceCategory>
 
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 19c4a3f..dd8064f 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -283,7 +283,7 @@
             CarrierConfigManager configManager =
                     (CarrierConfigManager) getSystemService(Context.CARRIER_CONFIG_SERVICE);
             PersistableBundle b = configManager.getConfig();
-            if (b.getBoolean(CarrierConfigManager.KEY_CI_ACTION_ON_SYS_UPDATE_BOOL)) {
+            if (b != null && b.getBoolean(CarrierConfigManager.KEY_CI_ACTION_ON_SYS_UPDATE_BOOL)) {
                 ciActionOnSysUpdate(b);
             }
         }
diff --git a/src/com/android/settings/FallbackHome.java b/src/com/android/settings/FallbackHome.java
index deb01a1..158f672 100644
--- a/src/com/android/settings/FallbackHome.java
+++ b/src/com/android/settings/FallbackHome.java
@@ -28,6 +28,7 @@
 import android.os.UserManager;
 import android.provider.Settings;
 import android.util.Log;
+import android.view.View;
 
 import java.util.Objects;
 
@@ -42,7 +43,9 @@
         // we don't flash the wallpaper before SUW
         if (Settings.Global.getInt(getContentResolver(),
                 Settings.Global.DEVICE_PROVISIONED, 0) == 0) {
-            setTheme(android.R.style.Theme_Black_NoTitleBar_Fullscreen);
+            setTheme(R.style.FallbackHome_SetupWizard);
+            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN
+                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
         }
 
         registerReceiver(mReceiver, new IntentFilter(Intent.ACTION_USER_UNLOCKED));
diff --git a/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java
index 318dea6..1b64fc4 100644
--- a/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java
+++ b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java
@@ -17,12 +17,15 @@
 package com.android.settings.deletionhelper;
 
 import android.app.Activity;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.Resources;
 import android.os.Bundle;
 import android.os.storage.StorageManager;
 import android.provider.Settings;
+import android.text.format.DateUtils;
+import android.text.format.Formatter;
 import android.util.Log;
 import android.view.View;
 import android.widget.Switch;
@@ -49,9 +52,11 @@
 
     private static final String KEY_DAYS = "days";
     private static final String KEY_DELETION_HELPER = "deletion_helper";
+    private static final String KEY_FREED = "freed_bytes";
     private static final String KEY_STORAGE_MANAGER_SWITCH = "storage_manager_active";
 
     private DropDownPreference mDaysToRetain;
+    private Preference mFreedBytes;
     private Preference mDeletionHelper;
     private SwitchPreference mStorageManagerSwitch;
 
@@ -67,18 +72,37 @@
         mDaysToRetain = (DropDownPreference) findPreference(KEY_DAYS);
         mDaysToRetain.setOnPreferenceChangeListener(this);
 
+        mFreedBytes = findPreference(KEY_FREED);
+
         mDeletionHelper = findPreference(KEY_DELETION_HELPER);
         mDeletionHelper.setOnPreferenceClickListener(this);
 
         mStorageManagerSwitch = (SwitchPreference) findPreference(KEY_STORAGE_MANAGER_SWITCH);
         mStorageManagerSwitch.setOnPreferenceChangeListener(this);
 
-        int value = Settings.Secure.getInt(getContentResolver(),
+        ContentResolver cr = getContentResolver();
+        int value = Settings.Secure.getInt(cr,
                 Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
                 Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT);
         String[] stringValues =
                 getResources().getStringArray(R.array.automatic_storage_management_days_values);
         mDaysToRetain.setValue(stringValues[daysValueToIndex(value, stringValues)]);
+
+        long freedBytes = Settings.Secure.getLong(cr,
+                Settings.Secure.AUTOMATIC_STORAGE_MANAGER_BYTES_CLEARED,
+                0);
+        long lastRunMillis = Settings.Secure.getLong(cr,
+                Settings.Secure.AUTOMATIC_STORAGE_MANAGER_LAST_RUN,
+                0);
+        if (freedBytes == 0 || lastRunMillis == 0) {
+            mFreedBytes.setVisible(false);
+        } else {
+            Activity activity = getActivity();
+            mFreedBytes.setSummary(activity.getString(
+                    R.string.automatic_storage_manager_freed_bytes,
+                    Formatter.formatFileSize(activity, freedBytes),
+                    DateUtils.formatDateTime(activity, lastRunMillis, DateUtils.FORMAT_SHOW_DATE)));
+        }
     }
 
     @Override
diff --git a/src/com/android/settings/gestures/GestureSettings.java b/src/com/android/settings/gestures/GestureSettings.java
index d40665f..cafba68 100644
--- a/src/com/android/settings/gestures/GestureSettings.java
+++ b/src/com/android/settings/gestures/GestureSettings.java
@@ -110,6 +110,11 @@
     }
 
     @Override
+    protected int getHelpResource() {
+        return R.string.help_url_gestures;
+    }
+
+    @Override
     protected int getMetricsCategory() {
         return MetricsEvent.SETTINGS_GESTURES;
     }
diff --git a/src/com/android/settings/search/Index.java b/src/com/android/settings/search/Index.java
index fd67ea6..976c6fb 100644
--- a/src/com/android/settings/search/Index.java
+++ b/src/com/android/settings/search/Index.java
@@ -1165,17 +1165,6 @@
         return result.toString();
     }
 
-    private int getResId(Context context, AttributeSet set, int[] attrs, int resId) {
-        final TypedArray sa = context.obtainStyledAttributes(set, attrs);
-        final TypedValue tv = sa.peekValue(resId);
-
-        if (tv != null && tv.type == TypedValue.TYPE_STRING) {
-            return tv.resourceId;
-        } else {
-            return 0;
-        }
-   }
-
     /**
      * A private class for updating the Index database
      */