Loading src/com/android/customization/module/DefaultCustomizationInjector.java→src/com/android/customization/module/ThemePickerInjector.java +32 −74 Original line number Diff line number Diff line Loading @@ -32,71 +32,45 @@ 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.wallpaper.model.CategoryProvider; import com.android.wallpaper.model.LiveWallpaperInfo; import com.android.wallpaper.model.WallpaperInfo; import com.android.wallpaper.module.BaseWallpaperInjector; import com.android.wallpaper.module.CustomizationSections; import com.android.wallpaper.module.DefaultCategoryProvider; import com.android.wallpaper.module.LoggingOptInStatusProvider; import com.android.wallpaper.module.WallpaperPicker2Injector; import com.android.wallpaper.module.WallpaperPreferences; import com.android.wallpaper.module.WallpaperRotationRefresher; import com.android.wallpaper.monitor.PerformanceMonitor; import com.android.wallpaper.picker.CustomizationPickerActivity; import com.android.wallpaper.picker.ImagePreviewFragment; import com.android.wallpaper.picker.LivePreviewFragment; import com.android.wallpaper.picker.PreviewFragment; public class DefaultCustomizationInjector extends BaseWallpaperInjector /** * A concrete, real implementation of the dependency provider. */ public class ThemePickerInjector extends WallpaperPicker2Injector implements CustomizationInjector { private CategoryProvider mCategoryProvider; private CustomizationSections mCustomizationSections; private ThemesUserEventLogger mUserEventLogger; private WallpaperRotationRefresher mWallpaperRotationRefresher; private PerformanceMonitor mPerformanceMonitor; private WallpaperPreferences mPrefs; private CustomizationSections mCustomizationSections; @Override public synchronized WallpaperPreferences getPreferences(Context context) { if (mPrefs == null) { mPrefs = new DefaultCustomizationPreferences(context.getApplicationContext()); } return mPrefs; } @Override public CustomizationPreferences getCustomizationPreferences(Context context) { return (CustomizationPreferences) getPreferences(context); } @Override public synchronized CategoryProvider getCategoryProvider(Context context) { if (mCategoryProvider == null) { mCategoryProvider = new DefaultCategoryProvider(context.getApplicationContext()); public CustomizationSections getCustomizationSections() { if (mCustomizationSections == null) { mCustomizationSections = new DefaultCustomizationSections(); } return mCategoryProvider; return mCustomizationSections; } @Override public synchronized ThemesUserEventLogger getUserEventLogger(Context context) { if (mUserEventLogger == null) { mUserEventLogger = new StatsLogUserEventLogger(context); } return mUserEventLogger; public Intent getDeepLinkRedirectIntent(Context context, Uri uri) { Intent intent = new Intent(); intent.setClass(context, CustomizationPickerActivity.class); intent.setData(uri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; } @Override public synchronized WallpaperRotationRefresher getWallpaperRotationRefresher() { if (mWallpaperRotationRefresher == null) { mWallpaperRotationRefresher = new WallpaperRotationRefresher() { @Override public void refreshWallpaper(Context context, Listener listener) { // Not implemented listener.onError(); } }; } return mWallpaperRotationRefresher; public String getDownloadableIntentAction() { return null; } @Override Loading @@ -120,35 +94,27 @@ public class DefaultCustomizationInjector extends BaseWallpaperInjector } @Override public Intent getDeepLinkRedirectIntent(Context context, Uri uri) { Intent intent = new Intent(); intent.setClass(context, CustomizationPickerActivity.class); intent.setData(uri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; public synchronized ThemesUserEventLogger getUserEventLogger(Context context) { if (mUserEventLogger == null) { mUserEventLogger = new StatsLogUserEventLogger(context); } @Override public String getDownloadableIntentAction() { return null; return mUserEventLogger; } @Override public synchronized PerformanceMonitor getPerformanceMonitor() { if (mPerformanceMonitor == null) { mPerformanceMonitor = new PerformanceMonitor() { @Override public void recordFullResPreviewLoadedMemorySnapshot() { // No Op } }; public synchronized WallpaperPreferences getPreferences(Context context) { if (mPrefs == null) { mPrefs = new DefaultCustomizationPreferences(context.getApplicationContext()); } return mPerformanceMonitor; return mPrefs; } // // Functions from {@link CustomizationInjector} // @Override public synchronized LoggingOptInStatusProvider getLoggingOptInStatusProvider(Context context) { return null; public CustomizationPreferences getCustomizationPreferences(Context context) { return (CustomizationPreferences) getPreferences(context); } @Override Loading @@ -156,12 +122,4 @@ public class DefaultCustomizationInjector extends BaseWallpaperInjector OverlayManagerCompat overlayManagerCompat, ThemesUserEventLogger logger) { return new ThemeManager(provider, activity, overlayManagerCompat, logger); } @Override public CustomizationSections getCustomizationSections() { if (mCustomizationSections == null) { mCustomizationSections = new DefaultCustomizationSections(); } return mCustomizationSections; } } src/com/android/customization/picker/CustomizationPickerApplication.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package com.android.customization.picker; import android.app.Application; import com.android.customization.module.DefaultCustomizationInjector; import com.android.customization.module.ThemePickerInjector; import com.android.wallpaper.module.InjectorProvider; public class CustomizationPickerApplication extends Application { Loading @@ -26,6 +26,6 @@ public class CustomizationPickerApplication extends Application { super.onCreate(); // Initialize the injector. InjectorProvider.setInjector(new DefaultCustomizationInjector()); InjectorProvider.setInjector(new ThemePickerInjector()); } } src/com/android/customization/picker/grid/GridFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ public class GridFragment extends AppbarFragment { getActivity(), view.findViewById(R.id.wallpaper_preview_image), wallpaperSurface); // Loads current Wallpaper. CurrentWallpaperInfoFactory factory = InjectorProvider.getInjector() .getCurrentWallpaperFactory(getContext().getApplicationContext()); .getCurrentWallpaperInfoFactory(getContext().getApplicationContext()); factory.createCurrentWallpaperInfos((homeWallpaper, lockWallpaper, presentationMode) -> { mHomeWallpaper = homeWallpaper; wallpaperPreviewer.setWallpaper(mHomeWallpaper, /* listener= */ null); Loading src/com/android/customization/picker/theme/CustomThemeNameFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { mTitle = view.findViewById(R.id.component_options_title); mTitle.setText(mTitleResId); CurrentWallpaperInfoFactory currentWallpaperFactory = InjectorProvider.getInjector() .getCurrentWallpaperFactory(getActivity().getApplicationContext()); .getCurrentWallpaperInfoFactory(getActivity().getApplicationContext()); CustomizationInjector injector = (CustomizationInjector) InjectorProvider.getInjector(); mCustomizationPreferences = injector.getCustomizationPreferences(getContext()); Loading src/com/android/customization/picker/theme/ThemeFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ public class ThemeFragment extends AppbarFragment { mLoading = view.findViewById(R.id.loading_indicator); mError = view.findViewById(R.id.error_section); mCurrentWallpaperFactory = InjectorProvider.getInjector() .getCurrentWallpaperFactory(getActivity().getApplicationContext()); .getCurrentWallpaperInfoFactory(getActivity().getApplicationContext()); mOptionsContainer = view.findViewById(R.id.options_container); mThemeOptionPreviewer = new ThemeOptionPreviewer( Loading Loading
src/com/android/customization/module/DefaultCustomizationInjector.java→src/com/android/customization/module/ThemePickerInjector.java +32 −74 Original line number Diff line number Diff line Loading @@ -32,71 +32,45 @@ 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.wallpaper.model.CategoryProvider; import com.android.wallpaper.model.LiveWallpaperInfo; import com.android.wallpaper.model.WallpaperInfo; import com.android.wallpaper.module.BaseWallpaperInjector; import com.android.wallpaper.module.CustomizationSections; import com.android.wallpaper.module.DefaultCategoryProvider; import com.android.wallpaper.module.LoggingOptInStatusProvider; import com.android.wallpaper.module.WallpaperPicker2Injector; import com.android.wallpaper.module.WallpaperPreferences; import com.android.wallpaper.module.WallpaperRotationRefresher; import com.android.wallpaper.monitor.PerformanceMonitor; import com.android.wallpaper.picker.CustomizationPickerActivity; import com.android.wallpaper.picker.ImagePreviewFragment; import com.android.wallpaper.picker.LivePreviewFragment; import com.android.wallpaper.picker.PreviewFragment; public class DefaultCustomizationInjector extends BaseWallpaperInjector /** * A concrete, real implementation of the dependency provider. */ public class ThemePickerInjector extends WallpaperPicker2Injector implements CustomizationInjector { private CategoryProvider mCategoryProvider; private CustomizationSections mCustomizationSections; private ThemesUserEventLogger mUserEventLogger; private WallpaperRotationRefresher mWallpaperRotationRefresher; private PerformanceMonitor mPerformanceMonitor; private WallpaperPreferences mPrefs; private CustomizationSections mCustomizationSections; @Override public synchronized WallpaperPreferences getPreferences(Context context) { if (mPrefs == null) { mPrefs = new DefaultCustomizationPreferences(context.getApplicationContext()); } return mPrefs; } @Override public CustomizationPreferences getCustomizationPreferences(Context context) { return (CustomizationPreferences) getPreferences(context); } @Override public synchronized CategoryProvider getCategoryProvider(Context context) { if (mCategoryProvider == null) { mCategoryProvider = new DefaultCategoryProvider(context.getApplicationContext()); public CustomizationSections getCustomizationSections() { if (mCustomizationSections == null) { mCustomizationSections = new DefaultCustomizationSections(); } return mCategoryProvider; return mCustomizationSections; } @Override public synchronized ThemesUserEventLogger getUserEventLogger(Context context) { if (mUserEventLogger == null) { mUserEventLogger = new StatsLogUserEventLogger(context); } return mUserEventLogger; public Intent getDeepLinkRedirectIntent(Context context, Uri uri) { Intent intent = new Intent(); intent.setClass(context, CustomizationPickerActivity.class); intent.setData(uri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; } @Override public synchronized WallpaperRotationRefresher getWallpaperRotationRefresher() { if (mWallpaperRotationRefresher == null) { mWallpaperRotationRefresher = new WallpaperRotationRefresher() { @Override public void refreshWallpaper(Context context, Listener listener) { // Not implemented listener.onError(); } }; } return mWallpaperRotationRefresher; public String getDownloadableIntentAction() { return null; } @Override Loading @@ -120,35 +94,27 @@ public class DefaultCustomizationInjector extends BaseWallpaperInjector } @Override public Intent getDeepLinkRedirectIntent(Context context, Uri uri) { Intent intent = new Intent(); intent.setClass(context, CustomizationPickerActivity.class); intent.setData(uri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; public synchronized ThemesUserEventLogger getUserEventLogger(Context context) { if (mUserEventLogger == null) { mUserEventLogger = new StatsLogUserEventLogger(context); } @Override public String getDownloadableIntentAction() { return null; return mUserEventLogger; } @Override public synchronized PerformanceMonitor getPerformanceMonitor() { if (mPerformanceMonitor == null) { mPerformanceMonitor = new PerformanceMonitor() { @Override public void recordFullResPreviewLoadedMemorySnapshot() { // No Op } }; public synchronized WallpaperPreferences getPreferences(Context context) { if (mPrefs == null) { mPrefs = new DefaultCustomizationPreferences(context.getApplicationContext()); } return mPerformanceMonitor; return mPrefs; } // // Functions from {@link CustomizationInjector} // @Override public synchronized LoggingOptInStatusProvider getLoggingOptInStatusProvider(Context context) { return null; public CustomizationPreferences getCustomizationPreferences(Context context) { return (CustomizationPreferences) getPreferences(context); } @Override Loading @@ -156,12 +122,4 @@ public class DefaultCustomizationInjector extends BaseWallpaperInjector OverlayManagerCompat overlayManagerCompat, ThemesUserEventLogger logger) { return new ThemeManager(provider, activity, overlayManagerCompat, logger); } @Override public CustomizationSections getCustomizationSections() { if (mCustomizationSections == null) { mCustomizationSections = new DefaultCustomizationSections(); } return mCustomizationSections; } }
src/com/android/customization/picker/CustomizationPickerApplication.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package com.android.customization.picker; import android.app.Application; import com.android.customization.module.DefaultCustomizationInjector; import com.android.customization.module.ThemePickerInjector; import com.android.wallpaper.module.InjectorProvider; public class CustomizationPickerApplication extends Application { Loading @@ -26,6 +26,6 @@ public class CustomizationPickerApplication extends Application { super.onCreate(); // Initialize the injector. InjectorProvider.setInjector(new DefaultCustomizationInjector()); InjectorProvider.setInjector(new ThemePickerInjector()); } }
src/com/android/customization/picker/grid/GridFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -160,7 +160,7 @@ public class GridFragment extends AppbarFragment { getActivity(), view.findViewById(R.id.wallpaper_preview_image), wallpaperSurface); // Loads current Wallpaper. CurrentWallpaperInfoFactory factory = InjectorProvider.getInjector() .getCurrentWallpaperFactory(getContext().getApplicationContext()); .getCurrentWallpaperInfoFactory(getContext().getApplicationContext()); factory.createCurrentWallpaperInfos((homeWallpaper, lockWallpaper, presentationMode) -> { mHomeWallpaper = homeWallpaper; wallpaperPreviewer.setWallpaper(mHomeWallpaper, /* listener= */ null); Loading
src/com/android/customization/picker/theme/CustomThemeNameFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ public class CustomThemeNameFragment extends CustomThemeStepFragment { mTitle = view.findViewById(R.id.component_options_title); mTitle.setText(mTitleResId); CurrentWallpaperInfoFactory currentWallpaperFactory = InjectorProvider.getInjector() .getCurrentWallpaperFactory(getActivity().getApplicationContext()); .getCurrentWallpaperInfoFactory(getActivity().getApplicationContext()); CustomizationInjector injector = (CustomizationInjector) InjectorProvider.getInjector(); mCustomizationPreferences = injector.getCustomizationPreferences(getContext()); Loading
src/com/android/customization/picker/theme/ThemeFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ public class ThemeFragment extends AppbarFragment { mLoading = view.findViewById(R.id.loading_indicator); mError = view.findViewById(R.id.error_section); mCurrentWallpaperFactory = InjectorProvider.getInjector() .getCurrentWallpaperFactory(getActivity().getApplicationContext()); .getCurrentWallpaperInfoFactory(getActivity().getApplicationContext()); mOptionsContainer = view.findViewById(R.id.options_container); mThemeOptionPreviewer = new ThemeOptionPreviewer( Loading