Merge "[WifiSetup] Align to mac address to locale start" into mnc-dev
diff --git a/res/drawable-hdpi/setup_illustration_wifi.jpg b/res/drawable-hdpi/setup_illustration_wifi.jpg
index f2b9c6a..2e7241d 100644
--- a/res/drawable-hdpi/setup_illustration_wifi.jpg
+++ b/res/drawable-hdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-mdpi/setup_illustration_wifi.jpg b/res/drawable-mdpi/setup_illustration_wifi.jpg
index 7f5e788..4a9b8a5 100644
--- a/res/drawable-mdpi/setup_illustration_wifi.jpg
+++ b/res/drawable-mdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-xhdpi/setup_illustration_wifi.jpg b/res/drawable-xhdpi/setup_illustration_wifi.jpg
index 19478aa..c03f4dd 100644
--- a/res/drawable-xhdpi/setup_illustration_wifi.jpg
+++ b/res/drawable-xhdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-xxhdpi/setup_illustration_wifi.jpg b/res/drawable-xxhdpi/setup_illustration_wifi.jpg
index a28052b..e0791cd 100644
--- a/res/drawable-xxhdpi/setup_illustration_wifi.jpg
+++ b/res/drawable-xxhdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable-xxxhdpi/setup_illustration_wifi.jpg b/res/drawable-xxxhdpi/setup_illustration_wifi.jpg
index f2187cb..62352d3 100644
--- a/res/drawable-xxxhdpi/setup_illustration_wifi.jpg
+++ b/res/drawable-xxxhdpi/setup_illustration_wifi.jpg
Binary files differ
diff --git a/res/drawable/enrollment_fingerprint_isolated.xml b/res/drawable/enrollment_fingerprint_isolated.xml
index 2f1db7a..fc31ff8 100644
--- a/res/drawable/enrollment_fingerprint_isolated.xml
+++ b/res/drawable/enrollment_fingerprint_isolated.xml
@@ -30,7 +30,7 @@
             <path
                 android:name="ridge_5_path"
                 android:pathData="M 24.9488677979,32.3508300781 c -1.81059265137,0.338500976562 -3.58520507812,0.447387695312 -4.62879943848,0.447387695312 c -4.12730407715,0.0 -8.05894470215,-0.96842956543 -11.5207061768,-3.45275878906 c -5.33699035645,-3.830078125 -8.56369018555,-10.0885009766 -8.56369018555,-17.1589355469"
-                android:strokeColor="#10000000"
+                android:strokeColor="#19000000"
                 android:strokeWidth="5"
                 android:strokeLineCap="round"
                 android:trimPathEnd="0" />
@@ -40,7 +40,7 @@
             <path
                 android:name="ridge_7_path"
                 android:pathData="M -9.23379516602,40.8356933594 c -3.24549865723,-3.46032714844 -5.1540222168,-5.77195739746 -7.87710571289,-10.9068603516 c -2.76379394531,-5.21166992188 -4.04838562012,-11.3482666016 -4.04838562012,-17.6915283203 c 0.0,-11.6563720703 9.44940185547,-21.1059570312 21.1058959961,-21.1059570312 c 11.6564941406,0.0 21.1058959961,9.44958496094 21.1058959961,21.1059570312"
-                android:strokeColor="#10000000"
+                android:strokeColor="#19000000"
                 android:strokeWidth="5"
                 android:strokeLineCap="round"
                 android:trimPathEnd="0" />
@@ -50,7 +50,7 @@
             <path
                 android:name="ridge_6_path"
                 android:pathData="M -28.8249053955,28.5169677734 c -2.41259765625,-6.82202148438 -2.85319519043,-12.3121337891 -2.85319519043,-16.3226318359 c 0.0,-4.64868164062 0.792999267578,-9.06323242188 2.59269714355,-13.0396728516 c 4.96929931641,-10.9801025391 16.0211029053,-18.619140625 28.857208252,-18.619140625 c 17.4846954346,0.0 31.6587982178,14.1740722656 31.6587982178,31.6588134766 c 0.0,5.82824707031 -4.72470092773,10.5529785156 -10.5529022217,10.5529785156 c -5.82820129395,0.0 -10.5529937744,-4.72473144531 -10.5529937744,-10.5529785156 c 0.0,-5.82824707031 -4.72470092773,-10.5529785156 -10.5529022217,-10.5529785156 c -5.82820129395,0.0 -10.5529022217,4.72473144531 -10.5529022217,10.5529785156 c 0.0,8.17932128906 3.10879516602,15.5925292969 8.25030517578,21.0004882812 c 3.88919067383,4.09069824219 7.77758789062,6.64123535156 14.2838897705,8.52136230469"
