Add background image for work challenge

If the challenge shown is for a work profile, add the default image and
color to the background of the fragment.

Change-Id: I148c6cd3a835a84c7bac78b020839dfdae4a6c36
diff --git a/res/drawable-nodpi/work_challenge_background.png b/res/drawable-nodpi/work_challenge_background.png
new file mode 100644
index 0000000..d38668f
--- /dev/null
+++ b/res/drawable-nodpi/work_challenge_background.png
Binary files differ
diff --git a/res/layout-land/confirm_lock_password.xml b/res/layout-land/confirm_lock_password.xml
index 0d46bfa..dff4e4d 100644
--- a/res/layout-land/confirm_lock_password.xml
+++ b/res/layout-land/confirm_lock_password.xml
@@ -13,81 +13,89 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<LinearLayout
+<FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/topLayout"
-    android:orientation="vertical"
-    android:layout_width="wrap_content"
-    android:layout_height="match_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
 
-    <TextView
-        style="@android:style/TextAppearance.Material.Title"
-        android:id="@+id/headerText"
-        android:layout_marginStart="24dp"
-        android:layout_marginEnd="24dp"
-        android:layout_marginTop="12dp"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textColor="?android:attr/colorAccent"/>
+    <include layout="@layout/confirm_lock_background_base" />
 
-    <TextView
-        style="@android:style/TextAppearance.Material.Body1"
-        android:id="@+id/detailsText"
-        android:layout_marginStart="24dp"
-        android:layout_marginEnd="24dp"
-        android:layout_marginTop="8dp"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        />
-
-    <View
+    <LinearLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/topLayout"
+        android:orientation="vertical"
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1"/>
+        android:layout_height="match_parent">
 
-    <FrameLayout
-        android:layout_height="wrap_content"
-        android:layout_width="match_parent"
-        android:orientation="horizontal">
-
-        <Button
-            style="@android:style/Widget.Material.Button.Borderless"
-            android:id="@+id/cancelButton"
+        <TextView
+            style="@android:style/TextAppearance.Material.Title"
+            android:id="@+id/headerText"
+            android:layout_marginStart="24dp"
+            android:layout_marginEnd="24dp"
+            android:layout_marginTop="12dp"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="start|bottom"
-            android:text="@string/cancel"
-            android:layout_marginStart="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginBottom="14dp"/>
+            android:textColor="?android:attr/colorAccent"/>
 
-        <EditText android:id="@+id/password_entry"
-            android:layout_width="208dp"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal|bottom"
-            android:layout_marginBottom="26dp"
-            android:inputType="textPassword"
-            android:imeOptions="actionNext|flagNoFullscreen"
-            android:gravity="center"
-            android:textSize="16sp"
-            style="@style/TextAppearance.PasswordEntry"/>
-
-        <TextView style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
-            android:accessibilityLiveRegion="polite"
-            android:id="@+id/errorText"
+        <TextView
+            style="@android:style/TextAppearance.Material.Body1"
+            android:id="@+id/detailsText"
+            android:layout_marginStart="24dp"
+            android:layout_marginEnd="24dp"
+            android:layout_marginTop="8dp"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal|bottom"
-            android:layout_marginBottom="10dp"/>
+            />
 
-        <ImageView
-            android:id="@+id/fingerprintIcon"
-            android:layout_gravity="end|bottom"
-            android:layout_width="wrap_content"
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1"/>
+
+        <FrameLayout
             android:layout_height="wrap_content"
-            android:layout_marginBottom="28dp"
-            android:layout_marginEnd="20dp"
-            android:visibility="gone"/>
-    </FrameLayout>
+            android:layout_width="match_parent"
+            android:orientation="horizontal">
 
