mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 07:46:55 +00:00
Allow Launcher to automatically restore widgets
This replaces PendingAppWidgetHostView with configured widget view when OPTION_APPWIDGET_RESTORE_COMPLETED is set to True by a widget provider. Bug: 63667276 Test: Manual Change-Id: Ide21f5e9a7dac7e3d6a745660a38ad0b951b47d3
This commit is contained in:
@@ -49,6 +49,9 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
public class WidgetManagerHelper {
|
||||
|
||||
//TODO: replace this with OPTION_APPWIDGET_RESTORE_COMPLETED b/63667276
|
||||
public static final String WIDGET_OPTION_RESTORE_COMPLETED = "appWidgetRestoreCompleted";
|
||||
|
||||
final AppWidgetManager mAppWidgetManager;
|
||||
final Context mContext;
|
||||
|
||||
@@ -127,6 +130,14 @@ public class WidgetManagerHelper {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if a AppWidgetProvider has marked a widget restored
|
||||
*/
|
||||
public boolean isAppWidgetRestored(int appWidgetId) {
|
||||
return !WidgetsModel.GO_DISABLE_WIDGETS && mAppWidgetManager.getAppWidgetOptions(
|
||||
appWidgetId).getBoolean(WIDGET_OPTION_RESTORE_COMPLETED);
|
||||
}
|
||||
|
||||
public static Map<ComponentKey, AppWidgetProviderInfo> getAllProvidersMap(Context context) {
|
||||
if (WidgetsModel.GO_DISABLE_WIDGETS) {
|
||||
return Collections.emptyMap();
|
||||
|
||||
Reference in New Issue
Block a user