Fix AppWidget layout inflation to resolve references.
When RemoteViews inflates a layout and set of actions, it
uses a cloned remote Context so it can fully access the
resources needed to complete the inflate. However, in one
specific case when inflating the root view, LayoutInflater
calls back to the soon-to-be parent view to request the
correct set of LayoutParams through generateLayoutParams().
The default implementation of generateLayoutParams() uses
the Context of the /local/ View instead of the remote
Context being used for the inflation, which means that any
LayoutParam references in the root view are unresolved.
To fix this, we internally create our own copy of the target
remote Context. This way, when the remote LayoutInflater
calls generateLayoutParams(), we inflate it using the remote
Context to correctly resolve any references.
This change is required as part of http://b/2038594
1 file changed