Fixing widget size incorreectly updated during preview
Bug: 408934352 Bug: 228328759 Flag: EXEMPT bugfix Test: Manually verified Change-Id: Ie69e67cfaee6231da3971323ae98d2b3ab514c0d
This commit is contained in:
1 parent
d3c7533a55
commit
f6b98ada0d
7 files changed
+172
-32
No files matched your search
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3.widget.util;
|
||||
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
|
||||
import android.appwidget.AppWidgetHostView;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
@@ -25,13 +23,13 @@ import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.util.Size;
|
||||
import android.util.SizeF;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.LauncherAppState;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.dagger.LauncherComponentProvider;
|
||||
import com.android.launcher3.model.WidgetItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -110,17 +108,8 @@ public final class WidgetSizes {
|
||||
return;
|
||||
}
|
||||
|
||||
UI_HELPER_EXECUTOR.execute(() -> {
|
||||
AppWidgetManager widgetManager = AppWidgetManager.getInstance(context);
|
||||
Bundle sizeOptions = getWidgetSizeOptions(context, info.provider, spanX, spanY);
|
||||
if (sizeOptions.<SizeF>getParcelableArrayList(
|
||||
AppWidgetManager.OPTION_APPWIDGET_SIZES).equals(
|
||||
widgetManager.getAppWidgetOptions(widgetId).<SizeF>getParcelableArrayList(
|
||||
AppWidgetManager.OPTION_APPWIDGET_SIZES))) {
|
||||
return;
|
||||
}
|
||||
widgetManager.updateAppWidgetOptions(widgetId, sizeOptions);
|
||||
});
|
||||
LauncherComponentProvider.get(context).getWidgetSizeHandler()
|
||||
.updateSizeRangesAsync(widgetId, info, spanX, spanY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,8 +126,6 @@ public final class WidgetSizes {
|
||||
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, rect.right);
|
||||
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, rect.bottom);
|
||||
options.putParcelableArrayList(AppWidgetManager.OPTION_APPWIDGET_SIZES, paddedSizes);
|
||||
Log.d("b/267448330", "provider: " + provider + ", paddedSizes: " + paddedSizes
|
||||
+ ", getMinMaxSizes: " + rect);
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user