-</LinearLayout>
\ No newline at end of file
+            <Button
+                style="@android:style/Widget.Material.Button.Borderless"
+                android:id="@+id/cancelButton"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="start|bottom"
+                android:text="@string/cancel"
+                android:layout_marginStart="8dp"
+                android:layout_marginEnd="8dp"
+                android:layout_marginBottom="14dp"/>
+
+            <EditText android:id="@+id/password_entry"
+                android:layout_width="208dp"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_horizontal|bottom"
+                android:layout_marginBottom="26dp"
+                android:inputType="textPassword"
+                android:imeOptions="actionNext|flagNoFullscreen"
+                android:gravity="center"
+                android:textSize="16sp"
+                style="@style/TextAppearance.PasswordEntry"/>
+
+            <TextView style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
+                android:accessibilityLiveRegion="polite"
+                android:id="@+id/errorText"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center_horizontal|bottom"
+                android:layout_marginBottom="10dp"/>
+
+            <ImageView
+                android:id="@+id/fingerprintIcon"
+                android:layout_gravity="end|bottom"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginBottom="28dp"
+                android:layout_marginEnd="20dp"
+                android:visibility="gone"/>
+        </FrameLayout>
+
+    </LinearLayout>
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout-land/confirm_lock_pattern.xml b/res/layout-land/confirm_lock_pattern.xml
index 329f52a..81f257e 100644
--- a/res/layout-land/confirm_lock_pattern.xml
+++ b/res/layout-land/confirm_lock_pattern.xml
@@ -13,103 +13,110 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+<FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/topLayout"
-    android:orientation="horizontal"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:clipChildren="false"
-    android:clipToPadding="false">
+    android:layout_height="match_parent" >
 
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_vertical"
-        android:layout_weight="1"
-        android:orientation="vertical">
+    <include layout="@layout/confirm_lock_background_base" />
 
-        <TextView
-            style="@android:style/TextAppearance.Material.Headline"
-            android:id="@+id/headerText"
-            android:layout_marginStart="32dp"
-            android:layout_marginEnd="32dp"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="?android:attr/colorAccent"/>
-
-        <TextView
-            style="@android:style/TextAppearance.Material.Body1"
-            android:id="@+id/detailsText"
-            android:layout_marginStart="32dp"
-            android:layout_marginEnd="32dp"
-            android:layout_marginTop="12dp"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"/>
-
-        <Button
-            style="@android:style/Widget.Material.Button.Borderless"
-            android:id="@+id/cancelButton"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:text="@string/cancel"
-            android:layout_marginStart="16dp"
-            android:layout_marginEnd="16dp"
-            android:layout_marginTop="16dp"/>
-    </LinearLayout>
-
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_weight="1"
+    <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/topLayout"
         android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:clipChildren="false"
         android:clipToPadding="false">
 
-        <View
-            android:id="@+id/leftSpacer"
+        <LinearLayout
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:layout_weight="1"
+            android:orientation="vertical">
+
+            <TextView
+                style="@android:style/TextAppearance.Material.Headline"
+                android:id="@+id/headerText"
+                android:layout_marginStart="32dp"
+                android:layout_marginEnd="32dp"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="?android:attr/colorAccent"/>
+
+            <TextView
+                style="@android:style/TextAppearance.Material.Body1"
+                android:id="@+id/detailsText"
+                android:layout_marginStart="32dp"
+                android:layout_marginEnd="32dp"
+                android:layout_marginTop="12dp"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"/>
+
+            <Button
+                style="@android:style/Widget.Material.Button.Borderless"
+                android:id="@+id/cancelButton"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/cancel"
+                android:layout_marginStart="16dp"
+                android:layout_marginEnd="16dp"
+                android:layout_marginTop="16dp"/>
+        </LinearLayout>
+
+        <LinearLayout
             android:layout_width="0dp"
             android:layout_height="match_parent"
-            android:layout_weight="0.4"/>
-
-        <FrameLayout
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:orientation="horizontal"
             android:clipChildren="false"
             android:clipToPadding="false">
 
-            <com.android.internal.widget.LockPatternView
-                android:id="@+id/lockPattern"
-                android:layout_width="288dp"
-                android:layout_height="288dp"
-                android:layout_marginStart="-42dp"
-                android:layout_marginEnd="-42dp"
-                android:layout_gravity="center_vertical"/>
+            <View
+                android:id="@+id/leftSpacer"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="0.4"/>
 
-            <TextView
-                style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
-                android:accessibilityLiveRegion="polite"
-                android:id="@+id/errorText"
+            <FrameLayout
                 android:layout_width="wrap_content"
