Fill dialog/save ui style refinement

Bug: 225234267
Test: use sample code to verify the fill dialog and saveui.
See bug the screenshot.

Change-Id: I94588180de83b27c291aa5843d0e722e21150285
diff --git a/core/res/res/layout/autofill_fill_dialog.xml b/core/res/res/layout/autofill_fill_dialog.xml
index e638764..ba27d90 100644
--- a/core/res/res/layout/autofill_fill_dialog.xml
+++ b/core/res/res/layout/autofill_fill_dialog.xml
@@ -62,18 +62,24 @@
         android:layout_marginEnd="24dp"
         android:background="@drawable/autofill_dataset_picker_background"/>
 
-    <ListView
-        android:id="@+id/autofill_dialog_list"
-        android:layout_weight="1"
+    <LinearLayout
         android:layout_width="fill_parent"
-        android:layout_height="0dp"
-        android:drawSelectorOnTop="true"
-        android:clickable="true"
-        android:divider="?android:attr/listDivider"
+        android:layout_height="wrap_content"
         android:layout_marginStart="24dp"
         android:layout_marginEnd="24dp"
-        android:background="@drawable/autofill_dataset_picker_background"
-        android:visibility="gone"/>
+        android:theme="@style/Theme.DeviceDefault.AutofillHalfScreenDialogList"
+        android:orientation="vertical">
+        <ListView
+            android:id="@+id/autofill_dialog_list"
+            android:layout_weight="1"
+            android:layout_width="fill_parent"
+            android:layout_height="0dp"
+            android:drawSelectorOnTop="true"
+            android:clickable="true"
+            android:divider="@drawable/list_divider_material"
+            android:background="@drawable/autofill_dataset_picker_background"
+            android:visibility="gone"/>
+    </LinearLayout>
 
     <com.android.internal.widget.ButtonBarLayout
         android:layout_width="match_parent"
diff --git a/core/res/res/layout/autofill_save.xml b/core/res/res/layout/autofill_save.xml
index 8a1a9c7..49539cf 100644
--- a/core/res/res/layout/autofill_save.xml
+++ b/core/res/res/layout/autofill_save.xml
@@ -23,45 +23,38 @@
     android:orientation="vertical">
 
     <LinearLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/autofill_save"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="@dimen/autofill_save_outer_top_margin"
-        android:paddingTop="@dimen/autofill_save_outer_top_padding"
+        android:layout_marginStart="24dp"
+        android:layout_marginEnd="24dp"
         android:elevation="@dimen/autofill_elevation"
         android:background="?android:attr/colorSurface"
+        android:gravity="center_horizontal"
         android:orientation="vertical">
 
         <LinearLayout
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
-            android:paddingStart="@dimen/autofill_save_inner_padding"
-            android:paddingEnd="@dimen/autofill_save_inner_padding"
             android:orientation="vertical">
 
-            <LinearLayout
+            <ImageView
+                android:id="@+id/autofill_save_icon"
+                android:scaleType="fitStart"
+                android:layout_gravity="center"
+                android:layout_width="@dimen/autofill_save_icon_size"
+                android:layout_height="@dimen/autofill_save_icon_size"/>
+
+            <TextView
+                android:id="@+id/autofill_save_title"
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
-                android:orientation="horizontal">
-
-                <ImageView
-                    android:id="@+id/autofill_save_icon"
-                    android:scaleType="fitStart"
-                    android:layout_width="@dimen/autofill_save_icon_size"
-                    android:layout_height="@dimen/autofill_save_icon_size"/>
-
-                <TextView
-                    android:id="@+id/autofill_save_title"
-                    android:paddingStart="@dimen/autofill_save_title_start_padding"
-                    android:layout_width="fill_parent"
-                    android:layout_height="wrap_content"
-                    android:text="@string/autofill_save_title"
-                    android:textAppearance="@style/TextAppearance.DeviceDefault.Subhead"
-                    android:layout_weight="1">
-                </TextView>
-
-            </LinearLayout>
+                android:text="@string/autofill_save_title"
+                android:layout_marginTop="16dp"
+                android:gravity="center"
+                android:textAppearance="@style/AutofillSaveUiTitle">
+            </TextView>
 
             <com.android.server.autofill.ui.CustomScrollView
                 android:id="@+id/autofill_save_custom_subtitle"
