From f5fee1a7d3286673d4513aab95109245b53aea66 Mon Sep 17 00:00:00 2001 From: Jonathan Miranda Date: Tue, 20 Jul 2021 00:37:19 +0000 Subject: [PATCH] Revert "Use wallpaper colors for widgets in wallpaper change preview" Revert "Implement generateColorsOverride from LocalColorExtractor" Revert submission 15331418-colorcp Reason for revert: Broke the build Reverted Changes: Ife80b07f9:Use wallpaper colors for widgets in wallpaper chan... I1371eb787:Implement generateColorsOverride from LocalColorEx... Bug: 194138049 // Using original change's merged-in tag to avoid clashing Merged-In: I3fb76b6036cb909771b789eac15742df78c2c742 Merged-In: I4da9ad1cc88be251f97e86b6c8c9b346ed20f586 Change-Id: I3835dfb8efe745dc0a654712a5b1f68c4946f446 --- .../graphics/LauncherPreviewRenderer.java | 26 +------------------ .../graphics/PreviewSurfaceRenderer.java | 2 +- .../launcher3/widget/LocalColorExtractor.java | 8 ------ 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index a387f04e5b..cf3da4b9b7 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -15,7 +15,6 @@ */ package com.android.launcher3.graphics; -import static android.app.WallpaperManager.FLAG_SYSTEM; import static android.view.View.MeasureSpec.EXACTLY; import static android.view.View.MeasureSpec.makeMeasureSpec; import static android.view.View.VISIBLE; @@ -27,8 +26,6 @@ import static com.android.launcher3.model.ModelUtils.sortWorkspaceItemsSpatially import android.annotation.TargetApi; import android.app.Fragment; -import android.app.WallpaperColors; -import android.app.WallpaperManager; import android.appwidget.AppWidgetHostView; import android.appwidget.AppWidgetProviderInfo; import android.content.Context; @@ -44,7 +41,6 @@ import android.os.Handler; import android.os.Looper; import android.os.Process; import android.util.AttributeSet; -import android.util.SparseIntArray; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -88,7 +84,6 @@ import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.BaseDragLayer; import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; -import com.android.launcher3.widget.LocalColorExtractor; import com.android.launcher3.widget.custom.CustomWidgetManager; import java.util.ArrayList; @@ -206,12 +201,8 @@ public class LauncherPreviewRenderer extends ContextWrapper private final InsettableFrameLayout mRootView; private final Hotseat mHotseat; private final CellLayout mWorkspace; - private final SparseIntArray mWallpaperColorResources; - - public LauncherPreviewRenderer(Context context, - InvariantDeviceProfile idp, - WallpaperColors wallpaperColorsOverride) { + public LauncherPreviewRenderer(Context context, InvariantDeviceProfile idp) { super(context); mUiHandler = new Handler(Looper.getMainLooper()); mContext = context; @@ -263,16 +254,6 @@ public class LauncherPreviewRenderer extends ContextWrapper mDp.workspacePadding.top, mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx, mDp.workspacePadding.bottom); - - if (Utilities.ATLEAST_S) { - WallpaperColors wallpaperColors = wallpaperColorsOverride != null - ? wallpaperColorsOverride - : WallpaperManager.getInstance(context).getWallpaperColors(FLAG_SYSTEM); - mWallpaperColorResources = LocalColorExtractor.newInstance(context) - .generateColorsOverride(wallpaperColors); - } else { - mWallpaperColorResources = null; - } } /** Populate preview and render it. */ @@ -376,11 +357,6 @@ public class LauncherPreviewRenderer extends ContextWrapper view.setAppWidget(-1, providerInfo); view.updateAppWidget(null); view.setTag(info); - - if (mWallpaperColorResources != null) { - view.setColorResources(mWallpaperColorResources); - } - addInScreenFromBind(view, info); } diff --git a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java index df493599ed..a8c3d15bde 100644 --- a/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java +++ b/src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java @@ -209,7 +209,7 @@ public class PreviewSurfaceRenderer { if (mDestroyed) { return; } - View view = new LauncherPreviewRenderer(inflationContext, mIdp, mWallpaperColors) + View view = new LauncherPreviewRenderer(inflationContext, mIdp) .getRenderedView(dataModel, widgetProviderInfoMap); // This aspect scales the view to fit in the surface and centers it final float scale = Math.min(mWidth / (float) view.getMeasuredWidth(), diff --git a/src/com/android/launcher3/widget/LocalColorExtractor.java b/src/com/android/launcher3/widget/LocalColorExtractor.java index 23d9e151f7..8ae6b2e435 100644 --- a/src/com/android/launcher3/widget/LocalColorExtractor.java +++ b/src/com/android/launcher3/widget/LocalColorExtractor.java @@ -75,14 +75,6 @@ public class LocalColorExtractor implements ResourceBasedOverride { */ public void applyColorsOverride(Context base, WallpaperColors colors) { } - /** - * Generates color resource overrides from {@link WallpaperColors}. - */ - @Nullable - public SparseIntArray generateColorsOverride(WallpaperColors colors) { - return null; - } - /** * Takes a view and returns its rect that can be used by the wallpaper local color extractor. *