Loading lint-baseline-launcher3.xml +22 −0 Original line number Diff line number Diff line Loading @@ -573,4 +573,26 @@ column="42"/> </issue> <issue id="NewApi" message="Call requires API level 31 (current min is 26): `android.appwidget.AppWidgetHostView#setColorResources`" errorLine1=" view.setColorResources(mWallpaperColorResources);" errorLine2=" ~~~~~~~~~~~~~~~~~"> <location file="packages/apps/Launcher3/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java" line="381" column="18"/> </issue> <issue id="NewApi" message="Call requires API level 27 (current min is 26): `android.app.WallpaperManager#getWallpaperColors`" errorLine1=" : WallpaperManager.getInstance(context).getWallpaperColors(FLAG_SYSTEM);" errorLine2=" ~~~~~~~~~~~~~~~~~~"> <location file="packages/apps/Launcher3/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java" line="270" column="61"/> </issue> </issues> src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +25 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ 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; Loading @@ -26,6 +27,8 @@ 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; Loading @@ -41,6 +44,7 @@ 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; Loading Loading @@ -84,6 +88,7 @@ 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; Loading Loading @@ -201,8 +206,12 @@ 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; Loading Loading @@ -254,6 +263,16 @@ 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. */ Loading Loading @@ -357,6 +376,11 @@ public class LauncherPreviewRenderer extends ContextWrapper view.setAppWidget(-1, providerInfo); view.updateAppWidget(null); view.setTag(info); if (mWallpaperColorResources != null) { view.setColorResources(mWallpaperColorResources); } addInScreenFromBind(view, info); } Loading src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java +1 −1 Original line number Diff line number Diff line Loading @@ -209,7 +209,7 @@ public class PreviewSurfaceRenderer { if (mDestroyed) { return; } View view = new LauncherPreviewRenderer(inflationContext, mIdp) View view = new LauncherPreviewRenderer(inflationContext, mIdp, mWallpaperColors) .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(), Loading src/com/android/launcher3/widget/LocalColorExtractor.java +8 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,14 @@ 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. * Loading Loading
lint-baseline-launcher3.xml +22 −0 Original line number Diff line number Diff line Loading @@ -573,4 +573,26 @@ column="42"/> </issue> <issue id="NewApi" message="Call requires API level 31 (current min is 26): `android.appwidget.AppWidgetHostView#setColorResources`" errorLine1=" view.setColorResources(mWallpaperColorResources);" errorLine2=" ~~~~~~~~~~~~~~~~~"> <location file="packages/apps/Launcher3/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java" line="381" column="18"/> </issue> <issue id="NewApi" message="Call requires API level 27 (current min is 26): `android.app.WallpaperManager#getWallpaperColors`" errorLine1=" : WallpaperManager.getInstance(context).getWallpaperColors(FLAG_SYSTEM);" errorLine2=" ~~~~~~~~~~~~~~~~~~"> <location file="packages/apps/Launcher3/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java" line="270" column="61"/> </issue> </issues>
src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +25 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ 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; Loading @@ -26,6 +27,8 @@ 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; Loading @@ -41,6 +44,7 @@ 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; Loading Loading @@ -84,6 +88,7 @@ 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; Loading Loading @@ -201,8 +206,12 @@ 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; Loading Loading @@ -254,6 +263,16 @@ 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. */ Loading Loading @@ -357,6 +376,11 @@ public class LauncherPreviewRenderer extends ContextWrapper view.setAppWidget(-1, providerInfo); view.updateAppWidget(null); view.setTag(info); if (mWallpaperColorResources != null) { view.setColorResources(mWallpaperColorResources); } addInScreenFromBind(view, info); } Loading
src/com/android/launcher3/graphics/PreviewSurfaceRenderer.java +1 −1 Original line number Diff line number Diff line Loading @@ -209,7 +209,7 @@ public class PreviewSurfaceRenderer { if (mDestroyed) { return; } View view = new LauncherPreviewRenderer(inflationContext, mIdp) View view = new LauncherPreviewRenderer(inflationContext, mIdp, mWallpaperColors) .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(), Loading
src/com/android/launcher3/widget/LocalColorExtractor.java +8 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,14 @@ 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. * Loading