Let the wallpaper category list page(CategorySelectorFragment) can be attached to not only fragment but also activity independently.
Bug: 181299737
Test: Manual
Change-Id: Ie72bf73726b87eef4494df0268edfc0236d2fc22
diff --git a/src/com/android/wallpaper/picker/TopLevelPickerActivity.java b/src/com/android/wallpaper/picker/TopLevelPickerActivity.java
index 77bbd58..e8f1ab6 100755
--- a/src/com/android/wallpaper/picker/TopLevelPickerActivity.java
+++ b/src/com/android/wallpaper/picker/TopLevelPickerActivity.java
@@ -238,8 +238,7 @@
return;
}
- CategoryFragment categoryFragment = getCategoryFragment();
- if (categoryFragment != null && categoryFragment.popChildFragment()) {
+ if (fragment != null && fragment.getChildFragmentManager().popBackStackImmediate()) {
return;
}
super.onBackPressed();
@@ -650,12 +649,13 @@
@Override
@Nullable
- public CategoryFragment getCategoryFragment() {
+ public CategorySelectorFragment getCategorySelectorFragment() {
if (mDelegate.getFormFactor() != FormFactorChecker.FORM_FACTOR_MOBILE) {
return null;
}
FragmentManager fm = getSupportFragmentManager();
- return (CategoryFragment) fm.findFragmentById(R.id.fragment_container);
+ return ((CategoryFragment) fm.findFragmentById(
+ R.id.fragment_container)).getCategorySelectorFragment();
}
/**