Merge "Settings: "No interruptions" -> "Total silence"" into mnc-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 435236a..0446178 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1490,7 +1490,7 @@
         </activity>
 
         <activity
-                android:name="Settings$StorageVolumeSettingsActivity"
+                android:name="Settings$PublicVolumeSettingsActivity"
                 android:label="@string/storage_settings_title"
                 android:taskAffinity="com.android.settings"
                 android:parentActivityName="Settings$StorageSettingsActivity">
@@ -1508,6 +1508,19 @@
                 android:resource="@id/storage_settings" />
         </activity>
 
+        <activity
+                android:name="Settings$PrivateVolumeForgetActivity"
+                android:label="@string/storage_settings_title"
+                android:taskAffinity="com.android.settings"
+                android:parentActivityName="Settings$StorageSettingsActivity"
+                android:exported="true"
+                android:permission="android.permission.MOUNT_UNMOUNT_FILESYSTEMS">
+            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+                android:value="com.android.settings.deviceinfo.PrivateVolumeForget" />
+            <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
+                android:resource="@id/storage_settings" />
+        </activity>
+
         <!-- Exported for SystemUI to launch into -->
         <activity android:name=".deviceinfo.StorageWizardInit"
                 android:theme="@style/SuwThemeMaterial.Light"
diff --git a/res/anim/enrollment_fingerprint_isolated_ridge_1_path_animation.xml b/res/anim/enrollment_fingerprint_isolated_ridge_1_path_animation.xml
new file mode 100644
index 0000000..3332715
--- /dev/null
+++ b/res/anim/enrollment_fingerprint_isolated_ridge_1_path_animation.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="233"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="0.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="566"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="0.0"
+            android:valueTo="1.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/fast_out_slow_in" />
+    </set>
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="700"
+            android:propertyName="trimPathStart"
+            android:valueFrom="0.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="433"
+            android:propertyName="trimPathStart"
+            android:valueFrom="0.0"
+            android:valueTo="1.0"
+            android:valueType="floatType"
+            android:interpolator="@interpolator/enrollment_fingerprint_isolated_animation_interpolator_1" />
+    </set>
+</set>
diff --git a/res/anim/enrollment_fingerprint_isolated_ridge_2_path_animation.xml b/res/anim/enrollment_fingerprint_isolated_ridge_2_path_animation.xml
new file mode 100644
index 0000000..9285122
--- /dev/null
+++ b/res/anim/enrollment_fingerprint_isolated_ridge_2_path_animation.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="733"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="1.0"
+            android:valueTo="1.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="533"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="1.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@interpolator/enrollment_fingerprint_isolated_animation_interpolator_2" />
+    </set>
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="366"
+            android:propertyName="trimPathStart"
+            android:valueFrom="1.0"
+            android:valueTo="1.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="633"
+            android:propertyName="trimPathStart"
+            android:valueFrom="1.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@interpolator/enrollment_fingerprint_isolated_animation_interpolator_2" />
+    </set>
+</set>
diff --git a/res/anim/enrollment_fingerprint_isolated_ridge_5_path_animation.xml b/res/anim/enrollment_fingerprint_isolated_ridge_5_path_animation.xml
new file mode 100644
index 0000000..1329b7b
--- /dev/null
+++ b/res/anim/enrollment_fingerprint_isolated_ridge_5_path_animation.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="166"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="0.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="900"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="0.0"
+            android:valueTo="1.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/fast_out_slow_in" />
+    </set>
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="600"
+            android:propertyName="trimPathStart"
+            android:valueFrom="0.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="833"
+            android:propertyName="trimPathStart"
+            android:valueFrom="0.0"
+            android:valueTo="1.0"
+            android:valueType="floatType"
+            android:interpolator="@interpolator/enrollment_fingerprint_isolated_animation_interpolator_1" />
+    </set>
+</set>
diff --git a/res/anim/enrollment_fingerprint_isolated_ridge_6_path_animation.xml b/res/anim/enrollment_fingerprint_isolated_ridge_6_path_animation.xml
new file mode 100644
index 0000000..eeb9681
--- /dev/null
+++ b/res/anim/enrollment_fingerprint_isolated_ridge_6_path_animation.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="400"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="1.0"
+            android:valueTo="1.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="900"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="1.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@interpolator/enrollment_fingerprint_isolated_animation_interpolator_0" />
+    </set>
+    <objectAnimator
+        android:duration="866"
+        android:propertyName="trimPathStart"
+        android:valueFrom="1.0"
+        android:valueTo="0.0"
+        android:valueType="floatType"
+        android:interpolator="@interpolator/enrollment_fingerprint_isolated_animation_interpolator_2" />
+</set>
diff --git a/res/anim/enrollment_fingerprint_isolated_ridge_7_path_animation.xml b/res/anim/enrollment_fingerprint_isolated_ridge_7_path_animation.xml
new file mode 100644
index 0000000..69acef6
--- /dev/null
+++ b/res/anim/enrollment_fingerprint_isolated_ridge_7_path_animation.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<set
+    xmlns:android="http://schemas.android.com/apk/res/android" >
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="100"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="0.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="966"
+            android:propertyName="trimPathEnd"
+            android:valueFrom="0.0"
+            android:valueTo="1.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/fast_out_slow_in" />
+    </set>
+    <set
+        android:ordering="sequentially" >
+        <objectAnimator
+            android:duration="533"
+            android:propertyName="trimPathStart"
+            android:valueFrom="0.0"
+            android:valueTo="0.0"
+            android:valueType="floatType"
+            android:interpolator="@android:interpolator/linear" />
+        <objectAnimator
+            android:duration="900"
+            android:propertyName="trimPathStart"
+            android:valueFrom="0.0"
+            android:valueTo="1.0"
+            android:valueType="floatType"
+            android:interpolator="@interpolator/enrollment_fingerprint_isolated_animation_interpolator_1" />
+    </set>
+</set>
diff --git a/res/drawable-mdpi/tapandpay_emptystate.png b/res/drawable-mdpi/tapandpay_emptystate.png
new file mode 100644
index 0000000..1c0eb76
--- /dev/null
+++ b/res/drawable-mdpi/tapandpay_emptystate.png
Binary files differ
diff --git a/res/drawable-xhdpi/tapandpay_emptystate.png b/res/drawable-xhdpi/tapandpay_emptystate.png
new file mode 100644
index 0000000..f7f436b
--- /dev/null
+++ b/res/drawable-xhdpi/tapandpay_emptystate.png
Binary files differ
diff --git a/res/drawable-xxhdpi/tapandpay_emptystate.png b/res/drawable-xxhdpi/tapandpay_emptystate.png
new file mode 100644
index 0000000..6e60022
--- /dev/null
+++ b/res/drawable-xxhdpi/tapandpay_emptystate.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/tapandpay_emptystate.png b/res/drawable-xxxhdpi/tapandpay_emptystate.png
new file mode 100644
index 0000000..de8e437
--- /dev/null
+++ b/res/drawable-xxxhdpi/tapandpay_emptystate.png
Binary files differ
diff --git a/res/drawable/enrollment_fingerprint_isolated.xml b/res/drawable/enrollment_fingerprint_isolated.xml
new file mode 100644
index 0000000..2f1db7a
--- /dev/null
+++ b/res/drawable/enrollment_fingerprint_isolated.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:name="enrollment_fingerprint_isolated"
+    android:width="75dp"
+    android:viewportWidth="75"
+    android:height="88dp"
+    android:viewportHeight="88" >
+    <group
+        android:name="fingerprint_ridges_2"
+        android:translateX="37.5835"
+        android:translateY="43.66685" >
+        <group
+            android:name="ridge_5" >
+            <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:strokeWidth="5"
+                android:strokeLineCap="round"
+                android:trimPathEnd="0" />
+        </group>
+        <group
+            android:name="ridge_4" >
+            <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:strokeWidth="5"
+                android:strokeLineCap="round"
+                android:trimPathEnd="0" />
+        </group>
+        <group
+            android:name="ridge_3" >
+            <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:strokeWidth="5"
+                android:strokeLineCap="round"
+                android:trimPathStart="1" />
+        </group>
+        <group
+            android:name="ridge_2" >
+            <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:strokeWidth="5"
+                android:strokeLineCap="round"
+                android:trimPathStart="1" />
+        </group>
+        <group
+            android:name="ridge_1"
+            android:translateX="-97.5"
+            android:translateY="-142.5" >
+            <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:strokeWidth="5"
+                android:strokeLineCap="round"
+                android:trimPathEnd="0" />
+        </group>
+    </group>
+</vector>
diff --git a/res/drawable/enrollment_fingerprint_isolated_animation.xml b/res/drawable/enrollment_fingerprint_isolated_animation.xml
new file mode 100644
index 0000000..39c27f0
--- /dev/null
+++ b/res/drawable/enrollment_fingerprint_isolated_animation.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<animated-vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:drawable="@drawable/enrollment_fingerprint_isolated" >
+    <target
+        android:name="ridge_5_path"
+        android:animation="@anim/enrollment_fingerprint_isolated_ridge_5_path_animation" />
+    <target
+        android:name="ridge_7_path"
+        android:animation="@anim/enrollment_fingerprint_isolated_ridge_7_path_animation" />
+    <target
+        android:name="ridge_6_path"
+        android:animation="@anim/enrollment_fingerprint_isolated_ridge_6_path_animation" />
+    <target
+        android:name="ridge_2_path"
+        android:animation="@anim/enrollment_fingerprint_isolated_ridge_2_path_animation" />
+    <target
+        android:name="ridge_1_path"
+        android:animation="@anim/enrollment_fingerprint_isolated_ridge_1_path_animation" />
+</animated-vector>
diff --git a/res/interpolator/enrollment_fingerprint_isolated_animation_interpolator_0.xml b/res/interpolator/enrollment_fingerprint_isolated_animation_interpolator_0.xml
new file mode 100644
index 0000000..7f442ee
--- /dev/null
+++ b/res/interpolator/enrollment_fingerprint_isolated_animation_interpolator_0.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 c 0.4,0.0 0.5,1.0 1.0,1.0" />
diff --git a/res/interpolator/enrollment_fingerprint_isolated_animation_interpolator_1.xml b/res/interpolator/enrollment_fingerprint_isolated_animation_interpolator_1.xml
new file mode 100644
index 0000000..e10db01
--- /dev/null
+++ b/res/interpolator/enrollment_fingerprint_isolated_animation_interpolator_1.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 c 0.8,0.0 0.5,1.0 1.0,1.0" />
diff --git a/res/interpolator/enrollment_fingerprint_isolated_animation_interpolator_2.xml b/res/interpolator/enrollment_fingerprint_isolated_animation_interpolator_2.xml
new file mode 100644
index 0000000..736eac6
--- /dev/null
+++ b/res/interpolator/enrollment_fingerprint_isolated_animation_interpolator_2.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2015 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
+  -->
+<pathInterpolator
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 c 0.4,0.0 0.6,1.0 1.0,1.0" />
diff --git a/res/layout/fingerprint_enroll_enrolling_content.xml b/res/layout/fingerprint_enroll_enrolling_content.xml
index 6da744e..9fa503b 100644
--- a/res/layout/fingerprint_enroll_enrolling_content.xml
+++ b/res/layout/fingerprint_enroll_enrolling_content.xml
@@ -23,12 +23,18 @@
     android:layout_gravity="center_horizontal">
 
     <ImageView
-        android:id="@+id/fingerprint_animator"
         android:layout_width="88dp"
         android:layout_height="88dp"
         android:layout_centerInParent="true"
         android:src="@drawable/fingerprint_indicator" />
 
+    <ImageView
+        android:id="@+id/fingerprint_animator"
+        android:layout_width="88dp"
+        android:layout_height="88dp"
+        android:layout_centerInParent="true"
+        android:src="@drawable/enrollment_fingerprint_isolated_animation" />
+
     <ProgressBar
         android:id="@+id/fingerprint_progress_bar"
         android:layout_width="192dp"
diff --git a/res/layout/nfc_payment.xml b/res/layout/nfc_payment.xml
index d6f9fa4..f56d2a4 100644
--- a/res/layout/nfc_payment.xml
+++ b/res/layout/nfc_payment.xml
@@ -1,45 +1,62 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:tools="http://schemas.android.com/tools"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:gravity="center_vertical"
-        android:orientation="vertical" >
-        <ImageView
-            android:id="@+id/nfc_payment_tap_image"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:gravity="center"
-            android:visibility="gone"
-            android:src="@drawable/nfc_payment_empty_state"/>
-        <TextView
-            android:id="@+id/nfc_payment_empty_text"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:gravity="center"
-            android:textSize="24sp"
-            android:visibility="gone"
-            android:paddingTop="16dp"
-            android:text="@string/nfc_payment_no_apps"/>
-        <TextView
-            android:id="@+id/nfc_payment_learn_more"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:gravity="center"
-            android:clickable="true"
-            android:textSize="20sp"
-            android:textStyle="italic"
-            android:visibility="gone"
-            android:textColor="@android:color/holo_blue_light"
-            android:paddingTop="16dp"
-            android:text="@string/nfc_payment_learn_more"/>
-    </LinearLayout>
-    <ListView
-        android:id="@android:id/list"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:layout_marginTop="5dp" />
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
 
