Snap for 5761090 from 0305b8b0be35fed3b51f68c083feca3cfbd0668a to qt-c2f2-release

Change-Id: I6eaaaf7591ab09e919ce51748eac6b05856e69f1
diff --git a/res/layout/fragment_category_picker.xml b/res/layout/fragment_category_picker.xml
index 51bf8d7..3c74180 100755
--- a/res/layout/fragment_category_picker.xml
+++ b/res/layout/fragment_category_picker.xml
@@ -26,6 +26,7 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:clipToPadding="false"
+        android:fitsSystemWindows="true"
         android:paddingLeft="@dimen/grid_padding"
         android:paddingTop="@dimen/grid_padding"
         android:scrollbarSize="@dimen/grid_padding"
diff --git a/res/layout/preview_page_info.xml b/res/layout/preview_page_info.xml
index 587e120..9299426 100644
--- a/res/layout/preview_page_info.xml
+++ b/res/layout/preview_page_info.xml
@@ -49,7 +49,7 @@
         android:layout_marginTop="@dimen/preview_attribution_pane_author_top_margin"
         android:forceHasOverlappingRendering="false"
         android:gravity="center"
-        android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
+        android:textAppearance="@android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Subtitle"
         android:textColor="@color/material_white_100"
         android:visibility="gone"/>
 
@@ -60,7 +60,8 @@
         android:minHeight="@dimen/preview_attribution_pane_description_height"
         android:forceHasOverlappingRendering="false"
         android:gravity="center_horizontal"
-        android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Caption"
+        android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"
+        android:textSize="12dp"
         android:textColor="@color/material_white_100"
         android:visibility="gone"/>
 
diff --git a/res/values-es-rUS/strings.xml b/res/values-es-rUS/strings.xml
index a95e589..d96971c 100644
--- a/res/values-es-rUS/strings.xml
+++ b/res/values-es-rUS/strings.xml
@@ -28,7 +28,7 @@
     <string name="load_wallpaper_error_message" msgid="7913278480467707374">"No se puede cargar el fondo de pantalla. La imagen está dañada o no está disponible."</string>
     <string name="static_wallpaper_presentation_mode_message" msgid="417940227049360906">"Establecido actualmente"</string>
     <string name="rotating_wallpaper_presentation_mode_message" msgid="3361676041605733288">"Fondo de pantalla diario"</string>
-    <string name="wallpaper_destination_both" msgid="1124197176741944063">"Pantalla principal y bloqueada"</string>
+    <string name="wallpaper_destination_both" msgid="1124197176741944063">"Pantalla principal y de bloqueo"</string>
     <string name="home_screen_message" msgid="106444102822522813">"Pantalla principal"</string>
     <string name="lock_screen_message" msgid="1534506081955058013">"Pantalla bloqueada"</string>
     <string name="home_and_lock_short_label" msgid="2937922943541927983">"Pantalla principal y bloqueada"</string>
diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml
index 269f05d..453ecb0 100644
--- a/res/values-hi/strings.xml
+++ b/res/values-hi/strings.xml
@@ -37,9 +37,9 @@
     <string name="set_wallpaper_lock_screen_destination" msgid="6224685559375417945">"लॉक स्‍क्रीन"</string>
     <string name="set_wallpaper_both_destination" msgid="6967226064958263939">"होम स्क्रीन और लॉक स्क्रीन"</string>
     <string name="no_backup_image_wallpaper_label" msgid="6316627676107284851">"तय समय के बाद बदलने वाला इमेज वॉलपेपर"</string>
-    <string name="permission_needed_explanation" msgid="139166837541426823">"यहां पर मौजूदा वॉलपेपर दिखाने के लिए, <xliff:g id="APP_NAME">%1$s</xliff:g> को आपके डिवाइस की मेमोरी का एक्सेस चाहिए."</string>
-    <string name="permission_needed_explanation_go_to_settings" msgid="3923551582092599609">"यहां पर मौजूदा वॉलपेपर दिखाने के लिए, वॉलपेपर को आपके डिवाइस की मेमोरी का एक्सेस चाहिए. \n\nवॉलपेपर ऐप्लिकेशन की जानकारी के मंज़ूरी वाले विकल्प पर जाकर आप यह सेटिंग बदल सकते हैं."</string>
-    <string name="permission_needed_allow_access_button_label" msgid="1943133660612924306">"एक्सेस दें"</string>
+    <string name="permission_needed_explanation" msgid="139166837541426823">"यहां पर मौजूदा वॉलपेपर दिखाने के लिए, <xliff:g id="APP_NAME">%1$s</xliff:g> को आपके डिवाइस की मेमोरी का ऐक्सेस चाहिए."</string>
+    <string name="permission_needed_explanation_go_to_settings" msgid="3923551582092599609">"यहां पर मौजूदा वॉलपेपर दिखाने के लिए, वॉलपेपर को आपके डिवाइस की मेमोरी का ऐक्सेस चाहिए. \n\nवॉलपेपर ऐप्लिकेशन की जानकारी के मंज़ूरी वाले विकल्प पर जाकर आप यह सेटिंग बदल सकते हैं."</string>
+    <string name="permission_needed_allow_access_button_label" msgid="1943133660612924306">"ऐक्सेस दें"</string>
     <string name="no_backup_image_wallpaper_description" msgid="8303268619408738057">"तय समय के बाद बदलने वाले वॉलपेपर के लिए लाइव वॉलपेपर सेवा"</string>
     <string name="daily_refresh_tile_title" msgid="3270456074558525091">"रोज़ वॉलपेपर बदलने की सुविधा"</string>
     <string name="daily_refresh_tile_subtitle" msgid="3976682014885446443">"चालू करने के लिए टैप करें"</string>
