Snap for 7493928 from 6ba55424ee2c74fcd8b937a4cf6aadcd44529b22 to sc-v2-release

Change-Id: Iddc144eeba664eefb9c826fafe467c52c4d539e8
diff --git a/res/values-ky/strings.xml b/res/values-ky/strings.xml
index 050b30c..a9442fc 100644
--- a/res/values-ky/strings.xml
+++ b/res/values-ky/strings.xml
@@ -79,7 +79,7 @@
     <string name="accessibility_custom_shape_title" msgid="7708408259374643129">"Жеке форма"</string>
     <string name="accessibility_custom_name_title" msgid="5494460518085463262">"Жеке стилдин аталышы"</string>
     <string name="mode_title" msgid="2394873501427436055">"Караңгы тема"</string>
-    <string name="mode_disabled_msg" msgid="9196245518435936512">"Батареяны үнөмдөгүч режиминде убактылуу өчүрүлдү"</string>
+    <string name="mode_disabled_msg" msgid="9196245518435936512">"Батареяны үнөмдөөчү режимде убактылуу өчүрүлдү"</string>
     <string name="themed_icon_title" msgid="7312460430471956558">"Тематикалык сүрөтчөлөр"</string>
     <string name="gird_picker_entry_content_description" msgid="9087651470212293439">"Колдонмонун торчосун өзгөртүү"</string>
 </resources>
diff --git a/src/com/android/customization/picker/theme/ThemeFragment.java b/src/com/android/customization/picker/theme/ThemeFragment.java
index 3537c36..f5d56ca 100644
--- a/src/com/android/customization/picker/theme/ThemeFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFragment.java
@@ -52,6 +52,7 @@
 import com.android.wallpaper.picker.AppbarFragment;
 import com.android.wallpaper.widget.BottomActionBar;
 import com.android.wallpaper.widget.BottomActionBar.AccessibilityCallback;
+import com.android.wallpaper.widget.BottomActionBar.BottomSheetContent;
 
 import java.util.List;
 
@@ -147,9 +148,9 @@
             mBottomActionBar.disableActions();
             applyTheme();
         });
-        mThemeInfoView = (ThemeInfoView) LayoutInflater.from(getContext()).inflate(
-                R.layout.theme_info_view, /* root= */ null);
-        mBottomActionBar.attachViewToBottomSheetAndBindAction(mThemeInfoView, INFORMATION);
+
+        mBottomActionBar.bindBottomSheetContentWithAction(
+                new ThemeInfoContent(getContext()), INFORMATION);
         mBottomActionBar.setActionClickListener(CUSTOMIZE, this::onCustomizeClicked);
 
         // Update target view's accessibility param since it will be blocked by the bottom sheet
@@ -378,4 +379,24 @@
                 themeToEdit.getSerializedPackages());
         startActivityForResult(intent, CustomThemeActivity.REQUEST_CODE_CUSTOM_THEME);
     }
+
+    private final class ThemeInfoContent extends BottomSheetContent<ThemeInfoView> {
+
+        private ThemeInfoContent(Context context) {
+            super(context);
+        }
+
+        @Override
+        public int getViewId() {
+            return R.layout.theme_info_view;
+        }
+
+        @Override
+        public void onViewCreated(ThemeInfoView view) {
+            mThemeInfoView = view;
+            if (mSelectedTheme != null) {
+                mThemeInfoView.populateThemeInfo(mSelectedTheme);
+            }
+        }
+    }
 }
diff --git a/src/com/android/customization/picker/theme/ThemeFullPreviewFragment.java b/src/com/android/customization/picker/theme/ThemeFullPreviewFragment.java
index 5ea84ce..3ba64ec 100644
--- a/src/com/android/customization/picker/theme/ThemeFullPreviewFragment.java
+++ b/src/com/android/customization/picker/theme/ThemeFullPreviewFragment.java
@@ -21,6 +21,7 @@
 import static com.android.wallpaper.widget.BottomActionBar.BottomAction.INFORMATION;
 
 import android.app.Activity;
+import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
 import android.util.Log;
@@ -42,6 +43,7 @@
 import com.android.wallpaper.module.InjectorProvider;
 import com.android.wallpaper.picker.AppbarFragment;
 import com.android.wallpaper.widget.BottomActionBar;
+import com.android.wallpaper.widget.BottomActionBar.BottomSheetContent;
 
 import com.bumptech.glide.Glide;
 
@@ -131,10 +133,8 @@
         } else {
             bottomActionBar.showActionsOnly(INFORMATION);
         }
-        ThemeInfoView themeInfoView = (ThemeInfoView) LayoutInflater.from(getContext()).inflate(
-                R.layout.theme_info_view, /* root= */ null);
-        themeInfoView.populateThemeInfo(mThemeBundle);
-        bottomActionBar.attachViewToBottomSheetAndBindAction(themeInfoView, INFORMATION);
+        bottomActionBar.bindBottomSheetContentWithAction(
+                new ThemeInfoContent(getContext()), INFORMATION);
         bottomActionBar.show();
     }
 
@@ -145,4 +145,21 @@
         activity.setResult(RESULT_OK, intent);
         activity.finish();
     }
+
+    private final class ThemeInfoContent extends BottomSheetContent<ThemeInfoView> {
+
+        private ThemeInfoContent(Context context) {
+            super(context);
+        }
+
+        @Override
+        public int getViewId() {
+            return R.layout.theme_info_view;
+        }
+
+        @Override
+        public void onViewCreated(ThemeInfoView view) {
+            view.populateThemeInfo(mThemeBundle);
+        }
+    }
 }