+                android:layout_height="match_parent"
+                android:clipChildren="false"
+                android:clipToPadding="false">
+
+                <com.android.internal.widget.LockPatternView
+                    android:id="@+id/lockPattern"
+                    android:layout_width="288dp"
+                    android:layout_height="288dp"
+                    android:layout_marginStart="-42dp"
+                    android:layout_marginEnd="-42dp"
+                    android:layout_gravity="center_vertical"/>
+
+                <TextView
+                    style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
+                    android:accessibilityLiveRegion="polite"
+                    android:id="@+id/errorText"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="bottom|center_horizontal"
+                    android:layout_marginBottom="24dp"/>
+            </FrameLayout>
+
+            <View
+                android:id="@+id/rightSpacer"
+                android:layout_width="0dp"
+                android:layout_height="match_parent"
+                android:layout_weight="1"/>
+
+            <ImageView
+                android:id="@+id/fingerprintIcon"
+                android:layout_gravity="center_vertical"
+                android:layout_width="0dp"
+                android:layout_weight="1"
                 android:layout_height="wrap_content"
-                android:layout_gravity="bottom|center_horizontal"
-                android:layout_marginBottom="24dp"/>
-        </FrameLayout>
+                android:visibility="gone"/>
+        </LinearLayout>
 
-        <View
-            android:id="@+id/rightSpacer"
-            android:layout_width="0dp"
-            android:layout_height="match_parent"
-            android:layout_weight="1"/>
-
-        <ImageView
-            android:id="@+id/fingerprintIcon"
-            android:layout_gravity="center_vertical"
-            android:layout_width="0dp"
-            android:layout_weight="1"
-            android:layout_height="wrap_content"
-            android:visibility="gone"/>
-    </LinearLayout>
-
-</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-
+    </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/confirm_lock_background_base.xml b/res/layout/confirm_lock_background_base.xml
new file mode 100644
index 0000000..62be672
--- /dev/null
+++ b/res/layout/confirm_lock_background_base.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<ImageView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/background_image"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:scaleType="centerCrop" />
\ No newline at end of file
diff --git a/res/layout/confirm_lock_password_base.xml b/res/layout/confirm_lock_password_base.xml
index b20131a..3478dba 100644
--- a/res/layout/confirm_lock_password_base.xml
+++ b/res/layout/confirm_lock_password_base.xml
@@ -13,79 +13,87 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+<FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/topLayout"
-    android:orientation="vertical"
-    android:layout_width="wrap_content"
-    android:layout_height="match_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
 
-    <TextView
-        style="@android:style/TextAppearance.Material.Headline"
-        android:id="@+id/headerText"
-        android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
-        android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
-        android:layout_marginTop="?attr/confirmDeviceCredentialsTopMargin"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textColor="?android:attr/colorAccent"/>
+    <include layout="@layout/confirm_lock_background_base" />
 
-    <TextView
-        style="@android:style/TextAppearance.Material.Body1"
-        android:id="@+id/detailsText"
-        android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
-        android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
-        android:layout_marginTop="12dp"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        />
+    <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/topLayout"
+        android:orientation="vertical"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
-    <Button
-        style="@android:style/Widget.Material.Button.Borderless"
-        android:id="@+id/cancelButton"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/cancel"
-        android:layout_marginStart="16dp"
-        android:layout_marginEnd="16dp"
-        android:layout_marginTop="16dp"/>
+        <TextView
+            style="@android:style/TextAppearance.Material.Headline"
+            android:id="@+id/headerText"
+            android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
+            android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
+            android:layout_marginTop="?attr/confirmDeviceCredentialsTopMargin"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="?android:attr/colorAccent"/>
 
-    <View android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1"/>
+        <TextView
+            style="@android:style/TextAppearance.Material.Body1"
+            android:id="@+id/detailsText"
+            android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
+            android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
+            android:layout_marginTop="12dp"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            />
 
-    <EditText
-        android:id="@+id/password_entry"
-        android:layout_width="208dp"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginTop="-40dp"
-        android:inputType="textPassword"
-        android:imeOptions="actionNext|flagNoFullscreen"
-        android:gravity="center"
-        android:textSize="16sp"
-        style="@style/TextAppearance.PasswordEntry"/>
+        <Button
+            style="@android:style/Widget.Material.Button.Borderless"
+            android:id="@+id/cancelButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/cancel"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="16dp"
+            android:layout_marginTop="16dp"/>
 