-</FrameLayout>
+     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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:orientation="vertical">
+
+    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
+        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+            xmlns:tools="http://schemas.android.com/tools"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical" >
+            <ImageView
+                android:id="@+id/nfc_payment_tap_image"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center"
+                android:visibility="gone"
+                android:src="@drawable/tapandpay_emptystate"/>
+            <TextView
+                android:id="@+id/nfc_payment_empty_text"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:gravity="center"
+                android:textSize="24sp"
+                android:visibility="gone"
+                android:paddingTop="32dp"
+                android:text="@string/nfc_payment_no_apps"/>
+        </LinearLayout>
+        <ListView android:id="@android:id/list"
+            android:drawSelectorOnTop="false"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:clipToPadding="false"
+            android:scrollbarStyle="@integer/preference_scrollbar_style" />
+<!--
+        <ListView
+            android:id="@android:id/list"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:clipToPadding="false"
+            android:scrollbarStyle="@integer/preference_scrollbar_style" />
+-->
+    </FrameLayout>
+</LinearLayout>
diff --git a/res/layout/nfc_payment_empty.xml b/res/layout/nfc_payment_empty.xml
new file mode 100644
index 0000000..42e2fa9
--- /dev/null
+++ b/res/layout/nfc_payment_empty.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:gravity="center"
+        android:orientation="vertical">
+
+        <ImageView
+            android:id="@+id/nfc_payment_tap_image"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:src="@drawable/tapandpay_emptystate"/>
+        <TextView
+            android:id="@+id/nfc_payment_empty_text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceLarge"
+            android:textColor="?android:attr/textColorSecondary"
+            android:paddingTop="32dp"
+            android:text="@string/nfc_payment_no_apps"/>
+</LinearLayout>
diff --git a/res/layout/nfc_payment_option.xml b/res/layout/nfc_payment_option.xml
index 76fea4f..90ba279 100644
--- a/res/layout/nfc_payment_option.xml
+++ b/res/layout/nfc_payment_option.xml
@@ -13,40 +13,28 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_weight="1"
     android:id="@+id/nfc_payment_pref"
     android:focusable="true"
     android:clickable="false"
-    android:gravity="center_vertical"
-    android:paddingTop="10dp"
-    android:paddingBottom="10dp"
+    android:orientation="horizontal"
+    android:paddingLeft="24dip"
     android:minHeight="?android:attr/listPreferredItemHeight"
     android:background="?android:attr/selectableItemBackground">
-    <FrameLayout
+    <RadioButton xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/button"
         android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:gravity="center"
-        android:minWidth="@*android:dimen/preference_icon_minWidth"
-        android:orientation="horizontal">
-        <ImageView
-            android:id="@+id/banner"
-            android:layout_gravity="center"
-            android:layout_width="wrap_content"
-            android:layout_height="96dp"
-            android:scaleType="centerInside"
-            android:clickable="true"
-                />
-    </FrameLayout>
-    <RadioButton
-        android:id="@android:id/button1"
+        android:layout_height="fill_parent"
+        android:checkMark="?android:attr/listChoiceIndicatorSingle"
+        />
+    <ImageView
+        android:id="@+id/banner"
         android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:layout_alignParentEnd="true"
-        android:layout_centerVertical="true"
-        android:duplicateParentState="true"
+        android:layout_height="64dp"
+        android:scaleType="centerInside"
         android:clickable="true"
-        android:focusable="false" />
-</RelativeLayout>
+            />
+</LinearLayout>
diff --git a/res/layout/preference_widget_settings.xml b/res/layout/preference_widget_settings.xml
new file mode 100644
index 0000000..6d9ac2fe
--- /dev/null
+++ b/res/layout/preference_widget_settings.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:gravity="center_vertical"
+    android:paddingEnd="?android:attr/scrollbarSize">
+
+    <!-- Settings button -->
+    <ImageView
+        android:id="@+id/settings_button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:padding="8dip"
+        android:background="?android:attr/selectableItemBackground"
+        android:src="@drawable/ic_sysbar_quicksettings"
+        android:contentDescription="@string/settings_button" />
+
+</LinearLayout>
diff --git a/res/layout/storage_internal_forget.xml b/res/layout/storage_internal_forget.xml
new file mode 100644
index 0000000..cb47d3b
--- /dev/null
+++ b/res/layout/storage_internal_forget.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1">
+        <TextView
+            android:id="@+id/body"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingTop="@dimen/suw_description_margin_top"
+            android:paddingBottom="@dimen/suw_description_margin_bottom"
+            android:paddingStart="@dimen/suw_layout_margin_sides"
+            android:paddingEnd="@dimen/suw_layout_margin_sides"
+            android:lineSpacingExtra="@dimen/suw_description_line_spacing_extra"
+            android:textAppearance="@android:style/TextAppearance.Material.Body1"
+            android:textColor="?android:attr/textColorPrimary" />
+    </ScrollView>
+
+    <FrameLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:padding="4dp">
+        <Button
+            android:id="@+id/confirm"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:text="@string/storage_menu_forget" />
+    </FrameLayout>
+
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 784e3a2..f7d5900 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2287,6 +2287,8 @@
     <string name="storage_menu_format_internal">Erase &amp; format as internal storage</string>
     <!-- Storage setting.  Menu option for USB transfer settings [CHAR LIMIT=30]-->
     <string name="storage_menu_usb">USB computer connection</string>
+    <!-- Storage setting.  Menu option for forgetting a storage device [CHAR LIMIT=30]-->
+    <string name="storage_menu_forget">Forget</string>
 
     <!-- Storage setting.  Title for USB transfer settings [CHAR LIMIT=30]-->
     <string name="storage_title_usb">USB computer connection</string>
@@ -2346,6 +2348,12 @@
     <string name="storage_internal_unmount_details"><b>When you eject this <xliff:g id="name" example="SD card">^1</xliff:g>, apps stored on it will stop working, and media files stored on it will not be available until it is reinserted.</b>
 \n\nThis <xliff:g id="name" example="SD card">^1</xliff:g> is formatted to work on this device only.  It won\'t work on any others.</string>
 
+    <!-- Body of dialog informing user about consequences of forgetting an internal storage device [CHAR LIMIT=NONE]-->
+    <string name="storage_internal_forget_details">To use the apps, photos, or data this <xliff:g id="name" example="SD card">^1</xliff:g> contains, reinsert it.
+\n\nAlternatively, you can choose to forget this storage if the device isn\'t available.
+\n\nIf you choose to forget, all the data the device contains will be lost forever.
+\n\nYou can reinstall the apps later, but their data stored on this device will be lost.</string>
+
     <!-- Title of wizard step prompting user to setup a storage device [CHAR LIMIT=32] -->
     <string name="storage_wizard_init_title">Set up your <xliff:g id="name" example="SD card">^1</xliff:g></string>
     <!-- Title of wizard choice to use storage device as external storage [CHAR LIMIT=64] -->
@@ -2364,6 +2372,14 @@
 \n\nAfter formatting, this <xliff:g id="name" example="SD card">^1</xliff:g> will only work in this device.
 \n\n<b>Formatting erases all data currently stored on the <xliff:g id="name" example="SD card">^1</xliff:g>.</b> To avoid losing the data, consider backing it up.
     </string>
+
+    <!-- Title of wizard step prompting user to format a storage device [CHAR LIMIT=32] -->
+    <string name="storage_wizard_format_confirm_public_title">Format as portable storage</string>
+    <!-- Body of wizard step prompting user to format a storage device [CHAR LIMIT=NONE] -->
+    <string name="storage_wizard_format_confirm_public_body">This requires the <xliff:g id="name" example="SD card">^1</xliff:g> to be formatted.
+\n\n<b>Formatting erases all data currently stored on the <xliff:g id="name" example="SD card">^1</xliff:g>.</b> To avoid losing the data, consider backing it up.
+    </string>
+
     <!-- Next button text of wizard step prompting user to format a storage device [CHAR LIMIT=32] -->
     <string name="storage_wizard_format_confirm_next">Erase &amp; format</string>
 
@@ -5501,24 +5517,35 @@
 
     <!-- NFC payment settings --><skip/>
     <string name="nfc_payment_settings_title">Tap &amp; pay</string>
-    <!-- Google Wallet label.  [CHAR LIMIT=40] --><skip/>
-    <string name="google_wallet">Google Wallet</string>
+    <!-- Caption for button linking to a page explaining how Tap and Pay works-->
+    <string name="nfc_payment_how_it_works">How it works</string>
     <!-- String shown when there are no NFC payment applications installed -->
-    <string name="nfc_payment_no_apps">Pay with just a tap</string>
-    <!-- String shown before a checkbox, allowing the user to indicate that he wants foreground apps
-         to be able to override the configured default app -->
-    <string name="nfc_payment_favor_foreground">Favor foreground app</string>
-    <!-- String shown when there are no NFC payment applications installed, clickable, pointing to
-         a website to learn more-->
-    <string name="nfc_payment_learn_more">Learn more</string>
+    <string name="nfc_payment_no_apps">Use Tap &amp; pay to make in-store purchases</string>
+    <!-- Header text that can be clicked on to change the default payment app -->
+    <string name="nfc_payment_default">Payment default</string>
+    <!-- Summary text that is shown when no default app is set -->
+    <string name="nfc_payment_default_not_set">Not set</string>
+    <!-- String indicating the label of the default payment app and a description of its state; eg Google Wallet - MasterCard 1234 -->
+    <string name="nfc_payment_app_and_desc"><xliff:g id="app">%1$s</xliff:g> - <xliff:g id="description">%2$s</xliff:g></string>
+    <!-- Header for action to choose when the open app supports TapPay -->
+    <string name="nfc_payment_open_app">If open app supports Tap &amp; pay</string>
+    <!-- If open app supports TapPay, use that app instead of the default -->
+    <string name="nfc_payment_favor_open">Use that app instead of <xliff:g id="app">%1$s</xliff:g></string>
+    <!-- If open app supports TapPay, use that app instead of the default (name of default app unknown) -->
+    <string name="nfc_payment_favor_open_default_unknown">Use that app instead</string>
+    <!-- If open app supports TapPay, still use the default app -->
+    <string name="nfc_payment_favor_default">Still use <xliff:g id="app">%1$s</xliff:g></string>
+    <!-- If open app supports TapPay, still use the default app (name of default app unknown) -->
+    <string name="nfc_payment_favor_default_default_unknown">Still use default</string>
+    <!-- Header for a dialog asking the user which payment app to use -->
+    <string name="nfc_payment_pay_with">At a Tap &amp; pay terminal, pay with:</string>
     <!-- NFC More... title.  [CHAR LIMIT=40] -->
     <string name="nfc_more_title">More...</string>
-    <string name="nfc_payment_menu_item_add_service">Find apps</string>
     <!-- Label for the dialog that is shown when the user is asked to set a
          preferred payment application -->
     <string name="nfc_payment_set_default_label">Set as your preference?</string>
-    <string name="nfc_payment_set_default">Always use <xliff:g id="app">%1$s</xliff:g> when you tap &amp; pay?</string>
-    <string name="nfc_payment_set_default_instead_of">Always use <xliff:g id="app">%1$s</xliff:g> instead of <xliff:g id="app">%2$s</xliff:g> when you tap &amp; pay?</string>
+    <string name="nfc_payment_set_default">Always use <xliff:g id="app">%1$s</xliff:g> when you Tap &amp; pay?</string>
+    <string name="nfc_payment_set_default_instead_of">Always use <xliff:g id="app">%1$s</xliff:g> instead of <xliff:g id="app">%2$s</xliff:g> when you Tap &amp; pay?</string>
     <!-- Restrictions settings --><skip/>
 
     <!-- Restriction settings title [CHAR LIMIT=35] -->
diff --git a/res/xml/timezones.xml b/res/xml/timezones.xml
index b6f1f1d..4426495 100644
--- a/res/xml/timezones.xml
+++ b/res/xml/timezones.xml
@@ -1,5 +1,4 @@
 <timezones>
-    <timezone id="Pacific/Majuro"></timezone>
     <timezone id="Pacific/Midway"></timezone>
     <timezone id="Pacific/Honolulu"></timezone>
     <timezone id="America/Anchorage"></timezone>
@@ -84,6 +83,8 @@
     <timezone id="Asia/Vladivostok"></timezone>
     <timezone id="Pacific/Guam"></timezone>
     <timezone id="Asia/Magadan"></timezone>
+    <timezone id="Pacific/Noumea"></timezone>
+    <timezone id="Pacific/Majuro"></timezone>
     <timezone id="Pacific/Auckland"></timezone>
     <timezone id="Pacific/Fiji"></timezone>
     <timezone id="Pacific/Tongatapu"></timezone>
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index a3bd5a1..4b2de72 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -29,6 +29,7 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.Process;
+import android.os.UserHandle;
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
 import android.security.KeyStore;
@@ -168,7 +169,7 @@
                 Preference preference) {
             final String key = preference.getKey();
 
-            if (!isUnlockMethodSecure(key) && mLockPatternUtils.isSecure()) {
+            if (!isUnlockMethodSecure(key) && mLockPatternUtils.isSecure(UserHandle.myUserId())) {
                 // Show the disabling FRP warning only when the user is switching from a secure
                 // unlock method to an insecure one
                 showFactoryResetProtectionWarningDialog(key);
@@ -268,10 +269,10 @@
         }
 
         private String getKeyForCurrent() {
-            if (mLockPatternUtils.isLockScreenDisabled()) {
+            if (mLockPatternUtils.isLockScreenDisabled(UserHandle.myUserId())) {
                 return KEY_UNLOCK_SET_OFF;
             }
-            switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
+            switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) {
                 case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
                     return KEY_UNLOCK_SET_PATTERN;
                 case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
@@ -474,8 +475,9 @@
                 }
                 startActivityForResult(intent, CHOOSE_LOCK_REQUEST);
             } else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
-                mChooseLockSettingsHelper.utils().clearLock();
-                mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled);
+                mChooseLockSettingsHelper.utils().clearLock(UserHandle.myUserId());
+                mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled,
+                        UserHandle.myUserId());
                 removeAllFingerprintTemplates();
                 getActivity().setResult(Activity.RESULT_OK);
                 finish();
