Improve splash screen small icon support.

This change gets rid of the small splash screen layout, which
effectively shifts the text placement a little closer to the icon when
the icon in small, and avoids having long text get cut off vertically.

This also lowers the minimum icon size to 16dp for screens smaller
than 600dp, where small icons don't look quite as bad.

Bug: 977198
Change-Id: I58ebe7c76af6dc756709a21141c5cc45843cf135
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1670121
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672128}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java
index 445f350..11aa7109 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java
@@ -279,40 +279,6 @@
     @Test
     @SmallTest
     @Feature({"Webapps"})
-    public void testSmallSplashScreenAppears() throws Exception {
-        // Register a smaller icon for the splash screen.
-        Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
-        int thresholdSize = context.getResources().getDimensionPixelSize(
-                R.dimen.webapp_splash_image_size_threshold);
-        int size = context.getResources().getDimensionPixelSize(
-                R.dimen.webapp_splash_image_size_minimum);
-        Bitmap splashBitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
-        String bitmapString = ShortcutHelper.encodeBitmapAsString(splashBitmap);
-
-        TestFetchStorageCallback callback = new TestFetchStorageCallback();
-        WebappRegistry.getInstance().register(WebappActivityTestRule.WEBAPP_ID, callback);
-        callback.waitForCallback(0);
-        callback.getStorage().updateSplashScreenImage(bitmapString);
-
-        ViewGroup splashScreen = mActivityTestRule.startWebappActivityAndWaitForSplashScreen();
-        Assert.assertTrue(mActivityTestRule.isSplashScreenVisible());
-
-        // The icon is centered within a fixed-size area on the splash screen.
-        ImageView splashImage =
-                (ImageView) splashScreen.findViewById(R.id.webapp_splash_screen_icon);
-        Assert.assertEquals(thresholdSize, splashImage.getMeasuredWidth());
-        Assert.assertEquals(thresholdSize, splashImage.getMeasuredHeight());
-
-        // The web app name is anchored to the icon.
-        TextView splashText = (TextView) splashScreen.findViewById(R.id.webapp_splash_screen_name);
-        int[] rules = ((RelativeLayout.LayoutParams) splashText.getLayoutParams()).getRules();
-        Assert.assertEquals(0, rules[RelativeLayout.ALIGN_PARENT_BOTTOM]);
-        Assert.assertEquals(R.id.webapp_splash_screen_icon, rules[RelativeLayout.BELOW]);
-    }
-
-    @Test
-    @SmallTest
-    @Feature({"Webapps"})
     public void testSplashScreenWithoutImageAppears() throws Exception {
         // Register an image that's too small for the splash screen.
         Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
diff --git a/chrome/android/webapk/libs/common/res_splash/layout/webapp_splash_screen_small.xml b/chrome/android/webapk/libs/common/res_splash/layout/webapp_splash_screen_small.xml
deleted file mode 100644
index 9d3cb22..0000000
--- a/chrome/android/webapk/libs/common/res_splash/layout/webapp_splash_screen_small.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2018 The Chromium Authors. All rights reserved.
-
-     Use of this source code is governed by a BSD-style license that can be
-     found in the LICENSE file.
--->
-
-<!-- The spec offsets the center of the ImageView from the center of the screen by either 16 or
-     24dp, depending on the device type.  That's implemented here by adding a bottom margin of twice
-     that amount to the RelativeLayout, which effectively moves its center upward by the desired dp.
- -->
-<RelativeLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/webapp_splash_screen_layout"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layout_marginBottom="@dimen/webapp_splash_offset" >
-
-    <ImageView
-        android:id="@+id/webapp_splash_screen_icon"
-        android:layout_width="@dimen/webapp_splash_small_image_size"
-        android:layout_height="@dimen/webapp_splash_small_image_size"
-        android:layout_centerInParent="true"
-        android:scaleType="center"
-        tools:ignore="ContentDescription" />
-
-    <TextView
-        android:id="@+id/webapp_splash_screen_name"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_below="@id/webapp_splash_screen_icon"
-        android:layout_centerHorizontal="true"
-        android:layout_marginTop="@dimen/webapp_splash_small_title_margin_top"
-        style="@style/WebappSplashScreenTextTheme" />
-
-</RelativeLayout>
diff --git a/chrome/android/webapk/libs/common/res_splash/values-sw600dp/common_dimens.xml b/chrome/android/webapk/libs/common/res_splash/values-sw600dp/common_dimens.xml
index 1fa4a23..e0b278d 100644
--- a/chrome/android/webapk/libs/common/res_splash/values-sw600dp/common_dimens.xml
+++ b/chrome/android/webapk/libs/common/res_splash/values-sw600dp/common_dimens.xml
@@ -6,4 +6,5 @@
 <resources>
     <dimen name="webapp_splash_offset">48dp</dimen>
     <dimen name="webapp_splash_large_title_margin_bottom">8dp</dimen>
+    <dimen name="webapp_splash_image_size_minimum">48dp</dimen>
 </resources>
diff --git a/chrome/android/webapk/libs/common/res_splash/values/common_dimens.xml b/chrome/android/webapk/libs/common/res_splash/values/common_dimens.xml
index fdcb563..ead441c2 100644
--- a/chrome/android/webapk/libs/common/res_splash/values/common_dimens.xml
+++ b/chrome/android/webapk/libs/common/res_splash/values/common_dimens.xml
@@ -7,9 +7,7 @@
     <dimen name="webapp_splash_offset">32dp</dimen>
     <dimen name="webapp_splash_image_size_ideal">128dp</dimen>
     <dimen name="webapp_splash_image_size_threshold">80dp</dimen>
-    <dimen name="webapp_splash_image_size_minimum">48dp</dimen>
+    <dimen name="webapp_splash_image_size_minimum">16dp</dimen>
 
-    <dimen name="webapp_splash_small_image_size">80dp</dimen>
-    <dimen name="webapp_splash_small_title_margin_top">32dp</dimen>
     <dimen name="webapp_splash_large_title_margin_bottom">16dp</dimen>
 </resources>
diff --git a/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/splash/SplashLayout.java b/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/splash/SplashLayout.java
index 0fc21f2..69031fe 100644
--- a/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/splash/SplashLayout.java
+++ b/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/splash/SplashLayout.java
@@ -68,7 +68,6 @@
             case IconClassification.INVALID:
                 return R.layout.webapp_splash_screen_no_icon;
             case IconClassification.SMALL:
-                return R.layout.webapp_splash_screen_small;
             case IconClassification.LARGE:
             default:
                 return R.layout.webapp_splash_screen_large;
diff --git a/chrome/android/webapk/shell_apk/current_version/current_version.gni b/chrome/android/webapk/shell_apk/current_version/current_version.gni
index fe83047..c3a2029 100644
--- a/chrome/android/webapk/shell_apk/current_version/current_version.gni
+++ b/chrome/android/webapk/shell_apk/current_version/current_version.gni
@@ -12,4 +12,4 @@
 # //chrome/android/webapk/shell_apk:webapk is changed. This includes
 # Java files, Android resource files and AndroidManifest.xml. Does not affect
 # Chrome.apk
-current_shell_apk_version = 96
+current_shell_apk_version = 97