-    <TextView
-        style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
-        android:accessibilityLiveRegion="polite"
-        android:id="@+id/errorText"
-        android:layout_width="wrap_content"
-        android:layout_height="0dp"
-        android:layout_weight="1"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginStart="12dp"
-        android:layout_marginEnd="12dp"
-        android:gravity="center_vertical"/>
+        <View android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1"/>
 
-    <ImageView
-        android:id="@+id/fingerprintIcon"
-        android:layout_gravity="center_horizontal"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_alignParentBottom="true"
-        android:layout_marginBottom="24dp"
-        android:contentDescription="@string/confirm_fingerprint_icon_content_description"
-        android:visibility="gone"/>
+        <EditText
+            android:id="@+id/password_entry"
+            android:layout_width="208dp"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="-40dp"
+            android:inputType="textPassword"
+            android:imeOptions="actionNext|flagNoFullscreen"
+            android:gravity="center"
+            android:textSize="16sp"
+            style="@style/TextAppearance.PasswordEntry"/>
 
-</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
\ No newline at end of file
+        <TextView
+            style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
+            android:accessibilityLiveRegion="polite"
+            android:id="@+id/errorText"
+            android:layout_width="wrap_content"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginStart="12dp"
+            android:layout_marginEnd="12dp"
+            android:gravity="center_vertical"/>
+
+        <ImageView
+            android:id="@+id/fingerprintIcon"
+            android:layout_gravity="center_horizontal"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_alignParentBottom="true"
+            android:layout_marginBottom="24dp"
+            android:contentDescription="@string/confirm_fingerprint_icon_content_description"
+            android:visibility="gone"/>
+
+    </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/confirm_lock_pattern_base.xml b/res/layout/confirm_lock_pattern_base.xml
index a69d297..d5dee74 100644
--- a/res/layout/confirm_lock_pattern_base.xml
+++ b/res/layout/confirm_lock_pattern_base.xml
@@ -13,83 +13,91 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+<FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/topLayout"
-    android:orientation="vertical"
-    android:layout_width="wrap_content"
-    android:layout_height="match_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent" >
 
-    <TextView
-        style="@android:style/TextAppearance.Material.Headline"
-        android:id="@+id/headerText"
-        android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
-        android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
-        android:layout_marginTop="?attr/confirmDeviceCredentialsTopMargin"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textColor="?android:attr/colorAccent"/>
+    <include layout="@layout/confirm_lock_background_base" />
 
-    <TextView
-        style="@android:style/TextAppearance.Material.Body1"
-        android:id="@+id/detailsText"
-        android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
-        android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
-        android:layout_marginTop="12dp"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        />
-
-    <Button
-        style="@android:style/Widget.Material.Button.Borderless"
-        android:id="@+id/cancelButton"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/cancel"
-        android:layout_marginStart="16dp"
-        android:layout_marginEnd="16dp"
-        android:layout_marginTop="16dp"/>
-
-    <View android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="0.5"/>
-
-    <com.android.internal.widget.LockPatternView
-        android:id="@+id/lockPattern"
-        android:layout_width="312dp"
-        android:layout_height="312dp"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginTop="-46dp"
-        android:layout_marginBottom="-46dp"/>
-
-    <LinearLayout
+    <com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/topLayout"
+        android:orientation="vertical"
         android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="1"
-        android:orientation="vertical">
+        android:layout_height="match_parent">
 
         <TextView
-            style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
-            android:accessibilityLiveRegion="polite"
-            android:id="@+id/errorText"
-            android:layout_width="wrap_content"
-            android:layout_height="0dp"
-            android:layout_weight="1"
-            android:layout_gravity="center_horizontal"
-            android:layout_marginTop="12dp"
-            android:layout_marginStart="12dp"
-            android:layout_marginEnd="12dp"
-            android:gravity="center_vertical"/>
-
-        <ImageView
-            android:id="@+id/fingerprintIcon"
-            android:layout_gravity="center_horizontal"
+            style="@android:style/TextAppearance.Material.Headline"
+            android:id="@+id/headerText"
+            android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
+            android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
+            android:layout_marginTop="?attr/confirmDeviceCredentialsTopMargin"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_alignParentBottom="true"
-            android:layout_marginBottom="24dp"
-            android:contentDescription="@string/confirm_fingerprint_icon_content_description"
-            android:visibility="gone"/>
-    </LinearLayout>
+            android:textColor="?android:attr/colorAccent"/>
 