-                android:strokeColor="#10000000"
+                android:strokeColor="#19000000"
                 android:strokeWidth="5"
                 android:strokeLineCap="round"
                 android:trimPathStart="1" />
@@ -60,7 +60,7 @@
             <path
                 android:name="ridge_2_path"
                 android:pathData="M -34.4861907959,-11.6943359375 c 3.78790283203,-5.64636230469 8.36389160156,-9.94665527344 14.3594970703,-13.2164306641 c 5.99560546875,-3.26977539062 12.8716125488,-5.1279296875 20.1817016602,-5.1279296875 c 7.27980041504,0.0 14.129196167,1.84289550781 20.1071014404,5.08740234375 c 5.97790527344,3.24450683594 10.7957000732,7.759765625 14.5897064209,13.3666992188"
-                android:strokeColor="#10000000"
+                android:strokeColor="#19000000"
                 android:strokeWidth="5"
                 android:strokeLineCap="round"
                 android:trimPathStart="1" />
@@ -72,7 +72,7 @@
             <path
                 android:name="ridge_1_path"
                 android:pathData="M 121.472564697,107.859741211 c -7.39790344238,-4.03979492188 -15.2462921143,-6.34167480469 -24.3116912842,-6.34167480469 c -9.06539916992,0.0 -16.2951049805,2.40405273438 -23.12550354,6.34167480469"
-                android:strokeColor="#10000000"
+                android:strokeColor="#19000000"
                 android:strokeWidth="5"
                 android:strokeLineCap="round"
                 android:trimPathEnd="0" />
diff --git a/res/layout/setup_choose_lock_pattern.xml b/res/layout/setup_choose_lock_pattern.xml
index 6ab0d47..d6bd208 100644
--- a/res/layout/setup_choose_lock_pattern.xml
+++ b/res/layout/setup_choose_lock_pattern.xml
@@ -48,6 +48,13 @@
                 android:minHeight="50dip"
                 android:textSize="18sp"/>
 
+            <Button android:id="@+id/retryButton"
+                style="@android:style/Widget.Material.Button.Borderless.Colored"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_horizontal"
+                android:text="@string/lockpattern_retry_button_text"/>
+
             <com.android.internal.widget.LockPatternView android:id="@+id/lockPattern"
                 android:layout_width="match_parent"
                 android:layout_height="0dip"
@@ -56,24 +63,13 @@
 
         </LinearLayout>
 
-        <LinearLayout
-            android:layout_width="match_parent"
+        <TextView android:id="@+id/footerText"
+            android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:gravity="center_horizontal"
-            android:orientation="horizontal">
-
-            <Button android:id="@+id/retryButton"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/lockpattern_retry_button_text"/>
-
-            <TextView android:id="@+id/footerText"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:minHeight="50dip"
-                android:textSize="14sp"/>
-
-        </LinearLayout>
+            android:layout_gravity="center_horizontal"
+            android:minHeight="50dip"
+            android:textSize="14sp"
+            android:visibility="gone"/>
 
         <!-- Buttons are hidden during setup, and use the buttons in setup navigation bar instead -->
         <LinearLayout
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c00d904..b1628d9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -751,8 +751,8 @@
 	<string name="fingerprint_enable_keyguard_toggle_title">screen lock</string>
     <!-- message shown for menu item that launches fingerprint settings or enrollment -->
     <plurals name="security_settings_fingerprint_preference_summary">
-        <item quantity="one"><xliff:g id="count">%1$d</xliff:g> fingerprint enrolled</item>
-        <item quantity="other"><xliff:g id="count">%1$d</xliff:g> fingerprints enrolled</item>
+        <item quantity="one"><xliff:g id="count">%1$d</xliff:g> fingerprint set up</item>
+        <item quantity="other"><xliff:g id="count">%1$d</xliff:g> fingerprints set up</item>
     </plurals>
     <!-- Introduction title shown in fingerprint enrollment dialog [CHAR LIMIT=22] -->
     <string name="security_settings_fingerprint_enroll_onboard_title">Fingerprint setup</string>