diff --git a/res/values-in/strings.xml b/res/values-in/strings.xml
index 565f9c4..afe8069 100644
--- a/res/values-in/strings.xml
+++ b/res/values-in/strings.xml
@@ -42,8 +42,8 @@
     <string name="permission_needed_allow_access_button_label" msgid="1943133660612924306">"Izinkan akses"</string>
     <string name="no_backup_image_wallpaper_description" msgid="8303268619408738057">"Layanan wallpaper animasi untuk memutar wallpaper"</string>
     <string name="daily_refresh_tile_title" msgid="3270456074558525091">"Wallpaper harian"</string>
-    <string name="daily_refresh_tile_subtitle" msgid="3976682014885446443">"Tap untuk mengaktifkan"</string>
-    <string name="start_rotation_dialog_body_live_wallpaper_needed" msgid="5132580257563846082">"Wallpaper akan otomatis berubah setiap hari. Untuk menyelesaikan penyiapan, tap &lt;strong&gt;Setel wallpaper&lt;/strong&gt; di layar selanjutnya."</string>
+    <string name="daily_refresh_tile_subtitle" msgid="3976682014885446443">"Ketuk untuk mengaktifkan"</string>
+    <string name="start_rotation_dialog_body_live_wallpaper_needed" msgid="5132580257563846082">"Wallpaper akan otomatis berubah setiap hari. Untuk menyelesaikan penyiapan, ketuk &lt;strong&gt;Setel wallpaper&lt;/strong&gt; di layar selanjutnya."</string>
     <string name="start_rotation_dialog_wifi_only_option_message" msgid="3126269859713666225">"Download wallpaper mendatang hanya melalui Wi-Fi"</string>
     <string name="start_rotation_dialog_continue" msgid="276678987852274872">"Lanjutkan"</string>
     <string name="start_rotation_progress_message" msgid="7872623873682262083">"Mendownload wallpaper pertama…"</string>
diff --git a/res/values-notnight-v27/styles.xml b/res/values-notnight-v27/styles.xml
index 683d09d..e090c4c 100755
--- a/res/values-notnight-v27/styles.xml
+++ b/res/values-notnight-v27/styles.xml
@@ -20,10 +20,8 @@
         <item name="colorPrimary">?android:colorPrimary</item>
         <item name="colorControlActivated">?attr/colorPrimary</item>
         <item name="colorControlNormal">?android:attr/colorPrimary</item>
-        <item name="android:statusBarColor">?attr/colorPrimary</item>
-        <item name="android:windowLightStatusBar">true</item>
 
-        <item name="android:navigationBarColor">?android:colorPrimaryDark</item>
+        <item name="android:navigationBarColor">@android:color/transparent</item>
         <item name="android:navigationBarDividerColor">@android:color/transparent</item>
         <item name="android:windowLightNavigationBar">true</item>
 
@@ -39,8 +37,6 @@
 
         <item name="android:windowActionBar">false</item>
         <item name="android:windowNoTitle">true</item>
-        <item name="android:fitsSystemWindows">false</item>
-        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
     </style>
 
     <!-- Dialog themes -->
diff --git a/res/values-v29/styles.xml b/res/values-v29/styles.xml
new file mode 100644
index 0000000..e7f27d4
--- /dev/null
+++ b/res/values-v29/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+     Copyright (C) 2019 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.
+-->
+<resources>
+    <style name="PreviewCheckboxDeviceTheme" parent="@android:style/ThemeOverlay.DeviceDefault.Accent.DayNight">
+        <item name="android:colorControlActivated">?android:attr/colorAccent</item>
+    </style>
+</resources>
\ No newline at end of file
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 2723934..6259281 100755
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -13,7 +13,7 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<resources xmlns:tools="http://schemas.android.com/tools" tools:targetApi="23">
+<resources>
 
     <!-- Main themes -->
     <style name="WallpaperTheme" parent="@android:style/Theme.DeviceDefault.Settings">
@@ -102,9 +102,7 @@
 
     <style name="ActionBarCheckboxStyle" parent="@android:style/Widget.DeviceDefault.CompoundButton.CheckBox"/>
 