@@ -79,8 +72,6 @@
             android:clipToPadding="false"
             android:layout_marginTop="32dp"
             android:layout_marginBottom="18dp"
-            android:layout_marginStart="24dp"
-            android:layout_marginEnd="24dp"
             android:theme="@style/Theme.DeviceDefault.AutofillHalfScreenDialogButton"
             android:orientation="horizontal">
 
diff --git a/core/res/res/values-night/themes_device_defaults.xml b/core/res/res/values-night/themes_device_defaults.xml
index 366e6f9..7cfdba7 100644
--- a/core/res/res/values-night/themes_device_defaults.xml
+++ b/core/res/res/values-night/themes_device_defaults.xml
@@ -98,5 +98,10 @@
         <item name="colorAccentPrimary">@color/system_accent1_700</item>
         <item name="textColorPrimary">@color/system_neutral1_100</item>
         <item name="textColorSecondary">@color/system_neutral2_100</item>
+        <item name="colorListDivider">@color/white</item>
+    </style>
+
+    <style name="Theme.DeviceDefault.AutofillHalfScreenDialogList" parent="Theme.DeviceDefault.DayNight">
+        <item name="colorForeground">@android:color/white</item>
     </style>
 </resources>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 211bf7f..43ca4f0 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -865,13 +865,13 @@
     <dimen name="autofill_dataset_picker_max_height">90%</dimen>
 
     <!-- Autofill save dialog padding -->
-    <dimen name="autofill_save_outer_top_margin">32dp</dimen>
+    <dimen name="autofill_save_outer_top_margin">24dp</dimen>
     <dimen name="autofill_save_outer_top_padding">16dp</dimen>
     <dimen name="autofill_elevation">32dp</dimen>
     <dimen name="autofill_save_inner_padding">16dp</dimen>
-    <dimen name="autofill_save_icon_size">24dp</dimen>
+    <dimen name="autofill_save_icon_size">32dp</dimen>
     <dimen name="autofill_save_title_start_padding">8dp</dimen>
-    <dimen name="autofill_save_scroll_view_top_margin">4dp</dimen>
+    <dimen name="autofill_save_scroll_view_top_margin">16dp</dimen>
     <dimen name="autofill_save_button_bar_padding">16dp</dimen>
     <dimen name="autofill_dialog_corner_radius">28dp</dimen>
 
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 0c35f93..34b1526 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1495,7 +1495,14 @@
         <item name="background">@drawable/autofill_dataset_picker_background</item>
     </style>
 
-    <!-- @hide -->
+    <!-- @hide Autofill save dialog title -->
+    <style name="AutofillSaveUiTitle" parent="TextAppearance.DeviceDefault.Subhead">
+        <item name="textColor">?attr/textColorPrimary</item>
+        <item name="fontFamily">google-sans</item>
+        <item name="textSize">24sp</item>
+    </style>
+
+    <!--@hide -->
     <style name="AutofillHalfScreenAnimation">
         <item name="android:windowEnterAnimation">@anim/slide_in_up</item>
         <item name="android:windowExitAnimation">@anim/slide_out_down</item>
diff --git a/core/res/res/values/themes_device_defaults.xml b/core/res/res/values/themes_device_defaults.xml
index 5000b58..c603c83 100644
--- a/core/res/res/values/themes_device_defaults.xml
+++ b/core/res/res/values/themes_device_defaults.xml
@@ -2704,4 +2704,8 @@
         <item name="textColorPrimary">@color/system_neutral1_900</item>
         <item name="textColorSecondary">@color/system_neutral2_700</item>
     </style>
+    <style name="Theme.DeviceDefault.AutofillHalfScreenDialogList" parent="Theme.DeviceDefault.DayNight">
+        <item name="colorListDivider">@color/list_divider_opacity_device_default_light</item>
+        <item name="opacityListDivider">@color/list_divider_opacity_device_default_light</item>
+    </style>
 </resources>
diff --git a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
index 826a98a..078a1d9 100644
--- a/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
+++ b/services/autofill/java/com/android/server/autofill/ui/SaveUi.java
@@ -348,7 +348,9 @@
         window.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
         window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
                 | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
+                | WindowManager.LayoutParams.FLAG_DIM_BEHIND
                 | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
+        window.setDimAmount(0.6f);
         window.addPrivateFlags(WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS);
         window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
         window.setGravity(Gravity.BOTTOM | Gravity.CENTER);