mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
fix: Ignore generatedPreviews flags on Vanilla Ice Cream and above
This is always enabled on correct AOSP implementations, crashes should be handled by OEM
This commit is contained in:
@@ -55,7 +55,7 @@ public class WidgetItem extends ComponentKey {
|
||||
spanX = Math.min(info.spanX, idp.numColumns);
|
||||
spanY = Math.min(info.spanY, idp.numRows);
|
||||
|
||||
if (BuildCompat.isAtLeastV() && Flags.enableGeneratedPreviews()) {
|
||||
if (BuildCompat.isAtLeastV()) {
|
||||
generatedPreviews = new SparseArray<>(3);
|
||||
for (int widgetCategory : new int[] {
|
||||
WIDGET_CATEGORY_HOME_SCREEN,
|
||||
@@ -120,7 +120,7 @@ public class WidgetItem extends ComponentKey {
|
||||
* category.
|
||||
*/
|
||||
public boolean hasGeneratedPreview(int widgetCategory) {
|
||||
if (!Flags.enableGeneratedPreviews() || generatedPreviews == null) {
|
||||
if (!Utilities.ATLEAST_V || generatedPreviews == null) {
|
||||
return false;
|
||||
}
|
||||
return generatedPreviews.contains(widgetCategory)
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatedPropertySetter;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.icons.RoundDrawableWrapper;
|
||||
@@ -292,7 +293,7 @@ public class WidgetCell extends LinearLayout {
|
||||
mAppWidgetHostViewPreview = createAppWidgetHostView(context);
|
||||
setAppWidgetHostViewPreview(mAppWidgetHostViewPreview, item.widgetInfo,
|
||||
mRemoteViewsPreview);
|
||||
} else if (Flags.enableGeneratedPreviews()
|
||||
} else if (Utilities.ATLEAST_V
|
||||
&& item.hasGeneratedPreview(WIDGET_CATEGORY_HOME_SCREEN)) {
|
||||
mAppWidgetHostViewPreview = createAppWidgetHostView(context);
|
||||
setAppWidgetHostViewPreview(mAppWidgetHostViewPreview, item.widgetInfo,
|
||||
|
||||
@@ -33,6 +33,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.logging.FileLog;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.pm.UserCache;
|
||||
@@ -162,7 +163,6 @@ public class WidgetManagerHelper {
|
||||
@RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM)
|
||||
public RemoteViews loadGeneratedPreview(@NonNull AppWidgetProviderInfo info,
|
||||
int widgetCategory) {
|
||||
if (!Flags.generatedPreviews()) return null;
|
||||
return mAppWidgetManager.getWidgetPreview(info.provider, info.getProfile(), widgetCategory);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user