-    <style name="PreviewCheckboxDeviceTheme" parent="@android:style/Theme.DeviceDefault">
-        <item name="android:colorControlActivated">@*android:color/accent_device_default_light</item>
-    </style>
+    <style name="PreviewCheckboxDeviceTheme" parent="@android:style/Theme.DeviceDefault"/>
 
     <style name="select_wallpaper_header">
         <item name="android:textColor">@color/translucent_black_60_alpha</item>
diff --git a/src/com/android/wallpaper/asset/StreamableAsset.java b/src/com/android/wallpaper/asset/StreamableAsset.java
index 118581d..17f2522 100755
--- a/src/com/android/wallpaper/asset/StreamableAsset.java
+++ b/src/com/android/wallpaper/asset/StreamableAsset.java
@@ -260,12 +260,6 @@
                 mTargetWidth = tempHeight;
             }
 
-            InputStream inputStream = openInputStream();
-            // Input stream may be null if there was an error opening it.
-            if (inputStream == null) {
-                return null;
-            }
-
             BitmapFactory.Options options = new BitmapFactory.Options();
 
             Point rawDimensions = calculateRawDimensions();
@@ -277,6 +271,7 @@
                     rawDimensions.x, rawDimensions.y, mTargetWidth, mTargetHeight);
             options.inPreferredConfig = Config.HARDWARE;
 
+            InputStream inputStream = openInputStream();
             Bitmap bitmap = BitmapFactory.decodeStream(inputStream, null, options);
             closeInputStream(
                     inputStream, "Error closing the input stream used to decode the full bitmap");
diff --git a/src/com/android/wallpaper/picker/TopLevelPickerActivity.java b/src/com/android/wallpaper/picker/TopLevelPickerActivity.java
index ac6a13b..87358ec 100755
--- a/src/com/android/wallpaper/picker/TopLevelPickerActivity.java
+++ b/src/com/android/wallpaper/picker/TopLevelPickerActivity.java
@@ -20,6 +20,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.graphics.Color;
+import android.graphics.Insets;
 import android.graphics.Point;
 import android.graphics.PorterDuff.Mode;
 import android.graphics.drawable.Drawable;
@@ -32,6 +33,7 @@
 import android.util.Log;
 import android.view.View;
 import android.view.View.OnClickListener;
+import android.view.WindowInsets;
 import android.widget.Button;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
@@ -47,6 +49,7 @@
 
 import com.android.wallpaper.R;
 import com.android.wallpaper.asset.Asset;
+import com.android.wallpaper.compat.BuildCompat;
 import com.android.wallpaper.compat.ButtonDrawableSetterCompat;
 import com.android.wallpaper.config.Flags;
 import com.android.wallpaper.model.Category;
@@ -241,6 +244,29 @@
 
     private void initializeMobile(boolean shouldForceRefresh) {
         setContentView(R.layout.activity_single_fragment);
+        getWindow().getDecorView().setSystemUiVisibility(
+                getWindow().getDecorView().getSystemUiVisibility()
+                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+                        | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
+        findViewById(R.id.fragment_container)
+                .setOnApplyWindowInsetsListener((view, windowInsets) -> {
+            view.setPadding(view.getPaddingLeft(), windowInsets.getSystemWindowInsetTop(),
+                    view.getPaddingRight(), view.getBottom());
+            // Consume only the top inset (status bar), to let other content in the Activity consume
+            // the nav bar (ie, by using "fitSystemWindows")
+            if (BuildCompat.isAtLeastQ()) {
+                WindowInsets.Builder builder = new WindowInsets.Builder(windowInsets);
+                builder.setSystemWindowInsets(Insets.of(windowInsets.getSystemWindowInsetLeft(),
+                        0, windowInsets.getStableInsetRight(),
+                        windowInsets.getSystemWindowInsetBottom()));
+                return builder.build();
+            } else {
+                return windowInsets.replaceSystemWindowInsets(
+                        windowInsets.getSystemWindowInsetLeft(),
+                        0, windowInsets.getStableInsetRight(),
+                        windowInsets.getSystemWindowInsetBottom());
+            }
+        });
 
         // Set toolbar as the action bar.
         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerActivity.java b/src/com/android/wallpaper/picker/individual/IndividualPickerActivity.java
index 1f5dc99..3ed5bf3 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerActivity.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerActivity.java
@@ -114,7 +114,8 @@
                 getWindow().getDecorView().getSystemUiVisibility()
                         | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                         | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
-        getWindow().getDecorView().setOnApplyWindowInsetsListener((view, windowInsets) -> {
+        ((View) findViewById(R.id.fragment_container).getParent())
+                .setOnApplyWindowInsetsListener((view, windowInsets) -> {
             view.setPadding(view.getPaddingLeft(), windowInsets.getSystemWindowInsetTop(),
                     view.getPaddingRight(), view.getBottom());
             // Consume only the top inset (status bar), to let other content in the Activity consume