@@ -502,7 +504,7 @@
         }
 
         private int getResIdForFactoryResetProtectionWarningTitle() {
-            switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
+            switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) {
                 case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
                     return R.string.unlock_disable_lock_pattern_summary;
                 case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java
index e15d3fc..0817eeb 100644
--- a/src/com/android/settings/ChooseLockPassword.java
+++ b/src/com/android/settings/ChooseLockPassword.java
@@ -31,6 +31,7 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
+import android.os.UserHandle;
 import android.text.Editable;
 import android.text.InputType;
 import android.text.Selection;
@@ -200,24 +201,31 @@
                 throw new SecurityException("Fragment contained in wrong activity");
             }
             mRequestedQuality = Math.max(intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY,
-                    mRequestedQuality), mLockPatternUtils.getRequestedPasswordQuality());
+                    mRequestedQuality), mLockPatternUtils.getRequestedPasswordQuality(
+                    UserHandle.myUserId()));
             mPasswordMinLength = Math.max(Math.max(
                     LockPatternUtils.MIN_LOCK_PASSWORD_SIZE,
                     intent.getIntExtra(PASSWORD_MIN_KEY, mPasswordMinLength)),
-                    mLockPatternUtils.getRequestedMinimumPasswordLength());
+                    mLockPatternUtils.getRequestedMinimumPasswordLength(UserHandle.myUserId()));
             mPasswordMaxLength = intent.getIntExtra(PASSWORD_MAX_KEY, mPasswordMaxLength);
             mPasswordMinLetters = Math.max(intent.getIntExtra(PASSWORD_MIN_LETTERS_KEY,
-                    mPasswordMinLetters), mLockPatternUtils.getRequestedPasswordMinimumLetters());
+                    mPasswordMinLetters), mLockPatternUtils.getRequestedPasswordMinimumLetters(
+                    UserHandle.myUserId()));
             mPasswordMinUpperCase = Math.max(intent.getIntExtra(PASSWORD_MIN_UPPERCASE_KEY,
-                    mPasswordMinUpperCase), mLockPatternUtils.getRequestedPasswordMinimumUpperCase());
+                    mPasswordMinUpperCase), mLockPatternUtils.getRequestedPasswordMinimumUpperCase(
+                    UserHandle.myUserId()));
             mPasswordMinLowerCase = Math.max(intent.getIntExtra(PASSWORD_MIN_LOWERCASE_KEY,
-                    mPasswordMinLowerCase), mLockPatternUtils.getRequestedPasswordMinimumLowerCase());
+                    mPasswordMinLowerCase), mLockPatternUtils.getRequestedPasswordMinimumLowerCase(
+                    UserHandle.myUserId()));
             mPasswordMinNumeric = Math.max(intent.getIntExtra(PASSWORD_MIN_NUMERIC_KEY,
-                    mPasswordMinNumeric), mLockPatternUtils.getRequestedPasswordMinimumNumeric());
+                    mPasswordMinNumeric), mLockPatternUtils.getRequestedPasswordMinimumNumeric(
+                    UserHandle.myUserId()));
             mPasswordMinSymbols = Math.max(intent.getIntExtra(PASSWORD_MIN_SYMBOLS_KEY,
-                    mPasswordMinSymbols), mLockPatternUtils.getRequestedPasswordMinimumSymbols());
+                    mPasswordMinSymbols), mLockPatternUtils.getRequestedPasswordMinimumSymbols(
+                    UserHandle.myUserId()));
             mPasswordMinNonLetter = Math.max(intent.getIntExtra(PASSWORD_MIN_NONLETTER_KEY,
-                    mPasswordMinNonLetter), mLockPatternUtils.getRequestedPasswordMinimumNonLetter());
+                    mPasswordMinNonLetter), mLockPatternUtils.getRequestedPasswordMinimumNonLetter(
+                    UserHandle.myUserId()));
 
             mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
         }
@@ -448,7 +456,7 @@
                     return getString(R.string.lockpassword_password_requires_digit);
                 }
             }
