Fix live full preview show black
Live full preview will show black wallpaper while unlocking
the device from lock screen.
Wallpaper does not set up connection while unlocking the
device from lock screen.
Update wallpaper conneciton in onStart().
Bug: 158812342
Test: Manual
Change-Id: I8a2685e7c19291564d68403d7c54a688c44ff160
diff --git a/src/com/android/wallpaper/picker/LivePreviewFragment.java b/src/com/android/wallpaper/picker/LivePreviewFragment.java
index efc4d93..6ac8649 100644
--- a/src/com/android/wallpaper/picker/LivePreviewFragment.java
+++ b/src/com/android/wallpaper/picker/LivePreviewFragment.java
@@ -200,7 +200,6 @@
setupPreview()
);
setupCurrentWallpaperPreview(view);
- previewLiveWallpaper(container, mHomePreview);
setupPreview();
renderWorkspaceSurface();
onBottomActionBarReady(mBottomActionBar);
@@ -302,8 +301,8 @@
super.onDestroy();
}
- private void previewLiveWallpaper(ViewGroup container, ImageView thumbnailView) {
- container.post(() -> {
+ private void previewLiveWallpaper(ImageView thumbnailView) {
+ thumbnailView.post(() -> {
mWallpaper.getThumbAsset(requireActivity().getApplicationContext()).loadPreviewImage(
requireActivity(), thumbnailView,
getResources().getColor(R.color.secondary_color));
@@ -378,7 +377,7 @@
mWallpaperConnection.setVisibility(true);
previewView.post(() -> {
- if (!mWallpaperConnection.connect()) {
+ if (mWallpaperConnection != null && !mWallpaperConnection.connect()) {
mWallpaperConnection = null;
LiveTileOverlay.INSTANCE.detach(previewView.getOverlay());
}
@@ -517,6 +516,12 @@
}
@Override
+ public void onStart() {
+ super.onStart();
+ previewLiveWallpaper(mHomePreview);
+ }
+
+ @Override
public void onResume() {
super.onResume();
if (mWallpaperConnection != null) {