144 {
145 super.onCreate(savedInstanceState);
146
147 getWindow().setBackgroundDrawable(
new ColorDrawable(
android.graphics.Color.TRANSPARENT));
148 if (state.fakeWindowViewGroup == null) {
149 state.fakeWindowViewGroup = new SingleViewFakeWindowViewGroup(getContext());
150 }
151 if (state.windowManagerHandler == null) {
152 WindowManager windowManagerDelegate =
153 (WindowManager) getContext().getSystemService(WINDOW_SERVICE);
154 state.windowManagerHandler =
155 new WindowManagerHandler(windowManagerDelegate, state.fakeWindowViewGroup);
156 }
157
158 container = new FrameLayout(getContext());
159
160
161
162 Context baseContext =
163 new PresentationContext(getContext(), state.windowManagerHandler, outerContext);
164
165 View embeddedView = state.platformView.
getView();
166 if (embeddedView.getContext() instanceof MutableContextWrapper) {
167 MutableContextWrapper currentContext = (MutableContextWrapper) embeddedView.getContext();
168 currentContext.setBaseContext(baseContext);
169 } else {
170
171
172
173
174
175
177 TAG,
178 "Unexpected platform view context for view ID "
179 + viewId
180 + "; some functionality may not work correctly. When constructing a platform view "
181 + "in the factory, ensure that the view returned from PlatformViewFactory#create "
182 + "returns the provided context from getContext(). If you are unable to associate "
183 + "the view with that context, consider using Hybrid Composition instead.");
184 }
185
186 container.addView(embeddedView);
187 rootView =
188 new AccessibilityDelegatingFrameLayout(
189 getContext(), accessibilityEventsDelegate, embeddedView);
190 rootView.addView(container);
191 rootView.addView(state.fakeWindowViewGroup);
192
193 embeddedView.setOnFocusChangeListener(focusChangeListener);
194 rootView.setFocusableInTouchMode(true);
195 if (startFocused) {
196 embeddedView.requestFocus();
197 } else {
198 rootView.requestFocus();
199 }
200 setContentView(rootView);
201 }
void Log(const char *format,...) SK_PRINTF_LIKE(1