-</com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
\ No newline at end of file
+        <TextView
+            style="@android:style/TextAppearance.Material.Body1"
+            android:id="@+id/detailsText"
+            android:layout_marginStart="?attr/confirmDeviceCredentialsSideMargin"
+            android:layout_marginEnd="?attr/confirmDeviceCredentialsSideMargin"
+            android:layout_marginTop="12dp"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            />
+
+        <Button
+            style="@android:style/Widget.Material.Button.Borderless"
+            android:id="@+id/cancelButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/cancel"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="16dp"
+            android:layout_marginTop="16dp"/>
+
+        <View android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="0.5"/>
+
+        <com.android.internal.widget.LockPatternView
+            android:id="@+id/lockPattern"
+            android:layout_width="312dp"
+            android:layout_height="312dp"
+            android:layout_gravity="center_horizontal"
+            android:layout_marginTop="-46dp"
+            android:layout_marginBottom="-46dp"/>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:orientation="vertical">
+
+            <TextView
+                style="@style/TextAppearance.ConfirmDeviceCredentialsErrorText"
+                android:accessibilityLiveRegion="polite"
+                android:id="@+id/errorText"
+                android:layout_width="wrap_content"
+                android:layout_height="0dp"
+                android:layout_weight="1"
+                android:layout_gravity="center_horizontal"
+                android:layout_marginTop="12dp"
+                android:layout_marginStart="12dp"
+                android:layout_marginEnd="12dp"
+                android:gravity="center_vertical"/>
+
+            <ImageView
+                android:id="@+id/fingerprintIcon"
+                android:layout_gravity="center_horizontal"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentBottom="true"
+                android:layout_marginBottom="24dp"
+                android:contentDescription="@string/confirm_fingerprint_icon_content_description"
+                android:visibility="gone"/>
+        </LinearLayout>
+
+    </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
+</FrameLayout>
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index f3fea10..1279a07 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -82,6 +82,7 @@
 
     <color name="warning">#ff5621</color>
     <color name="confirm_device_credential_dark_background">#263238</color>
+    <color name="confirm_device_credential_transparent_black">#60000000</color>
     <color name="fab_ripple">#1fffffff</color><!-- 12% white -->
     <color name="fab_shape">?android:attr/colorAccent</color>
     <color name="voice_interaction_highlight">#33b5e5</color>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index b15a77c..6288155 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -255,6 +255,9 @@
 
         <item name="android:windowAnimationStyle">@style/ConfirmDeviceCredentialsAnimationStyle</item>
     </style>
+    <style name="Theme.ConfirmDeviceCredentialsWork" parent="Theme.ConfirmDeviceCredentialsDark">
+        <item name="@*android:regularColor">@*android:color/white</item>
+    </style>
 
     <style name="Theme.FingerprintEnroll" parent="@*android:style/Theme.Material.Settings.NoActionBar">
         <item name="android:windowAnimationStyle">@style/Animation.SuwWindowAnimation</item>
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index bd46456..3def151 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -172,7 +172,7 @@
                     !mLockPatternUtils.isSeparateProfileChallengeAllowed(targetUser)) {
                 // Always use parent if explicitely requested or if profile challenge is not
                 // supported
-                mUserId = Utils.getSameOwnerUserId(getContext(), getArguments());
+                mUserId = Utils.getUserIdFromBundle(getContext(), getArguments());
             } else {
                 mUserId = targetUser;
             }
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java
index 6739475..86b6a52 100644
--- a/src/com/android/settings/ChooseLockPassword.java
+++ b/src/com/android/settings/ChooseLockPassword.java
@@ -238,7 +238,7 @@
                 throw new SecurityException("Fragment contained in wrong activity");
             }
             // Only take this argument into account if it belongs to the current profile.
