[automerger skipped] Merge tm-qpr-dev-plus-aosp-without-vendor@9129937 am: 8f21d7cc57 -s ours
am skip reason: Merged-In Ic2c1f4551c86f43a91dfa0bf6546eea8049eb957 with SHA-1 b27845dbf5 is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/ThemePicker/+/20136016
Change-Id: I01402a6f250a55428fc86e759b8a9fa5a20a046d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/customization/model/color/ColorBundle.java b/src/com/android/customization/model/color/ColorBundle.java
index dc5a367..2f2df51 100644
--- a/src/com/android/customization/model/color/ColorBundle.java
+++ b/src/com/android/customization/model/color/ColorBundle.java
@@ -15,18 +15,11 @@
*/
package com.android.customization.model.color;
-import static com.android.customization.model.ResourceConstants.PATH_SIZE;
-
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
-import android.graphics.Path;
import android.graphics.PorterDuff;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.ShapeDrawable;
-import android.graphics.drawable.shapes.PathShape;
-import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
@@ -34,16 +27,13 @@
import androidx.annotation.Dimension;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
-import androidx.core.graphics.PathParser;
import com.android.customization.model.ResourceConstants;
import com.android.systemui.monet.Style;
import com.android.wallpaper.R;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
/**
@@ -103,8 +93,6 @@
// Monet system palette and accent colors
@ColorInt public final int primaryColorLight;
@ColorInt public final int primaryColorDark;
- public final List<Drawable> icons;
- public final Drawable shapeDrawable;
@Dimension
public final int bottomSheetCornerRadius;
@@ -115,14 +103,11 @@
private PreviewInfo(
int secondaryColorLight, int secondaryColorDark, int colorSystemPaletteLight,
- int primaryColorDark, List<Drawable> icons, Drawable shapeDrawable,
- @Dimension int cornerRadius) {
+ int primaryColorDark, @Dimension int cornerRadius) {
this.secondaryColorLight = secondaryColorLight;
this.secondaryColorDark = secondaryColorDark;
this.primaryColorLight = colorSystemPaletteLight;
this.primaryColorDark = primaryColorDark;
- this.icons = icons;
- this.shapeDrawable = shapeDrawable;
this.bottomSheetCornerRadius = cornerRadius;
}
@@ -188,7 +173,6 @@
// System and Monet colors
@ColorInt private int mPrimaryColorLight = Color.TRANSPARENT;
@ColorInt private int mPrimaryColorDark = Color.TRANSPARENT;
- private List<Drawable> mIcons = new ArrayList<>();
private boolean mIsDefault;
private Style mStyle = Style.TONAL_SPOT;
private int mIndex;
@@ -213,26 +197,12 @@
* @return the {@link PreviewInfo} object
*/
public PreviewInfo createPreviewInfo(@NonNull Context context) {
- ShapeDrawable shapeDrawable = null;
Resources system = context.getResources().getSystem();
- String pathString = system.getString(
- system.getIdentifier(ResourceConstants.CONFIG_ICON_MASK,
- "string", ResourceConstants.ANDROID_PACKAGE));
- Path path = null;
- if (!TextUtils.isEmpty(pathString)) {
- path = PathParser.createPathFromPathData(pathString);
- }
- if (path != null) {
- PathShape shape = new PathShape(path, PATH_SIZE, PATH_SIZE);
- shapeDrawable = new ShapeDrawable(shape);
- shapeDrawable.setIntrinsicHeight((int) PATH_SIZE);
- shapeDrawable.setIntrinsicWidth((int) PATH_SIZE);
- }
return new PreviewInfo(mSecondaryColorLight,
- mSecondaryColorDark, mPrimaryColorLight, mPrimaryColorDark, mIcons,
- shapeDrawable, system.getDimensionPixelOffset(
- system.getIdentifier(ResourceConstants.CONFIG_CORNERRADIUS,
- "dimen", ResourceConstants.ANDROID_PACKAGE)));
+ mSecondaryColorDark, mPrimaryColorLight, mPrimaryColorDark,
+ system.getDimensionPixelOffset(
+ system.getIdentifier(ResourceConstants.CONFIG_CORNERRADIUS, "dimen",
+ ResourceConstants.ANDROID_PACKAGE)));
}
public Map<String, String> getPackages() {
@@ -298,16 +268,6 @@
}
/**
- * Sets icon for bundle
- * @param icon icon in {@link Drawable}
- * @return this of {@link Builder}
- */
- public Builder addIcon(Drawable icon) {
- mIcons.add(icon);
- return this;
- }
-
- /**
* Sets overlay package for bundle
* @param category the category of bundle
* @param packageName tha name of package in the category
diff --git a/src/com/android/customization/model/color/ColorBundlePreviewExtractor.java b/src/com/android/customization/model/color/ColorBundlePreviewExtractor.java
index b67eec8..55b637f 100644
--- a/src/com/android/customization/model/color/ColorBundlePreviewExtractor.java
+++ b/src/com/android/customization/model/color/ColorBundlePreviewExtractor.java
@@ -15,18 +15,12 @@
*/
package com.android.customization.model.color;
-import static com.android.customization.model.ResourceConstants.ANDROID_PACKAGE;
-import static com.android.customization.model.ResourceConstants.ICONS_FOR_PREVIEW;
import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_COLOR;
import static com.android.customization.model.ResourceConstants.OVERLAY_CATEGORY_SYSTEM_PALETTE;
import static com.android.customization.model.color.ColorUtils.toColorString;
import android.content.Context;
import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.res.Resources;
-import android.content.res.Resources.NotFoundException;
-import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.Log;
@@ -80,26 +74,4 @@
}
builder.setStyle(s);
}
-
- void addAndroidIconOverlay(ColorBundle.Builder builder) throws NameNotFoundException {
- addSystemDefaultIcons(builder, ICONS_FOR_PREVIEW);
- }
-
- void addSystemDefaultIcons(ColorBundle.Builder builder, String... previewIcons) {
- try {
- for (String iconName : previewIcons) {
- builder.addIcon(loadIconPreviewDrawable(iconName));
- }
- } catch (NameNotFoundException | NotFoundException e) {
- Log.w(TAG, "Didn't find android package icons, will skip preview", e);
- }
- }
-
- Drawable loadIconPreviewDrawable(String drawableName)
- throws NameNotFoundException, NotFoundException {
- Resources packageRes = mPackageManager.getResourcesForApplication(ANDROID_PACKAGE);
- Resources res = Resources.getSystem();
- return res.getDrawable(packageRes.getIdentifier(drawableName, "drawable",
- ANDROID_PACKAGE), null);
- }
}
diff --git a/src/com/android/customization/model/color/ColorProvider.kt b/src/com/android/customization/model/color/ColorProvider.kt
index a63f904..5d6aefc 100644
--- a/src/com/android/customization/model/color/ColorProvider.kt
+++ b/src/com/android/customization/model/color/ColorProvider.kt
@@ -271,7 +271,6 @@
builder.setColorPrimaryLight(lightColors[0]).setColorSecondaryLight(lightColors[1])
}
- extractor.addAndroidIconOverlay(builder)
bundles.add(builder.build(mContext))
index++
}
diff --git a/src/com/android/customization/module/DefaultCustomizationInjector.java b/src/com/android/customization/module/DefaultCustomizationInjector.java
index 220c406..9afad41 100644
--- a/src/com/android/customization/module/DefaultCustomizationInjector.java
+++ b/src/com/android/customization/module/DefaultCustomizationInjector.java
@@ -15,9 +15,16 @@
*/
package com.android.customization.module;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_FULL_SCREEN;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_PREVIEW_MODE;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_TESTING_MODE_ENABLED;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_VIEW_AS_HOME;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_WALLPAPER;
+
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
+import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
@@ -26,6 +33,7 @@
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;
@@ -35,6 +43,8 @@
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
@@ -97,8 +107,16 @@
boolean viewAsHome,
boolean viewFullScreen,
boolean testingModeEnabled) {
- return PreviewFragment.newInstance(wallpaperInfo, mode, viewAsHome, viewFullScreen,
- testingModeEnabled);
+ Bundle args = new Bundle();
+ args.putParcelable(ARG_WALLPAPER, wallpaperInfo);
+ args.putInt(ARG_PREVIEW_MODE, mode);
+ args.putBoolean(ARG_VIEW_AS_HOME, viewAsHome);
+ args.putBoolean(ARG_FULL_SCREEN, viewFullScreen);
+ args.putBoolean(ARG_TESTING_MODE_ENABLED, testingModeEnabled);
+ PreviewFragment fragment = wallpaperInfo instanceof LiveWallpaperInfo
+ ? new LivePreviewFragment() : new ImagePreviewFragment();
+ fragment.setArguments(args);
+ return fragment;
}
@Override
diff --git a/src_override/com/android/wallpaper/module/WallpapersInjector.java b/src_override/com/android/wallpaper/module/WallpapersInjector.java
index 9f8fe9c..e582fe4 100755
--- a/src_override/com/android/wallpaper/module/WallpapersInjector.java
+++ b/src_override/com/android/wallpaper/module/WallpapersInjector.java
@@ -15,17 +15,27 @@
*/
package com.android.wallpaper.module;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_FULL_SCREEN;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_PREVIEW_MODE;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_TESTING_MODE_ENABLED;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_VIEW_AS_HOME;
+import static com.android.wallpaper.picker.PreviewFragment.ARG_WALLPAPER;
+
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
+import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.android.wallpaper.model.CategoryProvider;
+import com.android.wallpaper.model.LiveWallpaperInfo;
import com.android.wallpaper.model.WallpaperInfo;
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;
/**
* A concrete, real implementation of the dependency provider.
@@ -74,8 +84,16 @@
boolean viewAsHome,
boolean viewFullScreen,
boolean testingModeEnabled) {
- return ImagePreviewFragment.newInstance(wallpaperInfo, mode, viewAsHome, viewFullScreen,
- testingModeEnabled);
+ Bundle args = new Bundle();
+ args.putParcelable(ARG_WALLPAPER, wallpaperInfo);
+ args.putInt(ARG_PREVIEW_MODE, mode);
+ args.putBoolean(ARG_VIEW_AS_HOME, viewAsHome);
+ args.putBoolean(ARG_FULL_SCREEN, viewFullScreen);
+ args.putBoolean(ARG_TESTING_MODE_ENABLED, testingModeEnabled);
+ PreviewFragment fragment = wallpaperInfo instanceof LiveWallpaperInfo
+ ? new LivePreviewFragment() : new ImagePreviewFragment();
+ fragment.setArguments(args);
+ return fragment;
}
@Override