summaryrefslogtreecommitdiff
path: root/core/java/android/window/WindowContextController.java
Commit message (Collapse)AuthorAgeFilesLines
* Disable debug log in WindowContextControllerCharles Chen2022-03-281-4/+3
| | | | | | fixes: 220049234 Test: build pass Change-Id: I4e4edbe1362207b2df411b966a8aef62dcaa8f8f
* Add more logs for WindowContextControllerWilson Wu2022-02-171-9/+56
| | | | | | | | | | | | | | | | | Change the mAttachedToDisplayArea from boolean to int which should help us to know the reason when there is a issue happened due to this flag. Add more logs to clarify the exception reason when WindowContextController calling attachToWindowToken but the WindowTokenClient haven't been associated with a display area. Bug: 211062619 Bug: 220049234 Test: atest WindowContextControllerTest Change-Id: I5e3832a466d47de5aafb32cf5fbf9c375a65160a
* Associate SystemUiContext with DisplayContentCharles Chen2021-11-231-35/+4
| | | | | | | | | | | | | | | | | Before this CL, SystemUiContexts were fixed to the Display metrics when the SystemUiContexts were created. It is the same mechanism as DisplayContext but applies to SystemUiContexts unexpectedly. This CL makes SystemUiContexts associate with DisplayContent with the corresponding display ID. In this way, SystemUiContext would receive updates when there is a Display property change. Bug: 194262507 Bug: 191064581 Bug: 205859784 Test: atest InputMethodMenuControllerTest WindowContextControllerTest Test: atest NexusLauncherTests Change-Id: I64a1614f32d097785915f6105b1813a929e0fe32
* Send DA's config directly when attaching to DACharles Chen2021-07-051-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | WindowContext relies on WindowTokenClient#onConfigurationChanged after calling WMS#attachWindowContextToDisplayArea. However, it took some time to wait for onConfigurationChanged callback from the server side so that we may get a stale value right after creating WindowContext. This confuses developers especially when the foreground activity is in size compat mode or freeform because the process config is overridden by activity's config. This CL makes #attachWindowContextToDisplayArea return DA's configuration and applies to WindowContext direcly. It also benefits WindowProviderService because it can obtain DA's configuration before onCreate() based on [1] and this CL. Bug: 190019118 Bug: 190745506 Test: manual - 1. launch an Activity in size compat mode 2. create a WindowContext and verify if WindowMetrics matches DA bounds. Test: atest WindowContextTest WindowContextTests Test: atest WindowContextControllerTest ContextGetDisplayTest [1]: dd4a748af05851356b5dbd90fb42f503905370bb Change-Id: I8dd3987b731662502bc01e9d2ed67e718ada5f46
* Introduce WindowProviderServiceCharles Chen2021-04-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Enable WindowContext to associate with WindowTokenCharles Chen2021-04-131-16/+53
| | | | | | | | | | | | This CL instroduces WMS#attachWindowContextToWindowToken and the corresponding API in WindowContextController to make WindowContext able to associate with a WindowToken. Test: atest WindowContextControllerTest Test: atest WindowManagerServiceTests#testAttachWindowContextToWindowToken* Bug: 159767464 Change-Id: I807a67fba149cbdc4267442bab0b64e6a95bd4b5
* Introduce WindowContextControllerCharles Chen2021-03-241-0/+96
This CL extracts the logic which is going to share with WindowProviderService. It is also the preparation to introduce WindowProviderService. Bug: 159767464 Test: atest WindowContextControllerTest Change-Id: Ib5a4cc8d7853bb01bde1081af091d1069865e3a0