Moving widget reinflation to push model
Instead of checking every widget, a widget which needs reinflation
would post a callback on launcher avoiding unnecessary loops in onResume
Bug: 67305604
Change-Id: I53e08d6f4795f7b716a9debca5c0c68dd25a7afe
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 9d31492..7688b9d 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -908,14 +908,6 @@
mWaitingForResume.setStayPressed(false);
}
- // It is possible that widgets can receive updates while launcher is not in the foreground.
- // Consequently, the widgets will be inflated in the orientation of the foreground activity
- // (framework issue). On resuming, we ensure that any widgets are inflated for the current
- // orientation.
- if (!isWorkspaceLoading()) {
- getWorkspace().reinflateWidgetsIfNecessary();
- }
-
updateInteraction(Workspace.State.NORMAL, mWorkspace.getState());
mWorkspace.onResume();
@@ -3257,7 +3249,10 @@
info.pendingItemInfo = null;
}
- mWorkspace.reinflateWidgetsIfNecessary();
+ if (((PendingAppWidgetHostView) view).isReinflateIfNeeded()) {
+ view.reinflate();
+ }
+
getModelWriter().updateItemInDatabase(info);
return info;
}