@@ -2926,7 +2926,7 @@
     <!-- Security & location settings screen, change unlock pattern screen button, on bottom of screen.  After they draw a pattern and release their finger, we display the pattern so they remember.  If they are nto satisfied with this pattern, they click this button to redraw the pattern. -->
     <string name="lockpattern_restart_button_text">Redraw</string>
     <!-- Security & location settings screen, change unlock pattern screen button, on bottom of screen. If they are supposed to enter their current pattern before being able to draw another one, and they screw up, they hit this button to try again -->
-    <string name="lockpattern_retry_button_text">Retry</string>
+    <string name="lockpattern_retry_button_text">Clear</string>
     <!-- Security & location settings screen, change unlock pattern screen button, on bottom of screen. Once they draw a new pattern and confirm it by drawing it again, they press this button to exit -->
     <string name="lockpattern_continue_button_text">Continue</string>
     <!-- Security & location settings screen, unlock screen activity title -->
@@ -2993,7 +2993,7 @@
     <!-- Manage applications, individual application info screen, section heading for stuff relating to an app's storage settings. -->
     <string name="storage_label">Storage</string>
     <!-- Manage applications, individual application info screen,  heading for settings related to controlling whether this app is the default for some actions -->
-    <string name="auto_launch_label">Launch by default</string>
+    <string name="auto_launch_label">Open by default</string>
     <!-- Manage applications, individual application info screen,  heading for settings related to controlling whether this app is the default for some actions *and* whether the app was given permission by the user to create widgets -->
     <string name="auto_launch_label_generic">Defaults</string>
     <!-- Manage applications, individual application info screen,  heading for settings related to controlling application screen compatibility -->
@@ -6379,16 +6379,16 @@
 
    <!-- New strings needed for App Info 2 -->
    <!-- Preference label for app default launch settings [CHAR LIMIT=35]-->
-   <string name="launch_by_default">Launch by default</string>
+   <string name="launch_by_default">Open by default</string>
 
    <!-- Summary for app storage preference [CHAR LIMIT=15] -->
    <string name="storage_summary_format"><xliff:g id="size" example="30.00MB">%1$s</xliff:g> used in <xliff:g id="storage_type" example="internal storage">%2$s</xliff:g></string>
 
    <!-- Category name for App Launch -->
-   <string name="app_launch_domain_links_title">Domain links</string>
-   <string name="app_launch_open_domain_urls_title">Open Domain URLs</string>
-   <string name="app_launch_open_domain_urls_summary">Allow app to directly open Domain URLs</string>
-   <string name="app_launch_supported_domain_urls_title">Supported domains URLs</string>
+   <string name="app_launch_domain_links_title">App links</string>
+   <string name="app_launch_open_domain_urls_title">Open supported links</string>
+   <string name="app_launch_open_domain_urls_summary">Open without asking</string>
+   <string name="app_launch_supported_domain_urls_title">Supported links</string>
    <string name="app_launch_other_defaults_title">Other defaults</string>
 
    <!-- Summary for app storage preference -->
@@ -6492,22 +6492,22 @@
    <string name="tap_to_wake_summary">Double-tap anywhere on the screen to wake device</string>
 
     <!-- Label for the Domain URLs list that shows domain urls per App [CHAR LIMIT=30] -->
-    <string name="domain_urls_title">Domain URLs</string>
+    <string name="domain_urls_title">App links</string>
 
     <!-- Summary for an App that dont open any domain URLs [CHAR LIMIT=45] -->
-    <string name="domain_urls_summary_none">Don\u2019t open any domain URL</string>
+    <string name="domain_urls_summary_none">Don\u2019t open supported links</string>
 
     <!-- Summary of number of App that can open one and only one domain URLs [CHAR LIMIT=45] -->
-    <string name="domain_urls_summary_one">Open \u2018<xliff:g id="domain" example="mail.google.com">%s</xliff:g>\u2019</string>
+    <string name="domain_urls_summary_one">Open <xliff:g id="domain" example="mail.google.com">%s</xliff:g></string>
 
     <!-- Summary of number of App that can open several domain URLs [CHAR LIMIT=45] -->
-    <string name="domain_urls_summary_some">Open \u2018<xliff:g id="domain" example="mail.google.com">%s</xliff:g>\u2019 and related URLs</string>
+    <string name="domain_urls_summary_some">Open <xliff:g id="domain" example="mail.google.com">%s</xliff:g> and related URLs</string>
 
     <!-- Description of settings item that leads to list of all apps with Domain URLs [CHAR LIMIT=NONE] -->
     <plurals name="domain_urls_apps_summary">
