Merge "Do not use bitmap cache on low ram devices" into ub-launcher3-qt-dev
diff --git a/src/com/android/customization/model/theme/DefaultThemeProvider.java b/src/com/android/customization/model/theme/DefaultThemeProvider.java
index 37b57c9..a2b9ab5 100644
--- a/src/com/android/customization/model/theme/DefaultThemeProvider.java
+++ b/src/com/android/customization/model/theme/DefaultThemeProvider.java
@@ -190,7 +190,7 @@
// Nothing to do here, if there's no wallpaper we'll just omit wallpaper
}
- mThemes.add(builder.build());
+ mThemes.add(builder.build(mContext));
} catch (NameNotFoundException | NotFoundException e) {
Log.w(TAG, String.format("Couldn't load part of theme %s, will skip it", themeName),
e);
@@ -397,7 +397,7 @@
// Nothing to do here, if there's no wallpaper we'll just omit wallpaper
}
- mThemes.add(builder.build());
+ mThemes.add(builder.build(mContext));
}
private void addSystemDefaultIcons(Builder builder, String packageName, String... previewIcons) {
@@ -464,7 +464,7 @@
ThemeBundle.Builder builder = parseCustomTheme(serializedTheme);
if (builder != null) {
builder.setTitle(mContext.getString(R.string.custom_theme_title));
- mThemes.add(builder.build());
+ mThemes.add(builder.build(mContext));
} else {
Log.w(TAG, "Couldn't read stored custom theme, resetting");
mThemes.add(new CustomTheme(mContext.getString(R.string.custom_theme_title),
diff --git a/src/com/android/customization/model/theme/ThemeBundle.java b/src/com/android/customization/model/theme/ThemeBundle.java
index 43752e6..67b085a 100644
--- a/src/com/android/customization/model/theme/ThemeBundle.java
+++ b/src/com/android/customization/model/theme/ThemeBundle.java
@@ -162,7 +162,7 @@
private Asset getOverrideWallpaperAsset(Context context) {
if (mOverrideWallpaperAsset == null) {
- mOverrideWallpaperAsset = new BitmapCachingAsset(
+ mOverrideWallpaperAsset = new BitmapCachingAsset(context,
mOverrideWallpaper.getThumbAsset(context));
}
return mOverrideWallpaperAsset;
@@ -216,7 +216,7 @@
public final List<Drawable> shapeAppIcons;
@Dimension public final int bottomSheeetCornerRadius;
- private PreviewInfo(Typeface bodyFontFamily, Typeface headlineFontFamily,
+ private PreviewInfo(Context context, Typeface bodyFontFamily, Typeface headlineFontFamily,
int colorAccentLight, int colorAccentDark, List<Drawable> icons,
Drawable shapeDrawable, @Dimension int cornerRadius,
@Nullable ResourceAsset wallpaperAsset, List<Drawable> shapeAppIcons) {
@@ -228,7 +228,7 @@
this.shapeDrawable = shapeDrawable;
this.bottomSheeetCornerRadius = cornerRadius;
this.wallpaperAsset = wallpaperAsset == null
- ? null : new BitmapCachingAsset(wallpaperAsset);
+ ? null : new BitmapCachingAsset(context, wallpaperAsset);
this.shapeAppIcons = shapeAppIcons;
}
@@ -260,12 +260,12 @@
private List<Drawable> mAppIcons = new ArrayList<>();
- public ThemeBundle build() {
+ public ThemeBundle build(Context context) {
return new ThemeBundle(mTitle, mPackages, mIsDefault, mWallpaperInfo,
- createPreviewInfo());
+ createPreviewInfo(context));
}
- protected PreviewInfo createPreviewInfo() {
+ protected PreviewInfo createPreviewInfo(Context context) {
ShapeDrawable shapeDrawable = null;
List<Drawable> shapeIcons = new ArrayList<>();
if (!TextUtils.isEmpty(mShapePath)) {
@@ -284,7 +284,7 @@
// non-adaptive icons
}
}
- return new PreviewInfo(mBodyFontFamily, mHeadlineFontFamily, mColorAccentLight,
+ return new PreviewInfo(context, mBodyFontFamily, mHeadlineFontFamily, mColorAccentLight,
mColorAccentDark, mIcons, shapeDrawable, mCornerRadius,
mWallpaperAsset, shapeIcons);
}
diff --git a/src/com/android/customization/model/theme/custom/CustomTheme.java b/src/com/android/customization/model/theme/custom/CustomTheme.java
index 5ab6d39..5e809a0 100644
--- a/src/com/android/customization/model/theme/custom/CustomTheme.java
+++ b/src/com/android/customization/model/theme/custom/CustomTheme.java
@@ -15,6 +15,7 @@
*/
package com.android.customization.model.theme.custom;
+import android.content.Context;
import android.view.View;
import androidx.annotation.Nullable;
@@ -60,8 +61,8 @@
public static class Builder extends ThemeBundle.Builder {
@Override
- public CustomTheme build() {
- return new CustomTheme(mTitle, mPackages, createPreviewInfo());
+ public CustomTheme build(Context context) {
+ return new CustomTheme(mTitle, mPackages, createPreviewInfo(context));
}
}
}
diff --git a/src/com/android/customization/picker/theme/CustomThemeActivity.java b/src/com/android/customization/picker/theme/CustomThemeActivity.java
index 4304b2b..c2d4e51 100644
--- a/src/com/android/customization/picker/theme/CustomThemeActivity.java
+++ b/src/com/android/customization/picker/theme/CustomThemeActivity.java
@@ -53,7 +53,6 @@
import com.android.customization.picker.theme.CustomThemeComponentFragment.CustomThemeComponentFragmentHost;
import com.android.wallpaper.R;
import com.android.wallpaper.module.InjectorProvider;
-import com.android.wallpaper.module.UserEventLogger;
import com.android.wallpaper.module.WallpaperSetter;
import java.util.ArrayList;
@@ -94,7 +93,7 @@
}
}
mCustomThemeManager = new CustomThemeManager(themeBuilder == null ? null
- : (CustomTheme) themeBuilder.build());
+ : (CustomTheme) themeBuilder.build(this));
mThemeManager = new ThemeManager(
new DefaultThemeProvider(this, injector.getCustomizationPreferences(this)),