Initialize WallpaperPicker in CustomizationPicker's creation only

Initialize WallpaperPicker section in CustomizationPickerActivity's onCreate() only

Bug: 131310001
Test: Manual
Change-Id: Iac58f689f66dbf1e2a2f1bc1ad52a84a5c8f6151
diff --git a/src/com/android/customization/picker/CustomizationPickerActivity.java b/src/com/android/customization/picker/CustomizationPickerActivity.java
index 110dbaf..6156458 100644
--- a/src/com/android/customization/picker/CustomizationPickerActivity.java
+++ b/src/com/android/customization/picker/CustomizationPickerActivity.java
@@ -17,7 +17,6 @@
 
 import android.app.Activity;
 import android.content.Intent;
-import android.content.SharedPreferences;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.LayerDrawable;
 import android.os.Build;
@@ -97,12 +96,15 @@
     private CategoryFragment mWallpaperCategoryFragment;
     private WallpaperSetter mWallpaperSetter;
 
+    private boolean mWallpaperCategoryInitialized;
+
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         Injector injector = InjectorProvider.getInjector();
         mDelegate = new WallpaperPickerDelegate(this, this, injector);
         mUserEventLogger = injector.getUserEventLogger(this);
         initSections();
+        mWallpaperCategoryInitialized = false;
 
         // Restore this Activity's state before restoring contained Fragments state.
         super.onCreate(savedInstanceState);
@@ -413,7 +415,10 @@
 
         @Override
         void onVisible() {
-            mDelegate.initialize(mForceCategoryRefresh);
+            if (!mWallpaperCategoryInitialized) {
+                mDelegate.initialize(mForceCategoryRefresh);
+            }
+            mWallpaperCategoryInitialized = true;
         }
     }