Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6755423 authored by Chuck Liao's avatar Chuck Liao Committed by Automerger Merge Worker
Browse files

Fix the crash when applying daily wallpaper without network connection am: 9020c8d7

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/ThemePicker/+/12538597

Change-Id: I8237f34feea6b865416dd8a4c7b72d5f5d5157d9
parents f2e33216 9020c8d7
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -70,6 +70,7 @@ import com.android.wallpaper.module.WallpaperPreferences;
import com.android.wallpaper.picker.BottomActionBarFragment;
import com.android.wallpaper.picker.CategoryFragment;
import com.android.wallpaper.picker.CategoryFragment.CategoryFragmentHost;
import com.android.wallpaper.picker.FragmentTransactionChecker;
import com.android.wallpaper.picker.MyPhotosStarter;
import com.android.wallpaper.picker.MyPhotosStarter.PermissionChangedListener;
import com.android.wallpaper.picker.TopLevelPickerActivity;
@@ -90,7 +91,7 @@ import java.util.Map;
 */
public class CustomizationPickerActivity extends FragmentActivity implements WallpapersUiContainer,
        CategoryFragmentHost, ThemeFragmentHost, GridFragmentHost, ClockFragmentHost,
        BottomActionBarHost {
        BottomActionBarHost, FragmentTransactionChecker {

    public static final String WALLPAPER_FLAVOR_EXTRA =
            "com.android.launcher3.WALLPAPER_FLAVOR";
@@ -105,6 +106,7 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
    private static final Map<Integer, CustomizationSection> mSections = new HashMap<>();
    private CategoryFragment mWallpaperCategoryFragment;
    private BottomActionBar mBottomActionBar;
    private boolean mIsSafeToCommitFragmentTransaction;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
@@ -155,6 +157,7 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
    @Override
    protected void onResume() {
        super.onResume();
        mIsSafeToCommitFragmentTransaction = true;
        boolean wallpaperOnly =
                WALLPAPER_ONLY.equals(getIntent().getStringExtra(WALLPAPER_FLAVOR_EXTRA));
        boolean provisioned = Settings.Global.getInt(getContentResolver(),
@@ -177,6 +180,12 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
        mIsSafeToCommitFragmentTransaction = false;
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
@@ -447,6 +456,11 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
        return mBottomActionBar;
    }

    @Override
    public boolean isSafeToCommitFragmentTransaction() {
        return mIsSafeToCommitFragmentTransaction;
    }

    /**
     * Represents a section of the Picker (eg "ThemeBundle", "Clock", etc).
     * There should be a concrete subclass per available section, providing the corresponding