-        <item quantity="zero">No app can open any domain URL</item>
-        <item quantity="one">One app can open its domain URLs</item>
-        <item quantity="other"><xliff:g id="count" example="10">%d</xliff:g> apps can open their domain URLs</item>
+        <item quantity="zero">No app can open any supported link</item>
+        <item quantity="one">One app can open its supported links</item>
+        <item quantity="other"><xliff:g id="count" example="10">%d</xliff:g> apps can open their supported links</item>
     </plurals>
 
     <!-- Fingerprint hint message when finger was not recognized.-->
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index a9ca053..a24da21 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -65,6 +65,14 @@
         android:persistent="false"
         android:title="@string/system_ui_settings" />
 
+    <ListPreference
+        android:key="night_mode"
+        android:title="@string/night_mode_title"
+        android:summary="@string/night_mode_summary"
+        android:persistent="false"
+        android:entries="@array/night_mode_entries"
+        android:entryValues="@array/night_mode_values" />
+
     <PreferenceCategory android:key="debug_debugging_category"
             android:title="@string/debug_debugging_category">
 
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 304a77b..e04d818 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -33,6 +33,7 @@
                 android:summary="@string/auto_brightness_summary"
                 android:persistent="false" />
 
+        <!-- Hide night mode for now
         <ListPreference
             android:key="night_mode"
             android:title="@string/night_mode_title"
@@ -40,7 +41,7 @@
             android:summary="@string/night_mode_summary"
             android:persistent="false"
             android:entries="@array/night_mode_entries"
-            android:entryValues="@array/night_mode_values" />
+            android:entryValues="@array/night_mode_values" /> -->
 
         <PreferenceScreen
                 android:key="wallpaper"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 1ef1dd9..4e9089d 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -23,6 +23,7 @@
 import android.app.AppOpsManager;
 import android.app.AppOpsManager.PackageOps;
 import android.app.Dialog;
+import android.app.UiModeManager;
 import android.app.admin.DevicePolicyManager;
 import android.app.backup.IBackupManager;
 import android.bluetooth.BluetoothAdapter;
@@ -76,10 +77,8 @@
 import com.android.settings.fuelgauge.InactiveApps;
 import com.android.settings.search.BaseSearchIndexProvider;
 import com.android.settings.search.Indexable;
-import com.android.settings.users.UserDetailsSettings;
 import com.android.settings.widget.SwitchBar;
 
-import java.lang.Process;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -181,6 +180,8 @@
 
     private static final String TERMINAL_APP_PACKAGE = "com.android.terminal";
 
+    private static final String KEY_NIGHT_MODE = "night_mode";
+
     private static final int RESULT_DEBUG_APP = 1000;
     private static final int RESULT_MOCK_LOCATION_APP = 1001;
 
@@ -264,6 +265,8 @@
 
     private SwitchPreference mShowAllANRs;
 
+    private ListPreference mNightModePreference;
+
     private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
 
     private final ArrayList<SwitchPreference> mResetSwitchPrefs
@@ -423,6 +426,13 @@
             mAllPrefs.add(hdcpChecking);
             removePreferenceForProduction(hdcpChecking);
         }
+
+        mNightModePreference = (ListPreference) findPreference(KEY_NIGHT_MODE);
+        final UiModeManager uiManager = (UiModeManager) getSystemService(
+                Context.UI_MODE_SERVICE);
+        final int currentNightMode = uiManager.getNightMode();
+        mNightModePreference.setValue(String.valueOf(currentNightMode));
+        mNightModePreference.setOnPreferenceChangeListener(this);
     }
 
     private ListPreference addListPreference(String prefKey) {
@@ -1798,6 +1808,16 @@
         } else if (preference == mTunerUiPref) {
             writeTweakUi(newValue);
             return true;
+        } else if (preference == mNightModePreference) {
+            try {
+                final int value = Integer.parseInt((String) newValue);
+                final UiModeManager uiManager = (UiModeManager) getSystemService(
+                        Context.UI_MODE_SERVICE);
+                uiManager.setNightMode(value);
+            } catch (NumberFormatException e) {
+                Log.e(TAG, "could not persist night mode setting", e);
+            }
+            return true;
         }
         return false;
     }
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java
index d9b6447..e0a3489 100644
--- a/src/com/android/settings/DisplaySettings.java
+++ b/src/com/android/settings/DisplaySettings.java
@@ -185,11 +185,13 @@
         }
 
         mNightModePreference = (ListPreference) findPreference(KEY_NIGHT_MODE);
