Unregister the package event listeners when they are not used.

If we don't unregister them, there will be many redundant listeners and it will cause we fetch wallpapers from the server many times in a short period when receiving the package change event.
For example, it will cause loading wallpapers takes lots of time.(Video:https://drive.google.com/file/d/12nPSrePI0xA1cLrNLOQo1y30WNY7L1W2/view?usp=sharing&resourcekey=0-Y7NWmg3Qax9Qi9UwMVs16Q)

Bug: 175867467

Change-Id: Ie111b5c1e700f3357be4cb0b006de8d7a3483984
diff --git a/src/com/android/wallpaper/picker/CategorySelectorFragment.java b/src/com/android/wallpaper/picker/CategorySelectorFragment.java
index 5433116..198bd1d 100644
--- a/src/com/android/wallpaper/picker/CategorySelectorFragment.java
+++ b/src/com/android/wallpaper/picker/CategorySelectorFragment.java
@@ -96,6 +96,11 @@
         void fetchCategories();
 
         /**
+         * Cleans up the listeners which will be notified when there's a package event.
+         */
+        void cleanUp();
+
+        /**
          * Hides the {@link com.android.wallpaper.widget.BottomActionBar}.
          */
         void hideBottomActionBar();
@@ -141,6 +146,12 @@
         return view;
     }
 
+    @Override
+    public void onDestroyView() {
+        getCategorySelectorFragmentHost().cleanUp();
+        super.onDestroyView();
+    }
+
     /**
      * Inserts the given category into the categories list in priority order.
      */