-            mUserId = Utils.getSameOwnerUserId(getActivity(), intent.getExtras());
+            mUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras());
             mRequestedQuality = Math.max(intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY,
                     mRequestedQuality), mLockPatternUtils.getRequestedPasswordQuality(
                     mUserId));
diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java
index 93ffa95..dbbe08c 100644
--- a/src/com/android/settings/ChooseLockPattern.java
+++ b/src/com/android/settings/ChooseLockPattern.java
@@ -370,7 +370,7 @@
             }
             Intent intent = getActivity().getIntent();
             // Only take this argument into account if it belongs to the current profile.
-            mUserId = Utils.getSameOwnerUserId(getActivity(), intent.getExtras());
+            mUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras());
         }
 
         @Override
diff --git a/src/com/android/settings/ChooseLockSettingsHelper.java b/src/com/android/settings/ChooseLockSettingsHelper.java
index b88dea2..70ecdfd 100644
--- a/src/com/android/settings/ChooseLockSettingsHelper.java
+++ b/src/com/android/settings/ChooseLockSettingsHelper.java
@@ -90,7 +90,7 @@
     boolean launchConfirmationActivity(int request, CharSequence title, boolean returnCredentials,
             int userId) {
         return launchConfirmationActivity(request, title, null, null,
-                returnCredentials, false, false, 0, Utils.getSameOwnerUserId(mActivity, userId));
+                returnCredentials, false, false, 0, Utils.enforceSameOwner(mActivity, userId));
     }
 
     /**
@@ -110,7 +110,7 @@
             @Nullable CharSequence header, @Nullable CharSequence description,
             boolean returnCredentials, boolean external) {
         return launchConfirmationActivity(request, title, header, description,
-                returnCredentials, external, false, 0, Utils.getEffectiveUserId(mActivity));
+                returnCredentials, external, false, 0, Utils.getCredentialOwnerUserId(mActivity));
     }
 
     /**
@@ -131,7 +131,7 @@
             @Nullable CharSequence header, @Nullable CharSequence description,
             boolean returnCredentials, boolean external, int userId) {
         return launchConfirmationActivity(request, title, header, description,
-                returnCredentials, external, false, 0, Utils.getSameOwnerUserId(mActivity, userId));
+                returnCredentials, external, false, 0, Utils.enforceSameOwner(mActivity, userId));
     }
 
     /**
@@ -147,7 +147,7 @@
             @Nullable CharSequence header, @Nullable CharSequence description,
             long challenge) {
         return launchConfirmationActivity(request, title, header, description,
-                false, false, true, challenge, Utils.getEffectiveUserId(mActivity));
+                false, false, true, challenge, Utils.getCredentialOwnerUserId(mActivity));
     }
 
     private boolean launchConfirmationActivity(int request, @Nullable CharSequence title,
diff --git a/src/com/android/settings/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/ConfirmDeviceCredentialActivity.java
index c4587eb..28c0515 100644
--- a/src/com/android/settings/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/ConfirmDeviceCredentialActivity.java
@@ -64,12 +64,12 @@
         Intent intent = getIntent();
         String title = intent.getStringExtra(KeyguardManager.EXTRA_TITLE);
         String details = intent.getStringExtra(KeyguardManager.EXTRA_DESCRIPTION);
-        int userId = Utils.getEffectiveUserId(this);
+        int userId = Utils.getCredentialOwnerUserId(this);
         if (isInternalActivity()) {
-            int givenUserId = intent.getIntExtra(Intent.EXTRA_USER_ID, userId);
-            UserManager userManager = UserManager.get(this);
-            if (userManager.isSameProfileGroup(givenUserId, userId)) {
-                userId = givenUserId;
+            try {
+                userId = Utils.getUserIdFromBundle(this, intent.getExtras());
+            } catch (SecurityException se) {
+                Log.e(TAG, "Invalid intent extra", se);
             }
         }
         ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(this);
diff --git a/src/com/android/settings/ConfirmDeviceCredentialBaseActivity.java b/src/com/android/settings/ConfirmDeviceCredentialBaseActivity.java
index d9af800..e6dd5e0 100644
--- a/src/com/android/settings/ConfirmDeviceCredentialBaseActivity.java
+++ b/src/com/android/settings/ConfirmDeviceCredentialBaseActivity.java
@@ -18,8 +18,10 @@
 
 import android.app.Fragment;
 import android.app.KeyguardManager;
+import android.content.Intent;
 import android.os.Bundle;
 import android.os.Handler;
+import android.os.UserManager;
 import android.view.MenuItem;
 import android.view.WindowManager;
 
@@ -33,7 +35,12 @@
 
     @Override
     protected void onCreate(Bundle savedState) {
-        if (getIntent().getBooleanExtra(ConfirmDeviceCredentialBaseFragment.DARK_THEME, false)) {
+        int credentialOwnerUserId = Utils.getCredentialOwnerUserId(this,
+                Utils.getUserIdFromBundle(this, getIntent().getExtras()));
+        if (Utils.isManagedProfile(UserManager.get(this), credentialOwnerUserId)) {
+            setTheme(R.style.Theme_ConfirmDeviceCredentialsWork);
+        } else if (getIntent().getBooleanExtra(
+                ConfirmDeviceCredentialBaseFragment.DARK_THEME, false)) {
             setTheme(R.style.Theme_ConfirmDeviceCredentialsDark);
             mDark = true;
         }
diff --git a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
index 0a22d45..d1ea8be 100644
--- a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
+++ b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
@@ -24,10 +24,16 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentSender;
+import android.graphics.Point;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.RemoteException;
+import android.os.UserManager;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.Button;
+import android.widget.FrameLayout;
 import android.widget.ImageView;
 import android.widget.TextView;
 
@@ -80,6 +86,14 @@
                 getActivity().finish();
             }
         });
+        int credentialOwnerUserId = Utils.getCredentialOwnerUserId(
+                getActivity(),
+                Utils.getUserIdFromBundle(
+                        getActivity(),
+                        getActivity().getIntent().getExtras()));
+        if (Utils.isManagedProfile(UserManager.get(getActivity()), credentialOwnerUserId)) {
+            setWorkChallengeBackground(view);
+        }
     }
 
     @Override
@@ -155,4 +169,20 @@
             }
         }
     }
+
+    private void setWorkChallengeBackground(View baseView) {
+        ImageView imageView = (ImageView) baseView.findViewById(R.id.background_image);
+        if (imageView != null) {
+            Drawable image = getResources().getDrawable(R.drawable.work_challenge_background);
+            image.setColorFilter(
+                    getResources().getColor(R.color.confirm_device_credential_transparent_black),
+                    PorterDuff.Mode.DARKEN);
+            imageView.setImageDrawable(image);
+            Point screenSize = new Point();
+            getActivity().getWindowManager().getDefaultDisplay().getSize(screenSize);
+            imageView.setLayoutParams(new FrameLayout.LayoutParams(
+                    ViewGroup.LayoutParams.MATCH_PARENT,
+                    screenSize.y));
+        }
+    }
 }
diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java
index 53555e0..00a68bf 100644
--- a/src/com/android/settings/ConfirmLockPassword.java
+++ b/src/com/android/settings/ConfirmLockPassword.java
@@ -111,7 +111,7 @@
             mLockPatternUtils = new LockPatternUtils(getActivity());
             Intent intent = getActivity().getIntent();
             // Only take this argument into account if it belongs to the current profile.
-            mEffectiveUserId = Utils.getSameOwnerUserId(getActivity(), intent.getExtras());
+            mEffectiveUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras());
         }
 
         @Override
diff --git a/src/com/android/settings/ConfirmLockPattern.java b/src/com/android/settings/ConfirmLockPattern.java
index 6331290..087a0b9 100644
--- a/src/com/android/settings/ConfirmLockPattern.java
+++ b/src/com/android/settings/ConfirmLockPattern.java
@@ -116,7 +116,7 @@
             mLockPatternUtils = new LockPatternUtils(getActivity());
             Intent intent = getActivity().getIntent();
             // Only take this argument into account if it belongs to the current profile.
-            mEffectiveUserId = Utils.getSameOwnerUserId(getActivity(), intent.getExtras());
+            mEffectiveUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras());
         }
 
         @Override
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 4afa1d9..56795ae 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -16,6 +16,7 @@
 
 package com.android.settings;
 
+import android.annotation.NonNull;
 import android.annotation.Nullable;
 import android.app.ActivityManager;
 import android.app.ActivityManagerNative;
@@ -181,6 +182,19 @@
     }
 
     /**
+     * Returns the UserManager for a given context
+     *
+     * @throws IllegalStateException if no UserManager could be retrieved.
+     */
+    public static UserManager getUserManager(Context context) {
+        UserManager um = UserManager.get(context);
+        if (um == null) {
+            throw new IllegalStateException("Unable to load UserManager");
+        }
+        return um;
+    }
+
+    /**
      * Returns true if Monkey is running.
      */
     public static boolean isMonkeyRunning() {
@@ -569,10 +583,24 @@
 
     /**
      * Returns true if the current profile is a managed one.
+     *
+     * @throws IllegalArgumentException if userManager is null.
      */
-    public static boolean isManagedProfile(UserManager userManager) {
-        UserInfo currentUser = userManager.getUserInfo(userManager.getUserHandle());
-        return currentUser.isManagedProfile();
+    public static boolean isManagedProfile(@NonNull UserManager userManager) {
+        return isManagedProfile(userManager, UserHandle.myUserId());
+    }
+
+    /**
+     * Returns true if the userId passed in is a managed profile.
+     *
+     * @throws IllegalArgumentException if userManager is null.
+     */
+    public static boolean isManagedProfile(@NonNull UserManager userManager, int userId) {
+        if (userManager == null) {
+            throw new IllegalArgumentException("userManager must not be null");
+        }
+        UserInfo userInfo = userManager.getUserInfo(userId);
+        return (userInfo != null) ? userInfo.isManagedProfile() : false;
     }
 
     /**
@@ -932,17 +960,17 @@
     }
 
     /**
-     * Returns the user id present in the bundle with {@link ChooseLockGeneric#KEY_USER_ID} if it
+     * Returns the user id present in the bundle with {@link Intent#EXTRA_USER_ID} if it
      * belongs to the current user.
      *
      * @throws SecurityException if the given userId does not belong to the current user group.
      */
-    public static int getSameOwnerUserId(Context context, Bundle bundle) {
+    public static int getUserIdFromBundle(Context context, Bundle bundle) {
         if (bundle == null) {
-            return getEffectiveUserId(context);
+            return getCredentialOwnerUserId(context);
         }
         int userId = bundle.getInt(Intent.EXTRA_USER_ID, UserHandle.myUserId());
-        return getSameOwnerUserId(context, userId);
+        return enforceSameOwner(context, userId);
     }
 
     /**
@@ -950,27 +978,28 @@
      *
      * @throws SecurityException if the given userId does not belong to the current user group.
      */
-    public static int getSameOwnerUserId(Context context, int userId) {
-        UserManager um = UserManager.get(context);
-        if (um != null) {
-            if (um.getUserProfiles().contains(new UserHandle(userId))) {
-                return userId;
-            } else {
-                throw new SecurityException("Given user id " + userId + " does not belong to user "
-                        + UserHandle.myUserId());
-            }
+    public static int enforceSameOwner(Context context, int userId) {
+        UserManager um = getUserManager(context);
+        if (!um.getUserProfiles().contains(new UserHandle(userId))) {
+            throw new SecurityException("Given user id " + userId + " does not belong to user "
+                    + UserHandle.myUserId());
         }
-        return getEffectiveUserId(context);
+        return userId;
     }
 
-    public static int getEffectiveUserId(Context context) {
-        UserManager um = UserManager.get(context);
-        if (um != null) {
-            return um.getCredentialOwnerProfile(UserHandle.myUserId());
-        } else {
-            Log.e(TAG, "Unable to acquire UserManager");
-            return UserHandle.myUserId();
-        }
+    /**
+     * Returns the effective credential owner of the calling user.
+     */
+    public static int getCredentialOwnerUserId(Context context) {
+        return getCredentialOwnerUserId(context, UserHandle.myUserId());
+    }
+
+    /**
+     * Returns the user id of the credential owner of the given user id.
+     */
+    public static int getCredentialOwnerUserId(Context context, int userId) {
+        UserManager um = getUserManager(context);
+        return um.getCredentialOwnerProfile(userId);
     }
 
     public static int resolveResource(Context context, int attr) {