-        final UiModeManager uiManager = (UiModeManager) getSystemService(
-                Context.UI_MODE_SERVICE);
-        final int currentNightMode = uiManager.getNightMode();
-        mNightModePreference.setValue(String.valueOf(currentNightMode));
-        mNightModePreference.setOnPreferenceChangeListener(this);
+        if (mNightModePreference != null) {
+            final UiModeManager uiManager = (UiModeManager) getSystemService(
+                    Context.UI_MODE_SERVICE);
+            final int currentNightMode = uiManager.getNightMode();
+            mNightModePreference.setValue(String.valueOf(currentNightMode));
+            mNightModePreference.setOnPreferenceChangeListener(this);
+        }
     }
 
     private static boolean allowAllRotations(Context context) {
diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java
index 56f3ff6..0c45cd9 100644
--- a/src/com/android/settings/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/fingerprint/FingerprintSettings.java
@@ -127,7 +127,6 @@
 
         private FingerprintManager mFingerprintManager;
         private EditText mDialogTextField;
-        private PreferenceGroup mManageCategory;
         private CancellationSignal mFingerprintCancel;
         private int mMaxFingerprintAttempts;
         private byte[] mToken;
@@ -148,7 +147,7 @@
             @Override
             public void onAuthenticationError(int errMsgId, CharSequence errString) {
                 // get activity will be null on a screen rotation
-                Activity activity = getActivity();
+                final Activity activity = getActivity();
                 if (activity != null) {
                     Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
                 }
@@ -159,7 +158,10 @@
 
             @Override
             public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
-                Toast.makeText(getActivity(), helpString, Toast.LENGTH_SHORT);
+                final Activity activity = getActivity();
+                if (activity != null) {
+                    Toast.makeText(activity, helpString, Toast.LENGTH_SHORT);
+                }
             }
         };
         private RemovalCallback mRemoveCallback = new RemovalCallback() {
@@ -172,7 +174,10 @@
 
             @Override
             public void onRemovalError(Fingerprint fp, int errMsgId, CharSequence errString) {
-                Toast.makeText(getActivity(), errString, Toast.LENGTH_SHORT);
+                final Activity activity = getActivity();
+                if (activity != null) {
+                    Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
+                }
             }
         };
         private final Handler mHandler = new Handler() {
@@ -186,7 +191,7 @@
                         retryFingerprint(true);
                     break;
                     case MSG_FINGER_AUTH_FAIL:
-                        retryFingerprint(false);
+                        retryFingerprint(true);
                     break;
                 }
             };
@@ -440,29 +445,33 @@
 
         private Drawable getHighlightDrawable() {
             if (mHighlightDrawable == null) {
-                mHighlightDrawable = getActivity().getDrawable(R.drawable.preference_highlight);
+                final Activity activity = getActivity();
+                if (activity != null) {
+                    mHighlightDrawable = activity.getDrawable(R.drawable.preference_highlight);
+                }
             }
             return mHighlightDrawable;
         }
 
         private void highlightFingerprintItem(int fpId) {
             String prefName = genKey(fpId);
-            FingerprintPreference fpref =
-                    (FingerprintPreference) mManageCategory.findPreference(prefName);
+            FingerprintPreference fpref = (FingerprintPreference) findPreference(prefName);
             final Drawable highlight = getHighlightDrawable();
-            final View view = fpref.getView();
-            final int centerX = view.getWidth() / 2;
-            final int centerY = view.getHeight() / 2;
-            highlight.setHotspot(centerX, centerY);
-            view.setBackground(highlight);
-            view.setPressed(true);
-            mHandler.postDelayed(new Runnable() {
-                @Override
-                public void run() {
-                    view.setPressed(false);
-                    view.setBackground(null);
-                }
-            }, RESET_HIGHLIGHT_DELAY_MS);
+            if (highlight != null) {
+                final View view = fpref.getView();
+                final int centerX = view.getWidth() / 2;
+                final int centerY = view.getHeight() / 2;
+                highlight.setHotspot(centerX, centerY);
+                view.setBackground(highlight);
+                view.setPressed(true);
+                mHandler.postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        view.setPressed(false);
+                        view.setBackground(null);
+                    }
+                }, RESET_HIGHLIGHT_DELAY_MS);
+            }
         }
 
         private void launchChooseOrConfirmLock() {