Optimize screen decor insets calculation
This stores the computed decor insets and frame excluding insets. So it can save 99% time of recomputing the insets every time during starting an activity. E.g. dozen times of "prepare display info/frame, compute window layout of insets source windows, calculate insets" becomes "get result from array". The saved decor insets will be updated when: - Display metrics is changed (DC#updateBaseDisplayMetrics). - Insets provider is added/removed/changed. Also - Use DisplayCutout rather than WmDisplayCutout to simplify passing the cutout between methods. - Optimize getSourceProvider to avoid unnecessary object allocation. This also fixes an issue that the display doesn't compute the latest configuration when navigation mode is changed. Now it is fixed by checking if the insets provider has layout changes and then recompute screen configuration. Bug: 238399969 Bug: 159103089 Test: atest DisplayPolicyInsetsTests DisplayPolicyLayoutTests DisplayPolicyTests#testUpdateDisplayConfigurationByDecor Test: Change navigation mode or display size (density) in Settings. And then swipe-up or press home key, there won't be a frozen effect (display configuration change). Change-Id: If6c28a89939372e6362b92f469ef7d793e8ec215
Loading
Please register or sign in to comment