Skip to content
Commit 49cd50b3 authored by Charles Chen's avatar Charles Chen
Browse files

Introduce WindowProviderService

A Window Provider Service is a Window-Context-like Service which handles
UI
components and is able to obtain the latest configuration.
The differences between a Window Context and a Window Provider Service
is that:
1. It is always associated with the primary display before
   attachWindowToken() or WM#addView is called. It is suggested to
render UI
   components after calling the APIs mentioned above.
2. A window context registers the listener in constructor and
   unregisters it in finalize(), while a window provider service
   registers the listener in onCreate() and unregisters in onDestroy().
3. Like the API Context#createWindowContext(int windowType, Bundle
options),
   the users of a Window Provider Service need to override
provideWindowType and
   provideOptions to pass the attributes.
4. When there's a configuration updates from the server side,
   the Service#onConfigurationChanged callback will be invoked.(TBD)
It is suggested to use window context when possible. This class is to
migrate the
Service to show UI components to the window context concept. We can't
migrate them
to WindowContext directly because developers are used to use this kind
of Service as
the container of UI components and may change its property at runtime.
An example is that keyboard developers may apply a new theme by
InputMethodService#getResources#setTheme(newTheme).

Bug: 159767464
Test: atest WindowContextTests#testWindowProviderServiceLifecycle

Change-Id: I7d537fd2d128efa28aa6e771d77aa105fb497672
parent a5b660e3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment