summaryrefslogtreecommitdiff
path: root/core/java/android/app/WindowTokenClient.java
Commit message (Collapse)AuthorAgeFilesLines
* Move WindowContext module to window packageCharles Chen2021-03-241-96/+0
| | | | | | | | | | | In this way, we can clarify the owners and it is easier to maintain. Also refactor to move WindowContext creation logic to ContextImpl. Test: atest WindowContext WindowContextTests WindowContextPolicyTests Bug: 159767464 Bug: 152193787 Change-Id: I78432aa18aa97e001f5a9a04321109e456fd137b
* Enable to listen to WindowContext's config changesCharles Chen2021-03-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | This CL overrides registerComponentCallbacks for WindowContext. Users can use below code snippet to listen to Configuration changes. ``` Context windowContext = context.createWindowContext( display, ...); windowContext.registerComponentCallbacks( new ComponentCallbacks() { @Override public void onConfigurationChanged( Configuration newConfig) { // Do Something } }); ``` Bug: 181134729 Test: atest WindowContextTests Test: atest ComponentCallbacksControllerTest Change-Id: Iff46607bae3c942a96b64dcc97708f3a8c33f23a
* Fix deadlock between WMG and WMSCharles Chen2021-03-091-3/+5
| | | | | | | | | | | | | | | | The dealock happened while WM#addView and WMS holds lock and called onWindowTokenRemoved. WM#addView -> WMG#addView(holds WMG lock) -> ... -> WMS#addWindow(holds WMS lock) (holds WMS lock) ... -> WindowTokenClient#onWindowTokenRemoved ... -> WMG#closeAll(holds WMG lock) This CL calls to WMG#closeAll asynchronously to release WMG lock fixes: 181839758 Test: manual Change-Id: I0cf8a505043a4def4dcf346952873b1362a92084
* Remove addWindowTokenWithOptionsCharles Chen2021-02-061-2/+2
| | | | | | | | | | | Since WindowContext won't add WindowToken from the client side, addWindowTokenWithOption is no more needed. Also remove the logic to invoke removeWindowToken from the client side. Bug: 159767464 Bug: 153369119 Test: atest WindowManagerServiceTests WindowManagerPermissionTests Change-Id: Ib0c948dca223cf8d056865ce3a0d4adaef07d247
* Don't override config of display contexts with activity display.Darryl L Johnson2020-08-201-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change migrates the previous usages of ResourcesManager#getResources() from using the display id of expected resources to an override display ID which will override the display properties from the parent token resources. This ensures that all contexts derived from a display context keep the overrides for their intended display. This also changes the meaning of ResourcesKey#mOverrideConfiguration and ResourcesKey#mDisplayId. Previously mDisplayId was used as both the current display of the ResourcesKey and used to apply overrides to mOverrideConfiguration. This made it unclear whether a particular key should keep its display override when an activity changes display or whether it should inherit the new display from the activity. Now the display IDs and overrides are managed by the ActivityResources struct and the ResourcesKey is expected to only contain the final display ID expected for the resources in 'mDisplayId' and the final configuration that should be applied to the global configuration in 'mOverrideConfiguration'. Fixes: 153866583 Fixes: 156758475 Fixes: 163813210 Fixes: 163812902 Fixes: 163813227 Test: ActivityThreadTest Test: ResourcesManagerTest Test: AppConfigurationTests#testActivityContextDerivedDisplayContextOrientationWhenRotating Change-Id: If93f98f93ee15b27d8c7292a2f830c2cc0f49277
* Fix WindowContextTestsCharles Chen2020-04-141-5/+3
| | | | | | | | | | | | | | Previously, window token assigns last config to mLastReportedConfiguration directly, which makes it share the same reference with getConfiguration(), and blocks all config changes request to clients. This CL uses Configuration#setTo instead. fixes: 152227175 Bug: 150251036 Test: atest WindowContextTests Change-Id: I44143aa558f223eb301e28f2e9110bfd66eac636
* Fix WindowContext leakCharles Chen2020-04-081-10/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The root causes of this issue are: 1. WindowTokenClient#attachContext makes WindowTokenClient has strong reference to WindowContext, which leads to WindowContext cannot be GC'd. 2. WMS#removeWindowToken needs MANAGE_APP_TOKEN permission which normal apps don't hold. This CL does following things: 1. Use weak reference instead on WindowTokenClient#mContext. 2. Relax WMS#removeWindowToken to check callingUid if MANAGE_WINDOW_TOKEN permission is not held 3. Deliver config changes to the client side in WMS#addWindowTokenWithOption 4. Some minor fixes fixes: 150812449 Bug: 150715095 Test: atest WindowContextTest Test: atest WindowManagerServiceTests Test: atest WindowTokenTests Test: atest WindowManagerPermissionTests#testMANAGE_APP_TOKENS Test: atest WindowManagerPermissionTests#testADD_WINDOW_TOKEN_WITH_OPTIONS Change-Id: I9f1d73af2abb78fc9844e6d9eb25e9f0293514e7
* Handle config/display changes for WindowContextAndrii Kulian2020-02-211-0/+76
Introduce IWindowToken to report config/display changes from server side. When config change callback is received, it will update the resources associated with the window token. Test: WindowContextTests Bug: 128338354 Bug: 146820733 Change-Id: I871bd78a21dbde1286786e65c340b6259b873660