Merge "Fix work challenge background size." into nyc-dev
diff --git a/res/layout-sw600dp/confirm_lock_password.xml b/res/layout-sw600dp/confirm_lock_password.xml
index 1649aaa..7ccf330 100644
--- a/res/layout-sw600dp/confirm_lock_password.xml
+++ b/res/layout-sw600dp/confirm_lock_password.xml
@@ -20,7 +20,7 @@
     android:paddingTop="48dp">
 
     <include layout="@layout/confirm_lock_password_base"
-        android:layout_width="328dp"
+        android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_gravity="center_horizontal"/>
 </FrameLayout>
diff --git a/res/layout-sw600dp/confirm_lock_pattern.xml b/res/layout-sw600dp/confirm_lock_pattern.xml
index 55e4fa1..c9a3dfa 100644
--- a/res/layout-sw600dp/confirm_lock_pattern.xml
+++ b/res/layout-sw600dp/confirm_lock_pattern.xml
@@ -18,7 +18,7 @@
     android:layout_height="match_parent">
 
     <include layout="@layout/confirm_lock_pattern_base"
-        android:layout_width="328dp"
+        android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_gravity="center_horizontal"/>
 </FrameLayout>
diff --git a/res/layout/confirm_lock_password_base.xml b/res/layout/confirm_lock_password_base.xml
index 3478dba..d92f4f1 100644
--- a/res/layout/confirm_lock_password_base.xml
+++ b/res/layout/confirm_lock_password_base.xml
@@ -24,8 +24,9 @@
         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">
+        android:layout_width="@dimen/confirm_credentials_layout_width"
+        android:layout_height="match_parent"
+        android:layout_gravity="top|center_horizontal">
 
         <TextView
             style="@android:style/TextAppearance.Material.Headline"
@@ -96,4 +97,4 @@
             android:visibility="gone"/>
 
     </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-</FrameLayout>
\ No newline at end of file
+</FrameLayout>
diff --git a/res/layout/confirm_lock_pattern_base.xml b/res/layout/confirm_lock_pattern_base.xml
index d5dee74..ed53fae 100644
--- a/res/layout/confirm_lock_pattern_base.xml
+++ b/res/layout/confirm_lock_pattern_base.xml
@@ -24,8 +24,9 @@
         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">
+        android:layout_width="@dimen/confirm_credentials_layout_width"
+        android:layout_height="match_parent"
+        android:layout_gravity="top|center_horizontal">
 
         <TextView
             style="@android:style/TextAppearance.Material.Headline"
@@ -100,4 +101,4 @@
         </LinearLayout>
 
     </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>
-</FrameLayout>
\ No newline at end of file
+</FrameLayout>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 14a52e4..e3c748a 100755
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -73,5 +73,6 @@
     <dimen name="wifi_assistant_text_padding">24dp</dimen>
 
     <dimen name="confirm_credentials_security_method_margin">72dp</dimen>
+    <dimen name="confirm_credentials_layout_width">328dp</dimen>
     <dimen name="fab_margin">24dp</dimen>
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index c84129a..af3a0c1 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -15,6 +15,8 @@
 -->
 
 <resources>
+    <dimen name="match_parent">-1px</dimen>
+
     <dimen name="device_memory_usage_button_width">16dip</dimen>
     <dimen name="device_memory_usage_button_height">32dip</dimen>
     <dimen name="action_bar_switch_padding">16dip</dimen>
@@ -232,6 +234,7 @@
     <dimen name="setup_fingerprint_progress_bar_size">168dp</dimen>
 
     <dimen name="confirm_credentials_security_method_margin">48dp</dimen>
+    <dimen name="confirm_credentials_layout_width">@dimen/match_parent</dimen>
     <dimen name="fab_size">56dp</dimen>
     <dimen name="fab_margin">16dp</dimen>
     <dimen name="fab_elevation">12dp</dimen>
diff --git a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
index 784e6b3..5925890 100644
--- a/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
+++ b/src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java
@@ -204,6 +204,12 @@
     }
 
     private void setWorkChallengeBackground(View baseView, int userId) {
+        View mainContent = getActivity().findViewById(com.android.settings.R.id.main_content);
+        if (mainContent != null) {
+            // Remove the main content padding so that the background image is full screen.
+            mainContent.setPadding(0, 0, 0, 0);
+        }
+
         DevicePolicyManager dpm = (DevicePolicyManager) getActivity().getSystemService(
                 Context.DEVICE_POLICY_SERVICE);
         baseView.setBackground(new ColorDrawable(dpm.getOrganizationColorForUser(userId)));