-            if(mLockPatternUtils.checkPasswordHistory(password)) {
+            if(mLockPatternUtils.checkPasswordHistory(password, UserHandle.myUserId())) {
                 return getString(mIsAlphaMode ? R.string.lockpassword_password_recently_used
                         : R.string.lockpassword_pin_recently_used);
             }
@@ -473,15 +481,17 @@
                 }
             } else if (mUiStage == Stage.NeedToConfirm) {
                 if (mFirstPin.equals(pin)) {
-                    boolean wasSecureBefore = mLockPatternUtils.isSecure();
+                    boolean wasSecureBefore = mLockPatternUtils.isSecure(UserHandle.myUserId());
                     final boolean required = getActivity().getIntent().getBooleanExtra(
                             EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
                     mLockPatternUtils.setCredentialRequiredToDecrypt(required);
-                    mLockPatternUtils.saveLockPassword(pin, mCurrentPassword, mRequestedQuality);
+                    mLockPatternUtils.saveLockPassword(pin, mCurrentPassword, mRequestedQuality,
+                            UserHandle.myUserId());
 
                     if (mHasChallenge) {
                         Intent intent = new Intent();
-                        byte[] token = mLockPatternUtils.verifyPassword(pin, mChallenge);
+                        byte[] token = mLockPatternUtils.verifyPassword(pin, mChallenge,
+                                UserHandle.myUserId());
                         intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
                         getActivity().setResult(RESULT_FINISHED, intent);
                     } else {
diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java
index e3b7d4b..99e8d24 100644
--- a/src/com/android/settings/ChooseLockPattern.java
+++ b/src/com/android/settings/ChooseLockPattern.java
@@ -31,6 +31,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -603,18 +604,18 @@
         private void saveChosenPatternAndFinish() {
             if (mDone) return;
             LockPatternUtils utils = mChooseLockSettingsHelper.utils();
-            final boolean lockVirgin = !utils.isPatternEverChosen();
+            final boolean lockVirgin = !utils.isPatternEverChosen(UserHandle.myUserId());
 
-            boolean wasSecureBefore = utils.isSecure();
+            boolean wasSecureBefore = utils.isSecure(UserHandle.myUserId());
 
             final boolean required = getActivity().getIntent().getBooleanExtra(
                     EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
 
             utils.setCredentialRequiredToDecrypt(required);
-            utils.saveLockPattern(mChosenPattern, mCurrentPattern);
+            utils.saveLockPattern(mChosenPattern, mCurrentPattern, UserHandle.myUserId());
 
             if (lockVirgin) {
-                utils.setVisiblePatternEnabled(true);
+                utils.setVisiblePatternEnabled(true, UserHandle.myUserId());
             }
 
             if (!wasSecureBefore) {
@@ -623,7 +624,8 @@
 
             if (mHasChallenge) {
                 Intent intent = new Intent();
-                byte[] token = utils.verifyPattern(mChosenPattern, mChallenge);
+                byte[] token = utils.verifyPattern(mChosenPattern, mChallenge,
+                        UserHandle.myUserId());
                 intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
                 getActivity().setResult(RESULT_FINISHED, intent);
             } else {
diff --git a/src/com/android/settings/ChooseLockSettingsHelper.java b/src/com/android/settings/ChooseLockSettingsHelper.java
index c9f20ff..8b8d976 100644
--- a/src/com/android/settings/ChooseLockSettingsHelper.java
+++ b/src/com/android/settings/ChooseLockSettingsHelper.java
@@ -21,6 +21,7 @@
 import android.app.Fragment;
 import android.app.admin.DevicePolicyManager;
 import android.content.Intent;
+import android.os.UserHandle;
 
 import com.android.internal.widget.LockPatternUtils;
 
@@ -116,7 +117,7 @@
             boolean returnCredentials, boolean external, boolean hasChallenge,
             long challenge) {
         boolean launched = false;
-        switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
+        switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) {
             case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
                 launched = launchConfirmationActivity(request, title, header, description,
                         returnCredentials || hasChallenge
diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java
index bec3a45..0994086 100644
--- a/src/com/android/settings/ConfirmLockPassword.java
+++ b/src/com/android/settings/ConfirmLockPassword.java
@@ -17,6 +17,7 @@
 package com.android.settings;
 
 import android.annotation.Nullable;
+import android.os.UserHandle;
 import android.text.TextUtils;
 import com.android.internal.logging.MetricsLogger;
 import com.android.internal.widget.LockPatternUtils;
@@ -90,7 +91,8 @@
         @Override
         public View onCreateView(LayoutInflater inflater, ViewGroup container,
                 Bundle savedInstanceState) {
-            final int storedQuality = mLockPatternUtils.getKeyguardStoredPasswordQuality();
+            final int storedQuality = mLockPatternUtils.getKeyguardStoredPasswordQuality(
+                    UserHandle.myUserId());
             View view = inflater.inflate(R.layout.confirm_lock_password, null);
 
             mPasswordEntry = (TextView) view.findViewById(R.id.password_entry);
@@ -156,7 +158,7 @@
         @Override
         public void onResume() {
             super.onResume();
-            long deadline = mLockPatternUtils.getLockoutAttemptDeadline();
+            long deadline = mLockPatternUtils.getLockoutAttemptDeadline(UserHandle.myUserId());
             if (deadline != 0) {
                 handleAttemptLockout(deadline);
             }
@@ -185,13 +187,14 @@
                 if (getActivity() instanceof ConfirmLockPassword.InternalActivity) {
                     long challenge = getActivity().getIntent().getLongExtra(
                             ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0);
-                    byte[] token = mLockPatternUtils.verifyPassword(pin, challenge);
+                    byte[] token = mLockPatternUtils.verifyPassword(pin, challenge,
+                            UserHandle.myUserId());
                     if (token != null) {
                         matched = true;
                         intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
                     }
                 }
-            } else if (mLockPatternUtils.checkPassword(pin)) {
+            } else if (mLockPatternUtils.checkPassword(pin, UserHandle.myUserId())) {
                 matched = true;
                 if (getActivity() instanceof ConfirmLockPassword.InternalActivity) {
                     intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
@@ -206,7 +209,8 @@
                 getActivity().finish();
             } else {
                 if (++mNumWrongConfirmAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
-                    long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
+                    long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
+                            UserHandle.myUserId());
                     handleAttemptLockout(deadline);
                 } else {
                     showError(getErrorMessage());
diff --git a/src/com/android/settings/ConfirmLockPattern.java b/src/com/android/settings/ConfirmLockPattern.java
index 420a7f8..2d0d117 100644
--- a/src/com/android/settings/ConfirmLockPattern.java
+++ b/src/com/android/settings/ConfirmLockPattern.java
@@ -28,6 +28,7 @@
 import android.os.CountDownTimer;
 import android.os.SystemClock;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.os.storage.StorageManager;
 import android.view.MenuItem;
 import android.widget.TextView;
@@ -135,7 +136,7 @@
                 // on first launch, if no lock pattern is set, then finish with
                 // success (don't want user to get stuck confirming something that
                 // doesn't exist).
-                if (!mLockPatternUtils.isLockPatternEnabled()) {
+                if (!mLockPatternUtils.isLockPatternEnabled(UserHandle.myUserId())) {
                     getActivity().setResult(Activity.RESULT_OK);
                     getActivity().finish();
                 }
@@ -168,7 +169,7 @@
             super.onResume();
 
             // if the user is currently locked out, enforce it.
-            long deadline = mLockPatternUtils.getLockoutAttemptDeadline();
+            long deadline = mLockPatternUtils.getLockoutAttemptDeadline(UserHandle.myUserId());
             if (deadline != 0) {
                 handleAttemptLockout(deadline);
             } else if (!mLockPatternView.isEnabled()) {
@@ -276,13 +277,14 @@
                     if (getActivity() instanceof ConfirmLockPattern.InternalActivity) {
                         long challenge = getActivity().getIntent().getLongExtra(
                             ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0);
-                        byte[] token = mLockPatternUtils.verifyPattern(pattern, challenge);
+                        byte[] token = mLockPatternUtils.verifyPattern(pattern, challenge,
+                                UserHandle.myUserId());
                         if (token != null) {
                             matched = true;
                             intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
                         }
                     }
-                } else if (mLockPatternUtils.checkPattern(pattern)) {
+                } else if (mLockPatternUtils.checkPattern(pattern, UserHandle.myUserId())) {
                     matched = true;
                     if (getActivity() instanceof ConfirmLockPattern.InternalActivity) {
                         intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
@@ -300,7 +302,8 @@
                     if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL &&
                             ++mNumWrongConfirmAttempts
                             >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
-                        long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
+                        long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
+                                UserHandle.myUserId());
                         handleAttemptLockout(deadline);
                     } else {
                         updateStage(Stage.NeedToUnlockWrong);
diff --git a/src/com/android/settings/CredentialStorage.java b/src/com/android/settings/CredentialStorage.java
index 8506964..81e0a46 100644
--- a/src/com/android/settings/CredentialStorage.java
+++ b/src/com/android/settings/CredentialStorage.java
@@ -200,7 +200,8 @@
      * Returns true if the currently set key guard matches our minimum quality requirements.
      */
     private boolean checkKeyGuardQuality() {
-        int quality = new LockPatternUtils(this).getActivePasswordQuality();
+        int quality = new LockPatternUtils(this).getActivePasswordQuality(
+                UserHandle.myUserId());
         return (quality >= MIN_PASSWORD_QUALITY);
     }
 
diff --git a/src/com/android/settings/CryptKeeperConfirm.java b/src/com/android/settings/CryptKeeperConfirm.java
index 77a1c45..513a428 100644
--- a/src/com/android/settings/CryptKeeperConfirm.java
+++ b/src/com/android/settings/CryptKeeperConfirm.java
@@ -120,8 +120,10 @@
 
             // 1. The owner info.
             LockPatternUtils utils = new LockPatternUtils(getActivity());
-            utils.setVisiblePatternEnabled(utils.isVisiblePatternEnabled());
-            if (utils.isOwnerInfoEnabled()) {
+            utils.setVisiblePatternEnabled(
+                    utils.isVisiblePatternEnabled(UserHandle.USER_OWNER),
+                    UserHandle.USER_OWNER);
+            if (utils.isOwnerInfoEnabled(UserHandle.USER_OWNER)) {
                 utils.setOwnerInfo(utils.getOwnerInfo(UserHandle.USER_OWNER),
                                    UserHandle.USER_OWNER);
             }
diff --git a/src/com/android/settings/CryptKeeperSettings.java b/src/com/android/settings/CryptKeeperSettings.java
index 2e4aeb8..c5a06eb 100644
--- a/src/com/android/settings/CryptKeeperSettings.java
+++ b/src/com/android/settings/CryptKeeperSettings.java
@@ -27,6 +27,7 @@
 import android.content.res.Resources;
 import android.os.BatteryManager;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.os.storage.StorageManager;
 import android.preference.Preference;
 import android.text.TextUtils;
@@ -160,7 +161,7 @@
         Resources res = getActivity().getResources();
         ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
 
-        if (helper.utils().getKeyguardStoredPasswordQuality()
+        if (helper.utils().getKeyguardStoredPasswordQuality(UserHandle.myUserId())
                 == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
             showFinalConfirmation(StorageManager.CRYPT_TYPE_DEFAULT, "");
             return true;
diff --git a/src/com/android/settings/EncryptionInterstitial.java b/src/com/android/settings/EncryptionInterstitial.java
index 9b6444c..794005b 100644
--- a/src/com/android/settings/EncryptionInterstitial.java
+++ b/src/com/android/settings/EncryptionInterstitial.java
@@ -33,6 +33,7 @@
 import android.content.DialogInterface.OnClickListener;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -149,7 +150,7 @@
             switch(dialogId) {
                 case ACCESSIBILITY_WARNING_DIALOG: {
                     final int quality = new LockPatternUtils(getActivity())
-                            .getKeyguardStoredPasswordQuality();
+                            .getKeyguardStoredPasswordQuality(UserHandle.myUserId());
                     final int titleId;
                     final int messageId;
                     switch (quality) {
diff --git a/src/com/android/settings/OwnerInfoSettings.java b/src/com/android/settings/OwnerInfoSettings.java
index 56da637..9cc78ea 100644
--- a/src/com/android/settings/OwnerInfoSettings.java
+++ b/src/com/android/settings/OwnerInfoSettings.java
@@ -101,7 +101,7 @@
     public void onClick(DialogInterface dialog, int which) {
         if (which == AlertDialog.BUTTON_POSITIVE) {
             String info = mOwnerInfo.getText().toString();
-            mLockPatternUtils.setOwnerInfoEnabled(!TextUtils.isEmpty(info));
+            mLockPatternUtils.setOwnerInfoEnabled(!TextUtils.isEmpty(info), mUserId);
             mLockPatternUtils.setOwnerInfo(info, mUserId);
 
             if (getTargetFragment() instanceof SecuritySettings) {
diff --git a/src/com/android/settings/ScreenPinningSettings.java b/src/com/android/settings/ScreenPinningSettings.java
index adda01b..cfeddbb 100644
--- a/src/com/android/settings/ScreenPinningSettings.java
+++ b/src/com/android/settings/ScreenPinningSettings.java
@@ -20,6 +20,7 @@
 import android.content.Intent;
 import android.content.res.Resources;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.preference.PreferenceScreen;
@@ -103,8 +104,9 @@
     private boolean setScreenLockUsed(boolean isEnabled) {
         if (isEnabled) {
             LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
-            if (lockPatternUtils.getKeyguardStoredPasswordQuality()
-                    == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
+            int passwordQuality = lockPatternUtils
+                    .getKeyguardStoredPasswordQuality(UserHandle.myUserId());
+            if (passwordQuality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
                 Intent chooseLockIntent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
                 chooseLockIntent.putExtra(
                         ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY,
@@ -123,7 +125,8 @@
         super.onActivityResult(requestCode, resultCode, data);
         if (requestCode == CHANGE_LOCK_METHOD_REQUEST) {
             LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
-            boolean validPassQuality = lockPatternUtils.getKeyguardStoredPasswordQuality()
+            boolean validPassQuality = lockPatternUtils.getKeyguardStoredPasswordQuality(
+                    UserHandle.myUserId())
                     != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
             setScreenLockUsed(validPassQuality);
             // Make sure the screen updates.
@@ -132,7 +135,8 @@
     }
 
     private int getCurrentSecurityTitle() {
-        int quality = mLockPatternUtils.getKeyguardStoredPasswordQuality();
+        int quality = mLockPatternUtils.getKeyguardStoredPasswordQuality(
+                UserHandle.myUserId());
         switch (quality) {
             case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
             case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
@@ -142,7 +146,7 @@
             case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
                 return R.string.screen_pinning_unlock_password;
             case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
-                if (mLockPatternUtils.isLockPatternEnabled()) {
+                if (mLockPatternUtils.isLockPatternEnabled(UserHandle.myUserId())) {
                     return R.string.screen_pinning_unlock_pattern;
                 }
         }
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 132281f..1c0f445 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -111,6 +111,8 @@
     // Only allow one trust agent on the platform.
     private static final boolean ONLY_ONE_TRUST_AGENT = true;
 
+    private static final int MY_USER_ID = UserHandle.myUserId();
+
     private DevicePolicyManager mDPM;
     private SubscriptionManager mSubscriptionManager;
 
@@ -160,14 +162,14 @@
     private static int getResIdForLockUnlockScreen(Context context,
             LockPatternUtils lockPatternUtils) {
         int resid = 0;
-        if (!lockPatternUtils.isSecure()) {
-            if (lockPatternUtils.isLockScreenDisabled()) {
+        if (!lockPatternUtils.isSecure(MY_USER_ID)) {
+            if (lockPatternUtils.isLockScreenDisabled(MY_USER_ID)) {
                 resid = R.xml.security_settings_lockscreen;
             } else {
                 resid = R.xml.security_settings_chooser;
             }
         } else {
-            switch (lockPatternUtils.getKeyguardStoredPasswordQuality()) {
+            switch (lockPatternUtils.getKeyguardStoredPasswordQuality(MY_USER_ID)) {
                 case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
                     resid = R.xml.security_settings_pattern;
                     break;
@@ -204,7 +206,7 @@
         addPreferencesFromResource(resid);
 
         // Add options for device encryption
-        mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER;
+        mIsPrimary = MY_USER_ID == UserHandle.USER_OWNER;
 
         mOwnerInfoPref = findPreference(KEY_OWNER_INFO_SETTINGS);
         if (mOwnerInfoPref != null) {
@@ -304,7 +306,7 @@
         mToggleAppInstallation.setChecked(isNonMarketAppsAllowed());
         // Side loading of apps.
         // Disable for restricted profiles. For others, check if policy disallows it.
-        mToggleAppInstallation.setEnabled(!um.getUserInfo(UserHandle.myUserId()).isRestricted());
+        mToggleAppInstallation.setEnabled(!um.getUserInfo(MY_USER_ID).isRestricted());
         if (um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES)
                 || um.hasUserRestriction(UserManager.DISALLOW_INSTALL_APPS)) {
             mToggleAppInstallation.setEnabled(false);
@@ -315,7 +317,7 @@
                 (PreferenceGroup)root.findPreference(KEY_ADVANCED_SECURITY);
         if (advancedCategory != null) {
             Preference manageAgents = advancedCategory.findPreference(KEY_MANAGE_TRUST_AGENTS);
-            if (manageAgents != null && !mLockPatternUtils.isSecure()) {
+            if (manageAgents != null && !mLockPatternUtils.isSecure(MY_USER_ID)) {
                 manageAgents.setEnabled(false);
                 manageAgents.setSummary(R.string.disabled_because_no_backup_security);
             }
@@ -348,7 +350,8 @@
         final List<Fingerprint> items = fpm.getEnrolledFingerprints();
         final int fingerprintCount = items != null ? items.size() : 0;
         final String clazz;
-        boolean hasPassword = mChooseLockSettingsHelper.utils().getActivePasswordQuality()
+        boolean hasPassword = mChooseLockSettingsHelper.utils().getActivePasswordQuality(
+                MY_USER_ID)
                 != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
         if (fingerprintCount > 0) {
             fingerprintPreference.setSummary(getResources().getQuantityString(
@@ -368,7 +371,7 @@
     }
 
     private void addTrustAgentSettings(PreferenceGroup securityCategory) {
-        final boolean hasSecurity = mLockPatternUtils.isSecure();
+        final boolean hasSecurity = mLockPatternUtils.isSecure(MY_USER_ID);
         ArrayList<TrustAgentComponentInfo> agents =
                 getActiveTrustAgents(getPackageManager(), mLockPatternUtils, mDPM);
         for (int i = 0; i < agents.size(); i++) {
@@ -438,7 +441,7 @@
         ArrayList<TrustAgentComponentInfo> result = new ArrayList<TrustAgentComponentInfo>();
         List<ResolveInfo> resolveInfos = pm.queryIntentServices(TRUST_AGENT_INTENT,
                 PackageManager.GET_META_DATA);
-        List<ComponentName> enabledTrustAgents = utils.getEnabledTrustAgents();
+        List<ComponentName> enabledTrustAgents = utils.getEnabledTrustAgents(MY_USER_ID);
 
         boolean disableTrustAgents = (dpm.getKeyguardDisabledFeatures(null)
                 & DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS) != 0;
@@ -597,10 +600,12 @@
 
         final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
         if (mVisiblePattern != null) {
-            mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled());
+            mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled(
+                    MY_USER_ID));
         }
         if (mPowerButtonInstantlyLocks != null) {
-            mPowerButtonInstantlyLocks.setChecked(lockPatternUtils.getPowerButtonInstantlyLocks());
+            mPowerButtonInstantlyLocks.setChecked(lockPatternUtils.getPowerButtonInstantlyLocks(
+                    MY_USER_ID));
         }
 
         if (mShowPassword != null) {
@@ -617,8 +622,8 @@
 
     public void updateOwnerInfo() {
         if (mOwnerInfoPref != null) {
-            mOwnerInfoPref.setSummary(mLockPatternUtils.isOwnerInfoEnabled()
-                    ? mLockPatternUtils.getOwnerInfo(UserHandle.myUserId())
+            mOwnerInfoPref.setSummary(mLockPatternUtils.isOwnerInfoEnabled(MY_USER_ID)
+                    ? mLockPatternUtils.getOwnerInfo(MY_USER_ID)
                     : getString(R.string.owner_info_settings_summary));
         }
     }
@@ -678,9 +683,9 @@
             }
             updateLockAfterPreferenceSummary();
         } else if (KEY_VISIBLE_PATTERN.equals(key)) {
-            lockPatternUtils.setVisiblePatternEnabled((Boolean) value);
+            lockPatternUtils.setVisiblePatternEnabled((Boolean) value, MY_USER_ID);
         } else if (KEY_POWER_INSTANTLY_LOCKS.equals(key)) {
-            mLockPatternUtils.setPowerButtonInstantlyLocks((Boolean) value);
+            mLockPatternUtils.setPowerButtonInstantlyLocks((Boolean) value, MY_USER_ID);
         } else if (KEY_SHOW_PASSWORD.equals(key)) {
             Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
                     ((Boolean) value) ? 1 : 0);
@@ -715,7 +720,7 @@
         public SecuritySearchIndexProvider() {
             super();
 
-            mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER;
+            mIsPrimary = MY_USER_ID == UserHandle.USER_OWNER;
         }
 
         @Override
@@ -800,7 +805,7 @@
 
             // Advanced
             final LockPatternUtils lockPatternUtils = new LockPatternUtils(context);
-            if (lockPatternUtils.isSecure()) {
+            if (lockPatternUtils.isSecure(MY_USER_ID)) {
                 ArrayList<TrustAgentComponentInfo> agents =
                         getActiveTrustAgents(context.getPackageManager(), lockPatternUtils,
                                 context.getSystemService(DevicePolicyManager.class));
@@ -835,7 +840,7 @@
             }
 
             // TrustAgent settings disappear when the user has no primary security.
-            if (!lockPatternUtils.isSecure()) {
+            if (!lockPatternUtils.isSecure(MY_USER_ID)) {
                 keys.add(KEY_TRUST_AGENT);
                 keys.add(KEY_MANAGE_TRUST_AGENTS);
             }
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index ba08036..88c8316 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -33,7 +33,8 @@
     public static class VpnSettingsActivity extends SettingsActivity { /* empty */ }
     public static class DateTimeSettingsActivity extends SettingsActivity { /* empty */ }
     public static class StorageSettingsActivity extends SettingsActivity { /* empty */ }
-    public static class StorageVolumeSettingsActivity extends SettingsActivity { /* empty */ }
+    public static class PublicVolumeSettingsActivity extends SettingsActivity { /* empty */ }
+    public static class PrivateVolumeForgetActivity extends SettingsActivity { /* empty */ }
     public static class WifiSettingsActivity extends SettingsActivity { /* empty */ }
     public static class WifiP2pSettingsActivity extends SettingsActivity { /* empty */ }
     public static class InputMethodAndLanguageSettingsActivity extends SettingsActivity { /* empty */ }
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index ee2b1b4..5e1acb1 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -83,6 +83,7 @@
 import com.android.settings.dashboard.DashboardTile;
 import com.android.settings.dashboard.NoHomeDialogFragment;
 import com.android.settings.dashboard.SearchResultsSummary;
+import com.android.settings.deviceinfo.PrivateVolumeForget;
 import com.android.settings.deviceinfo.PublicVolumeSettings;
 import com.android.settings.deviceinfo.StorageSettings;
 import com.android.settings.deviceinfo.UsbSettings;
@@ -310,6 +311,7 @@
             TextToSpeechSettings.class.getName(),
             StorageSettings.class.getName(),
             PublicVolumeSettings.class.getName(),
+            PrivateVolumeForget.class.getName(),
             DevelopmentSettings.class.getName(),
             UsbSettings.class.getName(),
             AndroidBeam.class.getName(),
diff --git a/src/com/android/settings/TrustAgentSettings.java b/src/com/android/settings/TrustAgentSettings.java
index 4c6b4ee..37a86eb 100644
--- a/src/com/android/settings/TrustAgentSettings.java
+++ b/src/com/android/settings/TrustAgentSettings.java
@@ -26,6 +26,7 @@
 import android.content.pm.ResolveInfo;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.preference.Preference;
 import android.preference.PreferenceGroup;
 import android.preference.SwitchPreference;
@@ -120,14 +121,16 @@
     }
 
     private void loadActiveAgents() {
-        List<ComponentName> activeTrustAgents = mLockPatternUtils.getEnabledTrustAgents();
+        List<ComponentName> activeTrustAgents = mLockPatternUtils.getEnabledTrustAgents(
+                UserHandle.myUserId());
         if (activeTrustAgents != null) {
             mActiveAgents.addAll(activeTrustAgents);
         }
     }
 
     private void saveActiveAgents() {
-        mLockPatternUtils.setEnabledTrustAgents(mActiveAgents);
+        mLockPatternUtils.setEnabledTrustAgents(mActiveAgents,
+                UserHandle.myUserId());
     }
 
     ArrayMap<ComponentName, AgentInfo> findAvailableTrustAgents() {
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index 6092532..16389cb 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -29,6 +29,7 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.UserHandle;
 import android.provider.Settings;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
@@ -368,7 +369,7 @@
 
     private String createConfirmCredentialReasonMessage() {
         int resId = R.string.enable_service_password_reason;
-        switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
+        switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) {
             case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: {
                 resId = R.string.enable_service_pattern_reason;
             } break;
diff --git a/src/com/android/settings/applications/DefaultBrowserPreference.java b/src/com/android/settings/applications/DefaultBrowserPreference.java
index da7f112..4479789 100644
--- a/src/com/android/settings/applications/DefaultBrowserPreference.java
+++ b/src/com/android/settings/applications/DefaultBrowserPreference.java
@@ -56,7 +56,8 @@
         intent.setData(Uri.parse("http:"));
 
         // Resolve that intent and check that the handleAllWebDataURI boolean is set
-        List<ResolveInfo> list = mPm.queryIntentActivitiesAsUser(intent, 0, UserHandle.myUserId());
+        List<ResolveInfo> list = mPm.queryIntentActivitiesAsUser(intent, PackageManager.MATCH_ALL,
+                UserHandle.myUserId());
 
         final int count = list.size();
         for (int i=0; i<count; i++) {
diff --git a/src/com/android/settings/applications/DefaultDialerPreference.java b/src/com/android/settings/applications/DefaultDialerPreference.java
index 8de4532..705e4ef1 100644
--- a/src/com/android/settings/applications/DefaultDialerPreference.java
+++ b/src/com/android/settings/applications/DefaultDialerPreference.java
@@ -16,7 +16,6 @@
 
 package com.android.settings.applications;
 
-import android.content.ComponentName;
 import android.content.Context;
 import android.os.UserManager;
 import android.telecom.DefaultDialerManager;
@@ -49,22 +48,18 @@
     }
 
     private void loadDialerApps() {
-        List<ComponentName> dialerComponents =
+        List<String> dialerPackages =
                 DefaultDialerManager.getInstalledDialerApplications(getContext());
 
-        final String[] dialers = new String[dialerComponents.size()];
-        for (int i = 0; i < dialerComponents.size(); i++) {
-            dialers[i] = dialerComponents.get(i).getPackageName();
+        final String[] dialers = new String[dialerPackages.size()];
+        for (int i = 0; i < dialerPackages.size(); i++) {
+            dialers[i] = dialerPackages.get(i);
         }
         setPackageNames(dialers, getDefaultPackage());
     }
 
     private String getDefaultPackage() {
-        ComponentName appName = DefaultDialerManager.getDefaultDialerApplication(getContext());
-        if (appName != null) {
-            return appName.getPackageName();
-        }
-        return null;
+        return DefaultDialerManager.getDefaultDialerApplication(getContext());
     }
 
     public static boolean isAvailable(Context context) {
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java b/src/com/android/settings/deviceinfo/PrivateVolumeForget.java
similarity index 75%
copy from src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java
copy to src/com/android/settings/deviceinfo/PrivateVolumeForget.java
index 614b737..c8b04e3 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeForget.java
@@ -17,9 +17,8 @@
 package com.android.settings.deviceinfo;
 
 import android.os.Bundle;
-import android.os.storage.DiskInfo;
 import android.os.storage.StorageManager;
-import android.os.storage.VolumeInfo;
+import android.os.storage.VolumeRecord;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -31,11 +30,9 @@
 import com.android.internal.logging.MetricsLogger;
 import com.android.settings.InstrumentedFragment;
 import com.android.settings.R;
-import com.android.settings.deviceinfo.StorageSettings.UnmountTask;
 
-public class PrivateVolumeUnmountConfirm extends InstrumentedFragment {
-    private VolumeInfo mVolume;
-    private DiskInfo mDisk;
+public class PrivateVolumeForget extends InstrumentedFragment {
+    private VolumeRecord mRecord;
 
     @Override
     protected int getMetricsCategory() {
@@ -46,16 +43,15 @@
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
         final StorageManager storage = getActivity().getSystemService(StorageManager.class);
-        final String volumeId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
-        mVolume = storage.findVolumeById(volumeId);
-        mDisk = storage.findDiskById(mVolume.getDiskId());
+        final String fsUuid = getArguments().getString(VolumeRecord.EXTRA_FS_UUID);
+        mRecord = storage.findRecordByUuid(fsUuid);
 
-        final View view = inflater.inflate(R.layout.storage_internal_unmount, container, false);
+        final View view = inflater.inflate(R.layout.storage_internal_forget, container, false);
         final TextView body = (TextView) view.findViewById(R.id.body);
         final Button confirm = (Button) view.findViewById(R.id.confirm);
 
-        body.setText(TextUtils.expandTemplate(getText(R.string.storage_internal_unmount_details),
-                mDisk.getDescription()));
+        body.setText(TextUtils.expandTemplate(getText(R.string.storage_internal_forget_details),
+                mRecord.getNickname()));
         confirm.setOnClickListener(mConfirmListener);
 
         return view;
@@ -64,7 +60,8 @@
     private final OnClickListener mConfirmListener = new OnClickListener() {
         @Override
         public void onClick(View v) {
-            new UnmountTask(getActivity(), mVolume).execute();
+            final StorageManager storage = getActivity().getSystemService(StorageManager.class);
+            storage.forgetVolume(mRecord.getFsUuid());
             getActivity().finish();
         }
     };
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeFormatConfirm.java b/src/com/android/settings/deviceinfo/PrivateVolumeFormat.java
similarity index 94%
rename from src/com/android/settings/deviceinfo/PrivateVolumeFormatConfirm.java
rename to src/com/android/settings/deviceinfo/PrivateVolumeFormat.java
index 666a918..e16778f 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeFormatConfirm.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeFormat.java
@@ -33,7 +33,7 @@
 import com.android.settings.InstrumentedFragment;
 import com.android.settings.R;
 
-public class PrivateVolumeFormatConfirm extends InstrumentedFragment {
+public class PrivateVolumeFormat extends InstrumentedFragment {
     private VolumeInfo mVolume;
     private DiskInfo mDisk;
 
@@ -66,7 +66,7 @@
         public void onClick(View v) {
             final Intent intent = new Intent(getActivity(), StorageWizardFormatProgress.class);
             intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
-            intent.putExtra(StorageWizardFormatProgress.EXTRA_FORMAT_PUBLIC, true);
+            intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
             startActivity(intent);
             getActivity().finish();
         }
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
index 492051d..3e2b570 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeSettings.java
@@ -37,10 +37,10 @@
 import android.os.storage.StorageEventListener;
 import android.os.storage.StorageManager;
 import android.os.storage.VolumeInfo;
+import android.os.storage.VolumeRecord;
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
 import android.provider.MediaStore;
-import android.text.TextUtils;
 import android.text.format.Formatter;
 import android.util.Log;
 import android.view.LayoutInflater;
@@ -160,7 +160,7 @@
         setHasOptionsMenu(true);
     }
 
-    public void refresh() {
+    public void update() {
         getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
 
         // Valid options may have changed
@@ -245,7 +245,7 @@
         }
 
         mStorageManager.registerListener(mStorageListener);
-        refresh();
+        update();
     }
 
     @Override
@@ -297,19 +297,19 @@
         final Bundle args = new Bundle();
         switch (item.getItemId()) {
             case R.id.storage_rename:
-                RenameFragment.show(this);
+                RenameFragment.show(this, mVolume);
                 return true;
             case R.id.storage_mount:
                 new MountTask(context, mVolume).execute();
                 return true;
             case R.id.storage_unmount:
                 args.putString(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId());
-                startFragment(this, PrivateVolumeUnmountConfirm.class.getCanonicalName(),
+                startFragment(this, PrivateVolumeUnmount.class.getCanonicalName(),
                         R.string.storage_menu_unmount, 0, args);
                 return true;
             case R.id.storage_format:
                 args.putString(VolumeInfo.EXTRA_VOLUME_ID, mVolume.getId());
-                startFragment(this, PrivateVolumeFormatConfirm.class.getCanonicalName(),
+                startFragment(this, PrivateVolumeFormat.class.getCanonicalName(),
                         R.string.storage_menu_format, 0, args);
                 return true;
             case R.id.storage_usb:
@@ -437,15 +437,15 @@
         public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
             if (Objects.equals(mVolume.getId(), vol.getId())) {
                 mVolume = vol;
-                refresh();
+                update();
             }
         }
 
         @Override
-        public void onVolumeMetadataChanged(VolumeInfo vol) {
-            if (Objects.equals(mVolume.getId(), vol.getId())) {
-                mVolume = vol;
-                refresh();
+        public void onVolumeMetadataChanged(String fsUuid) {
+            if (Objects.equals(mVolume.getFsUuid(), fsUuid)) {
+                mVolume = mStorageManager.findVolumeById(mVolumeId);
+                update();
             }
         }
     };
@@ -454,12 +454,14 @@
      * Dialog that allows editing of volume nickname.
      */
     public static class RenameFragment extends DialogFragment {
-        public static void show(PrivateVolumeSettings parent) {
+        public static void show(PrivateVolumeSettings parent, VolumeInfo vol) {
             if (!parent.isAdded()) return;
 
             final RenameFragment dialog = new RenameFragment();
             dialog.setTargetFragment(parent, 0);
-            dialog.setArguments(parent.getArguments());
+            final Bundle args = new Bundle();
+            args.putString(VolumeRecord.EXTRA_FS_UUID, vol.getFsUuid());
+            dialog.setArguments(args);
             dialog.show(parent.getFragmentManager(), TAG_RENAME);
         }
 
@@ -468,20 +470,16 @@
             final Context context = getActivity();
             final StorageManager storageManager = context.getSystemService(StorageManager.class);
 
-            final String volId = getArguments().getString(VolumeInfo.EXTRA_VOLUME_ID);
-            final VolumeInfo vol = storageManager.findVolumeById(volId);
+            final String fsUuid = getArguments().getString(VolumeRecord.EXTRA_FS_UUID);
+            final VolumeInfo vol = storageManager.findVolumeByUuid(fsUuid);
+            final VolumeRecord rec = storageManager.findRecordByUuid(fsUuid);
 
             final AlertDialog.Builder builder = new AlertDialog.Builder(context);
             final LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());
 
             final View view = dialogInflater.inflate(R.layout.dialog_edittext, null, false);
             final EditText nickname = (EditText) view.findViewById(R.id.edittext);
-
-            if (!TextUtils.isEmpty(vol.getNickname())) {
-                nickname.setText(vol.getNickname());
-            } else {
-                nickname.setText(storageManager.getBestVolumeDescription(vol));
-            }
+            nickname.setText(rec.getNickname());
 
             builder.setTitle(R.string.storage_rename_title);
             builder.setView(view);
@@ -491,7 +489,8 @@
                         @Override
                         public void onClick(DialogInterface dialog, int which) {
                             // TODO: move to background thread
-                            storageManager.setVolumeNickname(volId, nickname.getText().toString());
+                            storageManager.setVolumeNickname(fsUuid,
+                                    nickname.getText().toString());
                         }
                     });
             builder.setNegativeButton(R.string.cancel, null);
@@ -552,7 +551,7 @@
         public void onRemoveCompleted(final String packageName, final boolean succeeded) {
             synchronized (this) {
                 if (--mRemaining == 0) {
-                    mTarget.refresh();
+                    mTarget.update();
                 }
             }
         }
diff --git a/src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java b/src/com/android/settings/deviceinfo/PrivateVolumeUnmount.java
similarity index 96%
rename from src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java
rename to src/com/android/settings/deviceinfo/PrivateVolumeUnmount.java
index 614b737..410db8f 100644
--- a/src/com/android/settings/deviceinfo/PrivateVolumeUnmountConfirm.java
+++ b/src/com/android/settings/deviceinfo/PrivateVolumeUnmount.java
@@ -33,7 +33,7 @@
 import com.android.settings.R;
 import com.android.settings.deviceinfo.StorageSettings.UnmountTask;
 
-public class PrivateVolumeUnmountConfirm extends InstrumentedFragment {
+public class PrivateVolumeUnmount extends InstrumentedFragment {
     private VolumeInfo mVolume;
     private DiskInfo mDisk;
 
diff --git a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
index e0b6843..1d7991d 100644
--- a/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
+++ b/src/com/android/settings/deviceinfo/PublicVolumeSettings.java
@@ -33,7 +33,6 @@
 import com.android.internal.util.Preconditions;
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.deviceinfo.StorageSettings.FormatTask;
 import com.android.settings.deviceinfo.StorageSettings.MountTask;
 import com.android.settings.deviceinfo.StorageSettings.UnmountTask;
 
@@ -110,7 +109,7 @@
         mFormatInternal = buildAction(R.string.storage_menu_format_internal);
     }
 
-    public void refresh() {
+    public void update() {
         getActivity().setTitle(mStorageManager.getBestVolumeDescription(mVolume));
 
         final Context context = getActivity();
@@ -180,7 +179,7 @@
         }
 
         mStorageManager.registerListener(mStorageListener);
-        refresh();
+        update();
     }
 
     @Override
@@ -197,10 +196,14 @@
         } else if (pref == mUnmount) {
             new UnmountTask(context, mVolume).execute();
         } else if (pref == mFormat) {
-            new FormatTask(context, mVolume).execute();
+            final Intent intent = new Intent(context, StorageWizardFormatConfirm.class);
+            intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+            intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
+            startActivity(intent);
         } else if (pref == mFormatInternal) {
             final Intent intent = new Intent(context, StorageWizardFormatConfirm.class);
             intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+            intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, true);
             startActivity(intent);
         }
 
@@ -212,15 +215,15 @@
         public void onVolumeStateChanged(VolumeInfo vol, int oldState, int newState) {
             if (Objects.equals(mVolume.getId(), vol.getId())) {
                 mVolume = vol;
-                refresh();
+                update();
             }
         }
 
         @Override
-        public void onVolumeMetadataChanged(VolumeInfo vol) {
-            if (Objects.equals(mVolume.getId(), vol.getId())) {
-                mVolume = vol;
-                refresh();
+        public void onVolumeMetadataChanged(String fsUuid) {
+            if (Objects.equals(mVolume.getFsUuid(), fsUuid)) {
+                mVolume = mStorageManager.findVolumeById(mVolumeId);
+                update();
             }
         }
     };
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index 7a7d90d..4c03d8f 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -273,43 +273,6 @@
         }
     }
 
-    public static class FormatTask extends AsyncTask<Void, Void, Exception> {
-        private final Context mContext;
-        private final StorageManager mStorageManager;
-        private final String mVolumeId;
-        private final String mDescription;
-
-        public FormatTask(Context context, VolumeInfo volume) {
-            mContext = context.getApplicationContext();
-            mStorageManager = mContext.getSystemService(StorageManager.class);
-            mVolumeId = volume.getId();
-            mDescription = mStorageManager.getBestVolumeDescription(volume);
-        }
-
-        @Override
-        protected Exception doInBackground(Void... params) {
-            try {
-                mStorageManager.format(mVolumeId);
-                mStorageManager.mount(mVolumeId);
-                return null;
-            } catch (Exception e) {
-                return e;
-            }
-        }
-
-        @Override
-        protected void onPostExecute(Exception e) {
-            if (e == null) {
-                Toast.makeText(mContext, mContext.getString(R.string.storage_format_success,
-                        mDescription), Toast.LENGTH_SHORT).show();
-            } else {
-                Log.e(TAG, "Failed to format " + mVolumeId, e);
-                Toast.makeText(mContext, mContext.getString(R.string.storage_format_failure,
-                        mDescription), Toast.LENGTH_SHORT).show();
-            }
-        }
-    }
-
     /**
      * Enable indexing of searchable data
      */
diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java b/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java
index f4f475f..81073d6 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardFormatConfirm.java
@@ -24,6 +24,10 @@
 import com.android.settings.R;
 
 public class StorageWizardFormatConfirm extends StorageWizardBase {
+    public static final String EXTRA_FORMAT_PRIVATE = "format_private";
+
+    private boolean mFormatPrivate;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -31,9 +35,17 @@
 
         Preconditions.checkNotNull(mDisk);
 
-        setHeaderText(R.string.storage_wizard_format_confirm_title);
-        setBodyText(R.string.storage_wizard_format_confirm_body,
-                mDisk.getDescription());
+        mFormatPrivate = getIntent().getBooleanExtra(EXTRA_FORMAT_PRIVATE, false);
+
+        if (mFormatPrivate) {
+            setHeaderText(R.string.storage_wizard_format_confirm_title);
+            setBodyText(R.string.storage_wizard_format_confirm_body,
+                    mDisk.getDescription());
+        } else {
+            setHeaderText(R.string.storage_wizard_format_confirm_public_title);
+            setBodyText(R.string.storage_wizard_format_confirm_public_body,
+                    mDisk.getDescription());
+        }
 
         // TODO: make this a big red scary button
         getNextButton().setText(R.string.storage_wizard_format_confirm_next);
@@ -43,6 +55,7 @@
     public void onNavigateNext() {
         final Intent intent = new Intent(this, StorageWizardFormatProgress.class);
         intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+        intent.putExtra(EXTRA_FORMAT_PRIVATE, mFormatPrivate);
         startActivity(intent);
         finishAffinity();
     }
diff --git a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
index 2996d45..e60bbcf 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardFormatProgress.java
@@ -31,9 +31,7 @@
 import com.android.settings.R;
 
 public class StorageWizardFormatProgress extends StorageWizardBase {
-    public static final String EXTRA_FORMAT_PUBLIC = "format_private";
-
-    private boolean mFormatPublic;
+    private boolean mFormatPrivate;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -42,7 +40,8 @@
 
         Preconditions.checkNotNull(mDisk);
 
-        mFormatPublic = getIntent().getBooleanExtra(EXTRA_FORMAT_PUBLIC, false);
+        mFormatPrivate = getIntent().getBooleanExtra(
+                StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
 
         setHeaderText(R.string.storage_wizard_format_progress_title, mDisk.getDescription());
         setBodyText(R.string.storage_wizard_format_progress_body, mDisk.getDescription());
@@ -58,10 +57,10 @@
         @Override
         protected Exception doInBackground(Void... params) {
             try {
-                if (mFormatPublic) {
-                    mStorage.partitionPublic(mDisk.getId());
-                } else {
+                if (mFormatPrivate) {
                     mStorage.partitionPrivate(mDisk.getId());
+                } else {
+                    mStorage.partitionPublic(mDisk.getId());
                 }
                 return null;
             } catch (Exception e) {
@@ -73,7 +72,7 @@
         protected void onPostExecute(Exception e) {
             final Context context = StorageWizardFormatProgress.this;
             if (e == null) {
-                if (!mFormatPublic) {
+                if (mFormatPrivate) {
                     // TODO: bring back migration once implemented
 //                    final Intent intent = new Intent(context, StorageWizardMigrate.class);
 //                    intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
@@ -81,6 +80,10 @@
                     final Intent intent = new Intent(context, StorageWizardReady.class);
                     intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
                     startActivity(intent);
+                } else {
+                    final Intent intent = new Intent(context, StorageWizardReady.class);
+                    intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+                    startActivity(intent);
                 }
                 finishAffinity();
 
diff --git a/src/com/android/settings/deviceinfo/StorageWizardInit.java b/src/com/android/settings/deviceinfo/StorageWizardInit.java
index 9d59231..22a8008 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardInit.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardInit.java
@@ -19,6 +19,7 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.storage.DiskInfo;
+import android.os.storage.VolumeInfo;
 import android.widget.CompoundButton;
 import android.widget.CompoundButton.OnCheckedChangeListener;
 import android.widget.RadioButton;
@@ -72,15 +73,26 @@
     @Override
     public void onNavigateNext() {
         if (mRadioExternal.isChecked()) {
-            // Remember that user made decision
-            mStorage.setVolumeInited(mVolume.getId(), true);
+            if (mVolume != null && mVolume.getType() == VolumeInfo.TYPE_PUBLIC) {
+                // Remember that user made decision
+                mStorage.setVolumeInited(mVolume.getFsUuid(), true);
 
-            final Intent intent = new Intent(this, StorageWizardReady.class);
-            intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
-            startActivity(intent);
+                final Intent intent = new Intent(this, StorageWizardReady.class);
+                intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+                startActivity(intent);
+
+            } else {
+                // Gotta format to get there
+                final Intent intent = new Intent(this, StorageWizardFormatConfirm.class);
+                intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+                intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
+                startActivity(intent);
+            }
+
         } else if (mRadioInternal.isChecked()) {
             final Intent intent = new Intent(this, StorageWizardFormatConfirm.class);
             intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
+            intent.putExtra(StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, true);
             startActivity(intent);
         }
     }
diff --git a/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java b/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java
index b0946c5..1202b9e 100644
--- a/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java
+++ b/src/com/android/settings/deviceinfo/StorageWizardMoveProgress.java
@@ -49,7 +49,7 @@
 
         // Register for updates and push through current status
         getPackageManager().registerMoveCallback(mCallback, new Handler());
-        mCallback.onStatusChanged(mMoveId, getPackageManager().getMoveStatus(mMoveId), -1);
+        mCallback.onStatusChanged(mMoveId, null, getPackageManager().getMoveStatus(mMoveId), -1);
     }
 
     @Override
@@ -60,12 +60,7 @@
 
     private final MoveCallback mCallback = new MoveCallback() {
         @Override
-        public void onStarted(int moveId, String title) {
-            // Ignored
-        }
-
-        @Override
-        public void onStatusChanged(int moveId, int status, long estMillis) {
+        public void onStatusChanged(int moveId, String moveTitle, int status, long estMillis) {
             if (mMoveId != moveId) return;
 
             if (PackageManager.isMoveStatusFinished(status)) {
diff --git a/src/com/android/settings/fingerprint/FingerprintEnrollEnrolling.java b/src/com/android/settings/fingerprint/FingerprintEnrollEnrolling.java
index e70c405..6d0d10b 100644
--- a/src/com/android/settings/fingerprint/FingerprintEnrollEnrolling.java
+++ b/src/com/android/settings/fingerprint/FingerprintEnrollEnrolling.java
@@ -17,17 +17,15 @@
 package com.android.settings.fingerprint;
 
 import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
 import android.animation.ObjectAnimator;
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.DialogFragment;
 import android.content.DialogInterface;
 import android.content.Intent;
-import android.hardware.fingerprint.FingerprintManager;
+import android.graphics.drawable.AnimatedVectorDrawable;
 import android.os.Bundle;
-import android.os.CancellationSignal;
-import android.os.PowerManager;
-import android.os.SystemClock;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.animation.AnimationUtils;
@@ -51,6 +49,11 @@
     private static final int FINISH_DELAY = 250;
 
     /**
+     * How long the user needs to touch the icon until we show the dialog.
+     */
+    private static final long ICON_TOUCH_DURATION_UNTIL_DIALOG_SHOWN = 500;
+
+    /**
      * How many times the user needs to touch the icon until we show the dialog that this is not the
      * fingerprint sensor.
      */
@@ -65,6 +68,8 @@
     private Interpolator mFastOutSlowInInterpolator;
     private int mIconTouchCount;
     private FingerprintEnrollSidecar mSidecar;
+    private boolean mAnimationCancelled;
+    private AnimatedVectorDrawable mIconAnimationDrawable;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -76,17 +81,24 @@
         mErrorText = (TextView) findViewById(R.id.error_text);
         mProgressBar = (ProgressBar) findViewById(R.id.fingerprint_progress_bar);
         mFingerprintAnimator = (ImageView) findViewById(R.id.fingerprint_animator);
+        mIconAnimationDrawable = (AnimatedVectorDrawable) mFingerprintAnimator.getDrawable();
+        mIconAnimationDrawable.addListener(mIconAnimationListener);
         mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(
                 this, android.R.interpolator.fast_out_slow_in);
-        findViewById(R.id.fingerprint_animator).setOnTouchListener(new View.OnTouchListener() {
+        mFingerprintAnimator.setOnTouchListener(new View.OnTouchListener() {
             @Override
             public boolean onTouch(View v, MotionEvent event) {
                 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                     mIconTouchCount++;
                     if (mIconTouchCount == ICON_TOUCH_COUNT_SHOW_UNTIL_DIALOG_SHOWN) {
                         showIconTouchDialog();
-                        mIconTouchCount = 0;
+                    } else {
+                        mFingerprintAnimator.postDelayed(mShowDialogRunnable,
+                                ICON_TOUCH_DURATION_UNTIL_DIALOG_SHOWN);
                     }
+                } else if (event.getActionMasked() == MotionEvent.ACTION_CANCEL
+                        || event.getActionMasked() == MotionEvent.ACTION_UP) {
+                    mFingerprintAnimator.removeCallbacks(mShowDialogRunnable);
                 }
                 return true;
             }
@@ -102,18 +114,31 @@
             getFragmentManager().beginTransaction().add(mSidecar, TAG_SIDECAR).commit();
         }
         mSidecar.setListener(this);
-        if (mSidecar.isDone()) {
-            launchFinish(mToken);
-        } else {
-            updateProgress(false /* animate */);
-            updateDescription();
-        }
+        updateProgress(false /* animate */);
+        updateDescription();
+    }
+
+    @Override
+    public void onEnterAnimationComplete() {
+        super.onEnterAnimationComplete();
+        mAnimationCancelled = false;
+        startIconAnimation();
+    }
+
+    private void startIconAnimation() {
+        mIconAnimationDrawable.start();
+    }
+
+    private void stopIconAnimation() {
+        mAnimationCancelled = true;
+        mIconAnimationDrawable.stop();
     }
 
     @Override
     protected void onStop() {
         super.onStop();
         mSidecar.setListener(null);
+        stopIconAnimation();
     }
 
     private void animateProgress(int progress) {
@@ -187,6 +212,7 @@
     }
 
     private void showIconTouchDialog() {
+        mIconTouchCount = 0;
         new IconTouchDialog().show(getFragmentManager(), null /* tag */);
     }
 
@@ -211,13 +237,37 @@
     };
 
     // Give the user a chance to see progress completed before jumping to the next stage.
-    Runnable mDelayedFinishRunnable = new Runnable() {
+    private final Runnable mDelayedFinishRunnable = new Runnable() {
         @Override
         public void run() {
             launchFinish(mToken);
         }
     };
 
+    private final Animator.AnimatorListener mIconAnimationListener = new AnimatorListenerAdapter() {
+        @Override
+        public void onAnimationEnd(Animator animation) {
+            if (mAnimationCancelled) {
+                return;
+            }
+
+            // Start animation after it has ended.
+            mFingerprintAnimator.post(new Runnable() {
+                @Override
+                public void run() {
+                    startIconAnimation();
+                }
+            });
+        }
+    };
+
+    private final Runnable mShowDialogRunnable = new Runnable() {
+        @Override
+        public void run() {
+            showIconTouchDialog();
+        }
+    };
+
     private static class IconTouchDialog extends DialogFragment {
 
         @Override
diff --git a/src/com/android/settings/nfc/NfcForegroundPreference.java b/src/com/android/settings/nfc/NfcForegroundPreference.java
new file mode 100644
index 0000000..4f4398f
--- /dev/null
+++ b/src/com/android/settings/nfc/NfcForegroundPreference.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+package com.android.settings.nfc;
+
+import android.content.Context;
+import com.android.settings.DropDownPreference;
+import com.android.settings.R;
+
+public class NfcForegroundPreference extends DropDownPreference implements
+        DropDownPreference.Callback, PaymentBackend.Callback {
+
+    private final PaymentBackend mPaymentBackend;
+    public NfcForegroundPreference(Context context, PaymentBackend backend) {
+        super(context);
+        mPaymentBackend = backend;
+        mPaymentBackend.registerCallback(this);
+        setCallback(this);
+        refresh();
+    }
+
+    @Override
+    public void onPaymentAppsChanged() {
+        refresh();
+    }
+
+    void refresh() {
+        PaymentBackend.PaymentAppInfo defaultApp = mPaymentBackend.getDefaultApp();
+        boolean foregroundMode = mPaymentBackend.isForegroundMode();
+        setPersistent(false);
+        setTitle(getContext().getString(R.string.nfc_payment_open_app));
+        CharSequence favorOpen;
+        CharSequence favorDefault;
+        clearItems();
+        if (defaultApp == null) {
+            favorOpen = getContext().getString(R.string.nfc_payment_favor_open_default_unknown);
+            favorDefault = getContext().getString(R.string.nfc_payment_favor_default_default_unknown);
+        } else {
+            favorOpen = getContext().getString(R.string.nfc_payment_favor_open, defaultApp.label);
+            favorDefault = getContext().getString(R.string.nfc_payment_favor_default, defaultApp.label);
+        }
+        addItem(favorOpen.toString(), true);
+        addItem(favorDefault.toString(), false);
+        if (foregroundMode) {
+            setSelectedValue(true);
+        } else {
+            setSelectedValue(false);
+        }
+    }
+
+    @Override
+    public boolean onItemSelected(int pos, Object value) {
+        mPaymentBackend.setForegroundMode((Boolean) value);
+        return true;
+    }
+}
diff --git a/src/com/android/settings/nfc/NfcPaymentPreference.java b/src/com/android/settings/nfc/NfcPaymentPreference.java
new file mode 100644
index 0000000..e24a651
--- /dev/null
+++ b/src/com/android/settings/nfc/NfcPaymentPreference.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+package com.android.settings.nfc;
+
+import android.app.AlertDialog;
+import android.content.ActivityNotFoundException;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.preference.DialogPreference;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.CompoundButton;
+import android.widget.ImageView;
+import android.widget.RadioButton;
+import com.android.settings.R;
+import com.android.settings.nfc.PaymentBackend.PaymentAppInfo;
+
+import java.util.List;
+
+public class NfcPaymentPreference extends DialogPreference implements
+        DialogInterface.OnClickListener, PaymentBackend.Callback, View.OnClickListener {
+
+    private static final String TAG = "NfcPaymentPreference";
+
+    private final NfcPaymentAdapter mAdapter;
+    private final Context mContext;
+    private final LayoutInflater mLayoutInflater;
+    private final PaymentBackend mPaymentBackend;
+
+    // Fields below only modified on UI thread
+    private ImageView mSettingsButtonView;
+
+    public NfcPaymentPreference(Context context, PaymentBackend backend) {
+        super(context, null);
+        mPaymentBackend = backend;
+        mContext = context;
+        backend.registerCallback(this);
+        mAdapter = new NfcPaymentAdapter();
+        setDialogTitle(context.getString(R.string.nfc_payment_pay_with));
+        mLayoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        setWidgetLayoutResource(R.layout.preference_widget_settings);
+
+        refresh();
+    }
+
+    @Override
+    protected void onBindView(View view) {
+        super.onBindView(view);
+
+        mSettingsButtonView = (ImageView) view.findViewById(R.id.settings_button);
+        mSettingsButtonView.setOnClickListener(this);
+
+        updateSettingsVisibility();
+    }
+
+    /**
+     * MUST be called on UI thread.
+     */
+    public void refresh() {
+        List<PaymentAppInfo> appInfos = mPaymentBackend.getPaymentAppInfos();
+        PaymentAppInfo defaultApp = mPaymentBackend.getDefaultApp();
+        if (appInfos != null) {
+            PaymentAppInfo[] apps = appInfos.toArray(new PaymentAppInfo[appInfos.size()]);
+            mAdapter.updateApps(apps, defaultApp);
+        }
+        setTitle(R.string.nfc_payment_default);
+        if (defaultApp != null) {
+            setSummary(mContext.getString(R.string.nfc_payment_app_and_desc,
+                    defaultApp.label, defaultApp.description));
+        } else {
+            setSummary(mContext.getString(R.string.nfc_payment_default_not_set));
+        }
+        updateSettingsVisibility();
+    }
+
+    @Override
+    protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
+        super.onPrepareDialogBuilder(builder);
+
+        builder.setSingleChoiceItems(mAdapter, 0, this);
+    }
+
+    @Override
+    public void onPaymentAppsChanged() {
+        refresh();
+    }
+
+    @Override
+    public void onClick(View view) {
+        PaymentAppInfo defaultAppInfo = mPaymentBackend.getDefaultApp();
+        if (defaultAppInfo != null && defaultAppInfo.settingsComponent != null) {
+            Intent settingsIntent = new Intent(Intent.ACTION_MAIN);
+            settingsIntent.setComponent(defaultAppInfo.settingsComponent);
+            settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            try {
+                mContext.startActivity(settingsIntent);
+            } catch (ActivityNotFoundException e) {
+                Log.e(TAG, "Settings activity not found.");
+            }
+        }
+    }
+
+    void updateSettingsVisibility() {
+        if (mSettingsButtonView != null) {
+            PaymentAppInfo defaultApp = mPaymentBackend.getDefaultApp();
+            if (defaultApp == null || defaultApp.settingsComponent == null) {
+                mSettingsButtonView.setVisibility(View.GONE);
+            } else {
+                mSettingsButtonView.setVisibility(View.VISIBLE);
+
+            }
+        }
+    }
+
+    class NfcPaymentAdapter extends BaseAdapter implements CompoundButton.OnCheckedChangeListener,
+            View.OnClickListener {
+        // Only modified on UI thread
+        private PaymentAppInfo[] appInfos;
+
+        public NfcPaymentAdapter() {
+        }
+
+        public void updateApps(PaymentAppInfo[] appInfos, PaymentAppInfo currentDefault) {
+            // Clone app infos, only add those with a banner
+            this.appInfos = appInfos;
+            notifyDataSetChanged();
+        }
+
+        @Override
+        public int getCount() {
+            return appInfos.length;
+        }
+
+        @Override
+        public PaymentAppInfo getItem(int i) {
+            return appInfos[i];
+        }
+
+        @Override
+        public long getItemId(int i) {
+            return appInfos[i].componentName.hashCode();
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            ViewHolder holder;
+            PaymentAppInfo appInfo = appInfos[position];
+            if (convertView == null) {
+                convertView = mLayoutInflater.inflate(
+                        R.layout.nfc_payment_option, parent, false);
+                holder = new ViewHolder();
+                holder.imageView = (ImageView) convertView.findViewById(R.id.banner);
+                holder.radioButton = (RadioButton) convertView.findViewById(R.id.button);
+                convertView.setTag(holder);
+            } else {
+                holder = (ViewHolder) convertView.getTag();
+            }
+            holder.imageView.setImageDrawable(appInfo.banner);
+            holder.imageView.setTag(appInfo);
+            holder.imageView.setOnClickListener(this);
+
+            // Prevent checked callback getting called on recycled views
+            holder.radioButton.setOnCheckedChangeListener(null);
+            holder.radioButton.setChecked(appInfo.isDefault);
+            holder.radioButton.setOnCheckedChangeListener(this);
+            holder.radioButton.setTag(appInfo);
+            return convertView;
+        }
+
+        public class ViewHolder {
+            public ImageView imageView;
+            public RadioButton radioButton;
+        }
+
+        @Override
+        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
+            PaymentAppInfo appInfo = (PaymentAppInfo) compoundButton.getTag();
+            makeDefault(appInfo);
+        }
+
+        @Override
+        public void onClick(View view) {
+            PaymentAppInfo appInfo = (PaymentAppInfo) view.getTag();
+            makeDefault(appInfo);
+        }
+
+        void makeDefault(PaymentAppInfo appInfo) {
+            if (!appInfo.isDefault) {
+                mPaymentBackend.setDefaultPaymentApp(appInfo.componentName);
+            }
+            getDialog().dismiss();
+        }
+    }
+}
diff --git a/src/com/android/settings/nfc/PaymentBackend.java b/src/com/android/settings/nfc/PaymentBackend.java
index 25572a7..52e3f7e 100644
--- a/src/com/android/settings/nfc/PaymentBackend.java
+++ b/src/com/android/settings/nfc/PaymentBackend.java
@@ -16,15 +16,22 @@
 
 package com.android.settings.nfc;
 
-import android.content.ComponentName;
-import android.content.Context;
+import android.app.Activity;
+import android.content.*;
 import android.content.pm.PackageManager;
+import android.content.res.Resources;
 import android.graphics.drawable.Drawable;
 import android.nfc.NfcAdapter;
 import android.nfc.cardemulation.ApduServiceInfo;
 import android.nfc.cardemulation.CardEmulation;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.UserHandle;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
+import android.util.Log;
+import com.android.internal.content.PackageMonitor;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -32,47 +39,135 @@
 public class PaymentBackend {
     public static final String TAG = "Settings.PaymentBackend";
 
+    public interface Callback {
+        void onPaymentAppsChanged();
+    }
+
     public static class PaymentAppInfo {
-        CharSequence caption;
+        CharSequence label;
+        CharSequence description;
         Drawable banner;
         boolean isDefault;
         public ComponentName componentName;
+        public ComponentName settingsComponent;
     }
 
     private final Context mContext;
     private final NfcAdapter mAdapter;
     private final CardEmulation mCardEmuManager;
+    private final PackageMonitor mSettingsPackageMonitor = new SettingsPackageMonitor();
+    // Fields below only modified on UI thread
+    private ArrayList<PaymentAppInfo> mAppInfos;
+    private PaymentAppInfo mDefaultAppInfo;
+    private ArrayList<Callback> mCallbacks = new ArrayList<Callback>();
 
     public PaymentBackend(Context context) {
         mContext = context;
 
         mAdapter = NfcAdapter.getDefaultAdapter(context);
         mCardEmuManager = CardEmulation.getInstance(mAdapter);
+        refresh();
     }
 
-    public List<PaymentAppInfo> getPaymentAppInfos() {
+    public void onPause() {
+        mSettingsPackageMonitor.unregister();
+        mContext.unregisterReceiver(mReceiver);
+    }
+
+    public void onResume() {
+        mSettingsPackageMonitor.register(mContext, mContext.getMainLooper(), false);
+        // Register broadcast receiver for dynamic resource updates
+        IntentFilter filter = new IntentFilter(CardEmulation.ACTION_REQUEST_SERVICE_RESOURCES);
+        mContext.registerReceiver(mReceiver, filter);
+    }
+
+    public void refresh() {
         PackageManager pm = mContext.getPackageManager();
         List<ApduServiceInfo> serviceInfos =
                 mCardEmuManager.getServices(CardEmulation.CATEGORY_PAYMENT);
-        List<PaymentAppInfo> appInfos = new ArrayList<PaymentAppInfo>();
+        ArrayList<PaymentAppInfo> appInfos = new ArrayList<PaymentAppInfo>();
 
-        if (serviceInfos == null) return appInfos;
-
-        ComponentName defaultApp = getDefaultPaymentApp();
-
-        for (ApduServiceInfo service : serviceInfos) {
-            PaymentAppInfo appInfo = new PaymentAppInfo();
-            appInfo.banner = service.loadBanner(pm);
-            appInfo.caption = service.getDescription();
-            if (appInfo.caption == null) {
-                appInfo.caption = service.loadLabel(pm);
-            }
-            appInfo.isDefault = service.getComponent().equals(defaultApp);
-            appInfo.componentName = service.getComponent();
-            appInfos.add(appInfo);
+        if (serviceInfos == null) {
+            makeCallbacks();
+            return;
         }
 
-        return appInfos;
+        ComponentName defaultAppName = getDefaultPaymentApp();
+        PaymentAppInfo foundDefaultApp = null;
+        for (ApduServiceInfo service : serviceInfos) {
+            PaymentAppInfo appInfo = new PaymentAppInfo();
+            appInfo.label = service.loadLabel(pm);
+            if (appInfo.label == null) {
+                appInfo.label = service.loadAppLabel(pm);
+            }
+            appInfo.isDefault = service.getComponent().equals(defaultAppName);
+            if (appInfo.isDefault) {
+                foundDefaultApp = appInfo;
+            }
+            appInfo.componentName = service.getComponent();
+            String settingsActivity = service.getSettingsActivityName();
+            if (settingsActivity != null) {
+                appInfo.settingsComponent = new ComponentName(appInfo.componentName.getPackageName(),
+                        settingsActivity);
+            } else {
+                appInfo.settingsComponent = null;
+            }
+            if (service.hasDynamicResources()) {
+                appInfo.description = "";
+                appInfo.banner = null;
+                sendBroadcastForResources(appInfo);
+            } else {
+                appInfo.description = service.getDescription();
+                appInfo.banner = service.loadBanner(pm);
+            }
+            appInfos.add(appInfo);
+        }
+        mAppInfos = appInfos;
+        mDefaultAppInfo = foundDefaultApp;
+        makeCallbacks();
+    }
+
+    public void registerCallback(Callback callback) {
+        mCallbacks.add(callback);
+    }
+
+    public void unregisterCallback(Callback callback) {
+        mCallbacks.remove(callback);
+    }
+
+    public List<PaymentAppInfo> getPaymentAppInfos() {
+        return mAppInfos;
+    }
+
+    public PaymentAppInfo getDefaultApp() {
+        return mDefaultAppInfo;
+    }
+
+    void makeCallbacks() {
+        for (Callback callback : mCallbacks) {
+            callback.onPaymentAppsChanged();
+        }
+    }
+
+    Drawable loadDrawableForPackage(String pkgName, int drawableResId) {
+        PackageManager pm = mContext.getPackageManager();
+        try {
+            Resources res = pm.getResourcesForApplication(pkgName);
+            Drawable banner = res.getDrawable(drawableResId);
+            return banner;
+        } catch (Resources.NotFoundException e) {
+            return null;
+        } catch (PackageManager.NameNotFoundException e) {
+            return null;
+        }
+    }
+
+    void sendBroadcastForResources(PaymentAppInfo appInfo) {
+        Intent broadcastIntent = new Intent(CardEmulation.ACTION_REQUEST_SERVICE_RESOURCES);
+        broadcastIntent.setPackage(appInfo.componentName.getPackageName());
+        broadcastIntent.putExtra(CardEmulation.EXTRA_SERVICE_COMPONENT, appInfo.componentName);
+        mContext.sendOrderedBroadcastAsUser(broadcastIntent, UserHandle.CURRENT,
+                null, mReceiver, null, Activity.RESULT_OK, null, null);
     }
 
     boolean isForegroundMode() {
@@ -103,5 +198,66 @@
         Settings.Secure.putString(mContext.getContentResolver(),
                 Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT,
                 app != null ? app.flattenToString() : null);
+        refresh();
+    }
+
+    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            Bundle results = getResultExtras(false);
+            if (results != null) {
+                String desc = results.getString(CardEmulation.EXTRA_DESCRIPTION);
+                int resId = results.getInt(CardEmulation.EXTRA_BANNER_RES_ID, -1);
+                // Find corresponding component
+                PaymentAppInfo matchingAppInfo = null;
+                for (PaymentAppInfo appInfo : mAppInfos) {
+                    if (appInfo.componentName.equals(
+                            intent.getParcelableExtra(CardEmulation.EXTRA_SERVICE_COMPONENT))) {
+                        matchingAppInfo = appInfo;
+                    }
+                }
+                if (matchingAppInfo != null && (desc != null || resId != -1)) {
+                    if (desc != null) {
+                        matchingAppInfo.description = desc;
+                    }
+                    if (resId != -1) {
+                        matchingAppInfo.banner = loadDrawableForPackage(
+                                matchingAppInfo.componentName.getPackageName(), resId);
+                    }
+                    makeCallbacks();
+                }
+            } else {
+                Log.e(TAG, "Didn't find results extra.");
+            }
+
+        }
+    };
+    private final Handler mHandler = new Handler() {
+        @Override
+        public void dispatchMessage(Message msg) {
+            refresh();
+        }
+    };
+
+    private class SettingsPackageMonitor extends PackageMonitor {
+        @Override
+        public void onPackageAdded(String packageName, int uid) {
+            mHandler.obtainMessage().sendToTarget();
+        }
+
+        @Override
+        public void onPackageAppeared(String packageName, int reason) {
+            mHandler.obtainMessage().sendToTarget();
+        }
+
+        @Override
+        public void onPackageDisappeared(String packageName, int reason) {
+            mHandler.obtainMessage().sendToTarget();
+        }
+
+        @Override
+        public void onPackageRemoved(String packageName, int uid) {
+            mHandler.obtainMessage().sendToTarget();
+        }
     }
 }
\ No newline at end of file
diff --git a/src/com/android/settings/nfc/PaymentDefaultDialog.java b/src/com/android/settings/nfc/PaymentDefaultDialog.java
index 33ac947..949f87d 100644
--- a/src/com/android/settings/nfc/PaymentDefaultDialog.java
+++ b/src/com/android/settings/nfc/PaymentDefaultDialog.java
@@ -111,13 +111,13 @@
         if (defaultPaymentApp == null) {
             String formatString = getString(R.string.nfc_payment_set_default);
             String msg = String.format(formatString,
-                    sanitizePaymentAppCaption(requestedPaymentApp.caption.toString()));
+                    sanitizePaymentAppCaption(requestedPaymentApp.label.toString()));
             p.mMessage = msg;
         } else {
             String formatString = getString(R.string.nfc_payment_set_default_instead_of);
             String msg = String.format(formatString,
-                    sanitizePaymentAppCaption(requestedPaymentApp.caption.toString()),
-                    sanitizePaymentAppCaption(defaultPaymentApp.caption.toString()));
+                    sanitizePaymentAppCaption(requestedPaymentApp.label.toString()),
+                    sanitizePaymentAppCaption(defaultPaymentApp.label.toString()));
             p.mMessage = msg;
         }
         p.mPositiveButtonText = getString(R.string.yes);
diff --git a/src/com/android/settings/nfc/PaymentSettings.java b/src/com/android/settings/nfc/PaymentSettings.java
index 4f04d73..ca38d92 100644
--- a/src/com/android/settings/nfc/PaymentSettings.java
+++ b/src/com/android/settings/nfc/PaymentSettings.java
@@ -16,47 +16,24 @@
 
 package com.android.settings.nfc;
 
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
 import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.preference.Preference;
-import android.preference.Preference.OnPreferenceChangeListener;
 import android.preference.PreferenceManager;
 import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
-import android.view.View.OnClickListener;
 import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.RadioButton;
-import android.widget.TextView;
-
-import com.android.internal.content.PackageMonitor;
 import com.android.internal.logging.MetricsLogger;
-import com.android.settings.HelpUtils;
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.nfc.PaymentBackend.PaymentAppInfo;
 
 import java.util.List;
 
-public class PaymentSettings extends SettingsPreferenceFragment implements
-        OnClickListener, OnPreferenceChangeListener {
+public class PaymentSettings extends SettingsPreferenceFragment {
     public static final String TAG = "PaymentSettings";
-    private LayoutInflater mInflater;
     private PaymentBackend mPaymentBackend;
-    private final PackageMonitor mSettingsPackageMonitor = new SettingsPackageMonitor();
-
 
     @Override
     protected int getMetricsCategory() {
@@ -68,180 +45,50 @@
         super.onCreate(icicle);
 
         mPaymentBackend = new PaymentBackend(getActivity());
-        mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         setHasOptionsMenu(true);
     }
 
-    public void refresh() {
+    @Override
+    public void onViewCreated(View view, Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+        ViewGroup contentRoot = (ViewGroup) getListView().getParent();
+        View emptyView = getActivity().getLayoutInflater().inflate(
+                R.layout.nfc_payment_empty, contentRoot, false);
+        contentRoot.addView(emptyView);
+        getListView().setEmptyView(emptyView);
+
         PreferenceManager manager = getPreferenceManager();
         PreferenceScreen screen = manager.createPreferenceScreen(getActivity());
 
-        // Get all payment services
         List<PaymentAppInfo> appInfos = mPaymentBackend.getPaymentAppInfos();
         if (appInfos != null && appInfos.size() > 0) {
-            // Add all payment apps
-            for (PaymentAppInfo appInfo : appInfos) {
-                PaymentAppPreference preference =
-                        new PaymentAppPreference(getActivity(), appInfo, this);
-                preference.setTitle(appInfo.caption);
-                if (appInfo.banner != null) {
-                    screen.addPreference(preference);
-                } else {
-                    // Ignore, no banner
-                    Log.e(TAG, "Couldn't load banner drawable of service " + appInfo.componentName);
-                }
-            }
-        }
-        TextView emptyText = (TextView) getView().findViewById(R.id.nfc_payment_empty_text);
-        TextView learnMore = (TextView) getView().findViewById(R.id.nfc_payment_learn_more);
-        ImageView emptyImage = (ImageView) getView().findViewById(R.id.nfc_payment_tap_image);
-        if (screen.getPreferenceCount() == 0) {
-            emptyText.setVisibility(View.VISIBLE);
-            learnMore.setVisibility(View.VISIBLE);
-            emptyImage.setVisibility(View.VISIBLE);
-            getListView().setVisibility(View.GONE);
-        } else {
-            SwitchPreference foreground = new SwitchPreference(getActivity());
-            boolean foregroundMode = mPaymentBackend.isForegroundMode();
-            foreground.setPersistent(false);
-            foreground.setTitle(getString(R.string.nfc_payment_favor_foreground));
-            foreground.setChecked(foregroundMode);
-            foreground.setOnPreferenceChangeListener(this);
+            NfcPaymentPreference preference =
+                    new NfcPaymentPreference(getActivity(), mPaymentBackend);
+            screen.addPreference(preference);
+            NfcForegroundPreference foreground = new NfcForegroundPreference(getActivity(),
+                    mPaymentBackend);
             screen.addPreference(foreground);
-            emptyText.setVisibility(View.GONE);
-            learnMore.setVisibility(View.GONE);
-            emptyImage.setVisibility(View.GONE);
-            getListView().setVisibility(View.VISIBLE);
         }
         setPreferenceScreen(screen);
     }
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-            Bundle savedInstanceState) {
-        super.onCreateView(inflater, container, savedInstanceState);
-        View v = mInflater.inflate(R.layout.nfc_payment, container, false);
-        TextView learnMore = (TextView) v.findViewById(R.id.nfc_payment_learn_more);
-        learnMore.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                String helpUrl;
-                if (!TextUtils.isEmpty(helpUrl = getResources().getString(
-                        R.string.help_url_nfc_payment))) {
-                    final Uri fullUri = HelpUtils.uriWithAddedParameters(
-                            PaymentSettings.this.getActivity(), Uri.parse(helpUrl));
-                    Intent intent = new Intent(Intent.ACTION_VIEW, fullUri);
-                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
-                            | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
-                    startActivity(intent);
-                } else {
-                    Log.e(TAG, "Help url not set.");
-                }
-            }
-        });
-        return v;
-    }
-
-    @Override
-    public void onClick(View v) {
-        if (v.getTag() instanceof PaymentAppInfo) {
-            PaymentAppInfo appInfo = (PaymentAppInfo) v.getTag();
-            if (appInfo.componentName != null) {
-                mPaymentBackend.setDefaultPaymentApp(appInfo.componentName);
-            }
-            refresh();
-        }
-    }
-
-    @Override
     public void onResume() {
         super.onResume();
-        mSettingsPackageMonitor.register(getActivity(), getActivity().getMainLooper(), false);
-        refresh();
+        mPaymentBackend.onResume();
     }
 
     @Override
     public void onPause() {
-        mSettingsPackageMonitor.unregister();
         super.onPause();
+        mPaymentBackend.onPause();
     }
 
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
-        String searchUri = Settings.Secure.getString(getContentResolver(),
-                Settings.Secure.PAYMENT_SERVICE_SEARCH_URI);
-        if (!TextUtils.isEmpty(searchUri)) {
-            MenuItem menuItem = menu.add(R.string.nfc_payment_menu_item_add_service);
-            menuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_IF_ROOM);
-            menuItem.setIntent(new Intent(Intent.ACTION_VIEW,Uri.parse(searchUri)));
-        }
-    }
-
-    private final Handler mHandler = new Handler() {
-        @Override
-        public void dispatchMessage(Message msg) {
-            refresh();
-        }
-    };
-
-    private class SettingsPackageMonitor extends PackageMonitor {
-        @Override
-        public void onPackageAdded(String packageName, int uid) {
-           mHandler.obtainMessage().sendToTarget();
-        }
-
-        @Override
-        public void onPackageAppeared(String packageName, int reason) {
-            mHandler.obtainMessage().sendToTarget();
-        }
-
-        @Override
-        public void onPackageDisappeared(String packageName, int reason) {
-            mHandler.obtainMessage().sendToTarget();
-        }
-
-        @Override
-        public void onPackageRemoved(String packageName, int uid) {
-            mHandler.obtainMessage().sendToTarget();
-        }
-    }
-
-    public static class PaymentAppPreference extends Preference {
-        private final OnClickListener listener;
-        private final PaymentAppInfo appInfo;
-
-        public PaymentAppPreference(Context context, PaymentAppInfo appInfo,
-                OnClickListener listener) {
-            super(context);
-            setLayoutResource(R.layout.nfc_payment_option);
-            this.appInfo = appInfo;
-            this.listener = listener;
-        }
-
-        @Override
-        protected void onBindView(View view) {
-            super.onBindView(view);
-
-            RadioButton radioButton = (RadioButton) view.findViewById(android.R.id.button1);
-            radioButton.setChecked(appInfo.isDefault);
-            radioButton.setOnClickListener(listener);
-            radioButton.setTag(appInfo);
-
-            ImageView banner = (ImageView) view.findViewById(R.id.banner);
-            banner.setImageDrawable(appInfo.banner);
-            banner.setOnClickListener(listener);
-            banner.setTag(appInfo);
-        }
-    }
-
-    @Override
-    public boolean onPreferenceChange(Preference preference, Object newValue) {
-        if (preference instanceof SwitchPreference) {
-            mPaymentBackend.setForegroundMode(((Boolean) newValue).booleanValue());
-            return true;
-        } else {
-            return false;
-        }
+        MenuItem menuItem = menu.add(R.string.nfc_payment_how_it_works);
+        menuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
+        // TODO link to tutorial screen
     }
 }
diff --git a/src/com/android/settings/notification/AppNotificationSettings.java b/src/com/android/settings/notification/AppNotificationSettings.java
index 129c359..883975a 100644
--- a/src/com/android/settings/notification/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/AppNotificationSettings.java
@@ -26,6 +26,7 @@
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.ResolveInfo;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.preference.SwitchPreference;
@@ -191,7 +192,8 @@
     }
 
     private void updateDependents(boolean banned) {
-        final boolean lockscreenSecure = new LockPatternUtils(getActivity()).isSecure();
+        final boolean lockscreenSecure = new LockPatternUtils(getActivity()).isSecure(
+                UserHandle.myUserId());
         final boolean lockscreenNotificationsEnabled = getLockscreenNotificationsEnabled();
         final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
 
diff --git a/src/com/android/settings/notification/NotificationSettings.java b/src/com/android/settings/notification/NotificationSettings.java
index 581b707..cdff32f 100644
--- a/src/com/android/settings/notification/NotificationSettings.java
+++ b/src/com/android/settings/notification/NotificationSettings.java
@@ -36,6 +36,7 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
+import android.os.UserHandle;
 import android.os.Vibrator;
 import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
@@ -116,7 +117,7 @@
         mContext = getActivity();
         mPM = mContext.getPackageManager();
         mVoiceCapable = Utils.isVoiceCapable(mContext);
-        mSecure = new LockPatternUtils(getActivity()).isSecure();
+        mSecure = new LockPatternUtils(getActivity()).isSecure(UserHandle.myUserId());
 
         mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
         mVibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index f3b60fc..cef0833 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -357,7 +357,7 @@
 
     private boolean hasLockscreenSecurity() {
         LockPatternUtils lpu = new LockPatternUtils(getActivity());
-        return lpu.isLockPasswordEnabled() || lpu.isLockPatternEnabled();
+        return lpu.isSecure(UserHandle.myUserId());
     }
 
     private void launchChooseLockscreen() {