Reduce the top padding when message isn't at top.

If either the page number or an icon is shown above the message,
reduce the top padding on round screens.

Bug: 24961379
Change-Id: Iec9193e3bbdd8ac607743cd0010f2331edbebc81
diff --git a/res/layout-watch/confirmation_dialog.xml b/res/layout-watch/confirmation_dialog.xml
index 32e0657..ea25b6b 100644
--- a/res/layout-watch/confirmation_dialog.xml
+++ b/res/layout-watch/confirmation_dialog.xml
@@ -33,21 +33,28 @@
                 android:layout_height="wrap_content"
                 android:paddingTop="@dimen/conf_diag_content_padding_top">
 
-            <TextView
-                    android:id="@+id/current_page_text"
-                    android:layout_width="wrap_content"
+            <LinearLayout
+                    android:orientation="vertical"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:layout_gravity="center"
-                    android:layout_marginTop="@dimen/grant_permissions_app_breadcrumb_margin_top"
-                    android:textAppearance="@style/GrantPermissions.BreadcrumbText" />
+                    android:minHeight="@dimen/conf_diag_min_space_above_message"
+                    android:gravity="bottom">
+                <TextView
+                        android:id="@+id/current_page_text"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center_horizontal"
+                        android:layout_marginTop="@dimen/grant_permissions_app_breadcrumb_margin_top"
+                        android:textAppearance="@style/GrantPermissions.BreadcrumbText" />
 
-            <ImageView
-                    android:id="@+id/icon"
-                    android:layout_width="@dimen/grant_permissions_app_icon_size"
-                    android:layout_height="@dimen/grant_permissions_app_icon_size"
-                    android:tint="@color/grant_permissions_app_color"
-                    android:layout_gravity="center"
-                    android:layout_marginTop="@dimen/grant_permissions_app_icon_margin_top"/>
+                <ImageView
+                        android:id="@+id/icon"
+                        android:layout_width="@dimen/grant_permissions_app_icon_size"
+                        android:layout_height="@dimen/grant_permissions_app_icon_size"
+                        android:tint="@color/grant_permissions_app_color"
+                        android:layout_gravity="center_horizontal"
+                        android:layout_marginTop="@dimen/grant_permissions_app_icon_margin_top"/>
+            </LinearLayout>
 
             <TextView
                     android:id="@+id/message"
diff --git a/res/values-round/dimens.xml b/res/values-round/dimens.xml
index ad0fbe0..bed41ce 100644
--- a/res/values-round/dimens.xml
+++ b/res/values-round/dimens.xml
@@ -19,6 +19,8 @@
     <dimen name="conf_diag_button_container_height">96dp</dimen>
     <dimen name="conf_diag_2button_margin_side">32dp</dimen>
     <dimen name="conf_diag_2button_margin_top">10dp</dimen>
-    <dimen name="conf_diag_content_padding_top">32dp</dimen>
+    <!-- On round screens, the message can't be too close to the top or the corners will be
+         clipped. -->
+    <dimen name="conf_diag_min_space_above_message">26dp</dimen>
 
 </resources>
diff --git a/res/values-watch/dimens.xml b/res/values-watch/dimens.xml
index aa5652d..96f3214 100644
--- a/res/values-watch/dimens.xml
+++ b/res/values-watch/dimens.xml
@@ -33,6 +33,8 @@
     <dimen name="conf_diag_3button_padding_side">32dp</dimen>
     <dimen name="conf_diag_3button_padding_bottom">22dp</dimen>
     <dimen name="conf_diag_content_padding_top">6dp</dimen>
+    <!-- On square screens, the message can be at the top of the screen. -->
+    <dimen name="conf_diag_min_space_above_message">0dp</dimen>
 
 
     <!-- START: Ported values -->
diff --git a/src/com/android/packageinstaller/permission/ui/wear/ConfirmationViewHandler.java b/src/com/android/packageinstaller/permission/ui/wear/ConfirmationViewHandler.java
index abaf3e4..adc831d 100644
--- a/src/com/android/packageinstaller/permission/ui/wear/ConfirmationViewHandler.java
+++ b/src/com/android/packageinstaller/permission/ui/wear/ConfirmationViewHandler.java
@@ -189,7 +189,8 @@
         // In order to fake the buttons peeking at the bottom, need to do set the
         // padding properly.
         if (mContent.getPaddingBottom() != mButtonBarContainer.getHeight()) {
-            mContent.setPadding(0, mContent.getPaddingTop(), 0, mButtonBarContainer.getHeight());
+            mContent.setPadding(mContent.getPaddingLeft(), mContent.getPaddingTop(),
+                    mContent.getPaddingRight(), mButtonBarContainer.getHeight());
             if (Log.isLoggable(TAG, Log.DEBUG)) {
                 Log.d(TAG, "    set mContent.PaddingBottom: " + mButtonBarContainer.getHeight());
             }