summaryrefslogtreecommitdiff
path: root/core/java/android/app/WindowContext.java
Commit message (Collapse)AuthorAgeFilesLines
* Move WindowContext module to window packageCharles Chen2021-03-241-159/+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-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Migrate WindowContext to WindowContextListener mechanismCharles Chen2021-02-041-22/+10
| | | | | | | | | | | | | | | | | | | | | 1. Use registerWindowContextListener instead of addWindowTokenWithOptions 2. Clean up the logic of sending the config to the client in WindowToken 3. Add a mechanism in WMS#addWindow, when a WindowContext adds a view, the server side will switch to register the WindowToken for the WindowContext. In this way, we won't add a WindowToken until adding the fist view. Also, we could apply an existing window token by overriding WindowManager.LayoutParams.token. Bug: 159767464 Bug: 153369119 Test: atest WindowContextTests WindowContextPolicyTests Test: atest WindowContextTest Test: atest WindowContextListenerControllerTests Change-Id: I2396187c445306d18101706c4521edd9cf92facf
* Introduce #createWindowContext with displayCharles Chen2020-12-211-3/+19
| | | | | | | Test: atest ContextIsUiContextTest ContextGetDisplayTest Test: atest WindowContextPolicyTests Bug: 174640742 Change-Id: I13bd07fa3a4e79fe44bce34157ee93622cbb431d
* Annotating context in framework baseCharles Chen2020-08-031-0/+2
| | | | | | Bug: 151414704 Test: build & run Change-Id: I42c8ab699433c51158a1af201da0521413d74dcd
* Limit number of window context without any windowCharles Chen2020-04-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | This change is to prevent misuse of window context from app and leads to performance drop on system by limit the numer of window context an app can use. Code snippet below is a sample to cause this issue: ``` Rect getBounds() { Context windowContext = context.createWindowContext(...); return windowContext.getSystemService(WindowManager.class) .getCuttentWindowMetrics().getBounds() } ``` This method could be invoked dozens of times and produce dozens of window tokens. It would slow down the speed of window traversalling. These token won't be removed until system server has been GC'd. Test: atest WindowContextTests WindowContextPolicyTests fixes: 152934797 Bug: 153369119 Change-Id: I927e85a45c05c4d90b51a624ea408ff3a3ffce93
* Fix WindowContext leakCharles Chen2020-04-081-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Generate WindowInsets with new insets APICharles Chen2020-03-051-1/+0
| | | | | | | | | | | | | In previous CL[1], WindowMetrics#WindowInsets is provided with legacy insets, which are stable insets and system window insets. With the new insets mode enabled, we should provide insets with new insets API. [1]: f65e022caa681f2aa23d76bdc91c42e63be8b1f3 Bug: 150095967 Test: atest WindowMetricsTests Change-Id: I251313b4b8c033dbad8b54e58cd166e2e1665d37
* Handle config/display changes for WindowContextAndrii Kulian2020-02-211-33/+24
| | | | | | | | | | | | 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
* Fix that WindowContext token is always nullCharles Chen2020-02-051-2/+2
| | | | | | fixes: 148921212 Test: manual Change-Id: I5b4a28eb2f6cbe5950edee6876d450f4fc89f46f
* Exempt-From-Owner-Approval: Fix usages of WindowManager.getDefaultDisplay() ↵Andrii Kulian2020-01-311-1/+1
| | | | | | | | | | | | in f/b Replace the existing usages of now-deprecated API WindowManager.getDefaultDisplay() with WindowMetrics or Context.getDisplay() in frameworks/base. Bug: 128338354 Test: Build, auto test Change-Id: I02d38a022c5e0e6e9d699f03d35b65d6c8126da9
* Add bundle options to Context#createWindowContext APIAndrii Kulian2020-01-281-2/+2
| | | | | | | | | Add Bundle parameter to createWindowContext method to allow passing window-related options. Bug: 128338354 Test: Build, auto test Change-Id: I19cf9335068ecf94c9d94a99be0e8f1021f78e34
* Introduce WindowContext APIAndrii Kulian2020-01-221-0/+123
Test: atest WmTests CtsWindowManagerDeviceTestCases Bug: 128338354 Change-Id: I9c9dfc5e7f4edd4c968e60d2ffcbb19b5c72a853