Fix the crash when applying daily wallpaper without network connection
It's because CustomizationPickerActivity is cast to BaseActivity to call isSafeToCommitFragmentTransaction(), but it is not a BaseActivity.
Extract isSafeToCommitFragmentTransaction() to an interface to let CustomizationPickerActivity to implement it.
Bug: 167943713
Change-Id: I497620f86f5309392761ce11e19bc183a70178cb
diff --git a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
index 5fd0e7a..260d121 100755
--- a/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
+++ b/src/com/android/wallpaper/picker/individual/IndividualPickerFragment.java
@@ -78,6 +78,7 @@
import com.android.wallpaper.picker.BaseActivity;
import com.android.wallpaper.picker.BottomActionBarFragment;
import com.android.wallpaper.picker.CurrentWallpaperBottomSheetPresenter;
+import com.android.wallpaper.picker.FragmentTransactionChecker;
import com.android.wallpaper.picker.MyPhotosStarter.MyPhotosStarterProvider;
import com.android.wallpaper.picker.PreviewActivity;
import com.android.wallpaper.picker.RotationStarter;
@@ -816,7 +817,7 @@
}
private void showStartRotationErrorDialog(@NetworkPreference int networkPreference) {
- BaseActivity activity = (BaseActivity) getActivity();
+ FragmentTransactionChecker activity = (FragmentTransactionChecker) getActivity();
if (activity != null) {
StartRotationErrorDialogFragment startRotationErrorDialogFragment =
StartRotationErrorDialogFragment.newInstance(networkPreference);