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

Commit 6b65743a authored by Tony Wickham's avatar Tony Wickham Committed by Automerger Merge Worker
Browse files

Merging from ub-launcher3-rvc-qpr-dev @ build 6777894 am: 45f8faa5

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

Change-Id: Icf39216253fb1c992552e29d1fd3f3671665e79d
parents 95a8129f 45f8faa5
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -15,7 +15,12 @@
 */
package com.android.customization.module;

import static com.android.customization.picker.CustomizationPickerActivity.WALLPAPER_FLAVOR_EXTRA;
import static com.android.customization.picker.CustomizationPickerActivity.WALLPAPER_FOCUS;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
@@ -23,6 +28,7 @@ import androidx.fragment.app.FragmentActivity;
import com.android.customization.model.theme.OverlayManagerCompat;
import com.android.customization.model.theme.ThemeBundleProvider;
import com.android.customization.model.theme.ThemeManager;
import com.android.customization.picker.CustomizationPickerActivity;
import com.android.wallpaper.model.CategoryProvider;
import com.android.wallpaper.model.WallpaperInfo;
import com.android.wallpaper.module.BaseWallpaperInjector;
@@ -94,6 +100,16 @@ public class DefaultCustomizationInjector extends BaseWallpaperInjector
        return PreviewFragment.newInstance(wallpaperInfo, mode, viewAsHome, testingModeEnabled);
    }

    @Override
    public Intent getDeepLinkRedirectIntent(Context context, Uri uri) {
        Intent intent = new Intent();
        intent.setClass(context, CustomizationPickerActivity.class);
        intent.setData(uri);
        intent.putExtra(WALLPAPER_FLAVOR_EXTRA, WALLPAPER_FOCUS);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        return intent;
    }

    @Override
    public synchronized PerformanceMonitor getPerformanceMonitor() {
        if (mPerformanceMonitor == null) {
+12 −16
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ import com.android.wallpaper.picker.MyPhotosStarter.PermissionChangedListener;
import com.android.wallpaper.picker.TopLevelPickerActivity;
import com.android.wallpaper.picker.WallpaperPickerDelegate;
import com.android.wallpaper.picker.WallpapersUiContainer;
import com.android.wallpaper.util.DeepLinkUtils;
import com.android.wallpaper.widget.BottomActionBar;
import com.android.wallpaper.widget.BottomActionBar.BottomActionBarHost;

@@ -91,10 +92,10 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
        CategoryFragmentHost, ThemeFragmentHost, GridFragmentHost, ClockFragmentHost,
        BottomActionBarHost {

    private static final String TAG = "CustomizationPickerActivity";
    @VisibleForTesting static final String WALLPAPER_FLAVOR_EXTRA =
    public static final String WALLPAPER_FLAVOR_EXTRA =
            "com.android.launcher3.WALLPAPER_FLAVOR";
    @VisibleForTesting static final String WALLPAPER_FOCUS = "focus_wallpaper";
    public static final String WALLPAPER_FOCUS = "focus_wallpaper";
    private static final String TAG = "CustomizationPickerActivity";
    @VisibleForTesting static final String WALLPAPER_ONLY = "wallpaper_only";

    private WallpaperPickerDelegate mDelegate;
@@ -105,15 +106,12 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
    private CategoryFragment mWallpaperCategoryFragment;
    private BottomActionBar mBottomActionBar;

    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);
@@ -190,6 +188,9 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal

    private void skipToWallpaperPicker() {
        Intent intent = new Intent(this, TopLevelPickerActivity.class);
        if (DeepLinkUtils.isDeepLink(getIntent())) {
            intent.setData(getIntent().getData());
        }
        startActivity(intent);
        finish();
    }
@@ -371,6 +372,11 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
        return true;
    }

    @Override
    public void fetchCategories() {
        mDelegate.initialize(!mDelegate.getCategoryProvider().isCategoriesFetched());
    }

    @Override
    public void onWallpapersReady() {

@@ -471,7 +477,6 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
     * {@link CustomizationSection} corresponding to the "Wallpaper" section of the Picker.
     */
    private class WallpaperSection extends CustomizationSection {
        private boolean mForceCategoryRefresh;

        private WallpaperSection(int id) {
            super(id, null);
@@ -482,18 +487,9 @@ public class CustomizationPickerActivity extends FragmentActivity implements Wal
            if (mWallpaperCategoryFragment == null) {
                mWallpaperCategoryFragment = CategoryFragment.newInstance(
                        getString(R.string.wallpaper_title));
                mForceCategoryRefresh = true;
            }
            return mWallpaperCategoryFragment;
        }

        @Override
        void onVisible() {
            if (!mWallpaperCategoryInitialized) {
                mDelegate.initialize(mForceCategoryRefresh);
            }
            mWallpaperCategoryInitialized = true;
        }
    }

    private class ThemeSection extends CustomizationSection<ThemeBundle> {
+12 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
package com.android.wallpaper.module;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

import androidx.fragment.app.Fragment;

@@ -23,6 +25,7 @@ import com.android.wallpaper.model.CategoryProvider;
import com.android.wallpaper.model.WallpaperInfo;
import com.android.wallpaper.monitor.PerformanceMonitor;
import com.android.wallpaper.picker.ImagePreviewFragment;
import com.android.wallpaper.picker.TopLevelPickerActivity;

/**
 * A concrete, real implementation of the dependency provider.
@@ -74,6 +77,15 @@ public class WallpapersInjector extends BaseWallpaperInjector {
                testingModeEnabled);
    }

    @Override
    public Intent getDeepLinkRedirectIntent(Context context, Uri uri) {
        Intent intent = new Intent();
        intent.setClass(context, TopLevelPickerActivity.class);
        intent.setData(uri);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        return intent;
    }

    @Override
    public synchronized PerformanceMonitor getPerformanceMonitor() {
        if (mPerformanceMonitor == null) {